Commit Graph

9804 Commits

Author SHA1 Message Date
Andreas Schwab
1e15a853ed Add version set GLIBC_2.19 for linux/powerpc 2015-08-17 16:21:51 +02:00
Paul Pluzhnikov
d5dff793af Fix BZ #18084 -- backtrace (..., 0) dumps core on x86.
Other architectures also had bugs, or did unnecessary work.
2015-08-15 11:42:43 -07:00
Joseph Myers
739babd775 Fix fma spurious underflows (bug 18824).
Various fma implementations have logic that, when computing fma (x, y,
z) where z is large (so care needs taking to avoid internal overflow)
but x * y is small, scale x * y up instead of down to avoid internal
underflows resulting from scaling down.  (In these cases, x * y is
small enough that only its sign actually matters rather than the exact
value.)

The threshold for scaling up instead of down was correct for "if the
unscaled values were multiplied, the low part of the multiplication
could underflow", and the scaling was sufficient to ensure that the
low part of the multiplication did not underflow (given that cases of
very small x * y - less than half the least subnormal - were
previously dealt with).  However, the choice in the functions wasn't
between scaling up or no scaling, but between scaling up and scaling
down (scaling down actually being needed when x * y isn't so small
compared to z and so the exact value does matter).  Thus a larger
threshold is needed to ensure that scaling down doesn't produce values
the multiplication of whose low parts underflows.  This patch
increases the thresholds accordingly.

Tested for x86_64, x86 and mips64 (with the MIPS version of s_fmal.c
removed so that the ldbl-128 version gets tested instead of the
soft-fp one).

	[BZ #18824]
	* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Increase threshold for
	scaling x * y up instead of down.
	* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.
	* math/auto-libm-test-in: Add more tests of fma.
	* math/auto-libm-test-out: Regenerated.
2015-08-14 17:15:06 +00:00
Paul Pluzhnikov
db7f8c8fe0 Regenerated sysdeps/x86_64/fpu/libm-test-ulps with AVX2. 2015-08-14 09:59:04 -07:00
Siddhesh Poyarekar
37dd6a19ca Remove incorrect register mov in floorf/nearbyint on x86_64
The change in 0b5395f052 replaced calls
to __get_cpu_features@plt followed by a mov from rax to rdx, with a
single macro LOAD_RTLD_GLOBAL_RO_RDX.  It is pretty clear that there
was a typo in s_floorf and __nearbyint due to which the (now incorrect)
mov was not removed.  This patch removes that mov.

	* sysdeps/x86_64/fpu/multiarch/s_floorf.S (__floorf): Remove
	unnecessary movq.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.S (__nearbyint):
	Likewise.
2015-08-14 05:30:17 -07:00
Joseph Myers
3ba0ac10fa Add more random libm-test inputs.
This patch adds more test inputs to various libm functions found
through random generation to have larger ulps errors than previously
listed in libm-test-ulp, on at least one of x86_64 and x86.

Tested for x86_64 and x86.

	* math/auto-libm-test-in: Add more tests of acos, acosh, asin,
	asinh, atan, atan2, atanh, cabs, cbrt, cosh, csqrt, erf, erfc,
	exp, exp2, lgamma, log, log1p, log2, pow, sin, sincos, tan, tanh
	and tgamma.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-08-13 23:23:23 +00:00
Joseph Myers
37d83a089d Fix tanh missing underflows (bug 16520).
Similar to various other bugs in this area, some tanh implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16520]
	* sysdeps/ieee754/dbl-64/s_tanh.c: Include <float.h>.
	(__tanh): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/flt-32/s_tanhf.c: Include <float.h>.
	(__tanhf): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-128/s_tanhl.c: Include <float.h>.
	(__tanhl): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: Include <float.h>.
	(__tanhl): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-96/s_tanhl.c: Include <float.h>.
	(__tanhl): Force underflow exception for arguments with small
	absolute value.
	* math/auto-libm-test-in: Add more tests of tanh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-08-13 16:40:39 +00:00
H.J. Lu
a5cf909b8f Check if cpuid is available in init_cpu_features
Since not all i486 processors support cpuid, we call __get_cpuid_max to
check if cpuid is available before using it if not compiling for i586,
i686 nor x86-64.

	* sysdeps/x86/cpu-features.c (init_cpu_features): Call
	__get_cpuid_max if not compiling for i586, i686 nor x86-64.
2015-08-13 04:53:03 -07:00
H.J. Lu
e54388bd8b Don't include <cpuid.h> in elision-conf.h
Don't include the unused <cpuid.h> in Linux/x86 elision-conf.h.

	* sysdeps/unix/sysv/linux/x86/elision-conf.h: Don't include
	<cpuid.h>.
2015-08-13 03:46:26 -07:00
H.J. Lu
b376899d27 Update x86 elision-conf.c for <cpu-features.h>
This patch updates x86 elision-conf.c to use the newly defined
HAS_CPU_FEATURE from <cpu-features.h>.

	* sysdeps/unix/sysv/linux/x86/elision-conf.c (elision_init):
	Replace HAS_RTM with HAS_CPU_FEATURE (RTM).
2015-08-13 03:41:59 -07:00
H.J. Lu
1dfa4a94ae Update libmvec multiarch functions for <cpu-features.h>
This patch updates libmvec multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE and LOAD_RTLD_GLOBAL_RO_RDX from
<cpu-features.h>.

	* math/Makefile ($(addprefix $(objpfx), $(libm-vec-tests))):
	Remove $(objpfx)init-arch.o.
	* sysdeps/x86_64/fpu/Makefile (libmvec-support): Remove
	init-arch.
	* sysdeps/x86_64/fpu/math-tests-arch.h (avx_usable): Removed.
	(INIT_ARCH_EXT): Defined as empty.
	(CHECK_ARCH_EXT): Replace HAS_XXX with HAS_ARCH_FEATURE (XXX).
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core.S: Remove
	__init_cpu_features call.  Replace HAS_XXX with
	HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core.S: Likewise.
2015-08-13 03:41:47 -07:00
H.J. Lu
1aee37a22e Update i686 multiarch functions for <cpu-features.h>
This patch updates i686 multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE, LOAD_GOT_AND_RTLD_GLOBAL_RO and
LOAD_FUNC_GOT_EAX from <cpu-features.h>.

	* sysdeps/i386/i686/fpu/multiarch/e_expf.c: Replace HAS_XXX
	with HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
	* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/s_sincosf.c: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/s_sinf.c: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-impl-list.c: Likewise.
	* sysdeps/i386/i686/multiarch/s_fma.c: Likewise.
	* sysdeps/i386/i686/multiarch/s_fmaf.c: Likewise.
	* sysdeps/i386/i686/multiarch/bcopy.S: Remove __init_cpu_features
	call.  Merge SHARED and !SHARED.  Add LOAD_GOT_AND_RTLD_GLOBAL_RO.
	Use LOAD_FUNC_GOT_EAX to load function address.  Replace HAS_XXX
	with HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
	* sysdeps/i386/i686/multiarch/bzero.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/rawmemchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcasecmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat.S: Likewise.
	* sysdeps/i386/i686/multiarch/strchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncase.S: Likewise.
	* sysdeps/i386/i686/multiarch/strnlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wmemcmp.S: Likewise.
2015-08-13 03:41:37 -07:00
H.J. Lu
0b5395f052 Update x86_64 multiarch functions for <cpu-features.h>
This patch updates x86_64 multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE and LOAD_RTLD_GLOBAL_RO_RDX from
<cpu-features.h>.

	* sysdeps/x86_64/fpu/multiarch/e_asin.c: Replace HAS_XXX with
	HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
	* sysdeps/x86_64/fpu/multiarch/e_atan2.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_pow.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_fmaf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.S: Use
	LOAD_RTLD_GLOBAL_RO_RDX and HAS_CPU_FEATURE (SSE4_1).
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floor.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.S : Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.S: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.S : Likewise.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Likewise.
	* sysdeps/x86_64/multiarch/sched_cpucount.c: Likewise.
	* sysdeps/x86_64/multiarch/strstr.c: Likewise.
	* sysdeps/x86_64/multiarch/memmove.c: Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/test-multiarch.c: Likewise.
	* sysdeps/x86_64/multiarch/memcmp.S: Remove __init_cpu_features
	call.  Add LOAD_RTLD_GLOBAL_RO_RDX.  Replace HAS_XXX with
	HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
	* sysdeps/x86_64/multiarch/memcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memset.S: Likewise.
	* sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/strcat.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/strcspn.S: Likewise.
	* sysdeps/x86_64/multiarch/strspn.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.
2015-08-13 03:41:30 -07:00
H.J. Lu
e2e4f56056 Add _dl_x86_cpu_features to rtld_global
This patch adds _dl_x86_cpu_features to rtld_global in x86 ld.so
and initializes it early before __libc_start_main is called so that
cpu_features is always available when it is used and we can avoid
calling __init_cpu_features in IFUNC selectors.

	* sysdeps/i386/dl-machine.h: Include <cpu-features.c>.
	(dl_platform_init): Call init_cpu_features.
	* sysdeps/i386/dl-procinfo.c (_dl_x86_cpu_features): New.
	* sysdeps/i386/i686/cacheinfo.c
	(DISABLE_PREFERRED_MEMORY_INSTRUCTION): Removed.
	* sysdeps/i386/i686/multiarch/Makefile (aux): Remove init-arch.
	* sysdeps/i386/i686/multiarch/Versions: Removed.
	* sysdeps/i386/i686/multiarch/ifunc-defines.sym (KIND_OFFSET):
	Removed.
	* sysdeps/i386/ldsodefs.h: Include <cpu-features.h>.
	* sysdeps/unix/sysv/linux/x86/Makefile
	(libpthread-sysdep_routines): Remove init-arch.
	* sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c: Include
	<sysdeps/x86_64/dl-procinfo.c> instead of
	sysdeps/generic/dl-procinfo.c>.
	* sysdeps/x86/Makefile [$(subdir) == csu] (gen-as-const-headers):
	Add cpu-features-offsets.sym and rtld-global-offsets.sym.
	[$(subdir) == elf] (sysdep-dl-routines): Add dl-get-cpu-features.
	[$(subdir) == elf] (tests): Add tst-get-cpu-features.
	[$(subdir) == elf] (tests-static): Add
	tst-get-cpu-features-static.
	* sysdeps/x86/Versions: New file.
	* sysdeps/x86/cpu-features-offsets.sym: Likewise.
	* sysdeps/x86/cpu-features.c: Likewise.
	* sysdeps/x86/cpu-features.h: Likewise.
	* sysdeps/x86/dl-get-cpu-features.c: Likewise.
	* sysdeps/x86/libc-start.c: Likewise.
	* sysdeps/x86/rtld-global-offsets.sym: Likewise.
	* sysdeps/x86/tst-get-cpu-features-static.c: Likewise.
	* sysdeps/x86/tst-get-cpu-features.c: Likewise.
	* sysdeps/x86_64/dl-procinfo.c: Likewise.
	* sysdeps/x86_64/cacheinfo.c (__cpuid_count): Removed.
	Assume USE_MULTIARCH is defined and don't check it.
	(is_intel): Replace __cpu_features with GLRO(dl_x86_cpu_features).
	(is_amd): Likewise.
	(max_cpuid): Likewise.
	(intel_check_word): Likewise.
	(__cache_sysconf): Don't call __init_cpu_features.
	(__x86_preferred_memory_instruction): Removed.
	(init_cacheinfo): Don't call __init_cpu_features. Replace
	__cpu_features with GLRO(dl_x86_cpu_features).
	* sysdeps/x86_64/dl-machine.h: <cpu-features.c>.
	(dl_platform_init): Call init_cpu_features.
	* sysdeps/x86_64/ldsodefs.h: Include <cpu-features.h>.
	* sysdeps/x86_64/multiarch/Makefile (aux): Remove init-arch.
	* sysdeps/x86_64/multiarch/Versions: Removed.
	* sysdeps/x86_64/multiarch/cacheinfo.c: Likewise.
	* sysdeps/x86_64/multiarch/init-arch.c: Likewise.
	* sysdeps/x86_64/multiarch/ifunc-defines.sym (KIND_OFFSET):
	Removed.
	* sysdeps/x86_64/multiarch/init-arch.h: Rewrite.
2015-08-13 03:41:22 -07:00
Paul Pluzhnikov
84895dca70 Fix BZ #18086 -- nice resets errno to 0. 2015-08-11 23:40:00 -07:00
Ondrej Bilka
5011051da3 powerpc: Fix stpcpy performance for power8
This patch fixes the missing enablement for stpcpy on POWER8.

	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.
2015-08-11 10:03:10 -03:00
Adhemerval Zanella
6f714aa4ad powerpc: Fix PPC64/POWER7 conform tests
When building with --disable-multi-arch the memmove and strstr POWER7
optimization create and uses symbols that conflict with expect conform
tests.

	* sysdeps/powerpc/powerpc64/power7/memmove.S (bcopy): Changing to
	__bcopy and add a weak_alias to bcopy.
	* sysdeps/powerpc/powerpc64/power7/strstr.S (strstr): Use __strnlen
	for static build.
2015-08-11 10:03:10 -03:00
Adhemerval Zanella
142e0a9953 powerpc: Use default strcpy optimization for POWER7
This patches uses the default strcpy/stpcpy implementation for
POWER7/PPC64.  This is faster in mostly inputs for benchtests
and for multiarch the implementation uses the POWER7 strlen and
memcpy.

	* string/stpcpy.c (__stpcpy): Use STPCPY to redefine symbol name and
	cleanup macro usage.
	* string/strcpy.c (strcpt): Use STRCPY to redefine symbol name.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S: Remove file.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/stpcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && IS_IN (libc)]: Include <string/strcpy.c>.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && IS_IN (libc)]: Include <string/stpcpy.c>.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c: New file.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
2015-08-11 10:03:10 -03:00
Adhemerval Zanella
14362ef154 powerpc: Fix strnlen/power7 build
This patch fixes the strnlen.S build with --disable-multi-arch option.
2015-08-11 10:03:09 -03:00
Adhemerval Zanella
357bb400f1 powerpc: Fix strstr/power7 build
This patch fixes the strstr build with --disable-multi-arch option.
The optimization calls the __strstr_ppc symbol, which always build
for multiarch config but not if it is disable.  This patch fixes it
by adding the default C implementation object with the expected
symbol name.

	* sysdeps/powerpc/powerpc64/power7/Makefile [$(subdir) = string]
	(sysdep_routines): Add strstr-ppc64.
	* sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c: New file.
2015-08-11 10:03:09 -03:00
Andreas Schwab
dc8a7ff24d Remove unused definition of __openat(64)_nocancel 2015-08-11 09:37:38 +02:00
Joseph Myers
4afe4b20ce Add more tests of various libm functions.
This patch adds more tests of various libm functions found through
random test generation to give increased ulps on 32-bit x86.

Tested for x86_64 and x86.

	* math/auto-libm-test-in: Add more tests of acosh, asin, asinh,
	atanh, cabs, carg, cbrt, cosh, csqrt, erf, erfc, exp, exp10,
	expm1, hypot, log, log10, log1p, log2, pow, sinh, tan and tgamma.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-08-11 00:58:28 +00:00
Joseph Myers
7ee06ef158 Fix ldbl-128ibm tanhl inaccuracy (bug 18790).
ldbl-128ibm tanhl uses a too-small threshold to decide when to return
+/-1, resulting in large errors.  This patch changes it to a more
appropriate threshold (the requirement is for 2*exp(-2|x|) to be small
in terms of ulps of 1).

Tested for x86_64, x86 and powerpc.

	[BZ #18790]
	* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Increase
	threshold for returning +/- 1.
	* math/auto-libm-test-in: Add more tests of tanh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-08-10 20:35:30 +00:00
Andreas Schwab
eb32b0d403 Readd O_LARGEFILE flag for openat64 (bug 18781) 2015-08-10 18:10:19 +02:00
Joseph Myers
d0649b2d8e Fix ldbl-128ibm sinhl inaccuracy near 0 (bug 18789).
ldbl-128ibm sinhl uses a too-big threshold to decide when to return
the argument, resulting in large errors.  This patch fixes it to use a
more appropriate threshold.

Tested for x86_64, x86 and powerpc.

	[BZ #18789]
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Use
	smaller threshold for returning the argument.
	* math/auto-libm-test-in: Add more tests of sinh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-08-10 15:25:10 +00:00
H.J. Lu
d2ff039fa1 Add a missing break in tst-auditmod3b.c
[BZ #18674]
	* sysdeps/i386/tst-auditmod3b.c (la_objsearch): Add a missing
	break.
2015-08-09 08:06:50 -07:00
Mike Frysinger
ef086ef8ba hppa: put custom madvise defines behind __USE_MISC
No other arch exports these defines, and having them in the default
namespace causes conformance header tests to fail.  Put them behind
the __USE_MISC define as that is what other arches seem to use.
2015-08-08 23:46:44 -04:00
John David Anglin
04ece7d2de hppa: Fix miscompilation of sched_setaffinity() [BZ #18480]
The attached change fixes the miscompilation of sched_setaffinity() on
hppa.  This is an old problem that was fixed on other architectures using
a similar approach to the attached change.  See:
https://sourceware.org/ml/libc-hacker/2004-04/msg00016.html

Build tested on trunk.  Patch has been applied to debian glibc for some time.
2015-08-08 22:56:01 -04:00
John David Anglin
74bc0c3a16 hppa: Fix reload error with atomic code [BZ #18787]
As noted in the bug, the asm operands need to be copied to register
variables to avoid operand reloads in the principal asm of the macro.
See the arm implementation for reference.  Otherwise we get:
../sysdeps/unix/sysv/linux/hppa/bits/atomic.h:68:6: error:
	can't find a register in class 'R1_REGS' while reloading 'asm'

Build tested on trunk with gcc-4.8.  Similar patch has been tested
with 2.19 on Debian hppa-unknown-linux-gnu.
2015-08-08 01:11:44 -04:00
Mike Frysinger
5d5de49c3c microblaze: include unix/sysdep.h
The semi-recent SYSCALL_CANCEL inclusion broke microblaze due to the
sysdep.h header not including the unix/sysdep.h header.  Include it
here like all other ports.
2015-08-07 23:39:42 -04:00
Joseph Myers
37550cb3d6 Fix tan missing underflows (bug 16517).
Similar to various other bugs in this area, some tan implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16517]
	* sysdeps/ieee754/dbl-64/s_tan.c: Include <float.h>.
	(tan): Force underflow exception for arguments with small absolute
	value.
	* sysdeps/ieee754/flt-32/k_tanf.c: Include <float.h>.
	(__kernel_tanf): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/k_tanl.c: Include <float.h>.
	(__kernel_tanl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <float.h>.
	(__kernel_tanl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/k_tanl.c: Include <float.h>.
	(__kernel_tanl): Force underflow exception for arguments with
	small absolute value.
	* math/auto-libm-test-in: Add more tests of tan.
	* math/auto-libm-test-out: Regenerated.
2015-08-07 23:10:35 +00:00
Mike Frysinger
be144ba68c hppa: _dl_symbol_address: add missing hidden def
Commit 2a6ad8142d updated the headers and
the common dl-symaddr.c, but missed that hppa has its own dedicated source
file for this func.  Update that too to fix build errors due to missing
exports of the symbol.
2015-08-07 01:45:00 -04:00
Joseph Myers
5e29dd5737 Fix sinh missing underflows (bug 16519).
Similar to various other bugs in this area, some sinh implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16519]
	* sysdeps/ieee754/dbl-64/e_sinh.c: Include <float.h>.
	(__ieee754_sinh): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/flt-32/e_sinhf.c: Include <float.h>.
	(__ieee754_sinhf): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/e_sinhl.c: Include <float.h>.
	(__ieee754_sinhl): Force underflow exception for arguments with
	small absolute value.
	* math/auto-libm-test-in: Add more tests of sinh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-08-06 23:01:09 +00:00
Andreas Schwab
bb1d31d06e Properly terminate FDE in makecontext for m68k (bug 18635) 2015-08-05 23:35:28 +02:00
H.J. Lu
72354ab5e1 Align stack to 16 bytes when calling __errno_location
We should align stack to 16 bytes when calling __errno_location.

	[BZ #18661]
	* sysdeps/x86_64/fpu/s_cosf.S (__cosf): Align stack to 16 bytes
	when calling __errno_location.
	* sysdeps/x86_64/fpu/s_sincosf.S (__sincosf): Likewise.
	* sysdeps/x86_64/fpu/s_sinf.S (__sinf): Likewise.
2015-08-05 08:36:27 -07:00
H.J. Lu
b4425b95ad Align stack to 16 bytes when calling __gettimeofday
Subtract stack by 24 bytes instead of 16 bytes so that stack is aligned
to 16 bytes when calling __gettimeofday.

	[BZ #18661]
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
	(__lll_timedwait_tid): Align stack to 16 bytes when calling
	__gettimeofday.
2015-08-05 08:36:18 -07:00
H.J. Lu
8e1f346462 Align stack to 16 bytes when calling __setcontext
Don't use pop to restore %rdi so that stack is aligned to 16 bytes
when calling __setcontext.

	[BZ #18661]
	* sysdeps/unix/sysv/linux/x86_64/__start_context.S
	(__start_context): Don't use pop to restore %rdi so that stack
	is aligned to 16 bytes when calling __setcontext.
2015-08-05 08:36:12 -07:00
H.J. Lu
3b8d2eb7f8 Compile {memcpy,strcmp}-sse2-unaligned.S only for libc
{memcpy,strcmp}-sse2-unaligned.S aren't needed in ld.so.

	* sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: Compile
	only for libc.
	* sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: Likewise.
2015-08-05 08:28:37 -07:00
Wilco Dijkstra
05a910f7b4 Improve performance of mempcpy by inlining and using memcpy. Enable
this for all targets except sparc which has an optimized mempcpy
implementation.
2015-08-05 16:24:04 +01:00
Wilco Dijkstra
7b1c56e483 Improve feenableexcept performance - avoid an unnecessary FPCR read in case
the FPCR does not change. Also improve the logic of the return value.
2015-08-05 16:24:02 +01:00
Wilco Dijkstra
3136eb7abd Improve fesetenv performance by avoiding unnecessary FPSR/FPCR reads/writes.
It uses the same logic as the ARM version. The common case removes 1 FPSR
and 1 FPCR read. For FE_DFL_ENV and FE_NOMASK_ENV a FPCR read is avoided in
case the FPCR does not change.
2015-08-05 16:24:01 +01:00
Joseph Myers
cf36e5034f Fix powf (close to -1, large) (bug 18647).
The flt-32 implementation of powf wrongly uses x-1 instead of |x|-1
when computing log (x) for the case where |x| is close to 1 and y is
large.  This patch fixes the logic accordingly.  Relevant tests
existed for x close to 1, and corresponding tests are added for x
close to -1, as well as for some new variant cases.

Tested for x86_64 and x86.

	[BZ #18647]
	* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): For large y
	and |x| close to 1, use absolute value of x when computing log.
	* math/auto-libm-test-in: Add more tests of pow.
	* math/auto-libm-test-out: Regenerated.
2015-08-05 15:01:58 +00:00
Adhemerval Zanella
2aa6c8af26 arm: Assembly implementation cleanup
This patch removes arm assembly implementation of mmap and mmap64.
The new implementation used is the wordsize-32 generic linux one.

Tested on armhf.
2015-08-05 10:41:03 -03:00
Mike Frysinger
182d6096fe mmap64: fix undef warnings
The only target that defines this is m68k, so move the existing fallback
define up to avoid warnings on other systems.
2015-08-05 04:38:56 -04:00
Chris Metcalf
0d261f406d tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
Using a ({ }) structure avoids the "value computed is not used"
that a simple () structure causes.
2015-08-04 12:07:53 -04:00
Andreas Schwab
bbab82c25d Properly terminate FDE in makecontext for ix86 (bug 18635) 2015-08-04 17:46:56 +02:00
Andrew Senkevich
a9e8ea51cc Prevent runtime fail of SSE vector math tests on non SSE4.1 machine.
[BZ #18740]
    * sysdeps/x86_64/fpu/Makefile (double-vlen2-arch-ext-cflags,
    float-vlen4-arch-ext-cflags): Removed.
    * math/Makefile (CFLAGS-test-double-vlen2-wrappers.c,
    CFLAGS-test-float-vlen4-wrappers.c): Likewise.
2015-07-30 18:00:24 +03:00
Mike Frysinger
243cc404ca hppa: fix pthreadtypes.h namespace failures
The conform tests flag the "aligned" symbol used inside the attributes,
so rename it to __aligned__ like other headers.
2015-07-30 05:03:43 -04:00
Torvald Riegel
87ab9d55f7 hppa: Remove custom lowlevellock.h.
This untested patch removes the custom lowlevellock.h on hppa.  It seems
to contain an implementation equivalent to the generic lowlevellock.h.
2015-07-30 03:37:27 -04:00
Mike Frysinger
827e01851f hppa: sigaction.h: change sa_flags to an int
This fixes the conform test for the sigaction.h header and makes it match
all the other arches.
2015-07-29 23:14:03 -04:00
Mike Frysinger
979900af98 hppa: fix sysdep.h header setup
The semi-recent SYSCALL_CANCEL inclusion broke hppa due to the sysdep.h
headers not including the unix/sysdep.h headers.  Rework the includes so
we match the other ports:
* hppa/sysdep.h:
	- Do not include sys/syscall.h as the unix sysdep.h headers do it.
	- Do not include config.h as libc-symbols.h does it, and it has no
	#ifdef multiple-include protection, and it breaks when some files
	do things like #undef __OPTIMIZE__.
* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h:
	- Drop the generic/sysdep.h as the unix sysdep.h headers include it.
* sysdeps/unix/sysv/linux/hppa/sysdep.h:
	- Change to the unix & core hppa sysdep header stacks.
	- Undef a few defines that the core headers already set up for us.
2015-07-29 23:09:16 -04:00
Mike Frysinger
a822b0187a hppa: rewrite INLINE_SYSCALL
The semi-recent SYSCALL_CANCEL macro imposes a slight nuance on the
implementation of INLINE_SYSCALL: the nr argument cannot be expanded
directly but must be passed on to another macro which may expand it.
Most arches don't notice because INLINE_SYSCALL is defined in terms
of INTERNAL_SYSCALL which has the additional layer of expansion, but
on hppa, it was attempting to expand it directly.  That causes build
errors like so:
../sysdeps/unix/sysv/linux/sigsuspend.c: In function '__sigsuspend':
../sysdeps/unix/sysv/linux/sigsuspend.c:31:62: error:
	implicit declaration of function 'LOAD_ARGS___SYSCALL_NARGS'
../sysdeps/unix/sysv/linux/sigsuspend.c:31:304: error:
	called object 'LOAD_ARGS___SYSCALL_NARGS(set, 8)' is not a function

So rewrite hppa's INLINE_SYSCALL to use INTERNAL_SYSCALL like other
arches do.  This is also a nice clean up as the two macros had quite
a bit of duplicated logic.
2015-07-29 23:08:15 -04:00
H.J. Lu
9637d8a253 Extend local PLT reference check
On x86, linker in binutils 2.26 and newer consolidates R_*_JUMP_SLOT with
R_*_GLOB_DAT relocation against the same symbol.  This patch extends
local PLT reference check to support alternate relocations.

	[BZ #18078]
	* scripts/check-localplt.awk: Support alternate relocations.
	* scripts/localplt.awk: Also check relocations in DT_RELA/DT_REL
	sections.
	* sysdeps/unix/sysv/linux/i386/localplt.data: Mark free and
	malloc entries with + REL R_386_GLOB_DAT.
	* sysdeps/x86_64/localplt.data: New file.
2015-07-29 11:58:06 -07:00
Andrew Senkevich
febce2ac5f Added runtime check for AVX vector math tests.
[BZ #18731]
    * sysdeps/x86_64/fpu/math-tests-arch.h: Added AVX runtime check.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
2015-07-29 19:47:29 +03:00
Mike Frysinger
95d8f022bf ia64: drop __tls_get_addr from expected ld.so plt usage
This file was updated with an educated guess as to the symbols needed,
but on ia64, we don't have __tls_get_addr calls, so drop it from the
list.
2015-07-28 05:30:14 -04:00
Mike Frysinger
cf31a2c799 ia64: atomic.h: fix atomic_exchange_and_add 64bit handling
Way back in 2005 the atomic_exchange_and_add function was cleaned up to
avoid the explicit size checking and instead let gcc handle things itself.
Unfortunately that change ended up leaving beyond a cast to int, even when
the incoming value was a long.  This has flown under the radar for a long
time due to the function not being heavily used in the tree (especially as
a full 64bit field), but a recent change to semaphores made some nptl tests
fail reliably.  This is due to the code packing two 32bit values into one
64bit variable (where the high 32bits contained the number of waiters), and
then the whole variable being atomically updated between threads.  On ia64,
that meant we never atomically updated the count, so sometimes the sem_post
would not wake up the waiters.
2015-07-28 02:30:15 -04:00
Mike Frysinger
18855eca32 ia64: clean up old kernel headers cruft
This define made more sense in the pre-sanitized kernel headers days,
but since we require kernel versions that are sanitized, we don't need
this hack anymore.
2015-07-28 02:29:30 -04:00
Chung-Lin Tang
ae5eae7cfc Fixes extern protected data handling testcases elf/tst-protected1a
and elf/tst-protected1b for Nios II.
2015-07-26 05:27:18 -07:00
Chung-Lin Tang
1d4bbc54bd Update Nios II ulps file. 2015-07-25 07:14:29 -07:00
Chung-Lin Tang
3f96834346 Fix order of arguments to rt_sigprocmask syscall when setting the signal mask
in setcontext/swapcontext.
2015-07-24 23:19:50 -07:00
Roland McGrath
6b183b8339 NaCl: Remove bogus O_SHLOCK, O_EXLOCK definitions. 2015-07-24 12:31:23 -07:00
Adhemerval Zanella
48f5f7a63c Update powerpc-fpu libm-test-ulps. 2015-07-24 10:22:55 -03:00
Andrew Senkevich
9901716135 Fixed several libmvec bugs found during testing on KNL hardware.
AVX512 IFUNC implementations, implementations of wrappers to
AVX2 versions and KNL expf implementation fixed.

    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S: Fixed AVX512 IFUNC.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Fixed wrappers to AVX2.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S: Fixed KNL
    implementation.
2015-07-24 14:47:23 +03:00
Szabolcs Nagy
3bcea719dd [ARM][BZ #17711] Fix extern protected data handling
Fixes elf/tst-protected1a and elf/tst-protected1b tests.

Depends on a gcc patch that makes protected visibility data non-local:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01871.html
and on a binutils patch so R_*_GLOB_DAT relocs are used for it:
https://sourceware.org/ml/binutils/2015-07/msg00247.html
2015-07-24 10:05:07 +01:00
Szabolcs Nagy
0910702c4d [AArch64][BZ #17711] Fix extern protected data handling
Fixes elf/tst-protected1a and elf/tst-protected1b tests.

Depends on a gcc patch that makes protected visibility data non-local:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01871.html
and on a binutils patch so R_*_GLOB_DAT relocs are used for it:
https://sourceware.org/ml/binutils/2015-07/msg00246.html
2015-07-24 09:57:32 +01:00
Roland McGrath
b301e68e4b Make sysdeps/posix bring in login subdir. 2015-07-23 17:04:22 -07:00
Roland McGrath
f8c3be3f23 NaCl: Fix missing getdtablesize symbol. 2015-07-23 15:54:21 -07:00
Mike Frysinger
992f71ddd3 ia64: sigaction.h: fix sa_flags ordering
Since ia64 is little endian, sa_flags has to come before the padding
when splitting it from 64bits to 32bits.

Reported-by: Joseph Myers <joseph@codesourcery.com>
2015-07-23 03:28:13 -04:00
Mike Frysinger
9c9184b449 ia64: msg.h: fix msg_qnum/msg_qbytes types
These two fields have dedicated types, so change the ia64 header to match
all the other arches.  This fixes the conform test for msg.h.
2015-07-21 22:46:58 -04:00
Mike Frysinger
43ef687581 ia64: stat.h: rename pad0 to __glibc_reserved0
This fixes the conform test for the stat.h header and makes it match
all the other arches.
2015-07-21 22:43:21 -04:00
Mike Frysinger
1a5cb6c7d5 ia64: sifaction.h: change sa_flags to an int
This fixes the conform test for the sigaction.h header and makes it match
all the other arches.
2015-07-21 22:40:25 -04:00
Mike Frysinger
15fdf937b4 ia64: siginfo.h: delete siginfo name
This fixes the conform test for the siginfo.h header and makes it match
all the other arches.
2015-07-21 22:34:48 -04:00
Roland McGrath
0b24551cf3 NaCl: Use only nacl_irt_dev_filename, never nacl_irt_filename. 2015-07-21 15:48:56 -07:00
Roland McGrath
7493ab257e Add abilist files and NEWS item for arm-nacl port. 2015-07-21 13:31:21 -07:00
Chris Metcalf
0ac4f1dab3 tile: Fix BZ #18508 (makecontext yield infinite backtrace)
It turns out tile suffered from the same problem as S390.  However,
disabling CFI information for the __startcontext on tile was not
sufficient to fix the problem; I think the backtracer will just
blindly try to follow the link register (lr) in that case.

Instead, the change adds a cfi_undefined directive for "lr"
and then arranges to call __startcontext directly when the new
context starts, rather than just synthesizing a return to it.
In addition to being a bit easier now to understand the control
flow, this also allows the cfi_undefined directive to be placed in
a way that causes it to be in force at the address that the "lr"
from the called function points to.
2015-07-21 12:11:55 -04:00
Mike Frysinger
7fde904c73 sparc: fix sigaction for 32bit builds [BZ #18694]
Commit a059d359d8 changed the sigaction
struct to pass conform tests, but it ended up also changing the ABI for
32 bit builds.  For 64 bit builds, changing the long to two ints works,
but for 32 bit builds, it inserts 4 extra bytes.  This leads to many
packages randomly failing like bash that spews things like:
	configure: line 471: wait_for: No record of process 0

Bracket the new member by a wordsize check to fix the ABI for 32bit.
2015-07-20 21:53:47 -04:00
Andreas Schwab
530deb962f m68k: update libm test ULPs 2015-07-21 00:20:24 +02:00
H.J. Lu
d4358b51c2 Add si_addr_bnd to _sigfault in x86 struct siginfo
X86 struct siginfo in kernel 3.19 has been changed by

commit ee1b58d36aa1b5a79eaba11f5c3633c88231da83
Author: Qiaowei Ren <qiaowei.ren@intel.com>
Date:   Fri Nov 14 07:18:19 2014 -0800

    mpx: Extend siginfo structure to include bound violation information

    This patch adds new fields about bound violation into siginfo
    structure. si_lower and si_upper are respectively lower bound
    and upper bound when bound violation is caused.

This patch updates x86 struct siginfo to enable GDB with MPX support.

	[BZ #18696]
	* sysdeps/unix/sysv/linux/x86/bits/siginfo.h (_sigfault): Add
	si_addr_bnd.
	(si_lower): New.
	(si_upper): Likewise.
2015-07-20 11:54:53 -07:00
David S. Miller
d87630edc4 Regenerate SPARC ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Regenerated.
2015-07-16 12:03:33 -07:00
Rajalakshmi Srinivasaraghavan
b42f8cad52 powerpc: strstr optimization
This patch optimizes strstr function for power >= 7 systems.  Performance
gain is obtained using aligned memory access and usage of cmpb
instruction for quicker comparison.  The average improvement of this
optimization is ~40%.  Tested on ppc64 and ppc64le.

2015-07-16  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64/multiarch/Makefile: Add strstr().
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: New File.
	* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: New File.
	* sysdeps/powerpc/powerpc64/multiarch/strstr-ppc64.c: New File.
	* sysdeps/powerpc/powerpc64/multiarch/strstr.c: New File.
2015-07-16 13:43:51 -03:00
Mike Frysinger
6b96d6de8c hppa/ia64: _dl_unmap: make it hidden
This symbol is only used by DL_UNMAP which in turn is only used by
_dl_close_worker in dl-close.c, and _dl_close_worker itself is marked
hidden as it is only used by the ldso.  That means _dl_unmap should
be marked hidden.  Without this, the elf/check-localplt test fails.
2015-07-16 09:03:46 -04:00
Mike Frysinger
2a6ad8142d hppa/ia64: _dl_symbol_address: add PLT bypass for rtld
This symbol is defined in the ldso, and is used both there and libc.so.
There is no hidden symbol for it though which leads to relocations in
the ldso and the elf/check-localplt test failing.  Add a hidden def for
rtld to fix all of that.

This function/file is only used by hppa & ia64, so no testing is needed
for other arches.
2015-07-16 09:03:08 -04:00
David S. Miller
c59f721c73 Fix sparc build.
* sysdeps/sparc/nptl/pthread_barrier_init.c: Include
	futex-intenal.h
	* sysdeps/sparc/sparc32/sparcv9/Makefile (nscd): Add cpu_relax.
	* sysdeps/sparc/sparc64/Makefile: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/bits/atomic.h (atomic_spin_nop):
	Remove space from macro define.
	* sysdeps/sparc/sparc64/bits/atomic.h (atomic_spin_nop): Likewise.
2015-07-15 16:07:32 -07:00
Arjun Shankar
0035851c3c Modify several tests to use test-skeleton.c
These tests were skipped by the use-test-skeleton conversion done in
commit 29955b5d because they were reused in other tests via the #include
directive, and so deemed worth an inspection before they were modified.
This has now been done.

ChangeLog:

2015-07-09  Arjun Shankar  <arjun.is@lostca.se>

	* elf/tst-leaks1.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* localedata/tst-langinfo.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* math/test-fpucw.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* math/test-tgmath.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* math/test-tgmath2.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* setjmp/tst-setjmp.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* stdio-common/tst-sscanf.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
	* sysdeps/x86_64/tst-audit6.c (main): Converted to ...
	(do_test): ... this.
	(TEST_FUNCTION): New macro.
	Include test-skeleton.c.
2015-07-15 15:10:23 +05:30
Stefan Liebler
f6267fd880 i686: Mark stdlib/tst-makecontext as XFAIL.
The testcase stdlib/tst-makecontext fails on i686 because
_Unwind_Backtrace from libgcc produces a segmentation fault if it was
called within a context created by makecontext. See Bug 18635.

ChangeLog:

	* sysdeps/i386/i686/Makefile (test-xfail-tst-makecontext):
	New variable.
2015-07-15 09:33:15 +02:00
Stefan Liebler
ed95ec72fb S390: Regenerate ULPs
I've regenerated the ulps for s390 from scratch.

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2015-07-15 09:33:14 +02:00
Roland McGrath
c01ae97eb8 Factor file identity rules out of generic rtld code. 2015-07-14 13:15:26 -07:00
Wilco Dijkstra
82641e16aa Add AArch64 versions of math_opt_barrier and math_force_eval that avoid going via memory. 2015-07-13 12:48:33 +01:00
Wilco Dijkstra
c435989f52 Optimize the strlen implementation by using a page cross check and a fast check
for nul bytes which reverts to separate loop when a non-ASCII char is encountered.
Speedup on test-strlen is ~10%, long ASCII strings are processed ~60% faster,
and on random tests it is ~80% better.
2015-07-13 12:38:12 +01:00
Roland McGrath
398a80fec8 NaCl: Make pthread_condattr_setclock reject CLOCK_MONOTONIC. 2015-07-10 14:18:14 -07:00
Chris Metcalf
ef115d3ade tile: Regenerate ULPs.
Regenerated from scratch on tilegx.
2015-07-10 16:16:37 -04:00
Torvald Riegel
a2f0363f81 Add and use new glibc-internal futex API.
This adds new functions for futex operations, starting with wait,
abstimed_wait, reltimed_wait, wake.  They add documentation and error
checking according to the current draft of the Linux kernel futex manpage.

Waiting with absolute or relative timeouts is split into separate functions.
This allows for removing a few cases of code duplication in pthreads code,
which uses absolute timeouts; also, it allows us to put platform-specific
code to go from an absolute to a relative timeout into the platform-specific
futex abstractions..

Futex operations that can be canceled are also split out into separate
functions suffixed by "_cancelable".

There are separate versions for both Linux and NaCl; while they currently
differ only slightly, my expectation is that the separate versions of
lowlevellock-futex.h will eventually be merged into futex-internal.h
when we get to move the lll_ functions over to the new futex API.
2015-07-10 13:47:09 +02:00
Roland McGrath
af85d409a2 PLT avoidance for _exit in rtld. 2015-07-09 15:25:47 -07:00
H.J. Lu
2eb9ef29b6 Improve bndmov encoding with zero displacement
If x86-64 assembler doesn't support MPX, we encode bndmov instruction by
hand.  When displacement is zero, assembler generates shorter encoding.
This patch improves bndmov encoding with zero displacement so that ld.so
is identical when using assemblers with and without MPX support.

	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Improve
	bndmov encoding with zero displacement.
2015-07-09 09:30:20 -07:00
Igor Zamyatin
14c5cbabc2 Preserve bound registers for pointer pass/return
We need to save/restore bound registers and add a BND prefix before
branches in _dl_runtime_profile so that bound registers for pointer
pass and return are preserved when LD_AUDIT is used.

	[BZ #18134]
	* sysdeps/i386/configure.ac: Set HAVE_MPX_SUPPORT.
	* sysdeps/i386/configure: Regenerated.
	* sysdeps/i386/dl-trampoline.S (PRESERVE_BND_REGS_PREFIX): New.
	(_dl_runtime_profile): Save and restore Intel MPX return bound
	registers when calling _dl_call_pltexit.  Add
	PRESERVE_BND_REGS_PREFIX before return.
	* sysdeps/i386/link-defines.sym (LRV_BND0_OFFSET): New.
	(LRV_BND1_OFFSET): Likewise.
	* sysdeps/x86/bits/link.h (La_i86_retval): Add lrv_bnd0 and
	lrv_bnd1.
	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix
	typo in bndmov encoding.
	* sysdeps/x86_64/dl-trampoline.h: Properly save and restore
	Intel MPX bound registers.  Add PRESERVE_BND_REGS_PREFIX before
	branch instructions to preserve bounds.
2015-07-09 06:50:12 -07:00
Adhemerval Zanella
632b3db8e2 libio: Update powerpc64le libc.abilist
This patch adds the missing fmemopen entry for powerpc64le libc abilist
check file.

	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
2015-07-09 10:28:58 -03:00
Samuel Thibault
ed4060f50e hurd: permit to use mlock from non-root process
* sysdeps/mach/hurd/mlock.c (mlock): When __get_privileged_ports
returns an error, also try to use host port from __mach_host_self for
the __vm_wire call.
* sysdeps/mach/hurd/munlock.c (munlock): Likewise.
2015-07-09 13:56:30 +02:00
Szabolcs Nagy
b8528e771c [AArch64][BZ 18648] change greg_t definition in ucontext.h
This is an ABI breaking change, but

	typedef int greg_t;

is not a useful definition on aarch64.

greg_t is usually used for defining gregset_t which is used
in mcontext_t.  The general registers in mcontext_t can only
be accessed by target specific code and on aarch64 greg_t
is not needed for that so this change is not supposed to break
existing code, just fix the definition.

	[BZ #18648]
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (greg_t): Change the
	definition to elf_greg_t.

(Added another BZ entry that was missed in the previous commit).
2015-07-09 09:53:30 +01:00
Szabolcs Nagy
14d623bcd1 [AArch64][BZ 18400] fix elf_prpsinfo in procfs.h
Kernel uses int pr_uid, pr_gid, but glibc used unsigned short.

This is an ABI breaking change, but the size and alignment of
the struct and the layout of other members is not changed and
there is no known usage of pr_uid and pr_gid so it is expected
to be safe.

	[BZ #18400]
	* sysdeps/unix/sysv/linux/aarch64/sys/procfs.h (struct elf_prpsinfo):
	Fix pr_uid and pr_gid members.
2015-07-09 09:39:51 +01:00
Roland McGrath
95af4cffdb BZ#18383: Conditionalize test-xfail-tst-tlsalign{,-static} on ARM assembler bug. 2015-07-08 15:00:43 -07:00
Adhemerval Zanella
fdb7d390dd libio: fmemopen rewrite to POSIX compliance
This patch added a new fmemopen version, for glibc 2.22, that aims to be
POSIX complaint.  It fixes some long-stading glibc fmemopen issues, such
as:

* it changes the way fseek with SEEK_END works on fmemopen to seek
  relative to buffer size instead of first '\0'.  This is default mode and
  'b' opening mode does not change internal behavior (bz#6544).

* fix apending opening mode to use as start position either first null
  byte of len specified in function call (bz#13152 and #13151).

* remove binary option 'b' and internal different handling (bz#12836)

* fix seek/SEE_END with negative values (bz#14292).

A compatibility symbol is provided to with old behavior for older symbols
version (2.2.5).

	* include/stdio.h (fmemopen): Remove hidden prototype.
	(__fmemopen): Add new hidden prototype.
	* libio/Makefile: Add oldfmemopen object.
	* libio/Versions [GLIBC_2.22]: Add new fmemopen symbol.
	* libio/fmemopen.c (__fmemopen): Function rewrite to be POSIX
	compliance.
	* libio/oldfmemopen.c: New file: old fmemopen implementation for
	symbol compatibility.
	* stdio-common/Makefile [tests]: Add new tst-fmemopen3.
	* stdio-common/psiginfo.c [psiginfo]: Call __fmemopen instead of
	fmemopen.
	* stdio-common/tst-fmemopen3.c: New file: more fmemopen tests, focus
	on append and read mode.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.22]: Add
	fmemopen.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
	[GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist [GLIBC_2.22]:
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist [GLIBC_2.22]: Likewise.
2015-07-08 12:07:21 -03:00
Carlos O'Donell
1c1e312520 Add missing Advanced API (RFC3542) (1) defines.
Fixes bug 18643.

Defines IPV6_RECVPATHMTU, IPV6_PATHMTU, and IPV6_DONTFRAG for Linux.
2015-07-08 10:58:23 -04:00
Stefan Liebler
890b7a4b33 S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()" [BZ #18508].
On s390/s390x backtrace(buffer, size) returns the series of called functions until
"makecontext_ret" and additional entries (up to "size") with "makecontext_ret".
GDB-backtrace is also warning:
"Backtrace stopped: previous frame identical to this frame (corrupt stack?)"

To reproduce this scenario you have to setup a new context with makecontext()
and activate it with setcontext(). See e.g. cf() function in testcase stdlib/tst-makecontext.c.
Or see bug in libgo "Bug 66303 - runtime.Caller() returns infinitely deep stack frames
on s390x " (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66303).

This patch omits the cfi_startproc/cfi_endproc directives in ENTRY/END macro of
__makecontext_ret. Thus no frame information is generated in .eh_frame and backtrace
stops after __makecontext_ret. There is also no .eh_frame info for _start or
thread_start functions.

ChangeLog:

	[BZ #18508]
	* stdlib/Makefile ($(objpfx)tst-makecontext3):
	Depend on $(libdl).
	* stdlib/tst-makecontext.c (cf): Test if _Unwind_Backtrace
	is not called infinitely times.
	(backtrace_helper): New function.
	(trace_arg): New struct.
	(st1): Enlarge stack size.
	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:
	(__makecontext_ret): Omit cfi_startproc and cfi_endproc.
	* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S:
	Likewise.
2015-07-07 16:11:14 +02:00
Stefan Liebler
fa4eeac73d S390: Regenerate ULPs.
Regenerated ulps after recent changes.
Tested on s390/s390x.
All math-tests passes on s390 after this patch.

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2015-07-07 16:11:14 +02:00
Stefan Liebler
3fdc131c26 S390: Fix sem.h conformance test failures.
On s390 the following tests are failing due to unkown types time_t, pid_t:
FAIL: conform/UNIX98/sys/sem.h/conform
FAIL: conform/XOPEN2K/sys/sem.h/conform
FAIL: conform/XOPEN2K8/sys/sem.h/conform
FAIL: conform/XPG3/sys/sem.h/conform
FAIL: conform/XPG4/sys/sem.h/conform

This patch changes the s390 specific sem.h and includes sys/types.h instead
of bits/types.h. All other archs include sys/types.h, too.
Including bits/wordsize.h is obselete, because it is already inlcuded in
sys/types.h -> bits/types.h.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/bits/sem.h:
	Include sys/types.h instead of bits/types.h.
	Remove inclusion of bits/wordsize.h.
2015-07-07 16:11:14 +02:00
H.J. Lu
9aec6d2a2f Add la_symbind32 to x86-64 audit tests
la_symbind32 is used for x32 in x86-64 audit tests.  We should define
both la_symbind32 and la_symbind64 in x86-64 audit tests.

	* sysdeps/x86_64/tst-auditmod10b.c (la_symbind32): New.
	* sysdeps/x86_64/tst-auditmod4b.c (la_symbind32): Likewise.
	* sysdeps/x86_64/tst-auditmod5b.c (la_symbind32): Likewise.
	* sysdeps/x86_64/tst-auditmod6b.c (la_symbind32): Likewise.
	* sysdeps/x86_64/tst-auditmod6c.c (la_symbind32): Likewise.
	* sysdeps/x86_64/tst-auditmod7b.c (la_symbind32): Likewise.
2015-07-07 06:09:29 -07:00
H.J. Lu
ddd85a65b6 Add and use sysdeps/i386/link-defines.sym
Define macros for fields in La_i86_regs and La_i86_retval and use them
in dl-trampoline.S, instead of hardcoded values.

	* sysdeps/i386/Makefile (gen-as-const-headers)[elf]: Add
	link-defines.sym.
	* sysdeps/i386/dl-trampoline.S: Include <link-defines.h>.
	(_dl_runtime_profile): Use LONG_DOUBLE_SIZE, LRV_SIZE,
	LRV_EAX_OFFSET, LRV_EDX_OFFSET, LRV_ST0_OFFSET, LRV_ST1_OFFSET
	and LR_SIZE.
	* sysdeps/i386/link-defines.sym: New file.
2015-07-07 05:23:40 -07:00
H.J. Lu
fa9fef1f9b Add a testcase for i386 LD_AUDIT
This patch adds a testcase for i386 LD_AUDIT to check function return
and parameters passed in registers.

	* sysdeps/i386/Makefile (tests)[elf]: Add tst-audit3.
	(modules-names): Add tst-auditmod3a tst-auditmod3b.
	($(objpfx)tst-audit3): New rule.
	($(objpfx)tst-audit3.out): Likewise.
	* sysdeps/i386/tst-audit3.c: New file.
	* sysdeps/i386/tst-audit3.h: Likewise.
	* sysdeps/i386/tst-auditmod3a.c: Likewise.
	* sysdeps/i386/tst-auditmod3b.c: Likewise.
2015-07-07 05:09:30 -07:00
Torvald Riegel
213a2be7b4 Do not create invalid pointers in C code of string functions.
Some of the x86 string functions create pointers based on input strings
that may be outside of the input strings.  When this happens in C code,
the compiler can potentially detect this, leading to warnings in
application code when those string functions are inlined.  Perform those
operations in the assembly code instead of the C code to fix this.
2015-07-07 13:40:12 +02:00
Wilco Dijkstra
6471190491 Inline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions. 2015-07-06 12:52:55 +01:00
Wilco Dijkstra
a1b85e1d6c Remove unused file sysdeps/ieee754/support.c 2015-07-06 12:51:30 +01:00
Szabolcs Nagy
2b1d7148e3 [AArch64] make setcontext etc functions consistent with the kernel
since
https://sourceware.org/ml/libc-alpha/2014-04/msg00006.html
setcontext etc is no longer tied to the kernel use of ucontext.

in that patch the ucontext reserved space is not used consistently
with the kernel abi: the d8,d9 pair is saved in the slot of q8.

this is ok (*context functions work together), but probably not
desirable (ucontexts created by the kernel and getcontext are
subtly different).

the fix just replaces dN with qN in the save/restore code, which
does a bit more than needed (saves/restores the top half of qN that
is not callee saved), but this should not be an issue (and avoids
having to deal with endianness).

(kernel fpsimd context layout: the first 64bit contains 0x210 the fpsimd
context size and 0x46508001 the FPSIMD_MAGIC, the second 64bit is for
fpsr and fpcr, and the rest is the 128bit q0..q31 registers).

given d8=8.1, d9=9.1,... d15=15.1, the context created by getcontext is

current:

(gdb) x/40xg ctx.uc_mcontext.__reserved
0x410df0 <ctx+464>:     0x0000021046508001      0x0000000000000000
0x410e00 <ctx+480>:     0x0000000000000000      0x0000000000000000
0x410e10 <ctx+496>:     0x0000000000000000      0x0000000000000000
0x410e20 <ctx+512>:     0x0000000000000000      0x0000000000000000
0x410e30 <ctx+528>:     0x0000000000000000      0x0000000000000000
0x410e40 <ctx+544>:     0x0000000000000000      0x0000000000000000
0x410e50 <ctx+560>:     0x0000000000000000      0x0000000000000000
0x410e60 <ctx+576>:     0x0000000000000000      0x0000000000000000
0x410e70 <ctx+592>:     0x0000000000000000      0x0000000000000000
0x410e80 <ctx+608>:     0x4020333333333333      0x4022333333333333
0x410e90 <ctx+624>:     0x0000000000000000      0x0000000000000000
0x410ea0 <ctx+640>:     0x4024333333333333      0x4026333333333333
0x410eb0 <ctx+656>:     0x0000000000000000      0x0000000000000000
0x410ec0 <ctx+672>:     0x4028333333333333      0x402a333333333333
0x410ed0 <ctx+688>:     0x0000000000000000      0x0000000000000000
0x410ee0 <ctx+704>:     0x402c333333333333      0x402e333333333333
0x410ef0 <ctx+720>:     0x0000000000000000      0x0000000000000000
0x410f00 <ctx+736>:     0x0000000000000000      0x0000000000000000
0x410f10 <ctx+752>:     0x0000000000000000      0x0000000000000000
0x410f20 <ctx+768>:     0x0000000000000000      0x0000000000000000

fixed:

(gdb) x/40xg ctx.uc_mcontext.__reserved
0x410d70 <ctx+464>:     0x0000021046508001      0x0000000000000000
0x410d80 <ctx+480>:     0x0000000000000000      0x0000000000000000
0x410d90 <ctx+496>:     0x0000000000000000      0x0000000000000000
0x410da0 <ctx+512>:     0x0000000000000000      0x0000000000000000
0x410db0 <ctx+528>:     0x0000000000000000      0x0000000000000000
0x410dc0 <ctx+544>:     0x0000000000000000      0x0000000000000000
0x410dd0 <ctx+560>:     0x0000000000000000      0x0000000000000000
0x410de0 <ctx+576>:     0x0000000000000000      0x0000000000000000
0x410df0 <ctx+592>:     0x0000000000000000      0x0000000000000000
0x410e00 <ctx+608>:     0x4020333333333333      0x0000000000000000
0x410e10 <ctx+624>:     0x4022333333333333      0x0000000000000000
0x410e20 <ctx+640>:     0x4024333333333333      0x0000000000000000
0x410e30 <ctx+656>:     0x4026333333333333      0x0000000000000000
0x410e40 <ctx+672>:     0x4028333333333333      0x0000000000000000
0x410e50 <ctx+688>:     0x402a333333333333      0x0000000000000000
0x410e60 <ctx+704>:     0x402c333333333333      0x0000000000000000
0x410e70 <ctx+720>:     0x402e333333333333      0x0000000000000000
0x410e80 <ctx+736>:     0x0000000000000000      0x0000000000000000
0x410e90 <ctx+752>:     0x0000000000000000      0x0000000000000000
0x410ea0 <ctx+768>:     0x0000000000000000      0x0000000000000000

2015-07-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext): Use q
	registers instead of d ones so the layout is kernel abi compatible.
	* sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/swapcontext.S (__swapcontext):
	Likewise.# Please enter the commit message for your changes. Lines starting
2015-07-06 12:46:43 +01:00
Szabolcs Nagy
cfe4368e51 Regenerate aarch64 libm-test-ulps
* sysdeps/aarch64/libm-test-ulps: Regenerated.
2015-07-02 14:58:12 +01:00
Joseph Myers
a04bb3306a Fix ldbl-128 expm1l (-min_subnorm) result sign (bug 18619).
In the ldbl-128 implementation of expm1l, when expm1l's result should
underflow to 0 (argument minus the least subnormal, in some rounding
modes), it can be a zero of the wrong sign.  This patch fixes this in
the same way previously used for the x86 / x86_64 versions.

Tested for mips64.

	[BZ #18619]
	* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Force underflow
	and return argument in case of subnormal argument.
2015-07-01 22:27:49 +00:00
Joseph Myers
9081b7bcb1 Regenerate powerpc-nofpu libm-test-ulps.
* sysdeps/powerpc/nofpu/libm-test-ulps: Regenerated.
2015-07-01 18:04:28 +00:00
Joseph Myers
1ef3a80617 Regenerate ARM libm-test-ulps.
* sysdeps/arm/libm-test-ulps: Regenerated.
2015-07-01 17:50:15 +00:00
Joseph Myers
1dd751a3ba Regenerate MIPS libm-test-ulps.
* sysdeps/mips/mips32/libm-test-ulps: Regenerated.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
2015-07-01 17:24:37 +00:00
Torvald Riegel
4eb984d3ab Clean up BUSY_WAIT_NOP and atomic_delay.
This patch combines BUSY_WAIT_NOP and atomic_delay into a new
atomic_spin_nop function and adjusts all clients.  The new function is
put into atomic.h because what is best done in a spin loop is
architecture-specific, and atomics must be used for spinning.  The
function name is meant to tell users that this has no effect on
synchronization semantics but is a performance aid for spinning.
2015-06-30 15:57:15 +02:00
Joseph Myers
e02920bc02 Improve tgamma accuracy (bug 18613).
In non-default rounding modes, tgamma can be slightly less accurate
than permitted by glibc's accuracy goals.

Part of the problem is error accumulation, addressed in this patch by
setting round-to-nearest for internal computations.  However, there
was also a bug in the code dealing with computing pow (x + n, x + n)
where x + n is not exactly representable, providing another source of
error even in round-to-nearest mode; it was necessary to address both
bugs to get errors for all testcases within glibc's accuracy goals.
Given this second fix, accuracy in round-to-nearest mode is also
improved (hence regeneration of ulps for tgamma should be from scratch
- truncate libm-test-ulps or at least remove existing tgamma entries -
so that the expected ulps can be reduced).

Some additional complications also arose.  Certain tgamma tests should
strictly, according to IEEE semantics, overflow or not depending on
the rounding mode; this is beyond the scope of glibc's accuracy goals
for any function without exactly-determined results, but
gen-auto-libm-tests doesn't handle being lax there as it does for
underflow.  (libm-test.inc also doesn't handle being lax about whether
the result in cases very close to the overflow threshold is infinity
or a finite value close to overflow, but that doesn't cause problems
in this case though I've seen it cause problems with random test
generation for some functions.)  Thus, spurious-overflow markings,
with a comment, are added to auto-libm-test-in (no bug in Bugzilla
because the issue is with the testsuite, not a user-visible bug in
glibc).  And on x86, after the patch I saw ERANGE issues as previously
reported by Carlos (see my commentary in
<https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>), which
needed addressing by ensuring excess range and precision were
eliminated at various points if FLT_EVAL_METHOD != 0.

I also noticed and fixed a cosmetic issue where 1.0f was used in long
double functions and should have been 1.0L.

This completes the move of all functions to testing in all rounding
modes with ALL_RM_TEST, so gen-libm-have-vector-test.sh is updated to
remove the workaround for some functions not using ALL_RM_TEST.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #18613]
	* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Take log of
	X_ADJ not X when adjusting exponent.
	(__ieee754_gamma_r): Do intermediate computations in
	round-to-nearest then adjust overflowing and underflowing results
	as needed.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Take log
	of X_ADJ not X when adjusting exponent.
	(__ieee754_gammaf_r): Do intermediate computations in
	round-to-nearest then adjust overflowing and underflowing results
	as needed.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive): Take
	log of X_ADJ not X when adjusting exponent.
	(__ieee754_gammal_r): Do intermediate computations in
	round-to-nearest then adjust overflowing and underflowing results
	as needed.  Use 1.0L not 1.0f as numerator of division.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive): Take
	log of X_ADJ not X when adjusting exponent.
	(__ieee754_gammal_r): Do intermediate computations in
	round-to-nearest then adjust overflowing and underflowing results
	as needed.  Use 1.0L not 1.0f as numerator of division.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive): Take log
	of X_ADJ not X when adjusting exponent.
	(__ieee754_gammal_r): Do intermediate computations in
	round-to-nearest then adjust overflowing and underflowing results
	as needed.  Use 1.0L not 1.0f as numerator of division.
	* math/libm-test.inc (tgamma_test_data): Remove one test.  Moved
	to auto-libm-test-in.
	(tgamma_test): Use ALL_RM_TEST.
	* math/auto-libm-test-in: Add one test of tgamma.  Mark some other
	tests of tgamma with spurious-overflow.
	* math/auto-libm-test-out: Regenerated.
	* math/gen-libm-have-vector-test.sh: Do not check for START.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-06-29 23:29:35 +00:00
Joseph Myers
4aa10d01b6 Fix ldbl-128 j1l spurious underflows (bug 18612).
The ldbl-128 implementation of j1l produces spurious underflow
exceptions for some small arguments, as a result of squaring the
argument.  This patch fixes it just to use a linear approximation for
sufficiently small arguments, and then to force an underflow exception
only in the cases where it is required.

Tested for mips64.

	[BZ #18612]
	* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): For small
	arguments, just return 0.5 times the argument, with underflow
	forced as needed.
	* math/auto-libm-test-in: Add more tests of j1.
	* math/auto-libm-test-out: Regenerated.
2015-06-29 17:51:32 +00:00
Joseph Myers
63dbe5f322 Fix j1, jn missing underflows (bug 16559).
Similar to various other bugs in this area, j1 and jn implementations
can fail to raise the underflow exception when the internal
computation is exact although the actual function is inexact.  This
patch forces the exception in a similar way to other such fixes.  (The
ldbl-128 / ldbl-128ibm j1l implementation is different and doesn't
need a change for this until spurious underflows in it are fixed.)

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16559]
	* sysdeps/ieee754/dbl-64/e_j1.c: Include <float.h>.
	(__ieee754_j1): Force underflow exception for small results.
	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Include <float.h>.
	(__ieee754_j1f): Force underflow exception for small results.
	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j1l.c: Include <float.h>.
	(__ieee754_j1l): Force underflow exception for small results.
	* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
	* math/auto-libm-test-in: Add more tests of j1 and jn.
	* math/auto-libm-test-out: Regenerated.
2015-06-29 16:52:16 +00:00
Joseph Myers
31545c2327 Update headers for Linux 4.0, 4.1 definitions.
This patch updates installed glibc headers for new definitions from
Linux 4.0 and 4.1 that seem relevant to glibc headers.  In addition, I
noticed that PF_IB / AF_IB, added in Linux 3.11, were missing for no
obvious reason, so added those as well.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

	* sysdeps/unix/sysv/linux/bits/in.h (IP_CHECKSUM): New macro.
	* sysdeps/unix/sysv/linux/bits/socket.h (PF_IB): Likewise.
	(PF_MPLS): Likewise.
	(AF_IB): Likewise.
	(AF_MPLS): Likewise.
	* sysdeps/unix/sysv/linux/sys/mount.h (MS_LAZYTIME): New enum
	value and macro.
	(MS_RMT_MASK): Include MS_LAZYTIME.
2015-06-29 14:38:46 +00:00
Matthew Fortune
a2057c984e Add support for DT_MIPS_RLD_MAP_REL.
This tag allows debugging of MIPS position independent executables
and provides access to shared library information.

	* elf/elf.h (DT_MIPS_RLD_MAP_REL): New macro.
	(DT_MIPS_NUM): Update.
	* sysdeps/mips/dl-machine.h (ELF_MACHINE_DEBUG_SETUP): Handle
	DT_MIPS_RLD_MAP_REL.
2015-06-26 12:03:45 +01:00
Joseph Myers
a8e2112ae3 Use round-to-nearest internally in jn, test with ALL_RM_TEST (bug 18602).
Some existing jn tests, if run in non-default rounding modes, produce
errors above those accepted in glibc, which causes problems for moving
tests of jn to use ALL_RM_TEST.  This patch makes jn set rounding
to-nearest internally, as was done for yn some time ago, then computes
the appropriate underflowing value for results that underflowed to
zero in to-nearest, and moves the tests to ALL_RM_TEST.  It does
nothing about the general inaccuracy of Bessel function
implementations in glibc, though it should make jn more accurate on
average in non-default rounding modes through reduced error
accumulation.  The recomputation of results that underflowed to zero
should as a side-effect fix some cases of bug 16559, where jn just
used an exact zero, but that is *not* the goal of this patch and other
cases of that bug remain unfixed.

(Most of the changes in the patch are reindentation to add new scopes
for SET_RESTORE_ROUND*.)

Tested for x86_64, x86, powerpc and mips64.

	[BZ #16559]
	[BZ #18602]
	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Set
	round-to-nearest internally then recompute results that
	underflowed to zero in the original rounding mode.
	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise
	* math/libm-test.inc (jn_test): Use ALL_RM_TEST.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-06-25 21:46:02 +00:00
Roland McGrath
e185d57e99 Use unsigned types for counters in getaddrinfo_a code. 2015-06-24 17:58:12 -07:00
Roland McGrath
86edd44f04 Use unsigned types for counters in AIO code. 2015-06-24 17:43:32 -07:00
Joseph Myers
f9536db790 Refactor libm tests.
This patch refactors the libm tests using libm-test.inc to reduce the
level of duplicate definitions.  New headers are created for the
definitions shared by tests for a particular type; by tests of inline
functions; by tests of non-inline functions; by scalar tests; and by
vector tests.  The unused MATHCONST macro is removed.  A new macro
VEC_LEN is added to the vector headers to allow the macros defining
wrappers for vector functions to be defined once, instead of six times
each (differing only in vector length) as before.  There is still
scope for further refactoring, but this seems a useful start.

Tested for x86_64.

	* math/test-double.h: New file.
	* math/test-float.h: Likewise.
	* math/test-ldouble.h: Likewise.
	* math/test-math-inline.h: Likewise.
	* math/test-math-no-inline.h: Likewise.
	* math/test-math-scalar.h: Likewise.
	* math/test-math-vector.h: Likewise.
	* math/test-vec-loop.h: Remove file.  Contents moved into
	test-math-vector.h.
	* math/libm-test.inc (MATHCONST): Do not document macro.
	* math/test-double.c: Include test-double.h, test-math-no-inline.h
	and test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_DOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-float.c: Include test-float.h, test-math-no-inline.h
	and test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_FLOAT): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-idouble.c: Include test-double.h, test-math-inline.h
	and test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_DOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(TEST_INLINE): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-ifloat.c: Include test-float.h, test-math-inline.h and
	test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_FLOAT): Likewise.
	(TEST_MATHVEC): Likewise.
	(TEST_INLINE): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-ildoubl.c: Include test-ldouble.h, test-math-inline.h
	and test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_LDOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(TEST_INLINE): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-ldouble.c: Include test-ldouble.h,
	test-math-no-inline.h and test-math-scalar.h.
	(FUNC): Remove macro.
	(FUNC_TEST): Likewise.
	(FLOAT): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_LDOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	* math/test-double-vlen2.h: Include test-double.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_DOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* math/test-double-vlen4.h: Include test-double.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_DOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* math/test-double-vlen8.h: Include test-double.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_DOUBLE): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* math/test-float-vlen4.h: Include test-float.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_FLOAT): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* math/test-float-vlen8.h: Include test-float.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_FLOAT): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* math/test-float-vlen16.h: Include test-float.h,
	test-math-no-inline.h and test-math-vector.h.
	(FLOAT): Remove macro.
	(FUNC): Likewise.
	(MATHCONST): Likewise.
	(PRINTF_EXPR): Likewise.
	(PRINTF_XEXPR): Likewise.
	(PRINTF_NEXPR): Likewise.
	(TEST_FLOAT): Likewise.
	(TEST_MATHVEC): Likewise.
	(__NO_MATH_INLINES): Likewise.
	(CNCT): Likewise.
	(CONCAT): Likewise.
	(WRAPPER_NAME): Likewise.
	(WRAPPER_DECL): Likewise.
	(WRAPPER_DECL_ff): Likewise.
	(WRAPPER_DECL_fFF): Likewise.
	(VECTOR_WRAPPER): Likewise.
	(VECTOR_WRAPPER_ff): Likewise.
	(VECTOR_WRAPPER_fFF): Likewise.
	(VEC_LEN): New macro.
	* sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Do not include
	test-vec-loop.h.
	* sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Likewise.
2015-06-24 23:27:18 +00:00
Roland McGrath
5ba4a6eb9f NaCl: Fix glob.c build after getlogin_r -> __getlogin_r. 2015-06-24 15:29:53 -07:00
Joseph Myers
a67894c505 Fix cexp, ccos, ccosh, csin, csinh spurious underflows (bug 18594).
cexp, ccos, ccosh, csin and csinh have spurious underflows in cases
where they compute sin of the smallest normal, that produces an
underflow exception (depending on which sin implementation is in use)
but the final result does not underflow.  ctan and ctanh may also have
such underflows, or they may be latent (the issue there is that
e.g. ctan (DBL_MIN) should, rounded upwards, be the next double value
above DBL_MIN, which under glibc's accuracy goals may not have an
underflow exception, but the intermediate computation of sin (DBL_MIN)
would legitimately underflow on before-rounding architectures).

This patch fixes all those functions so they use plain comparisons (>
DBL_MIN etc.) instead of comparing the result of fpclassify with
FP_SUBNORMAL (in all these cases, we already know the number being
compared is finite).  Note that in the case of csin / csinf / csinl,
there is no need for fabs calls in the comparison because the real
part has already been reduced to its absolute value.

As the patch fixes the failures that previously obstructed moving
tests of cexp to use ALL_RM_TEST, those tests are moved to ALL_RM_TEST
by the patch (two functions remain yet to be converted).

Tested for x86_64 and x86 and ulps updated accordingly.

	[BZ #18594]
	* math/s_ccosh.c (__ccosh): Compare with least normal value
	instead of comparing class with FP_SUBNORMAL.
	* math/s_ccoshf.c (__ccoshf): Likewise.
	* math/s_ccoshl.c (__ccoshl): Likewise.
	* math/s_cexp.c (__cexp): Likewise.
	* math/s_cexpf.c (__cexpf): Likewise.
	* math/s_cexpl.c (__cexpl): Likewise.
	* math/s_csin.c (__csin): Likewise.
	* math/s_csinf.c (__csinf): Likewise.
	* math/s_csinh.c (__csinh): Likewise.
	* math/s_csinhf.c (__csinhf): Likewise.
	* math/s_csinhl.c (__csinhl): Likewise.
	* math/s_csinl.c (__csinl): Likewise.
	* math/s_ctan.c (__ctan): Likewise.
	* math/s_ctanf.c (__ctanf): Likewise.
	* math/s_ctanh.c (__ctanh): Likewise.
	* math/s_ctanhf.c (__ctanhf): Likewise.
	* math/s_ctanhl.c (__ctanhl): Likewise.
	* math/s_ctanl.c (__ctanl): Likewise.
	* math/auto-libm-test-in: Add more tests of ccos, ccosh, cexp,
	csin, csinh, ctan and ctanh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (cexp_test): Use ALL_RM_TEST.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-06-24 21:04:51 +00:00
Roland McGrath
010186901d Print more information in tst-getcpu failure case. 2015-06-24 13:56:46 -07:00
Joseph Myers
ac831b362a Fix csin, csinh overflow in directed rounding modes (bug 18593).
csin and csinh can produce bad results when overflowing in directed
rounding modes, because a multiplication that can overflow is followed
by a possible negation.  This patch fixes this by negating one of the
arguments of the multiplication before the multiplication instead of
negating the result.

The new tests for this issue are added to auto-libm-test-in, starting
use of that file for csin and csinh.  The issue was found in the
course of moving existing tests for csin and csinh (existing tests, by
being enabled in more cases than previously, showed the issue for
float and double but not for long double); that move will now be done
separately.

Tested for x86_64 and x86 and ulps updated accordingly.

	[BZ #18593]
	* math/s_csin.c (__csin): Negate before rather than after possibly
	overflowing multiplication.
	* math/s_csinf.c (__csinf): Likewise.
	* math/s_csinh.c (__csinh): Likewise.
	* math/s_csinhf.c (__csinhf): Likewise.
	* math/s_csinhl.c (__csinhl): Likewise.
	* math/s_csinl.c (__csinl): Likewise.
	* math/auto-libm-test-in: Add some tests of csin and csinh.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (csin_test_data): Use AUTO_TESTS_c_c.
	(csinh_test_data): Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2015-06-24 16:20:48 +00:00
Joseph Myers
8475ab1684 Fix ldbl-128 expl missing underflows (bug 18586).
Similar to various other bugs in this area, the ldbl-128 expl
implementation does not raise the underflow exception for all
subnormal results, if the scaling down is exact although the actual
result is inexact.  This patch fixes this by forcing the exception in
this case (the tests that failed before and pass after the test are
already in the testsuite).

Tested for mips64.

	[BZ #18586]
	* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Force
	underflow exception for small results.
2015-06-24 15:12:03 +00:00
Andrew Senkevich
36870482d2 Combination of data tables for x86_64 vector functions sinf, cosf and sincosf.
* sysdeps/x86_64/fpu/Makefile (libmvec-support): Fixed files list.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core_sse4.S: Renamed variable
    and included header.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_trig_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_trig_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.S: Removed file.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.h: Likewise.
2015-06-24 17:44:35 +03:00
Joseph Myers
ad39cce0da Fix sin, sincos missing underflows (bug 16526, bug 16538).
Similar to various other bugs in this area, some sin and sincos
implementations do not raise the underflow exception for subnormal
arguments, when the result is tiny and inexact.  This patch forces the
exception in a similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #16526]
	[BZ #16538]
	* sysdeps/ieee754/dbl-64/s_sin.c: Include <float.h>.
	(__sin): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/flt-32/k_sinf.c: Include <float.h>.
	(__kernel_sinf): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/k_sincosl.c: Include <float.h>.
	(__kernel_sincosl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/k_sinl.c: Include <float.h>.
	(__kernel_sinl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: Include <float.h>.
	(__kernel_sincosl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c: Include <float.h>.
	(__kernel_sinl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/k_sinl.c: Include <float.h>.
	(__kernel_sinl): Force underflow exception for arguments with
	small absolute value.
	* sysdeps/powerpc/fpu/k_sinf.c: Include <float.h>.
	(__kernel_sinf): Force underflow exception for arguments with
	small absolute value.
	* math/auto-libm-test-in: Add more tests of sin and sincos.
	* math/auto-libm-test-out: Regenerated.
2015-06-23 22:24:20 +00:00
Joseph Myers
8b1bab5ffa Fix spurious "inexact" exceptions from __kernel_standard_l (bug 18245, bug 18583).
__kernel_standard_l converts long double arguments to double for use
in SVID "struct exception".  This has special-case handling for when
that conversion would overflow or underflow but the original long
double function wouldn't.  However, it turns out that "inexact"
exceptions can be spurious here as well, when the function is exactly
determined and __kernel_standard_l is being called for a domain error.
This patch fixes this by using feholdexcept / fesetenv to avoid
exceptions from the conversion, replacing the previous special-case
logic for overflow and underflow (this covers all functions using
__kernel_standard_l, not just those that actually need a change, since
there doesn't seem to be much point in restricting things just to the
functions that mustn't get "inexact" here).

Tested for x86_64 and x86.

	[BZ #18245]
	[BZ #18583]
	* sysdeps/ieee754/k_standardl.c: Include <fenv.h>.
	(__kernel_standard_l): Use feholdexcept and fesetenv around
	conversion to double instead of special-casing overflow and
	underflow.
	* math/libm-test.inc (fmod_test_data): Add more tests.
	(remainder_test_data): Likewise.
	(sqrt_test_data): Likewise.
2015-06-23 17:26:46 +00:00
Torvald Riegel
c47ca9647f Fix atomic_full_barrier on x86 and x86_64.
This fixes BZ #17403 by defining atomic_full_barrier,
atomic_read_barrier, and atomic_write_barrier on x86 and x86_64.  A full
barrier is implemented through an atomic idempotent modification to the
stack and not through using mfence because the latter can supposedly be
somewhat slower due to having to provide stronger guarantees wrt.
self-modifying code, for example.
2015-06-23 19:20:52 +02:00
Andrew Senkevich
5872b8352a Combination of data tables for x86_64 vector functions sin, cos and sincos.
* sysdeps/x86_64/fpu/Makefile (libmvec-support): Fixed files list.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core_sse4.S: Renamed variable
    and included header.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_trig_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_trig_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos2_core.S: Removed unneeded include.
    * sysdeps/x86_64/fpu/svml_d_cos4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos8_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos_data.S: Removed file.
    * sysdeps/x86_64/fpu/svml_d_cos_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sin_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sin_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.h: Likewise.
2015-06-23 19:21:50 +03:00
Joseph Myers
718d34a309 Fix csqrt spurious underflows (bug 18371).
The csqrt implementations in glibc can cause spurious underflows in
some cases as a side-effect of the scaling for large arguments (when
underflow is correct for the square root of the argument that was
scaled down to avoid overflow, but not for the original argument).
This patch arranges to avoid the underflowing intermediate computation
(eliminating a multiplication in 0.5 in the problem cases where a
subsequent scaling by 2 would follow).

Tested for x86_64 and x86 and ulps updated accordingly (only needed
for x86).

	[BZ #18371]
	* math/s_csqrt.c (__csqrt): Avoid multiplication by 0.5 where
	intermediate but not final result might underflow.
	* math/s_csqrtf.c (__csqrtf): Likewise.
	* math/s_csqrtl.c (__csqrtl): Likewise.
	* math/auto-libm-test-in: Add more tests of csqrt.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-06-23 16:01:54 +00:00
Joseph Myers
b59549574e Fix exp2, exp2f spurious underflows (bug 18219).
The dbl-64 and flt-32 implementations of exp2 functions produce
spurious underflow exceptions.  The underlying reason is the same in
both cases: the computation works as (2^a - 1)*2^b + 2^b for suitably
chosen a and b, where a has small magnitude so 2^a - 1 can be computed
with a low-degree polynomial approximation, and (2^a - 1)*2^b can
underflow even when the final result does not.  This patch fixes this
by adjusting the threshold for when scaling is used to avoid
intermediate underflow so it works for any possible value of a where
the final result would not underflow.

Tested for x86_64 and x86.

	[BZ #18219]
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Reduce
	threshold on absolute value of exponent for which scaling is used.
	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
	* math/auto-libm-test-in: Add more tests of exp2.
	* math/auto-libm-test-out: Regenerated.
2015-06-23 14:35:18 +00:00
Joseph Myers
554edb23ff Fix expm1 missing underflows (bug 16353).
Similar to various other bugs in this area, some expm1 implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

(The issue does not apply to the ldbl-* implementations or to those
for x86 / x86_64 long double.  The change to
sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c is one I missed when
previously fixing bug 16354; the bug in that implementation was
previously latent, but the expm1 fixes stopped it being latent and so
required it to be fixed to avoid spurious underflows from cosh.)

Tested for x86_64 and x86.

	[BZ #16353]
	* sysdeps/i386/fpu/s_expm1.S (dbl_min): New object.
	(__expm1): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/i386/fpu/s_expm1f.S (flt_min): New object.
	(__expm1f): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/dbl-64/s_expm1.c: Include <float.h>.
	(__expm1): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/flt-32/s_expm1f.c: Include <float.h>.
	(__expm1f): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c (__ieee754_cosh):
	Check for small arguments before calling __expm1.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 16353.
	* math/auto-libm-test-out: Regenerated.
2015-06-22 21:06:19 +00:00
Joseph Myers
cb0937b299 Fix x86_64 / x86 expm1l (-min_subnorm) result sign (bug 18569).
In the x86 / x86_64 implementations of expm1l, when expm1l's result
should underflow to 0 (argument minus the least subnormal, in some
rounding modes), it can be a zero of the wrong sign.  This patch fixes
this by returning the argument with underflow forced in that case
(this is a 1ulp error relative to the correctly rounded result of -0,
which is OK in terms of the documented accuracy goals, whereas a
result with the wrong sign never is).

Tested for x86_64 and x86.

	[BZ #18569]
	* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Force
	underflow and return argument in case of subnormal argument.
	* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]:
	Likewise.
	* math/auto-libm-test-in: Add more tests of expm1.
	* math/auto-libm-test-out: Regenerated.
2015-06-21 18:43:10 +00:00
Joseph Myers
7540cfc5a8 Fix x86 / x86_64 expl, exp10l missing underflows (bug 16361).
Similar to various other bugs in this area, the x86 and x86_64
implementations of expl / exp10l can fail to produce underflow
exceptions when the unscaled result has trailing 0 bits so the scaling
down to subnormal precision is exact.  This patch fixes this by
forcing the exception in the case of tiny results.

Tested for x86_64 and x86.

	[BZ #16361]
	* sysdeps/i386/fpu/e_expl.S [!USE_AS_EXPM1L] (cmin): New object.
	[!USE_AS_EXPM1L] (IEEE754_EXPL): Force underflow exception for
	tiny results.
	* sysdeps/x86_64/fpu/e_expl.S [!USE_AS_EXPM1L] (cmin): New object.
	[!USE_AS_EXPM1L] (IEEE754_EXPL): Force underflow exception for
	tiny results.
	* math/auto-libm-test-in: Add more tests of exp and exp10.  Do not
	mark underflow exceptions as possibly missing for bug 16361.
	* math/auto-libm-test-out: Regenerated.
2015-06-21 17:48:04 +00:00
Andrew Senkevich
c342488200 Fixed powerpc64 build.
* sysdeps/ieee754/ldbl-opt/s_sin.c (__DECL_SIMD_sincos_disable,
    __DECL_SIMD_sincos_disablef, __DECL_SIMD_sincos_disablel): Added empty
    definitions for proper unfolding of __MATHDECL_VEC.
2015-06-19 20:42:34 +03:00
Stefan Liebler
52e9636260 S/390: Regenerate ULPs
Regenerated ULPs after recent math test changes.

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2015-06-19 13:47:59 +02:00
Joseph Myers
8db3cdefef Fix asinh missing underflows (bug 16350).
Similar to various other bugs in this area, some asinh implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86 and mips64.

	[BZ #16350]
	* sysdeps/i386/fpu/s_asinh.S (__asinh): Force underflow exception
	for arguments with small absolute value.
	* sysdeps/i386/fpu/s_asinhf.S (__asinhf): Likewise.
	* sysdeps/i386/fpu/s_asinhl.S (__asinhl): Likewise.
	* sysdeps/ieee754/dbl-64/s_asinh.c: Include <float.h>.
	(__asinh): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/flt-32/s_asinhf.c: Include <float.h>.
	(__asinhf): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-128/s_asinhl.c: Include <float.h>.
	(__asinhl): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: Include <float.h>.
	(__asinhl): Force underflow exception for arguments with small
	absolute value.
	* sysdeps/ieee754/ldbl-96/s_asinhl.c: Include <float.h>.
	(__asinhl): Force underflow exception for arguments with small
	absolute value.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 16350.
	* math/auto-libm-test-out: Regenerated.
2015-06-18 23:27:41 +00:00
Joseph Myers
d1ac55d890 Fix netinet/in.h MCAST_* namespace (bug 18558).
sysdeps/unix/sysv/linux/bits/in.h (as included in netinet/in.h, and
via that in netdb.h and arpa/inet.h) defines a series of MCAST_*
macros, both under __USE_MISC and then again unconditionally.  These
are not POSIX macros, nor in any of the namespaces listed in POSIX as
reserved for this header, so should not be defined unconditionally.
This patch duly removes the unconditional definitions, leaving the
ones conditional on __USE_MISC.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18558]
	* sysdeps/unix/sysv/linux/bits/in.h (MCAST_JOIN_GROUP): Remove
	unconditional definition.
	(MCAST_BLOCK_SOURCE): Likewise.
	(MCAST_UNBLOCK_SOURCE): Likewise.
	(MCAST_LEAVE_GROUP): Likewise.
	(MCAST_JOIN_SOURCE_GROUP): Likewise.
	(MCAST_LEAVE_SOURCE_GROUP): Likewise.
	(MCAST_MSFILTER): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/arpa/inet.h/conform):
	Remove variable.
	(test-xfail-XOPEN2K/netdb.h/conform): Likewise.
	(test-xfail-XOPEN2K/netinet/in.h/conform): Likewise.
	(test-xfail-XOPEN2K8/arpa/inet.h/conform): Likewise.
	(test-xfail-XOPEN2K8/netdb.h/conform): Likewise.
	(test-xfail-XOPEN2K8/netinet/in.h/conform): Likewise.
2015-06-18 19:48:22 +00:00
Andrew Senkevich
a6336cc446 Vector sincosf for x86_64 and tests.
Here is implementation of vectorized sincosf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * NEWS: Mention addition of x86_64 vector sincosf.
    * math/test-float-vlen16.h: Added wrapper for sincosf tests.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added sincosf SIMD declaration.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core_sse4.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core_avx2.S
    * sysdeps/x86_64/fpu/svml_s_sincosf16_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf4_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core_avx.S
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.h: New file.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Added 3 argument wrappers.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: : Vector sincosf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
2015-06-18 20:11:27 +03:00
Andrew Senkevich
c9a8c526ac Vector sincos for x86_64 and tests.
Here is implementation of vectorized sincos containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * NEWS: Mention addition of x86_64 vector sincos.
    * bits/libm-simd-decl-stubs.h: Added stubs for sincos.
    * math/math.h (__MATHDECL_VEC): New macro.
    * math/bits/mathcalls.h: Added sincos declaration with __MATHDECL_VEC.
    * math/gen-libm-have-vector-test.sh: Added generation of sincos wrapper
    declaration under condition.
    * math/test-vec-loop.h (TEST_VEC_LOOP): Refactored.
    * math/test-double-vlen2.h: Added wrapper for sincos tests, reflected
    TEST_VEC_LOOP change.
    * math/test-double-vlen4.h: Likewise.
    * math/test-double-vlen8.h: Likewise.
    * math/test-float-vlen16.h: Reflected TEST_VEC_LOOP change.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added sincos SIMD declaration.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.h: New file.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Added wrappers for sincos.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Vector sincos tests.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
2015-06-18 17:55:55 +03:00
Andrew Senkevich
8aa92022e2 Vector powf for x86_64 and tests.
Here is implementation of vectorized powf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for powf.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Added 2 argument wrappers.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf16_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf_data.h: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Vector powf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
    * math/test-float-vlen16.h: Fixed 2 argument macro.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * NEWS: Mention addition of x86_64 vector powf.
2015-06-18 17:04:07 +03:00
Joseph Myers
2f3184451d Remove ldbl-128ibm variants of complex math functions.
sysdeps/ieee754/ldbl-128ibm has its own versions of cprojl, ctanhl and
ctanl.

Having its own versions, where otherwise the math/ copies are
generally used for all floating-point formats, means they are liable
to get out of sync and not benefit from bug fixes to the generic
versions.  The substantive differences (not arising from getting out
of sync and slightly different fixes for the same issues) are: long
double compat handling (also done in the ldbl-opt versions, so doesn't
require special versions for ldbl-128ibm); handling of LDBL_EPSILON
(conditionally undefined and redefined in other math/ implementations,
so doesn't justify a special version), and:

      /* __gcc_qmul does not respect -0.0 so we need the following fixup.  */
      if ((__real__ res == 0.0L) && (__real__ x == 0.0L))
        __real__ res = __real__ x;

      if ((__real__ res == 0.0L) && (__imag__ x == 0.0L))
        __imag__ res = __imag__ x;

But if that statement about __gcc_qmul was ever true for an old
version of that libgcc function, it's not the case for any GCC version
now supported to build glibc; there's explicit logic early in that
function (and similarly in __gcc_qdiv) to return an appropriately
signed zero if the product of the high parts is zero.  So this patch
adds the special LDBL_EPSILON handling to the generic functions and
removes the ldbl-128ibm versions.

Tested for powerpc32 (compared test-ldouble.out before and after the
changes; there are slight changes to results for ctanl / ctanhl,
arising from divergence of the implementations, but nothing that
affects the overall nature of the issues shown by the testsuite, and
in particular nothing related to signs of zero resutls).

	* math/s_ctanhl.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
	and redefine.
	* math/s_ctanl.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
	and redefine.
	* sysdeps/ieee754/ldbl-128ibm/s_cprojl.c: Remove file.
	* sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_ctanl.c: Likewise.
2015-06-17 21:20:15 +00:00
Joseph Myers
c362135134 Fix nice getpriority, setpriority namespace (bug 18553).
nice (XPG3) calls getpriority and setpriority (in XPG4 but not XPG3,
i.e. UX-shaded in XPG4).  This patch fixes this by making those
functions into weak aliases of __* functions and calling the __*
versions as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by this patch).

This completes cleaning up the unsorted linknamespace test XFAILs.

	[BZ #18553]
	* resource/getpriority.c (getpriority): Rename to __getpriority
	and define as weak alias of __getpriority.
	* resource/setpriority.c (setpriority): Rename to __setpriority
	and define as weak alias of __setpriority.
	* sysdeps/mach/hurd/getpriority.c (getpriority): Rename to
	__getpriority and define as weak alias of __getpriority.
	* sysdeps/mach/hurd/setpriority.c (setpriority): Rename to
	__setpriority and define as weak alias of __setpriority.
	* sysdeps/unix/syscalls.list (getpriority): Use __getpriority as
	strong name.
	(setpriority): Use __setpriority as strong name.
	* sysdeps/unix/sysv/linux/getpriority.c (getpriority): Rename to
	__getpriority and define as weak alias of __getpriority.
	* include/sys/resource.h (__getpriority): Declare.  Use
	libc_hidden_proto.
	(__setpriority): Likewise.
	(getpriority): Don't use libc_hidden_proto.
	(setpriority): Likewise.
	* sysdeps/posix/nice.c (nice): Call __getpriority instead of
	getpriority.  Call __setpriority instead of setpriority.
	* conform/Makefile (test-xfail-XPG3/unistd.h/linknamespace):
	Remove variable.
2015-06-17 20:22:39 +00:00
Joseph Myers
0595c98494 Fix mq_notify socket, recv namespace (bug 18546).
mq_notify (in the 1996 edition of POSIX) brings in references to recv
and socket (not in POSIX until the 2001 edition).  This patch fixes
this by using __recv and __socket, exporting them from libc at version
GLIBC_PRIVATE.

Tested for x86_64 and x86 (testsuite and comparison of installed
stripped shared libraries; PLT / dynamic symbol table changes render
the comparison not particularly useful for libc).

	[BZ #18546]
	* socket/recv.c (__recv): Use libc_hidden_def.
	* socket/socket.c (__socket): Likewise.
	* sysdeps/mach/hurd/recv.c (__recv): Likewise.
	* sysdeps/mach/hurd/socket.c (__socket): Likewise.
	* sysdeps/unix/sysv/linux/generic/recv.c (__recv): Likewise.
	* sysdeps/unix/sysv/linux/recv.c (__recv): Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/socket.c (__socket): Use
	libc_hidden_def.
	* sysdeps/unix/sysv/linux/x86_64/recv.c (__recv): Use
	libc_hidden_weak.
	* include/sys/socket.h (__socket): Do not use attribute_hidden.
	Use libc_hidden_proto.
	(__recv): Likewise.
	* socket/Versions (libc): Export __recv and __socket at version
	GLIBC_PRIVATE.
	* sysdeps/unix/sysv/linux/mq_notify.c (helper_thread): Call __recv
	instead of recv.
	(init_mq_netlink): Call __socket instead of socket.
	* conform/Makefile (test-xfail-POSIX/mqueue.h/linknamespace):
	Remove variable.
2015-06-17 20:20:08 +00:00
Joseph Myers
dfa2d21450 Fix mq_receive, mq_send mq_timed* namespace (bug 18545).
mq_receive calls mq_timedreceive, and mq_send calls mq_timedsend.  But
mq_receive and mq_send were in POSIX by 1996, while mq_timed* were
added in the 2001 edition of POSIX.  This patch fixes this by making
mq_timed* into weak aliases for __mq_timed* and calling the
__mq_timed* names.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18545]
	* rt/mq_timedreceive.c (mq_timedreceive): Rename to
	__mq_timedreceive and define as alias of __mq_timedreceive.  Use
	hidden_weak.
	* rt/mq_timedsend.c (mq_timedsend): Rename to __mq_timedsend and
	define as alias of __mq_timedsend.  Use hidden_weak.
	* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Use
	__mq_timedsend as strong name.
	(mq_timedreceive): Use __mq_timedreceive as strong name.
	* include/mqueue.h (__mq_timedsend): Declare.  Use hidden_proto.
	(__mq_timedreceive): Likewise.
	* sysdeps/unix/sysv/linux/mq_receive.c (mq_receive): Call
	__mq_timedreceive instead of mq_timedreceive.
	* sysdeps/unix/sysv/linux/mq_send.c (mq_send): Call __mq_timedsend
	instead of mq_timedsend.
	* conform/Makefile (test-xfail-UNIX98/mqueue.h/linknamespace):
	Remove variable.
2015-06-17 20:19:04 +00:00
Joseph Myers
c21d37deb2 Create hidden aliases for non-libc syscalls automatically.
The syscall wrappers mechanism automatically creates hidden aliases
for syscalls with libc_hidden_def / libc_hidden_weak.  The use of
libc_hidden_* has the side-effect that for syscall wrappers in
non-libc libraries those aliases are not created.  In turn, this means
that three mq_* syscalls in sysdeps/unix/sysv/linux/syscalls.list list
the __GI_* names explicitly.

The use of libc_hidden_* dates back to the original introduction of
that support in

2002-08-03  Roland McGrath  <roland@redhat.com>

        * sysdeps/unix/make-syscalls.sh: Generate libc_hidden_def or
        libc_hidden_weak for every system call symbol defined.

(predating the non-libc syscalls in question) and I see no reason for
excluding non-libc syscalls.  This patch changes the code to use
hidden_def / hidden_weak (via a wrapper syscall_hidden_def in the case
where the argument is itself a macro, so that the argument gets
expanded before concatenation with __GI_), so avoiding the need to
specify the hidden aliases explicitly in this case.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch; the
mq_* symbols change from weak to strong, which is of no significance
and two of them will shortly change back to weak as part of a fix for
bug 18545).

	* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Use
	hidden_def and hidden_weak instead of libc_hidden_def and
	libc_hidden_weak.
	(top level): Refer to hidden_def in comment.
	* sysdeps/unix/syscall-template.S (syscall_hidden_def): New
	macro.  Use it instead of libc_hidden_def.
	* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Do not
	specify __GI_* name explicitly.
	(mq_timedreceive): Likewise.
	(mq_setattr): Likewise.
2015-06-17 20:17:49 +00:00
Joseph Myers
90dd591393 Fix mq_notify pthread_barrier_* namespace (bug 18544).
mq_notify (present in POSIX by 1996) brings in references to
pthread_barrier_init and pthread_barrier_wait (new in the 2001 edition
of POSIX).  This patch fixes this by making those functions into weak
aliases of __pthread_barrier_*, exporting the __pthread_barrier_*
names at version GLIBC_PRIVATE and using them in mq_notify.

Tested for x86_64 and x86 (testsuite, and comparison of installed
stripped shared libraries).  Changes in addresses from dynamic symbol
table / PLT changes render most comparisons not particularly useful,
but when the addresses of subsequent code don't change there's no sign
of unexpected changes there.  This patch does not remove any
linknamespace XFAILs because of other namespace issues remaining with
mqueue.h functions.

	[BZ #18544]
	* nptl/pthread_barrier_init.c (pthread_barrier_init): Rename to
	__pthread_barrier_init and define as weak alias of
	__pthread_barrier_init.
	* sysdeps/sparc/nptl/pthread_barrier_init.c
	(pthread_barrier_init): Likewise.
	* nptl/pthread_barrier_wait.c (pthread_barrier_wait): Rename to
	__pthread_barrier_wait and define as weak alias of
	__pthread_barrier_wait.
	* sysdeps/sparc/nptl/pthread_barrier_wait.c
	(pthread_barrier_wait): Likewise.
	* sysdeps/sparc/sparc32/pthread_barrier_wait.c
	(pthread_barrier_wait): Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
	(pthread_barrier_wait): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
	(pthread_barrier_wait): Likewise.
	* nptl/Versions (libpthread): Export __pthread_barrier_init and
	__pthread_barrier_wait at version GLIBC_PRIVATE.
	* include/pthread.h (__pthread_barrier_init): Declare.
	(__pthread_barrier_wait): Likewise.
	* sysdeps/unix/sysv/linux/mq_notify.c (notification_function):
	Call __pthread_barrier_wait instead of pthread_barrier_wait.
	(helper_thread): Likewise.
	(init_mq_netlink): Call __pthread_barrier_init instead of
	pthread_barrier_init.
2015-06-17 20:16:56 +00:00
Joseph Myers
d051b143f7 Fix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536).
The sem_* functions bring in references to tdelete, tfind, tsearch and
twalk.  But the t* functions are XSI-shaded, while sem_* aren't.  This
patch fixes this by using __t* instead, exporting those functions from
libc at version GLIBC_PRIVATE (since sem_* are in libpthread) and
using libc_hidden_* for the benefit of calls within libc.

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  libpthread gets changes from
PLT reordering; addresses in libc change because of PLT / dynamic
symbol table changes.

	[BZ #18536]
	* misc/tsearch.c (__tsearch): Use libc_hidden_def.
	(__tfind): Likewise.
	(__tdelete): Likewise.
	(__twalk): Likewise.
	* misc/Versions (libc): Add __tdelete, __tfind, __tsearch and
	__twalk to GLIBC_PRIVATE.
	* include/search.h (__tsearch): Use libc_hidden_proto.
	(__tfind): Likewise.
	(__tdelete): Likewise.
	(__twalk): Likewise.
	* nptl/sem_close.c (sem_close): Call __twalk instead of twalk.
	Call __tdelete instead of tdelete.
	* nptl/sem_open.c (check_add_mapping): Call __tfind instead of
	tfind.  Call __tsearch instead of tsearch.
	* sysdeps/sparc/sparc32/sem_open.c (check_add_mapping): Likewise.
	* conform/Makefile (test-xfail-POSIX/semaphore.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/semaphore.h/linknamespace): Likewise.
2015-06-17 20:11:58 +00:00
Andrew Senkevich
c10b9b13f7 Vector pow for x86_64 and tests.
Here is implementation of vectorized pow containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

  * bits/libm-simd-decl-stubs.h: Added stubs for pow.
    * math/bits/mathcalls.h: Added pow declaration with __MATHCALL_VEC.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for pow.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Added 2 argument wrappers.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_pow_data.h: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Added vector pow test.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector pow.
2015-06-17 16:22:26 +03:00
Andrew Senkevich
1663be053d Vector expf for x86_64 and tests.
Here is implementation of vectorized expf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for expf.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf16_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_expf_data.h: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Vector expf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector expf.
2015-06-17 16:10:51 +03:00
Andrew Senkevich
9c02f663f6 Vector exp for x86_64 and tests.
Here is implementation of vectorized exp containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * bits/libm-simd-decl-stubs.h: Added stubs for exp.
    * math/bits/mathcalls.h: Added exp declaration with __MATHCALL_VEC.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for exp.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_exp_data.h: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Added vector exp test.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector exp.
2015-06-17 15:58:05 +03:00
Andrew Senkevich
774488f88a Vector logf for x86_64 and tests.
Here is implementation of vectorized logf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for logf.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf16_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_logf_data.h: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Vector logf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector logf.
2015-06-17 15:53:00 +03:00
Andrew Senkevich
6af25acc7b Vector log for x86_64 and tests.
Here is implementation of vectorized log containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * bits/libm-simd-decl-stubs.h: Added stubs for log.
    * math/bits/mathcalls.h: Added log declaration with __MATHCALL_VEC.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for log.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_log_data.h: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Added vector log test.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector log.
2015-06-17 15:38:29 +03:00
Szabolcs Nagy
c71c89e5c7 [AArch64] Fix cfi_adjust_cfa_offset usage in dl-tlsdesc.S
Some of the cfi annotations used incorrect sign.

	* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return_lazy): Fix
	cfi_adjust_cfa_offset argument.
	(_dl_tlsdesc_undefweak, _dl_tlsdesc_dynamic): Likewise.
	(_dl_tlsdesc_resolve_rela, _dl_tlsdesc_resolve_hold): Likewise.
2015-06-17 12:44:53 +01:00
Szabolcs Nagy
08325735c2 [BZ 18034][AArch64] Lazy TLSDESC relocation data race fix
Lazy TLSDESC initialization needs to be synchronized with concurrent TLS
accesses.  The TLS descriptor contains a function pointer (entry) and an
argument that is accessed from the entry function.  With lazy initialization
the first call to the entry function updates the entry and the argument to
their final value.  A final entry function must make sure that it accesses an
initialized argument, this needs synchronization on systems with weak memory
ordering otherwise the writes of the first call can be observed out of order.

There are at least two issues with the current code:

tlsdesc.c (i386, x86_64, arm, aarch64) uses volatile memory accesses on the
write side (in the initial entry function) instead of C11 atomics.

And on systems with weak memory ordering (arm, aarch64) the read side
synchronization is missing from the final entry functions (dl-tlsdesc.S).

This patch only deals with aarch64.

* Write side:

Volatile accesses were replaced with C11 relaxed atomics, and a release
store was used for the initialization of entry so the read side can
synchronize with it.

* Read side:

TLS access generated by the compiler and an entry function code is roughly

  ldr x1, [x0]    // load the entry
  blr x1          // call it

entryfunc:
  ldr x0, [x0,#8] // load the arg
  ret

Various alternatives were considered to force the ordering in the entry
function between the two loads:

(1) barrier

entryfunc:
  dmb ishld
  ldr x0, [x0,#8]

(2) address dependency (if the address of the second load depends on the
result of the first one the ordering is guaranteed):

entryfunc:
  ldr x1,[x0]
  and x1,x1,#8
  orr x1,x1,#8
  ldr x0,[x0,x1]

(3) load-acquire (ARMv8 instruction that is ordered before subsequent
loads and stores)

entryfunc:
  ldar xzr,[x0]
  ldr x0,[x0,#8]

Option (1) is the simplest but slowest (note: this runs at every TLS
access), options (2) and (3) do one extra load from [x0] (same address
loads are ordered so it happens-after the load on the call site),
option (2) clobbers x1 which is problematic because existing gcc does
not expect that, so approach (3) was chosen.

A new _dl_tlsdesc_return_lazy entry function was introduced for lazily
relocated static TLS, so non-lazy static TLS can avoid the synchronization
cost.

	[BZ #18034]
	* sysdeps/aarch64/dl-tlsdesc.h (_dl_tlsdesc_return_lazy): Declare.
	* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return_lazy): Define.
	(_dl_tlsdesc_undefweak): Guarantee TLSDESC entry and argument load-load
	ordering using ldar.
	(_dl_tlsdesc_dynamic): Likewise.
	(_dl_tlsdesc_return_lazy): Likewise.
	* sysdeps/aarch64/tlsdesc.c (_dl_tlsdesc_resolve_rela_fixup): Use
	relaxed atomics instead of volatile and synchronize with release store.
	(_dl_tlsdesc_resolve_hold_fixup): Use relaxed atomics instead of
	volatile.
	* elf/tlsdeschtab.h (_dl_tlsdesc_resolve_early_return_p): Likewise.
2015-06-17 12:41:01 +01:00
Andrew Senkevich
2a8c2c7b33 Vector sinf for x86_64 and tests.
Here is implementation of vectorized sinf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration for sinf.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf16_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.h: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Vector sinf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector sinf.
2015-06-15 15:06:53 +03:00
Joseph Myers
5371d99e87 Fix getlogin_r namespace (bug 18527).
Various functions in XPG4 bring in references to getlogin_r, which is
not in XPG4; this is also a bug for some older POSIX versions which
aren't yet covered by the linknamespace tests.  This patch fixes this
by making getlogin_r into a weak alias for __getlogin_r and using
__getlogin_r as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch).

	[BZ #18527]
	* login/getlogin_r.c (getlogin_r): Rename to __getlogin_r and
	define as weak alias of __getlogin_r.  Use libc_hidden_weak.
	* sysdeps/mach/hurd/getlogin_r.c (getlogin_r): Likewise.
	* sysdeps/unix/getlogin_r.c (getlogin_r): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (getlogin_r): Likewise.
	* include/unistd.h (__getlogin_r): Declare.  Use
	libc_hidden_proto.
	* posix/glob.c (glob): Call __getlogin_r instead of getlogin_r.
	* conform/Makefile (test-xfail-XPG3/glob.h/linknamespace): Remove
	variable.
	(test-xfail-XPG3/wordexp.h/linknamespace): Likewise.
	(test-xfail-XPG4/glob.h/linknamespace): Likewise.
	(test-xfail-XPG4/wordexp.h/linknamespace): Likewise.
2015-06-12 20:02:30 +00:00
Joseph Myers
9714012ca0 Fix aio_* pread namespace (bug 18519).
aio_* bring in references to pread, which isn't in all the standards
containing aio_* (as a reference from one library to another, this is
a bug for dynamic as well as static linking).  This patch fixes this
by using __libc_pread instead, exporting that function from libc at
symbol version GLIBC_PRIVATE; the code, with conditionals that may
call either __pread64 or __libc_pread, becomes exactly analogous to
that elsewhere in the same file that may call either __pwrite64 or
__libc_pwrite.

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed shared libraries).  libc changes because of the PLT entry
for the newly exported __libc_pread; librt changes because of
assertion line numbers and PLT rearrangement; other stripped installed
shared libraries do not change.

	[BZ #18519]
	* posix/Versions (libc): Export __libc_pread at version
	GLIBC_PRIVATE.
	* sysdeps/pthread/aio_misc.c (handle_fildes_io): Call __libc_pread
	instead of pread.
	* conform/Makefile (test-xfail-POSIX/aio.h/linknamespace): Remove
	variable.
2015-06-12 17:34:11 +00:00
Andrew Senkevich
4b9c2b707b Vector sin for x86_64 and tests.
Here is implementation of vectorized sin containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * bits/libm-simd-decl-stubs.h: Added stubs for sin.
    * math/bits/mathcalls.h: Added sin declaration with __MATHCALL_VEC.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
    * sysdeps/x86/fpu/bits/math-vector.h: SIMD declaration for sin.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sin_data.h: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Added vector sin test.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
    * NEWS: Mention addition of x86_64 vector sin.
2015-06-11 17:12:38 +03:00
Andrew Senkevich
0724d898bb More strict check of AVX512 support in assembler.
Binutils 2.24 doesn't support some AVX512 instructions with ZMM
registers, so we need add more strict check.

    * configure.ac: Added more strict check.
    * configure: Regenerated.
2015-06-11 13:50:07 +03:00
Adhemerval Zanella
7cbeabac0f x86: Remove vsyscall usage
This patch removes the vsyscall usage for x86_64 port.  As indicated
by kernel code comments [1], vsyscalls are a legacy ABI and its concept
is problematic:

- It interferes with ASLR.
- It's awkward to write code that lives in kernel addresses but is
  callable by userspace at fixed addresses.
- The whole concept is impossible for 32-bit compat userspace.
- UML cannot easily virtualize a vsyscall.

The VDSO is a better approach for such functionality.  Tested on i686,
x86_64, and x32.

	* sysdeps/unix/sysv/linux/i386/gettimeofday.c
	(__gettimeofday_syscall): Remove vsyscall fallback.
	* sysdeps/unix/sysv/linux/i386/time.c (__time_syscall): Likewise.
	* sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday_syscall):
	Add syscall fallback function.
	(gettimeofday_ifunc): Use __gettimeofday_syscall as fallback mechanism
	if vDSO is not present.
	* sysdeps/unix/sysv/linux/x86/time.c (__time_syscall): Add syscall
	fallback function.
	(time_ifunc): Use __time_syscall as fallback mechanism if vDSO is not
	present.
	* sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: Remove file.
	* sysdeps/unix/sysv/linux/x86_64/time.c: Likewise.

[1] arch/x86/kernel/vsyscall_64.c
2015-06-09 18:10:19 -03:00
Joseph Myers
2f44ee08db Fix regcomp wcscoll, wcscmp namespace (bug 18497).
regcomp brings in references to wcscoll, which isn't in all the
standards that contain regcomp.  In turn, wcscoll brings in references
to wcscmp, also not in all those standards.  This patch fixes this by
making those functions into weak aliases of __wcscoll and __wcscmp and
calling those names instead as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18497]
	* wcsmbs/wcscmp.c [!WCSCMP] (WCSCMP): Define as __wcscmp instead
	of wcscmp.
	(wcscmp): Define as weak alias of WCSCMP.
	* wcsmbs/wcscoll.c (STRCOLL): Define as __wcscoll instead of
	wcscoll.
	(USE_HIDDEN_DEF): Define.
	[!USE_IN_EXTENDED_LOCALE_MODEL] (wcscoll): Define as weak alias of
	__wcscoll.  Don't use libc_hidden_weak.
	* wcsmbs/wcscoll_l.c (STRCMP): Define as __wcscmp instead of
	wcscmp.
	* sysdeps/i386/i686/multiarch/wcscmp-c.c
	[SHARED] (libc_hidden_def): Define __GI___wcscmp instead of
	__GI_wcscmp.
	(weak_alias): Undefine and redefine.
	* sysdeps/i386/i686/multiarch/wcscmp.S (wcscmp): Rename to
	__wcscmp and define as weak alias of __wcscmp.
	* sysdeps/x86_64/wcscmp.S (wcscmp): Likewise.
	* include/wchar.h (__wcscmp): Declare.  Use libc_hidden_proto.
	(__wcscoll): Likewise.
	(wcscmp): Don't use libc_hidden_proto.
	(wcscoll): Likewise.
	* posix/regcomp.c (build_range_exp): Call __wcscoll instead of
	wcscoll.
	* posix/regexec.c (check_node_accept_bytes): Likewise.
	* conform/Makefile (test-xfail-XPG3/regex.h/linknamespace): Remove
	variable.
	(test-xfail-XPG4/regex.h/linknamespace): Likewise.
	(test-xfail-POSIX/regex.h/linknamespace): Likewise.
2015-06-09 21:07:30 +00:00
Joseph Myers
d3ab671c94 Fix pathconf statvfs namespace (bug 18507).
pathconf uses __statvfs64, and fpathconf uses __fstatvfs64.  On
systems using sysdeps/unix/sysv/linux/wordsize-64, __statvfs64 then
brings in the strong symbol statvfs, and __fstatvfs64 brings in the
strong symbol fstatvfs, which are not in all the standards that have
pathconf and fpathconf.  This patch fixes this by making those symbols
into weak aliases.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18507]
	* sysdeps/unix/sysv/linux/fstatvfs.c (fstatvfs): Rename to
	__fstatvfs and define as weak alias of __fstatvfs.  Use
	libc_hidden_weak.
	* sysdeps/unix/sysv/linux/statvfs.c (statvs): Rename to __statvfs
	and define as weak alias of __statvfs.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c (__fstatvfs64):
	Define as alias of __fstatvfs, not fstatvfs.
	(fstatvfs64): Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/statvfs.c (__statvfs64):
	Define as alias of __statvfs, not statvfs.
	(statvfs64): Likewise.
	* conform/Makefile (test-xfail-POSIX/unistd.h/linknamespace):
	Remove variable.
2015-06-09 19:52:01 +00:00
Adhemerval Zanella
dd26c44403 Consolidate sched_getcpu
This patch consolidates the sched_getcpu implementations across all
arches (except tile, which requires its own).  This patch removes
the powerpc, x86_64 and x32 specific files and change the default
linux one to use INLINE_VSYSCALL where possible (for ports that
implements it).
2015-06-09 14:56:21 -03:00
Andrew Senkevich
2a523216d5 This patch adds vector cosf tests.
* math/Makefile: Added CFLAGS for new tests.
    * math/test-float-vlen16.h: New file.
    * math/test-float-vlen4.h: New file.
    * math/test-float-vlen8.h: New file.
    * math/test-double-vlen2.h: Fixed 2 argument macro and comment.
    * sysdeps/x86_64/fpu/Makefile: Added new tests and variables.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: New file.
2015-06-09 18:32:42 +03:00
Andrew Senkevich
04f496d602 Vector cosf for x86_64.
Here is implementation of vectorized cosf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/svml_s_cosf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/svml_s_cosf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_cosf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_cosf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: New file.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.h: New file.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New versions added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration for cosf.
    * NEWS: Mention addition of x86_64 vector cosf.
2015-06-09 18:29:47 +03:00
Andrew Senkevich
24a2718f59 Addition of testing infrastructure for vector math functions.
We test vector math functions using scalar tests infrastructure with
help of special wrappers from scalar versions to vector ones. Wrapper
implemented using platform specific vector types and placed in separate
file for compilation with architecture specific options, main part of
test has no such options. With help of system of definitions unfolding
of which is drived from test code we have wrapper called in individual
testing function instead of scalar function. Also system of definitions
includes generated during make check header math/libm-have-vector-test.h
with series of conditional definitions which help to avoid build fails
for functions having no vector versions; runtime architecture check
to prevent runtime fails of test run on inappropriate hardware.

    * math/Makefile: Added rules for vector tests.
    * math/gen-libm-have-vector-test.sh: Added generation of wrapper
    declaration under condition.
    * math/test-double-vlen2.h: New file.
    * math/test-double-vlen4.h: New file.
    * math/test-double-vlen8.h: New file.
    * math/test-vec-loop.h: Added initialization macro.
    * sysdeps/x86_64/fpu/Makefile: Added variables for vector tests.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenarated.
    * sysdeps/x86_64/fpu/math-tests-arch.h: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: New file.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: New file.
2015-06-09 14:51:52 +03:00
Andrew Senkevich
2193311288 Start of series of patches with x86_64 vector math functions.
Here is implementation of cos containing SSE, AVX, AVX2 and AVX512
versions according to Vector ABI which had been discussed in
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

Vector math library build and ABI testing enabled by default for x86_64.

    * sysdeps/x86_64/fpu/Makefile: New file.
    * sysdeps/x86_64/fpu/Versions: New file.
    * sysdeps/x86_64/fpu/svml_d_cos_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_cos_data.h: New file.
    * sysdeps/x86_64/fpu/svml_d_cos2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_cos4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_cos4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_cos8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines): Added
    build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration for cos.
    * math/bits/mathcalls.h: Added cos declaration with __MATHCALL_VEC.
    * sysdeps/x86_64/configure.ac: Options for libmvec build.
    * sysdeps/x86_64/configure: Regenerated.
    * sysdeps/x86_64/sysdep.h (cfi_offset_rel_rsp): New macro.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New file.
    * manual/install.texi (Configuring and compiling): Document
    --disable-mathvec.
    * INSTALL: Regenerated.
    * NEWS: Mention addition of libmvec and x86_64 vector cos.
2015-06-09 14:25:49 +03:00
Andrew Senkevich
5fe2a126d1 This patch adds detection of availability for AVX512F and AVX512DQ ISAs.
* sysdeps/x86_64/multiarch/init-arch.h (bit_AVX512F_Usable,
    bit_AVX512DQ_Usable, bit_Opmask_state, bit_ZMM0_15_state,
    bit_ZMM16_31_state): New macro.
    * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
    Check and set bit_AVX512F_Usable, bit_AVX512DQ_Usable.
2015-06-08 14:07:59 +03:00
Florian Weimer
7fe9e2e089 posix_fallocate: Emulation fixes and documentation [BZ #15661]
Handle signed integer overflow correctly.  Detect and reject O_APPEND.
Document drawbacks of emulation.

This does not completely address bug 15661, but improves the situation
somewhat.
2015-06-05 10:50:38 +02:00
Adhemerval Zanella
c6bb095eb5 nptl: Rewrite cancellation macros
This patch changes the way cancellation entrypoints are defined to
instead call the macro SYSCALL_CANCEL.  An usual cnacellation definition
is defined as:

  if (SINGLE_THREAD_P)
    return INLINE_SYSCALL (syscall, NARGS, args...)

  int oldtype = LIBC_CANCEL_ASYNC ();

  return INLINE_SYSCALL (syscall, NARGS, args...)

  LIBC_CANCEL_RESET (oldtype);

And it is rewrited as just:

  SYSCALL_CANCEL (syscall, args...)

The idea is to remove LIBC_CANCEL_ASYNC/LIBC_CANCEL_RESET explicit
usage.

Tested on i386, x86_64, powerpc32, powerpc64le, arm, and aarch64.

	* sysdeps/unix/sysdep.h [SYSCALL_CANCEL]: New macro: define
	cancellable syscalls.
	(SYS_ify): Add guard to no redefine it.
	(INLINE_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/accept4.c (accept4): Remove
	LIBC_CANCEL_ASYNC/INLINE_SYSCALL/LIBC_CANCEL_RESET and use
	SYSCALL_CANCEL instead.
	* sysdeps/unix/sysv/linux/alpha/fdatasync.c (__fdatasync): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/epoll_pwait.c (epoll_pwait): Likewise.
	* sysdeps/unix/sysv/linux/fallocate.c (fallocate): Likewise.
	* sysdeps/unix/sysv/linux/fallocate64.c (fallocate64): Likewise.
	* sysdeps/unix/sysv/linux/generic/open.c (__libc_open): Likewise.
	* sysdeps/unix/sysv/linux/generic/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/generic/pause.c (__libc_pause): Likewise.
	* sysdeps/unix/sysv/linux/generic/poll.c (__poll): Likewise.
	* sysdeps/unix/sysv/linux/generic/recv.c (__libc_recv): Likewise.
	* sysdeps/unix/sysv/linux/generic/select.c (__select): Likewise.
	* sysdeps/unix/sysv/linux/generic/send.c (__libc_send): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c
	(__libc_preadv): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c
	(__libc_readv64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
	(__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
	(__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c
	(__libc_pwritev): Likewise.
	* sysdeps/sysv/linux/generic/wordsize-32/pwritev64.c
	(__libc_pwritev64): Likewise.
	* sysdeps/unix/sysv/linux/i386/fcntl.c (__libc_fcntl): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
	(sync_file_range): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c (fallocate):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c (fallocate64):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/mips/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Likewise.
	* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Likewise.
	* sysdeps/unix/sysv/linux/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__libc_openat): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
	(__libc_read64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c (__libc_write):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c (__libc_write64):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c (__libc_fcntl):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c (__libc_pwrite):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
	(__libc_pwrite64): Likewise.
	* sysdeps/sysv/linux/powerpc/powerpc64/sync_file_range.c
	(sync_file_range): Likewise.
	* sysdeps/unix/sysv/linux/ppoll.c (ppoll): Likewise.
	* sysdeps/unix/sysv/linux/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/preadv.c (__libc_preadv): Likewise.
	* sysdeps/unix/sysv/linux/pselect.c (__pselect): Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/pwritev.c (PWRITEV): Likewise.
	* sysdeps/unix/sysv/linux/readv.c (__libc_readv): Likewise.
	* sysdeps/unix/sysv/linux/recvmmsg.c (recvmmsg): Likewise.
	* sysdeps/unix/sysv/linux/sendmmsg.c (sendmmsg): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c (__sigsuspend): Likewise.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c (__libc_msgrcv):
	Likewise.
	* sysdeps/unix/sysv/linux/sync_file_range.c (sync_file_range):
	Likewise.
	* sysdeps/unix/sysv/linux/tcdrain.c (__libc_tcdrain): Likewise.
	* sysdeps/unix/sysv/linux/timer_routines.c (timer_helper_thread):
	Likewise.
	* sysdeps/unix/sysv/linux/wait.c (__libc_wait): Likewise.
	* sysdeps/unix/sysv/linux/waitid.c (__waitid): Likewise.
	* sysdeps/unix/sysv/linux/waitpid.c (__libc_waitpid): Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/fallocate.c (fallocate):
	Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/preadv.c (preadv): Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/pwritev.c (pwritev): Likewise.
	* sysdeps/unix/sysv/linux/writev.c (__libc_writev): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/recv.c (__libc_recv): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/send.c (__libc_send): Likewise.
2015-06-04 18:58:36 -03:00
Nathan Lynch
b65d3e5f0f ARM: VDSO support
Beginning with the upcoming 4.1 release, Linux on a subset of 32-bit
ARM hardware will provide fast user-space implementations of the
following system calls:

- gettimeofday
- clock_gettime

The kernel implementation depends on the ARMv7 Generic Timers
Extension to accelerate these system calls.  So CPUs such as
Cortex-A15 and -A7 benefit, while Cortex-A9, -A8, and pre-v7 CPUs do
not.  On systems where the VDSO does not provide any speedup, the
kernel prevents the relevant symbol lookups from succeeding.

On OMAP5 (Cortex-A15) gettimeofday latency decreases from ~350ns to
~120ns.  On BeagleBone Black (Cortex-A8) it goes from ~650ns to
~660ns, which to my mind is an acceptable cost.

Verified that no new test failures are introduced on kernels with and
without the VDSO.

	* sysdeps/unix/sysv/linux/arm/Makefile: (sysdep_routines):
	Include dl-vdso.
	* sysdeps/unix/sysv/linux/arm/init-first.c: New file:
	Use VDSO routines for gettimeofday, clock_gettime if
	available.
	* sysdeps/unix/sysv/linux/arm/libc-vdso.h: New file:
	Declare VDSO symbols.
	* sysdeps/unix/sysv/linux/arm/sysdep.h:
	[HAVE_GETTIMEOFDAY_VSYSCALL]: Define.
	[HAVE_CLOCK_GETTIME_VSYSCALL]: Define.
	* sysdeps/unix/sysv/linux/arm/Versions: Add
	__vdso_clock_gettime.
2015-06-04 21:10:43 +00:00
Adhemerval Zanella
34caaafd1a Use inline syscalls for non-cancellable versions
This patch uses inline calls (through INLINE_SYSCALL macro) to define
the non-cancellable functions macros to avoid use of the
syscall_nocancel entrypoint.
2015-06-04 14:52:34 -03:00
Roland McGrath
da7f049cad NaCl: Implement nacl_interface_ext_supply entry point. 2015-06-03 13:51:11 -07:00
Wilco Dijkstra
cbf377edd3 Replace finite with isfinite. 2015-06-03 16:35:44 +01:00
Wilco Dijkstra
d81f90ccd0 This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code. 2015-06-03 15:41:36 +01:00
Joseph Myers
e0c349b40c Use better variable names in MIPS syscall macros.
Carlos noted in
<https://sourceware.org/ml/libc-alpha/2015-05/msg00680.html> that
various ports use potentially problematic short variables names in
their syscall macros, which could shadow variables with the same name
from containing scopes.

This patch fixes variables called err and ret in MIPS macros.  (I left
result_var and _sys_result - separate variables in different macros,
which need separate names - alone.)

Tested for mips64 (all three ABIs) that installed stripped shared
libraries are unchanged by this patch.

	* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (INLINE_SYSCALL):
	Use variable name _sc_err instead of err.
	[__mips16] (INTERNAL_SYSCALL_NCS): Use variable name _sc_ret
	instead of ret.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
	(INLINE_SYSCALL): Use variable name _sc_err instead of err.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
	(INLINE_SYSCALL): Likewise.
2015-06-02 20:38:49 +00:00
Joseph Myers
1769608794 Use libc_hidden_proto / libc_hidden_def with __strnlen.
Various code in glibc uses __strnlen instead of strnlen for namespace
reasons.  However, __strnlen does not use libc_hidden_proto /
libc_hidden_def (as is normally done for any function defined and
called within the same library, whether or not exported from the
library and whatever namespace it is in), so the compiler does not
know that those calls are to a function within libc.

This patch uses libc_hidden_proto / libc_hidden_def with __strnlen.
On x86_64, it makes no difference to the installed stripped shared
libraries.  On 32-bit x86, it causes __strnlen calls to go to the same
place as strnlen calls (the fallback strnlen implementation), rather
than through a PLT entry for the strnlen IFUNC; I'm not sure of the
logic behind when calls from within libc should use IFUNCs versus when
they should go direct to a particular function implementation, but
clearly it doesn't make sense for strnlen and __strnlen to be handled
differently in this regard.

Tested for x86_64 and x86 (testsuite, and comparison of installed
shared libraries as described above).

	* string/strnlen.c [!STRNLEN] (__strnlen): Use libc_hidden_def.
	* include/string.h (__strnlen): Use libc_hidden_proto.
	* sysdeps/aarch64/strnlen.S (__strnlen): Use libc_hidden_def.
	* sysdeps/i386/i686/multiarch/strnlen-c.c [SHARED]
	(libc_hidden_def): Define __GI___strnlen as well as __GI_strnlen.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-power7.S
	(libc_hidden_def): Undefine and redefine.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen-ppc32.c
	[SHARED] (libc_hidden_def): Define __GI___strnlen as well as
	__GI_strnlen.
	* sysdeps/powerpc/powerpc32/power7/strnlen.S (__strnlen): Use
	libc_hidden_def.
	* sysdeps/tile/tilegx/strnlen.c (__strnlen): Likewise.
2015-06-02 20:24:25 +00:00
Wilco Dijkstra
71bf272d91 2015-06-02 Szabolcs Nagy <szabolcs.nagy@arm.com>
* sysdeps/aarch64/libm-test-ulps: Update.
2015-06-02 10:47:45 +01:00
Adhemerval Zanella
1395ef2107 x86: clock_gettime and timespec_get vDSO cleanup
This patch removes the x86 specific timespec_get and clock_gettime
implementation to use generic HAVE_CLOCK_GETTIME_VSYSCALL way.
2015-06-01 22:25:02 -03:00
Martin Sebor
db8fed87d9 powerpc: setcontext.S uses power6 mtfsf when not supported [BZ #18116]
The attached patch fixes a glibc build failure with gcc 5 on powerpc64le
caused by a recent change in gcc where the compiler defines the
_ARCH_PWR6 macro when processing assembly files but doesn't invoke the
assembler in the corresponding machine mode (unless it has been
explicitly configured to target POWER 6 or later).  A bug had been filed
with gcc for this (65341) but was closed as won't fix. Glibc relies on
the _ARCH_PWR6 macro in a few .S files to make use of Power ISA 2.5
instructions (specifically, the four-argument form of the mtfsf insn).
A similar problem had occurred in the past (bug 10118) but the fix that
was committed for it didn't anticipate this new problem.
2015-06-01 16:19:50 -03:00
Adhemerval Zanella
fd57d826c6 Update powerpc-fpu libm-test-ulps. 2015-05-29 09:42:55 -03:00
Roland McGrath
3ed015122f NaCl: Make thread exit wake pthread_join. 2015-05-28 15:37:31 -07:00
Roland McGrath
f21754707c NaCl: Fix lll_futex_timed_wait timeout calculation. 2015-05-28 15:35:45 -07:00
Wilco Dijkstra
be2e25bbd7 2015-05-28 Wilco Dijkstra <wdijkstr@arm.com>
* sysdeps/ieee754/dbl-64/s_fabs.c: (__fabs): Call __builtin_fabs.
        * sysdeps/ieee754/flt-32/s_fabsf.c: (__fabsf): Likewise.
2015-05-28 11:42:55 +01:00
Chris Metcalf
1827059925 tile: use better variable naming in INLINE_SYSCALL
At issue for INLINE_SYSCALL was that it used "err" and "val"
as variable names in a #define, so that if it was used in a context
where the "caller" was also using "err" or "val", and those
variables were passed in to INLINE_SYSCALL, we would end up
referencing the internal shadowed variables instead.

For example, "char val" in check_may_shrink_heap() in
sysdeps/unix/sysv/linux/malloc-sysdep.h was being shadowed by
the syscall return "val" in INLINE_SYSCALL, causing the "char val"
not to get updated at all, and may_shrink_heap ended up always false.

A similar fix was made to INTERNAL_VSYSCALL_CALL.
2015-05-26 20:29:56 -04:00
Roland McGrath
4da82229f0 NaCl: Fix thinko in last change. 2015-05-26 16:11:46 -07:00
Roland McGrath
1f3a37b19c NaCl: Add NaCl-specific __lll_timedlock_wait. 2015-05-26 15:30:47 -07:00
Roland McGrath
68c97aef62 Split timed-wait functions out of nptl/lowlevellock.c. 2015-05-26 14:49:13 -07:00
Adhemerval Zanella
97554e4382 Consolidate gettimeofday across aarch64/s390/tile
This patch removes the architecture specific gettimeofday implementation
to use the vDSO symbol and consolidate it on a common Linux one.
Similar to clock_gettime and clock_getres vDSO implementation, each port
that supports gettimeofday through vDSO should just implement INLINE_VSYSCALL
to access the symbol and define HAVE_{GETTIME,GETRES}_VSYSCAL as 1.
2015-05-26 17:03:35 -03:00
Szabolcs Nagy
a06b40cdf5 struct stat is not posix conform
On 21/05/15 05:29, Siddhesh Poyarekar wrote:
> On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
>> i guess it's ok for consistency if i fix struct stat64
>> too to use __USE_XOPEN2K8.
>>
>> i will run some tests and come back with a patch
>
> I also think it would be appropriate to change this code in other
> architectures (microblaze and nacl IIRC) to make all of them
> consistent.  It is a mechanical enough change IMO that all arch
> maintainer acks is not necessary.
>

here is the patch with consistent __USE_XOPEN2K8

ok to commit?

2015-05-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	[BZ #18234]
	* conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
	st_mtim and st_ctim members.

	* sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
	st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.

	* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
	(struct stat64): Likewise.

	* sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
	(struct stat64): Likewise.

	* sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
	(struct stat64): Likewise.
2015-05-26 22:27:24 +05:30
Adhemerval Zanella
f534255e4d Consolidate vDSO macros and usage
This patch consolidate the Linux vDSO define and usage across all ports
that uses it.  The common vDSO definitions and calling through
{INLINE/INTERNAL}_VSYSCALL macros are moved to a common header
sysdep-vdso.h and vDSO name declaration and prototype is defined
using a common macro.

Also PTR_{MANGLE,DEMANGLE} is added to ports that does not use them
for vDSO calls (aarch64, powerpc, s390, and tile) and thus it will
reflect in code changes.  For ports that already implement pointer
mangling/demangling in vDSO system (i386, x32, x86_64) this patch
is mainly a code refactor.

Checked on x32, x86_64, x32, ppc64le, and aarch64.
2015-05-26 10:10:36 -03:00