external/glibc.git
9 years agoUpdate x86 elision-conf.c for <cpu-features.h>
H.J. Lu [Thu, 13 Aug 2015 10:40:40 +0000 (03:40 -0700)]
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).

9 years agoUpdate libmvec multiarch functions for <cpu-features.h>
H.J. Lu [Thu, 13 Aug 2015 10:40:00 +0000 (03:40 -0700)]
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.

9 years agoUpdate i686 multiarch functions for <cpu-features.h>
H.J. Lu [Thu, 13 Aug 2015 10:39:22 +0000 (03:39 -0700)]
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.

9 years agoUpdate x86_64 multiarch functions for <cpu-features.h>
H.J. Lu [Thu, 13 Aug 2015 10:38:47 +0000 (03:38 -0700)]
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.

9 years agoAdd _dl_x86_cpu_features to rtld_global
H.J. Lu [Thu, 13 Aug 2015 10:37:47 +0000 (03:37 -0700)]
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.

9 years agoFix BZ #18820 -- fmemopen may leak memory on failure.
Paul Pluzhnikov [Thu, 13 Aug 2015 06:51:04 +0000 (23:51 -0700)]
Fix BZ #18820 -- fmemopen may leak memory on failure.

9 years agoFix BZ #16734 -- fopen calls mmap to allocate its buffer
Paul Pluzhnikov [Thu, 13 Aug 2015 01:56:08 +0000 (18:56 -0700)]
Fix BZ #16734 -- fopen calls mmap to allocate its buffer

9 years agoFix BZ #18086 -- nice resets errno to 0.
Paul Pluzhnikov [Wed, 12 Aug 2015 06:40:00 +0000 (23:40 -0700)]
Fix BZ #18086 -- nice resets errno to 0.

9 years agopowerpc: Fix stpcpy performance for power8
Ondrej Bilka [Tue, 28 Jul 2015 20:34:04 +0000 (17:34 -0300)]
powerpc: Fix stpcpy performance for power8

This patch fixes the missing enablement for stpcpy on POWER8.

* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.

9 years agopowerpc: Fix PPC64/POWER7 conform tests
Adhemerval Zanella [Fri, 31 Jul 2015 13:48:20 +0000 (10:48 -0300)]
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.

9 years agopowerpc: Use default strcpy optimization for POWER7
Adhemerval Zanella [Tue, 28 Jul 2015 20:12:25 +0000 (17:12 -0300)]
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.

9 years agopowerpc: Fix strnlen/power7 build
Adhemerval Zanella [Tue, 28 Jul 2015 18:39:13 +0000 (15:39 -0300)]
powerpc: Fix strnlen/power7 build

This patch fixes the strnlen.S build with --disable-multi-arch option.

9 years agopowerpc: Fix strstr/power7 build
Adhemerval Zanella [Tue, 28 Jul 2015 18:34:25 +0000 (15:34 -0300)]
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.

9 years agoClear DF_1_NODELETE flag only for failed to load library.
Maxim Ostapenko [Mon, 10 Aug 2015 07:47:54 +0000 (10:47 +0300)]
Clear DF_1_NODELETE flag only for failed to load library.

https://sourceware.org/bugzilla/show_bug.cgi?id=18778

If dlopen fails to load an object that has triggered loading libpthread it
causes ld.so to unload libpthread because its DF_1_NODELETE flags has been
forcefully cleared. The next call to __rtdl_unlock_lock_recursive will crash
since pthread_mutex_unlock no longer exists.

This patch moves l->l_flags_1 &= ~DF_1_NODELETE out of loop through all loaded
libraries and performs the action only on inconsistent one.

[BZ #18778]
* elf/Makefile (tests): Add Add tst-nodelete2.
(modules-names): Add tst-nodelete2mod.
(tst-nodelete2mod.so-no-z-defs): New.
($(objpfx)tst-nodelete2): Likewise.
($(objpfx)tst-nodelete2.out): Likewise.
(LDFLAGS-tst-nodelete2): Likewise.
* elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
out of loop through all loaded libraries.
* elf/tst-nodelete2.c: New file.
* elf/tst-nodelete2mod.c: Likewise.

9 years agoRemove unused definition of __openat(64)_nocancel
Andreas Schwab [Mon, 10 Aug 2015 13:04:09 +0000 (15:04 +0200)]
Remove unused definition of __openat(64)_nocancel

9 years agoAdd more tests of various libm functions.
Joseph Myers [Tue, 11 Aug 2015 00:58:28 +0000 (00:58 +0000)]
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.

9 years agoFix ldbl-128ibm tanhl inaccuracy (bug 18790).
Joseph Myers [Mon, 10 Aug 2015 20:35:30 +0000 (20:35 +0000)]
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.

9 years agoReadd O_LARGEFILE flag for openat64 (bug 18781)
Andreas Schwab [Mon, 10 Aug 2015 12:12:47 +0000 (14:12 +0200)]
Readd O_LARGEFILE flag for openat64 (bug 18781)

9 years agoFix ldbl-128ibm sinhl inaccuracy near 0 (bug 18789).
Joseph Myers [Mon, 10 Aug 2015 15:25:10 +0000 (15:25 +0000)]
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.

9 years agoAdd a missing break in tst-auditmod3b.c
H.J. Lu [Sun, 9 Aug 2015 14:59:15 +0000 (07:59 -0700)]
Add a missing break in tst-auditmod3b.c

[BZ #18674]
* sysdeps/i386/tst-auditmod3b.c (la_objsearch): Add a missing
break.

9 years agoResort bug numbers in NEWS into ascending order.
Joseph Myers [Sun, 9 Aug 2015 14:35:43 +0000 (14:35 +0000)]
Resort bug numbers in NEWS into ascending order.

9 years agoRemove unused variables from timezone/Makefile
Andreas Schwab [Sun, 9 Aug 2015 14:03:14 +0000 (16:03 +0200)]
Remove unused variables from timezone/Makefile

9 years agogawk: fix gensub usage
Mike Frysinger [Thu, 6 Aug 2015 08:14:56 +0000 (04:14 -0400)]
gawk: fix gensub usage

The third arg can either be a string with "g" or "G", or it is a number.
The empty string elicits a warning with newer versions like so:
gawk: scripts/sysd-rules.awk:56: warning: gensub: third argument `' treated as 1

9 years agofix non-portable `echo -n` usage
Mike Frysinger [Thu, 6 Aug 2015 08:14:20 +0000 (04:14 -0400)]
fix non-portable `echo -n` usage

These scripts use #!/bin/sh explicitly, so make sure they avoid echo -n
as different shells treat it differently.  Use the portable printf func
instead.

9 years agohppa: put custom madvise defines behind __USE_MISC
Mike Frysinger [Wed, 5 Aug 2015 09:17:29 +0000 (05:17 -0400)]
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.

9 years agohppa: Fix miscompilation of sched_setaffinity() [BZ #18480]
John David Anglin [Fri, 7 Aug 2015 15:54:19 +0000 (11:54 -0400)]
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.

9 years agoIn preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
Paul Pluzhnikov [Sat, 8 Aug 2015 23:27:58 +0000 (16:27 -0700)]
In preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
when _G_HAVE_MMAP is turned off.

9 years agoFix trailing space.
Paul Pluzhnikov [Sat, 8 Aug 2015 22:54:40 +0000 (15:54 -0700)]
Fix trailing space.

9 years agoFix BZ #17905
Paul Pluzhnikov [Sat, 8 Aug 2015 22:53:03 +0000 (15:53 -0700)]
Fix BZ #17905

9 years agohppa: Fix reload error with atomic code [BZ #18787]
John David Anglin [Fri, 7 Aug 2015 17:37:35 +0000 (13:37 -0400)]
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.

9 years agomicroblaze: include unix/sysdep.h
Mike Frysinger [Thu, 6 Aug 2015 06:10:46 +0000 (02:10 -0400)]
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.

9 years agoFix tan missing underflows (bug 16517).
Joseph Myers [Fri, 7 Aug 2015 23:10:35 +0000 (23:10 +0000)]
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.

9 years agolocales/ce_RU: sync with other *_RU locales
Arslanbek Astemirov [Fri, 3 Jul 2015 09:19:39 +0000 (09:19 +0000)]
locales/ce_RU: sync with other *_RU locales

[BZ #18618]
* locales/ce_RU (LC_IDENTIFICATION): Fix language.
(LC_TIME): Set first_weekday and first_workday.
(LC_NUMERIC): Copy ru_RU.

9 years agoFix sysdeps/i386/fpu/s_scalbn.S build
Samuel Thibault [Fri, 7 Aug 2015 07:53:56 +0000 (09:53 +0200)]
Fix sysdeps/i386/fpu/s_scalbn.S build

* math/Versions (libc: GLIBC_2_22): New (empty) version set.

9 years agohppa: _dl_symbol_address: add missing hidden def
Mike Frysinger [Fri, 7 Aug 2015 05:43:08 +0000 (01:43 -0400)]
hppa: _dl_symbol_address: add missing hidden def

Commit 2a6ad8142d14c998e6c5eb51418aac1f598b621e 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.

9 years agoFix gcrt0.o compilation
Samuel Thibault [Thu, 6 Aug 2015 23:38:39 +0000 (01:38 +0200)]
Fix gcrt0.o compilation

When static-start-installed-name is different from
start-installed-name, we must not use the shared objects.

* csu/Makefile
(extra-objs): Add gmon-start.o when building shared library and
$(static-start-installed-name) is different from
$(start-installed-name).
$(objpfx)g$(static-start-installed-name): When building shared
library and $(static-start-installed-name) is different from
$(static-start-installed-name), revert to non-shared rule,
i.e. using $(objpfx)% and gmon-start.o.

9 years agoFix sinh missing underflows (bug 16519).
Joseph Myers [Thu, 6 Aug 2015 23:01:09 +0000 (23:01 +0000)]
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.

9 years agoAdd #include <unistd.h> to libio/oldfileops.c for write.
Paul Pluzhnikov [Thu, 6 Aug 2015 15:51:31 +0000 (08:51 -0700)]
Add #include <unistd.h> to libio/oldfileops.c for write.

9 years agofix missing ctype.h include
Mike Frysinger [Thu, 6 Aug 2015 06:44:44 +0000 (02:44 -0400)]
fix missing ctype.h include

This file uses isspace but doesn't include ctype.h leading to:
isomac.c: In function 'get_null_defines':
isomac.c:305:30: warning: implicit declaration of function 'isspace' [-Wimplicit-function-declaration]
for (end = start + 1; !isspace (*end) && *end != '\0'; ++end)

9 years agoModify several tests to use test-skeleton.c
Arjun Shankar [Mon, 3 Aug 2015 16:14:21 +0000 (16:14 +0000)]
Modify several tests to use test-skeleton.c

These tests were skipped by the use-test-skeleton conversion done in
commit 29955b5d because they did not have an `int main (void)'
declaration. Instead their `main' functions were declared with arguments
(i.e. argc, argv) even though they didn't use them.

Remove these arguments and include the test skeleton in these tests.

9 years agoCorrect comments about the history of <regexp.h>
Zack Weinberg [Thu, 6 Aug 2015 02:35:28 +0000 (22:35 -0400)]
Correct comments about the history of <regexp.h>

In the "Kill regexp.h" thread, Joseph dug up more accurate information
about exactly which editions of the Single Unix Standard included and
deprecated this header.

9 years agoProperly terminate FDE in makecontext for m68k (bug 18635)
Andreas Schwab [Wed, 5 Aug 2015 21:20:49 +0000 (23:20 +0200)]
Properly terminate FDE in makecontext for m68k (bug 18635)

9 years agoAlign stack to 16 bytes when calling __errno_location
H.J. Lu [Sun, 12 Jul 2015 21:41:20 +0000 (14:41 -0700)]
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.

9 years agoAlign stack to 16 bytes when calling __gettimeofday
H.J. Lu [Sun, 12 Jul 2015 21:40:25 +0000 (14:40 -0700)]
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.

9 years agoAlign stack to 16 bytes when calling __setcontext
H.J. Lu [Sun, 12 Jul 2015 21:38:58 +0000 (14:38 -0700)]
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.

9 years agoCompile {memcpy,strcmp}-sse2-unaligned.S only for libc
H.J. Lu [Wed, 29 Jul 2015 10:41:58 +0000 (03:41 -0700)]
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.

9 years agoImprove performance of mempcpy by inlining and using memcpy. Enable
Wilco Dijkstra [Wed, 5 Aug 2015 14:58:15 +0000 (15:58 +0100)]
Improve performance of mempcpy by inlining and using memcpy. Enable
this for all targets except sparc which has an optimized mempcpy
implementation.

9 years agoImprove memccpy performance by using memchr/memcpy/mempcpy rather than
Wilco Dijkstra [Wed, 5 Aug 2015 14:24:06 +0000 (15:24 +0100)]
Improve memccpy performance by using memchr/memcpy/mempcpy rather than
a byte loop. Overall performance on bench-memccpy is > 2x faster when
using the C implementation of memchr and an optimized memcpy.

9 years agoThis patch improves strncpy performance by using strnlen/memcpy rather than a byte...
Wilco Dijkstra [Wed, 5 Aug 2015 14:15:28 +0000 (15:15 +0100)]
This patch improves strncpy performance by using strnlen/memcpy rather than a byte loop. Performance
on bench-strncpy is 1.9-2.1x faster on average. I tried several variations, and using a tailcall and
calling memset conditionally gave the best overall results.

9 years agoImprove feenableexcept performance - avoid an unnecessary FPCR read in case
Wilco Dijkstra [Wed, 5 Aug 2015 14:03:08 +0000 (15:03 +0100)]
Improve feenableexcept performance - avoid an unnecessary FPCR read in case
the FPCR does not change. Also improve the logic of the return value.

9 years agoImprove fesetenv performance by avoiding unnecessary FPSR/FPCR reads/writes.
Wilco Dijkstra [Wed, 5 Aug 2015 13:57:37 +0000 (14:57 +0100)]
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.

9 years agoAlso check dead->data[category] != NULL
H.J. Lu [Wed, 5 Aug 2015 15:15:51 +0000 (08:15 -0700)]
Also check dead->data[category] != NULL

_nl_load_locale_from_archive (int category, const char **namep)

has

 for (cnt = 0; cnt < __LC_LAST; ++cnt)
    if (cnt != LC_ALL)
      {
        lia->data[cnt] = _nl_intern_locale_data (cnt,
                                                 results[cnt].addr,
                                                 results[cnt].len);
        if (__glibc_likely (lia->data[cnt] != NULL))
          {
...
          }
      }

lia->data[cnt] can be NULL, which happens to en_US.UTF-8 with
LC_COLLATE.  But this won't happen if glibc is configured with
--enable-hardcoded-path-in-tests.  We should also check
dead->data[category] != NULL.

* locale/loadarchive.c (_nl_archive_subfreeres): Also check
dead->data[category] != NULL.

9 years agoFix powf (close to -1, large) (bug 18647).
Joseph Myers [Wed, 5 Aug 2015 15:01:58 +0000 (15:01 +0000)]
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.

9 years agoarm: Assembly implementation cleanup
Adhemerval Zanella [Mon, 6 Jul 2015 13:00:29 +0000 (13:00 +0000)]
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.

9 years agolocaledata: remove timezone information [BZ #18525]
Marko Myllynen [Fri, 12 Jun 2015 14:05:25 +0000 (17:05 +0300)]
localedata: remove timezone information [BZ #18525]

as discussed in the thread starting at

https://sourceware.org/ml/libc-alpha/2015-06/msg00098.html

it looks like the best options is to remove locale timezone information
from locales which currently provide it (in incomplete or incorrect
fashion) rather than to start duplicating tzdata info in glibc.

9 years agoUpdated __nonnull annotations for wcscat, wcsncat, wcscmp and wcsncmp [BZ #18265]
Daniel Marjamäki [Fri, 22 May 2015 08:00:26 +0000 (08:00 +0000)]
Updated __nonnull annotations for wcscat, wcsncat, wcscmp and wcsncmp [BZ #18265]

This patch adds __nonnull annotations for wcscat, wcsncat, wcscmp and wcsncmp.

These added annotations match the annoations for strcat, strncat, strcmp, strncmp in glibc.

9 years agotest-skeleton: add usage information
Mike Frysinger [Tue, 4 Aug 2015 11:26:46 +0000 (07:26 -0400)]
test-skeleton: add usage information

I keep trying to run tests with --help and then remembering that does
nothing when it throws an error.  That means I have to dig into the
source when I want to refer to flags or env vars and re-read a good
amount of code to find the nested locations.

Make this all much more user friendly with a usage screen that gets
printed out whenever an unknown option is specified.

9 years agommap64: fix undef warnings
Mike Frysinger [Wed, 29 Jul 2015 15:35:37 +0000 (11:35 -0400)]
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.

9 years agonptl: fix set-but-unused warning w/_STACK_GROWS_UP
Mike Frysinger [Thu, 30 Jul 2015 02:53:28 +0000 (22:53 -0400)]
nptl: fix set-but-unused warning w/_STACK_GROWS_UP

On arches that set _STACK_GROWS_UP, the stacktop variable is declared
and set, but never actually used.  Refactor the code a bit so that the
variable is only declared/set under _STACK_GROWS_DOWN settings.

9 years agoOpen development for 2.23.
Carlos O'Donell [Wed, 5 Aug 2015 07:01:50 +0000 (03:01 -0400)]
Open development for 2.23.

9 years agoUpdate version.h and include/features.h for 2.22 release
Carlos O'Donell [Wed, 5 Aug 2015 06:42:21 +0000 (02:42 -0400)]
Update version.h and include/features.h for 2.22 release

9 years agotilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
Chris Metcalf [Tue, 4 Aug 2015 16:02:10 +0000 (12:02 -0400)]
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.

9 years agoProperly terminate FDE in makecontext for ix86 (bug 18635)
Andreas Schwab [Tue, 4 Aug 2015 10:35:50 +0000 (12:35 +0200)]
Properly terminate FDE in makecontext for ix86 (bug 18635)

9 years agoUpdated translations for 2.22.
Carlos O'Donell [Sat, 1 Aug 2015 18:48:31 +0000 (14:48 -0400)]
Updated translations for 2.22.

9 years agoDeprecate the use of regexp.h
Zack Weinberg [Sat, 1 Aug 2015 18:38:05 +0000 (14:38 -0400)]
Deprecate the use of regexp.h

<regexp.h> (not to be confused with <regex.h>) is an obsolete and
frankly horrible regular expression-matching API.  It was part of SVID
but was withdrawn in Issue 5 (for reference, we're on Issue 7 now).
It doesn't do anything you can't do with <regex.h>, and using it
involves defining a bunch of macros before including the header.
Moreover, the code in regexp.h that uses those macros has been buggy
since its creation (in 1996) and no one has noticed, which indicates
to me that there are no users.  (Specifically, RETURN() is used in a
whole bunch of cases where it should have been ERROR().)

The header is given a warning and marked deprecated for 2.22.

See:
https://sourceware.org/ml/libc-alpha/2015-07/msg00862.html and
https://sourceware.org/ml/libc-alpha/2015-07/msg00871.html.

9 years agoRegenerate libc.pot for 2.22 release.
Carlos O'Donell [Fri, 31 Jul 2015 04:13:33 +0000 (00:13 -0400)]
Regenerate libc.pot for 2.22 release.

9 years agoPrevent runtime fail of SSE vector math tests on non SSE4.1 machine.
Andrew Senkevich [Thu, 30 Jul 2015 15:00:24 +0000 (18:00 +0300)]
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.

9 years agohppa: add bz entry for pthreadtypes.h fix
Mike Frysinger [Thu, 30 Jul 2015 14:08:35 +0000 (10:08 -0400)]
hppa: add bz entry for pthreadtypes.h fix

9 years agohppa: fix pthreadtypes.h namespace failures
Mike Frysinger [Thu, 30 Jul 2015 09:02:15 +0000 (05:02 -0400)]
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.

9 years agohppa: Remove custom lowlevellock.h.
Torvald Riegel [Wed, 17 Dec 2014 22:52:06 +0000 (23:52 +0100)]
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.

9 years agohppa: sigaction.h: change sa_flags to an int
Mike Frysinger [Wed, 22 Jul 2015 02:49:22 +0000 (22:49 -0400)]
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.

9 years agohppa: fix sysdep.h header setup
Mike Frysinger [Thu, 30 Jul 2015 02:55:43 +0000 (22:55 -0400)]
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.

9 years agohppa: rewrite INLINE_SYSCALL
Mike Frysinger [Thu, 30 Jul 2015 03:01:01 +0000 (23:01 -0400)]
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.

9 years agoExtend local PLT reference check
H.J. Lu [Wed, 29 Jul 2015 18:57:54 +0000 (11:57 -0700)]
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.

9 years agoAdded runtime check for AVX vector math tests.
Andrew Senkevich [Wed, 29 Jul 2015 16:47:29 +0000 (19:47 +0300)]
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.

9 years agoia64: drop __tls_get_addr from expected ld.so plt usage
Mike Frysinger [Tue, 28 Jul 2015 09:28:57 +0000 (05:28 -0400)]
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.

9 years agoia64: atomic.h: fix atomic_exchange_and_add 64bit handling
Mike Frysinger [Tue, 28 Jul 2015 06:19:49 +0000 (02:19 -0400)]
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.

9 years agoia64: clean up old kernel headers cruft
Mike Frysinger [Tue, 28 Jul 2015 04:15:18 +0000 (00:15 -0400)]
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.

9 years agopwd.h: revert __nonnull markings on putpwent [BZ #18641]
Mike Frysinger [Tue, 28 Jul 2015 03:43:09 +0000 (23:43 -0400)]
pwd.h: revert __nonnull markings on putpwent [BZ #18641]

This function actually checks for NULL arguments and the API has been
tenatively documented as using EINVAL in that case.  We can debate
leaving it this way, but it should be done after the pending release.

9 years agoMark bug 2981 (elf/tst-audit* fail on MIPS) as fixed.
Joseph Myers [Mon, 27 Jul 2015 23:59:08 +0000 (23:59 +0000)]
Mark bug 2981 (elf/tst-audit* fail on MIPS) as fixed.

Changes in support of -fno-plt also cause the elf/tst-audit* tests to
start passing on MIPS.  This patch duly marks the relevant bug as
fixed in ChangeLog and NEWS.

9 years agoFix spurious conform test failures
Andreas Schwab [Mon, 27 Jul 2015 14:04:40 +0000 (16:04 +0200)]
Fix spurious conform test failures

9 years agoFixes extern protected data handling testcases elf/tst-protected1a
Chung-Lin Tang [Sun, 26 Jul 2015 12:27:18 +0000 (05:27 -0700)]
Fixes extern protected data handling testcases elf/tst-protected1a
and elf/tst-protected1b for Nios II.

9 years agoAdd #include <string.h> to nptl/tst-join7mod.c to silence GCC warnings.
Chung-Lin Tang [Sun, 26 Jul 2015 07:54:27 +0000 (00:54 -0700)]
Add #include <string.h> to nptl/tst-join7mod.c to silence GCC warnings.

9 years agoUpdate Nios II ulps file.
Chung-Lin Tang [Sat, 25 Jul 2015 14:14:29 +0000 (07:14 -0700)]
Update Nios II ulps file.

9 years agoFix order of arguments to rt_sigprocmask syscall when setting the signal mask
Chung-Lin Tang [Sat, 25 Jul 2015 06:19:50 +0000 (23:19 -0700)]
Fix order of arguments to rt_sigprocmask syscall when setting the signal mask
in setcontext/swapcontext.

9 years agoNaCl: Remove bogus O_SHLOCK, O_EXLOCK definitions.
Roland McGrath [Fri, 24 Jul 2015 19:31:23 +0000 (12:31 -0700)]
NaCl: Remove bogus O_SHLOCK, O_EXLOCK definitions.

9 years agoUse IE model for static variables in libc.so, libpthread.so and rtld
Siddhesh Poyarekar [Fri, 24 Jul 2015 13:43:38 +0000 (19:13 +0530)]
Use IE model for static variables in libc.so, libpthread.so and rtld

The recently introduced TLS variables in the thread-local destructor
implementation (__cxa_thread_atexit_impl) used the default GD access
model, resulting in a call to __tls_get_addr.  This causes a deadlock
with recent changes to the way TLS is initialized because DTV
allocations are delayed and hence despite knowing the offset to the
variable inside its TLS block, the thread has to take the global rtld
lock to safely update the TLS offset.

This causes deadlocks when a thread is instantiated and joined inside
a destructor of a dlopen'd DSO.  The correct long term fix is to
somehow not take the lock, but that will need a lot deeper change set
to alter the way in which the big rtld lock is used.

Instead, this patch just eliminates the call to __tls_get_addr for the
thread-local variables inside libc.so, libpthread.so and rtld by
building all of their units with -mtls-model=initial-exec.

There were concerns that the static storage for TLS is limited and
hence we should not be using it.  Additionally, dynamically loaded
modules may result in libc.so looking for this static storage pretty
late in static binaries.  Both concerns are valid when using TLSDESC
since that is where one may attempt to allocate a TLS block from
static storage for even those variables that are not IE.  They're not
very strong arguments for the traditional TLS model though, since it
assumes that the static storage would be used sparingly and definitely
not by default.  Hence, for now this would only theoretically affect
ARM architectures.

The impact is hence limited to statically linked binaries that dlopen
modules that in turn load libc.so, all that on arm hardware.  It seems
like a small enough impact to justify fixing the larger problem that
currently affects everything everywhere.

This still does not solve the original problem completely.  That is,
it is still possible to deadlock on the big rtld lock with a small
tweak to the test case attached to this patch.  That problem is
however not a regression in 2.22 and hence could be tackled as a
separate project.  The test case is picked up as is from Alex's patch.

This change has been tested to verify that it does not cause any
issues on x86_64.

ChangeLog:

[BZ #18457]
* nptl/Makefile (tests): New test case tst-join7.
(modules-names): New test case module tst-join7mod.
* nptl/tst-join7.c: New file.
* nptl/tst-join7mod.c: New file.
* Makeconfig (tls-model): Pass -ftls-model=initial-exec for
all translation units in libc.so, libpthread.so and rtld.

9 years agoUpdate powerpc-fpu libm-test-ulps.
Adhemerval Zanella [Fri, 24 Jul 2015 13:21:56 +0000 (10:21 -0300)]
Update powerpc-fpu libm-test-ulps.

9 years agoFixed several libmvec bugs found during testing on KNL hardware.
Andrew Senkevich [Fri, 24 Jul 2015 11:47:23 +0000 (14:47 +0300)]
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.

9 years ago[ARM][BZ #17711] Fix extern protected data handling
Szabolcs Nagy [Fri, 24 Jul 2015 09:05:07 +0000 (10:05 +0100)]
[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

9 years ago[AArch64][BZ #17711] Fix extern protected data handling
Szabolcs Nagy [Fri, 24 Jul 2015 08:57:32 +0000 (09:57 +0100)]
[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

9 years agoMention dl_load_lock by name in the comments
Siddhesh Poyarekar [Fri, 24 Jul 2015 00:39:47 +0000 (06:09 +0530)]
Mention dl_load_lock by name in the comments

Mention dl_load_lock by name instead of just 'load lock' in the
comments.  This makes it unambigious which lock we're talking about.

9 years agoMake sysdeps/posix bring in login subdir.
Roland McGrath [Fri, 24 Jul 2015 00:04:22 +0000 (17:04 -0700)]
Make sysdeps/posix bring in login subdir.

9 years agoAdd SIGWINCH to generic <bits/signum.h>.
Roland McGrath [Thu, 23 Jul 2015 23:44:47 +0000 (16:44 -0700)]
Add SIGWINCH to generic <bits/signum.h>.

9 years agoNaCl: Fix missing getdtablesize symbol.
Roland McGrath [Thu, 23 Jul 2015 22:54:21 +0000 (15:54 -0700)]
NaCl: Fix missing getdtablesize symbol.

9 years agoconform/linknamespace: whitelist matherrf/matherrl
Mike Frysinger [Thu, 23 Jul 2015 03:11:10 +0000 (23:11 -0400)]
conform/linknamespace: whitelist matherrf/matherrl

glibc supports the deprecated matherr hook for math error reporting.  The
conform tests take this into consideration and whitelist this symbol when
running linknamespace tests.

The ia64 libm code has long provided two additional hooks in this space:
matherrf (for floats)
matherrl (for long doubles)

Which causes the conform tests to fail with chains that all look like:
[initial] __atan2 ->
[libm.a(e_atan2.o)] __libm_error_support ->
[libm.a(libm_error.o)] matherrf

We can't (losslessly) redirect existing usage of these funcs to matherr
because the structure passed in is different -- matherr uses a struct with
doubles while matherrf/matherrl use floats and long doubles respectively.
Plus, this has been part of the exported ABI since glibc-2.2.3, so it
doesn't feel right to change it so late.

Until we get around to obsoleting matherr entirely, whitelist these two
additional ia64 symbols.

9 years agoia64: sigaction.h: fix sa_flags ordering
Mike Frysinger [Thu, 23 Jul 2015 07:27:04 +0000 (03:27 -0400)]
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>
9 years agoAlso use l_tls_dtor_count to decide on object unload (BZ #18657)
Siddhesh Poyarekar [Thu, 23 Jul 2015 05:46:18 +0000 (11:16 +0530)]
Also use l_tls_dtor_count to decide on object unload (BZ #18657)

When an TLS destructor is registered, we set the DF_1_NODELETE flag to
signal that the object should not be destroyed.  We then clear the
DF_1_NODELETE flag when all destructors are called, which is wrong -
the flag could have been set by other means too.

This patch replaces this use of the flag by using l_tls_dtor_count
directly to determine whether it is safe to unload the object.  This
change has the added advantage of eliminating the lock taking when
calling the destructors, which could result in a deadlock.  The patch
also fixes the test case tst-tls-atexit - it was making an invalid
dlclose call, which would just return an error silently.

I have also added a detailed note on concurrency which also aims to
justify why I chose the semantics I chose for accesses to
l_tls_dtor_count.  Thanks to Torvald for his help in getting me
started on this and (literally) teaching my how to approach the
problem.

Change verified on x86_64; the test suite does not show any
regressions due to the patch.

ChangeLog:

[BZ #18657]
* elf/dl-close.c (_dl_close_worker): Don't unload DSO if there
are pending TLS destructor calls.
* include/link.h (struct link_map): Add concurrency note for
L_TLS_DTOR_COUNT.
* stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl):
Don't touch the link map flag.  Atomically increment
l_tls_dtor_count.
(__call_tls_dtors): Atomically decrement l_tls_dtor_count.
Avoid taking the load lock and don't touch the link map flag.
* stdlib/tst-tls-atexit-nodelete.c: New test case.
* stdlib/Makefile (tests): Use it.
* stdlib/tst-tls-atexit.c (do_test): dlopen
tst-tls-atexit-lib.so again before dlclose.  Add conditionals
to allow tst-tls-atexit-nodelete test case to use it.

9 years agoia64: msg.h: fix msg_qnum/msg_qbytes types
Mike Frysinger [Wed, 22 Jul 2015 02:44:48 +0000 (22:44 -0400)]
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.

9 years agoia64: stat.h: rename pad0 to __glibc_reserved0
Mike Frysinger [Wed, 22 Jul 2015 02:42:37 +0000 (22:42 -0400)]
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.