]> sourceware.org Git - glibc.git/log
glibc.git
9 years agoVector pow for x86_64 and tests.
Andrew Senkevich [Wed, 17 Jun 2015 13:22:26 +0000 (16:22 +0300)]
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.

9 years agoVector expf for x86_64 and tests.
Andrew Senkevich [Wed, 17 Jun 2015 13:10:51 +0000 (16:10 +0300)]
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.

9 years agoVector exp for x86_64 and tests.
Andrew Senkevich [Wed, 17 Jun 2015 12:58:05 +0000 (15:58 +0300)]
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.

9 years agoVector logf for x86_64 and tests.
Andrew Senkevich [Wed, 17 Jun 2015 12:53:00 +0000 (15:53 +0300)]
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.

9 years agoVector log for x86_64 and tests.
Andrew Senkevich [Wed, 17 Jun 2015 12:38:29 +0000 (15:38 +0300)]
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.

9 years ago[AArch64] Fix cfi_adjust_cfa_offset usage in dl-tlsdesc.S
Szabolcs Nagy [Wed, 17 Jun 2015 11:44:53 +0000 (12:44 +0100)]
[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.

9 years ago[BZ 18034][AArch64] Lazy TLSDESC relocation data race fix
Szabolcs Nagy [Wed, 17 Jun 2015 11:37:49 +0000 (12:37 +0100)]
[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.

9 years agoVector sinf for x86_64 and tests.
Andrew Senkevich [Mon, 15 Jun 2015 12:06:53 +0000 (15:06 +0300)]
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.

9 years agoFix linknamespace expectations for in6addr_any, in6addr_loopback.
Joseph Myers [Sun, 14 Jun 2015 14:32:07 +0000 (14:32 +0000)]
Fix linknamespace expectations for in6addr_any, in6addr_loopback.

Some linknamespace test failures turned out to be because the
variables in6addr_any and in6addr_loopback weren't listed in the lists
of extra reserved symbols for the relevant standards (only functions
are handled automatically through -aux-info, data symbols need listing
manually in list-header-symbols.pl).  This patch duly adds those
symbols to those lists (there are still failures for older standards
because of references to those symbols being brought in for standards
that didn't reserve them: bug 18532, to be fixed separately).

Tested for x86_64.

* conform/list-header-symbols.pl (%extra_syms): Add in6addr_any
and in6addr_loopback for XOPEN2K, XOPEN2K8 and POSIX2008.
* conform/Makefile (test-xfail-XOPEN2K/netdb.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/netdb.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/netdb.h/linknamespace): Likewise.

9 years agoFix syslog fputs_unlocked namespace (bug 18530).
Joseph Myers [Fri, 12 Jun 2015 22:36:38 +0000 (22:36 +0000)]
Fix syslog fputs_unlocked namespace (bug 18530).

syslog (XSI POSIX) brings in references to fputs_unlocked (not
POSIX).  This patch fixes this by making fputs_unlocked into a weak
alias for __fputs_unlocked and using __fputs_unlocked as needed.  (No
linknamespace test XFAILs are removed because there are other failures
from syslog as well.)

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  Disassembly of installed
stripped shared libraries is unchanged on x86_64; on x86, I see some
small changes to instruction ordering and register choice, with no
apparent reason for such changes to be related to this patch, but they
also seem completely harmless with no change to code size.

[BZ #18530]
* libio/iofputs.c [!_IO_MTSAFE_IO] (__fputs_unlocked): Define as
strong alias of _IO_fputs.  Use libc_hidden_def.
* libio/iofputs_u.c (fputs_unlocked): Rename to __fputs_unlocked
and define as weak alias of __fputs_unlocked.  Use
libc_hidden_weak.
* include/stdio.h (__fputs_unlocked): Declare.  Use
libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __fputs_unlocked instead of
fputs_unlocked.

9 years agoFix netdb.h addrinfo namespace (bug 18529).
Joseph Myers [Fri, 12 Jun 2015 22:35:07 +0000 (22:35 +0000)]
Fix netdb.h addrinfo namespace (bug 18529).

netdb.h declares interfaces such as getaddrinfo if __USE_POSIX,
i.e. POSIX.1:1990 or later.  However, these interfaces were new in the
2001 edition of POSIX, although the header was in XPG4 and UNIX98, so
they should not be declared for XPG4 or UNIX98.  (This produces
spurious linknamespace test failures, although there are other
failures for this header as well for the same standards so this patch
doesn't remove any XFAILs.)  This patch corrects the condition, and
the conform/ test expectations which were similarly wrong.

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

[BZ #18529]
* resolv/netdb.h [__USE_POSIX]: Change condition to
[__USE_XOPEN2K].
* conform/data/netdb.h-data [XPG4 || UNIX98] (struct addrinfo): Do
not expect.
[XPG4 || UNIX98] (AI_PASSIVE): Likewise.
[XPG4 || UNIX98] (AI_CANONNAME): Likewise.
[XPG4 || UNIX98] (AI_NUMERICHOST): Likewise.
[XPG4 || UNIX98] (AI_V4MAPPED): Likewise.
[XPG4 || UNIX98] (AI_ALL): Likewise.
[XPG4 || UNIX98] (AI_ADDRCONFIG): Likewise.
[XPG4 || UNIX98] (AI_NUMERICSERV): Likewise.
[XPG4 || UNIX98] (NI_NOFQDN): Likewise.
[XPG4 || UNIX98] (NI_NUMERICHOST): Likewise.
[XPG4 || UNIX98] (NI_NAMEREQD): Likewise.
[XPG4 || UNIX98] (NI_NUMERICSERV): Likewise.
[XPG4 || UNIX98] (NI_DGRAM): Likewise.
[XPG4 || UNIX98] (EAI_AGAIN): Likewise.
[XPG4 || UNIX98] (EAI_BADFLAGS): Likewise.
[XPG4 || UNIX98] (EAI_FAIL): Likewise.
[XPG4 || UNIX98] (EAI_FAMILY): Likewise.
[XPG4 || UNIX98] (EAI_MEMORY): Likewise.
[XPG4 || UNIX98] (EAI_NONAME): Likewise.
[XPG4 || UNIX98] (EAI_SERVICE): Likewise.
[XPG4 || UNIX98] (EAI_SOCKTYPE): Likewise.
[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
[XPG4 || UNIX98] (freeaddrinfo): Likewise.
[XPG4 || UNIX98] (gai_strerror): Likewise.
[XPG4 || UNIX98] (getaddrinfo): Likewise.
[XPG4 || UNIX98] (getnameinfo): Likewise.

9 years agoFix grp.h endgrent, getgrent namespace (bug 18528).
Joseph Myers [Fri, 12 Jun 2015 22:29:19 +0000 (22:29 +0000)]
Fix grp.h endgrent, getgrent namespace (bug 18528).

grp.h declares endgrent and getgrent if __USE_XOPEN2K8 (i.e. 2008
edition of POSIX, non-XSI).  However, the 2013 Technical Corrigendum
corrected the grp.h specification to XSI-shade these functions as in
previous editions (see <http://austingroupbugs.net/view.php?id=24>),
so they should not be declared for non-XSI POSIX.  This patch corrects
the conditions - using __USE_MISC || __USE_XOPEN_EXTENDED to match
setgrent - and the conform/ test expectations for this header, thereby
fixing the conform tests for this header for XPG3 (where the
expectations were wrong) and the linknamespace tests for it for
POSIX2008 (where the header bug meant it was wrongly considered a
problem for endgrent to bring in a reference to setgrent).

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

[BZ #18528]
* grp/grp.h (endgrent): Condition on [__USE_MISC ||
__USE_XOPEN_EXTENDED], not [__USE_XOPEN_EXTENDED ||
__USE_XOPEN2K8].
(getgrent): Likewise.
* conform/data/grp.h-data [XPG3 || POSIX2008] (getgrent): Do not
expect.
[XPG3 || POSIX2008] (endgrent): Likewise.
[XPG3] (setgrent): Likewise.
* conform/Makefile (test-xfail-XPG3/grp.h/conform): Remove
variable.
(test-xfail-POSIX2008/grp.h/linknamespace): Likewise.

9 years agoFix getlogin_r namespace (bug 18527).
Joseph Myers [Fri, 12 Jun 2015 20:02:30 +0000 (20:02 +0000)]
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.

9 years agoAttempting to install glibc configured with --prefix=/usr into
Martin Sebor [Fri, 12 Jun 2015 19:15:57 +0000 (13:15 -0600)]
Attempting to install glibc configured with --prefix=/usr into
a non-standard directory specified by the prefix make variable
fails with an error.  Since this is an unsupported use case,
this change makes make install fail early and with a descriptive
error message when either the prefix or the exec_prefix make
variable is overridden on the command line.

9 years agoFix aio_* pread namespace (bug 18519).
Joseph Myers [Fri, 12 Jun 2015 17:34:11 +0000 (17:34 +0000)]
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.

9 years agoFix ecvt_r, fcvt_r namespace (bug 18522).
Joseph Myers [Fri, 12 Jun 2015 10:11:35 +0000 (10:11 +0000)]
Fix ecvt_r, fcvt_r namespace (bug 18522).

The functions ecvt, fcvt and gcvt, in some standards, bring in
references to ecvt_r and fcvt_r, which aren't in any of those
standards.  The calls are correctly to __ecvt_r and __fcvt_r, but then
the names ecvt_r and fcvt_r are defined as strong aliases; this patch
changes them to weak aliases.

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

[BZ #18522]
* misc/efgcvt_r.c
[LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) && !LONG_DOUBLE_CVT]
(cvt_symbol): Use weak_alias instead of strong_alias.
[LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)] (cvt_symbol): Likewise.
* conform/Makefile (test-xfail-XPG4/stdlib.h/linknamespace):
Remove variable.
(test-xfail-UNIX98/stdlib.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/stdlib.h/linknamespace): Likewise.

9 years agoFix h_errno namespace (bug 18520).
Joseph Myers [Fri, 12 Jun 2015 10:10:18 +0000 (10:10 +0000)]
Fix h_errno namespace (bug 18520).

The 2008 edition of POSIX removed h_errno, but some functions still
bring in references to the h_errno external symbol.  As this symbol is
not a part of the public ABI (only __h_errno_location is), this patch
fixes this by renaming the GLIBC_PRIVATE TLS symbol to __h_errno.

Tested for x86_64 and x86 (testsuite, and comparison of installed
shared libraries).  Disassembly of all shared libraries using h_errno
changes because of the renaming (and changes to associated TLS / GOT
offsets in some cases); disassembly of libpthread on x86_64 changes
more substantially because the enlargement of .dynsym affects
subsequent addresses.

[BZ #18520]
* inet/herrno.c (h_errno): Rename to __h_errno.
(__libc_h_errno): Define as alias of __h_errno not h_errno.
* include/netdb.h [IS_IN_LIB && !IS_IN (libc)] (h_errno): Define
to __h_errno instead of h_errno.
* nptl/herrno.c (h_errno): Rename to __h_errno.
(__h_errno_location): Refer to __h_errno not h_errno.
* resolv/Versions (h_errno): Rename to __h_errno.
* conform/Makefile (test-xfail-XOPEN2K8/grp.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K8/pwd.h/linknamespace): Likewise.

9 years agoVector sin for x86_64 and tests.
Andrew Senkevich [Thu, 11 Jun 2015 14:12:38 +0000 (17:12 +0300)]
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.

9 years agoMore strict check of AVX512 support in assembler.
Andrew Senkevich [Thu, 11 Jun 2015 10:50:07 +0000 (13:50 +0300)]
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.

9 years agopthread_key_create: Fix typo in comment
Florian Weimer [Thu, 11 Jun 2015 09:48:01 +0000 (11:48 +0200)]
pthread_key_create: Fix typo in comment

9 years agonptl: restore .interp section in libpthread.so
Gleb Fotengauer-Malinovskiy [Tue, 2 Jun 2015 18:04:06 +0000 (21:04 +0300)]
nptl: restore .interp section in libpthread.so

In commit 02657da2cf4457804ed938ee08b8316249126444, .interp section
was removed from libpthread.so.  This led to an error:

  $ /lib64/libpthread.so.0
  Native POSIX Threads Library by Ulrich Drepper et al
  Copyright (C) 2015 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE.
  Forced unwind support included.
  Segmentation fault

  (gdb) bt
  #0  0x00000000000055a6 in _exit@plt ()

Unfortunately, there is no way to add a regression test for the bug
because .interp specifies the path to dynamic linker of the target
system.

[BZ #18479]
* nptl/pt-interp.c: New file.
* nptl/Makefile (libpthread-routines, libpthread-shared-only-routines):
Add pt-interp.
[$(build-shared) = yes] ($(objpfx)pt-interp.os): Depend on
$(common-objpfx)runtime-linker.h.

9 years agoPrepare for restoration of .interp section in libpthread.so
Dmitry V. Levin [Fri, 5 Jun 2015 22:20:13 +0000 (22:20 +0000)]
Prepare for restoration of .interp section in libpthread.so

Make runtime-linker.h available outside $(elf-objpfx) by moving
the file to $(common-objpfx) and the rules for it to Makerules.

Tested for x86_64 and x86 (testsuite, and that no compiled code
changed by the patch).

* Makeconfig (+interp): Remove unused variable.
* elf/Makefile ($(objpfx)interp.os): Define for [$(build-shared) = yes]
only.  Depend on $(common-objpfx)runtime-linker.h instead of
$(elf-objpfx)runtime-linker.h.
($(elf-objpfx)runtime-linker.h): Rename to
$(common-objpfx)runtime-linker.h and move ...
* Makerules [$(build-shared) = yes]: ... here.
* elf/interp.c: Include <runtime-linker.h> instead of
<elf/runtime-linker.h>.

9 years agox86: Remove vsyscall usage
Adhemerval Zanella [Thu, 23 Apr 2015 12:17:42 +0000 (09:17 -0300)]
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

9 years agoFix regcomp wcscoll, wcscmp namespace (bug 18497).
Joseph Myers [Tue, 9 Jun 2015 21:07:30 +0000 (21:07 +0000)]
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.

9 years agoFix pathconf statvfs namespace (bug 18507).
Joseph Myers [Tue, 9 Jun 2015 19:52:01 +0000 (19:52 +0000)]
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.

9 years agoConsolidate sched_getcpu
Adhemerval Zanella [Wed, 22 Apr 2015 17:21:39 +0000 (14:21 -0300)]
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).

9 years agoThis patch adds vector cosf tests.
Andrew Senkevich [Tue, 9 Jun 2015 15:32:42 +0000 (18:32 +0300)]
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.

9 years agoVector cosf for x86_64.
Andrew Senkevich [Tue, 9 Jun 2015 15:29:47 +0000 (18:29 +0300)]
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.

9 years agoAddition of testing infrastructure for vector math functions.
Andrew Senkevich [Tue, 9 Jun 2015 11:51:52 +0000 (14:51 +0300)]
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.

9 years agoStart of series of patches with x86_64 vector math functions.
Andrew Senkevich [Tue, 9 Jun 2015 11:25:49 +0000 (14:25 +0300)]
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.

9 years agoRemove unused PREDEFINED_CLASSES code
Marko Myllynen [Tue, 12 May 2015 07:50:28 +0000 (10:50 +0300)]
Remove unused PREDEFINED_CLASSES code

Hi,

AFAICS PREDEFINED_CLASSES is never defined thus the code is unused. It would seem that the code is related to LO_LTYPE which was discussed in the past but there are no any recent references:

http://pubs.opengroup.org/onlinepubs/9638399/loltype.htm

Patch below, compiles and passes make check.

2015-05-12 Marko Myllynen  <myllynen@redhat.com>

* locale/C-ctype.c (PREDEFINED_CLASSES): Remove.
* locale/programs/ld-ctype.c: Likewise.

9 years agoThis patch adds detection of availability for AVX512F and AVX512DQ ISAs.
Andrew Senkevich [Mon, 8 Jun 2015 11:07:59 +0000 (14:07 +0300)]
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.

9 years agoSay "C++ tests" in comment on __open_memstream declaration.
Joseph Myers [Mon, 8 Jun 2015 10:24:37 +0000 (10:24 +0000)]
Say "C++ tests" in comment on __open_memstream declaration.

* include/stdio.h (__open_memstream): Say "C++ tests" in comment.

9 years agomach: fix typo
Samuel Thibault [Sat, 6 Jun 2015 09:48:42 +0000 (11:48 +0200)]
mach: fix typo

* mach/mach/mach_traps.h (thread_switch): Fix typo in comment.

9 years agoFix open_memstream namespace (bug 18498).
Joseph Myers [Fri, 5 Jun 2015 23:32:46 +0000 (23:32 +0000)]
Fix open_memstream namespace (bug 18498).

open_memstream is new in the 2008 edition of POSIX.  However, the
older functions getopt, closelog and fmtmsg all bring in references to
it.  This patch fixes this in the usual way, making open_memstream
into a weak alias of __open_memstream and calling __open_memstream
from the relevant places.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).  32-bit builds
produce an XPASS for conform/POSIX/unistd.h/linknamespace after this
patch (because the only cause of failure left there now is 64-bit
specific); that will disappear once the 64-bit failure is resolved and
the XFAIL removed at that time.

[BZ #18498]
* libio/memstream.c (open_memstream): Rename to __open_memstream
and define as weak alias of __open_memstream.
* include/stdio.h (__open_memstream): Declare.  Use
libc_hidden_proto.
(open_memstream): Don't use libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __open_memstream instead of
open_memstream.
* posix/getopt.c (_getopt_internal_r): Likewise.
* conform/Makefile (test-xfail-XPG3/stdio.h/linknamespace): Remove
variable.
(test-xfail-XPG4/stdio.h/linknamespace): Likewise.
(test-xfail-UNIX98/stdio.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/unistd.h/linknamespace): Likewise.

9 years agoFix regex wcrtomb namespace (bug 18496).
Joseph Myers [Fri, 5 Jun 2015 21:31:39 +0000 (21:31 +0000)]
Fix regex wcrtomb namespace (bug 18496).

The regex code brings in references to wcrtomb, which isn't in all the
standards that contain regex.  This patch makes it call __wcrtomb
instead (in fact some places already called __wcrtomb, so this patch
makes it internally consistent about which name is used).

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

[BZ #18496]
* posix/regex_internal.c (build_wcs_upper_buffer): Call __wcrtomb
instead of wcrtomb.

9 years agoFix psignal, psiginfo declaration conditions (bug 18483).
Joseph Myers [Fri, 5 Jun 2015 21:14:16 +0000 (21:14 +0000)]
Fix psignal, psiginfo declaration conditions (bug 18483).

signal.h declares psignal and psiginfo if __USE_XOPEN2K - that is, for
the 2001 edition of POSIX.  These functions were actually added in the
2008 edition (as indicated in the header comments).  This patch fixes
the header conditionals.  This fixes some linknamespace test failures
because psiginfo uses fmemopen, which is also new in the 2008 edition,
so before the header fix this appeared to the linknamespace tests as a
2001 function bringing in references to a 2008 function.  The problem
also appeared in conformtest header namespace test results (the
conformtest data has correct conditionals for when these functions
should be visible), but the affected headers still have other
namespace problems so this doesn't fix any of those XFAILs.

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

[BZ #18483]
* signal/signal.h [__USE_XOPEN2K] (psignal): Change condition to
[__USE_XOPEN2K8].  Remove redundant #endif.
[__USE_XOPEN2K] (psiginfo): Change condition to [__USE_XOPEN2K8].
Remove redundant #if.
* conform/Makefile (test-xfail-XOPEN2K/signal.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/sys/wait.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/ucontext.h/linknamespace): Likewise.

9 years agoFix regex wctype namespace (bug 18495).
Joseph Myers [Fri, 5 Jun 2015 20:04:47 +0000 (20:04 +0000)]
Fix regex wctype namespace (bug 18495).

regcomp brings in references to various wctype functions that aren't
in all the standards including regcomp.  This patch fixes this in the
usual way by using the __* versions of these functions (which already
exist, but some didn't have libc_hidden_proto / libc_hidden_def
before).

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).  (Other wide character
function references from the regex code mean that this patch by itself
doesn't fix any XFAILed linknamespace test failures; further patches
will be needed for that.)

[BZ #18495]
* wctype/wcfuncs.c (__iswalnum): Use libc_hidden_def.
(__iswlower): Likewise.
* include/wctype.h (__iswalnum): Declare.  Use libc_hidden_proto.
(__iswlower): Likewise.
* posix/regcomp.c (re_compile_fastmap_iter): Call __towlower
instead of towlower.
* posix/regex_internal.c (build_wcs_upper_buffer): Call __iswlower
instead of iswlower.  Call __towupper instead of towupper.
* posix/regex_internal.h (IS_WIDE_WORD_CHAR): Call __iswalnum
instead of iswalnum.

9 years agoCommit 7fe9e2e089f4990b7d18d0798f591ab276b15f2b fixes [BZ# 17322]
Florian Weimer [Fri, 5 Jun 2015 13:18:14 +0000 (15:18 +0200)]
Commit 7fe9e2e089f4990b7d18d0798f591ab276b15f2b fixes [BZ# 17322]

9 years agoAvoid outputting to TTY after an expected memory corruption in testcase
Tulio Magno Quites Machado Filho [Tue, 2 Jun 2015 13:32:25 +0000 (10:32 -0300)]
Avoid outputting to TTY after an expected memory corruption in testcase

Protect TTY against an expected memory corruption from testcase
tst-malloc-backtrace, which is expected to SIGABRT after a forced memory
corruption.

9 years agoposix_fallocate: Emulation fixes and documentation [BZ #15661]
Florian Weimer [Fri, 5 Jun 2015 08:50:38 +0000 (10:50 +0200)]
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.

9 years agonptl: Rewrite cancellation macros
Adhemerval Zanella [Sun, 28 Sep 2014 11:46:23 +0000 (08:46 -0300)]
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.

9 years agoARM: VDSO support
Nathan Lynch [Thu, 4 Jun 2015 21:10:43 +0000 (21:10 +0000)]
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.

9 years agoUse inline syscalls for non-cancellable versions
Adhemerval Zanella [Wed, 24 Sep 2014 16:38:59 +0000 (13:38 -0300)]
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.

9 years agoFix missing wake-ups in pthread_rwlock_rdlock.
Torvald Riegel [Tue, 28 Apr 2015 21:24:36 +0000 (23:24 +0200)]
Fix missing wake-ups in pthread_rwlock_rdlock.

This adds wake-ups that would be missing if assuming that for a
non-writer-preferring rwlock, if one thread has acquired a rdlock and
does not release it, another thread will eventually acquire a rdlock too
despite concurrent write lock acquisition attempts.  BZ 14958 is about
supporting this assumption.  Strictly speaking, this isn't a valid
test case, but nonetheless worth supporting (see comment 7 of BZ 14958).

9 years agoFix lost wake-up when pthread_rwlock_timedrwlock times out.
Torvald Riegel [Tue, 21 Apr 2015 18:34:21 +0000 (20:34 +0200)]
Fix lost wake-up when pthread_rwlock_timedrwlock times out.

If we set up a rwlock to prefer writers (and disallow recursive rdlock
acquisitions), then readers will block for writers that are blocked to
acquire the lock (otherwise, readers could constantly enter and exit,
and the writer would never get the lock).  However, the existing
implementation did not wake such readers when the writer timed out.
This patch adds the missing wake-up.
There's no similar case for writers being blocked on readers.

9 years agoNaCl: Implement nacl_interface_ext_supply entry point.
Roland McGrath [Wed, 3 Jun 2015 20:51:11 +0000 (13:51 -0700)]
NaCl: Implement nacl_interface_ext_supply entry point.

9 years agoReplace finite with isfinite.
Wilco Dijkstra [Wed, 3 Jun 2015 15:35:44 +0000 (16:35 +0100)]
Replace finite with isfinite.

9 years agoThis patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use...
Wilco Dijkstra [Wed, 3 Jun 2015 14:36:34 +0000 (15:36 +0100)]
This patch renames all uses of __isinf*, __isnan*, __finite* and __signbit* to use standard C99 macros. This has no effect on generated code.

9 years agoFix fnmatch strnlen namespace (bug 18470).
Joseph Myers [Wed, 3 Jun 2015 13:58:58 +0000 (13:58 +0000)]
Fix fnmatch strnlen namespace (bug 18470).

fnmatch brings in references to strnlen, which isn't in all the
standards that contain fnmatch (not added until the 2008 edition of
POSIX), resulting in linknamespace test failures.  (This is contrary
to glibc conventions, rather than a standards conformance issue,
because of the str* reservation.)  This patch fixes this in the usual
way, using __strnlen instead of strnlen.

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

[BZ #18470]
* posix/fnmatch.c (fnmatch) [_LIBC]: Call __strnlen instead of
strnlen.
* conform/Makefile (test-xfail-XPG3/fnmatch.h/linknamespace):
Remove variable.
(test-xfail-XPG4/fnmatch.h/linknamespace): Likewise.
(test-xfail-POSIX/fnmatch.h/linknamespace): Likewise.
(test-xfail-POSIX/glob.h/linknamespace): Likewise.
(test-xfail-POSIX/wordexp.h/linknamespace): Likewise.
(test-xfail-UNIX98/fnmatch.h/linknamespace): Likewise.
(test-xfail-UNIX98/glob.h/linknamespace): Likewise.
(test-xfail-UNIX98/wordexp.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/fnmatch.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/glob.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/wordexp.h/linknamespace): Likewise.

9 years agoFix fnmatch wmemchr namespace (bug 18468).
Joseph Myers [Wed, 3 Jun 2015 13:57:40 +0000 (13:57 +0000)]
Fix fnmatch wmemchr namespace (bug 18468).

fnmatch brings in references to wmemchr, which isn't in all the
standards that contain fnmatch, resulting in linknamespace test
failures.  This patch fixes this in the usual way, making wmemchr into
a weak alias for __wmemchr.

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

[BZ #18468]
* wcsmbs/wmemchr.c (wmemchr): Rename to __wmemchr and define as
weak alias of __wmemchr.  Use libc_hidden_weak.
* include/wchar.h (__wmemchr): Declare.  Use libc_hidden_proto.
* posix/fnmatch.c [HANDLE_MULTIBYTE] (MEMCHR): Use __wmemchr
instead of wmemchr.

9 years agoBZ#18383: Another test case, with TLS refs and defs in separate TUs.
Roland McGrath [Tue, 2 Jun 2015 23:55:36 +0000 (16:55 -0700)]
BZ#18383: Another test case, with TLS refs and defs in separate TUs.

9 years agoUse better variable names in MIPS syscall macros.
Joseph Myers [Tue, 2 Jun 2015 20:38:49 +0000 (20:38 +0000)]
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.

9 years agoUse libc_hidden_proto / libc_hidden_def with __strnlen.
Joseph Myers [Tue, 2 Jun 2015 20:24:25 +0000 (20:24 +0000)]
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.

9 years agoFix fnmatch towlower namespace (bug 18469).
Joseph Myers [Tue, 2 Jun 2015 20:23:09 +0000 (20:23 +0000)]
Fix fnmatch towlower namespace (bug 18469).

fnmatch brings in references to towlower (and thereby towupper), which
isn't in all the standards that contain fnmatch, resulting in
linknamespace test failures.  (This is contrary to glibc conventions,
rather than a standards conformance issue, because of the to*
reservation.)  This patch fixes this in the usual way, making those
functions into weak aliases.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).  This is on top
of <https://sourceware.org/ml/libc-alpha/2015-06/msg00019.html>, but
the two patches should be independent.

(The __attribute_pure__ on the declarations in include/wctype.h comes
from GCC's built-in attributes for towlower and towupper, and is
needed to get the same code generation for fnmatch before and after
the patch.  It seems likely there are cases where the declaration of
__foo in the internal headers is missing attributes from foo in the
public headers, built-in to GCC or both, but I don't know a good way
to detect such missing attributes.)

[BZ #18469]
* wctype/wcfuncs.c (towlower): Rename to __towlower and define as
weak alias of __towlower.  Use libc_hidden_weak.
(towupper): Rename to __towupper and define as weak alias of
__towupper.  Use libc_hidden_weak.
* include/wctype.h (__towlower): Declare.  Use libc_hidden_proto.
(__towupper): Likewise.
* posix/fnmatch.c [HANDLE_MULTIBYTE && _LIBC] (FOLD): Use
__towlower instead of towlower.

9 years agoFix setenv.c diagnostic pragma to be compatible with GCC 4.6
Roland McGrath [Tue, 2 Jun 2015 19:58:45 +0000 (12:58 -0700)]
Fix setenv.c diagnostic pragma to be compatible with GCC 4.6

9 years ago2015-06-02 Szabolcs Nagy <szabolcs.nagy@arm.com>
Wilco Dijkstra [Tue, 2 Jun 2015 09:47:45 +0000 (10:47 +0100)]
2015-06-02  Szabolcs Nagy  <szabolcs.nagy@arm.com>

        * sysdeps/aarch64/libm-test-ulps: Update.

9 years agox86: clock_gettime and timespec_get vDSO cleanup
Adhemerval Zanella [Fri, 17 Apr 2015 17:28:03 +0000 (14:28 -0300)]
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.

9 years agoFix ChangeLog entry
Adhemerval Zanella [Mon, 1 Jun 2015 22:24:25 +0000 (19:24 -0300)]
Fix ChangeLog entry

9 years agoBZ #18116: Mark fixed in NEWS.
Tulio Magno Quites Machado Filho [Mon, 1 Jun 2015 20:03:45 +0000 (17:03 -0300)]
BZ #18116: Mark fixed in NEWS.

9 years agopowerpc: setcontext.S uses power6 mtfsf when not supported [BZ #18116]
Martin Sebor [Mon, 1 Jun 2015 17:12:09 +0000 (14:12 -0300)]
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.

9 years agobenchtest: script to compare two benchmarks
Siddhesh Poyarekar [Mon, 1 Jun 2015 17:44:11 +0000 (23:14 +0530)]
benchtest: script to compare two benchmarks

This script is a sample implementation that uses import_bench to
construct two benchmark objects and compare them.  If detailed timing
information is available (when one does `make DETAILED=1 bench`), it
writes out graphs for all functions it benchmarks and prints
significant differences in timings of the two benchmark runs.  If
detailed timing information is not available, it points out
significant differences in aggregate times.

Call this script as follows:

  compare_bench.py schema_file.json bench1.out bench2.out

Alternatively, if one wants to set a different threshold for warnings
(default is a 10% difference):

  compare_bench.py schema_file.json bench1.out bench2.out 25

The threshold in the example above is 25%.  schema_file.json is the
JSON schema (which is $srcdir/benchtests/scripts/benchout.schema.json
for the benchmark output file) and bench1.out and bench2.out are the
two benchmark output files to compare.

The key functionality here is the compress_timings function which
groups together points that are close together into a single point
that is the mean of all its representative points.  Any point in such
a group is at most 1.5x the smallest point in that group.  The
detailed derivation is a comment in the function.

* benchtests/scripts/compare_bench.py: New file.
* benchtests/scripts/import_bench.py (mean): New function.
(split_list): Likewise.
(do_for_all_timings): Likewise.
(compress_timings): Likewise.

9 years agoNew module to import and process benchmark output
Siddhesh Poyarekar [Mon, 1 Jun 2015 17:43:29 +0000 (23:13 +0530)]
New module to import and process benchmark output

This is the beginning of a module to import and process benchmark
outputs.  The module currently supports importing of a bench.out and
validating it against a schema file.  In future this could grow a set
of routines that benchmark consumers may find useful to build their
own analysis tools.  I have altered validate_bench to use this module
too.

* benchtests/scripts/import_bench.py: New file.
* benchtests/scripts/validate_benchout.py: Import import_bench
instead of jsonschema.
(validate_bench): Remove function.
(main): Use import_bench.

9 years ago * resolv/res_hconf.c (_res_hconf_reorder_addrs): Use a union to
Steve Ellcey [Mon, 1 Jun 2015 16:00:05 +0000 (09:00 -0700)]
* resolv/res_hconf.c (_res_hconf_reorder_addrs): Use a union to
copy data from cur_ifr->ifr_addr and cur_ifr->ifr_netmask.

9 years agoUpdate powerpc-fpu libm-test-ulps.
Adhemerval Zanella [Fri, 29 May 2015 12:40:33 +0000 (12:40 +0000)]
Update powerpc-fpu libm-test-ulps.

9 years agoNaCl: Make thread exit wake pthread_join.
Roland McGrath [Thu, 28 May 2015 22:37:31 +0000 (15:37 -0700)]
NaCl: Make thread exit wake pthread_join.

9 years agoNaCl: Fix lll_futex_timed_wait timeout calculation.
Roland McGrath [Thu, 28 May 2015 22:35:45 +0000 (15:35 -0700)]
NaCl: Fix lll_futex_timed_wait timeout calculation.

9 years agoMake sure that calloc is called at least once
H.J. Lu [Thu, 28 May 2015 12:06:27 +0000 (05:06 -0700)]
Make sure that calloc is called at least once

PLT relocations aren't required when -z now used.  Linker on master with:

commit 25070364b0ce33eed46aa5d78ebebbec6accec7e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat May 16 07:00:21 2015 -0700

    Don't generate PLT relocations for now binding

    There is no need for PLT relocations with -z now. We can use GOT
    relocations, which take less space, instead and replace 16-byte .plt
    entres with 8-byte .plt.got entries.

    bfd/

      * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
      for now binding.
      (elf_i386_allocate_dynrelocs): Use .plt.got section for now
      binding.
      * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
      section for now binding.
      (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
      binding.

won't generate PLT relocations with -z now.  elf/tst-audit2.c expect
certain order of execution in ld.so.  With PLT relocations, the GOTPLT
entry of calloc is update to calloc defined in tst-audit2:

(gdb) bt
    skip_ifunc=<optimized out>, reloc_addr_arg=<optimized out>,
    version=<optimized out>, sym=<optimized out>, map=<optimized out>)
    at ../sysdeps/i386/dl-machine.h:329
out>,
    nrelative=<optimized out>, relsize=<optimized out>,
    reladdr=<optimized out>, map=<optimized out>) at do-rel.h:137
reloc_mode=reloc_mode@entry=0,
    consider_profiling=1, consider_profiling@entry=0) at dl-reloc.c:258
    user_entry=0xffffcf1c, auxv=0xffffd0a8) at rtld.c:2133
    start_argptr=start_argptr@entry=0xffffcfb0,
    dl_main=dl_main@entry=0xf7fda6f0 <dl_main>) at
../elf/dl-sysdep.c:249
   from /export/build/gnu/glibc-32bit/build-i686-linux/elf/ld.so
(gdb)

and then calloc is called:

(gdb) c
Continuing.

Breakpoint 4, calloc (n=n@entry=20, m=4) at tst-audit2.c:18
18 {
(gdb) bt
    reloc_mode=reloc_mode@entry=0, consider_profiling=1,
    consider_profiling@entry=0) at dl-reloc.c:272
    user_entry=0xffffcf1c, auxv=0xffffd0a8) at rtld.c:2133
    start_argptr=start_argptr@entry=0xffffcfb0,
    dl_main=dl_main@entry=0xf7fda6f0 <dl_main>) at
../elf/dl-sysdep.c:249
   from /export/build/gnu/glibc-32bit/build-i686-linux/elf/ld.so
(gdb)

With GOT relocation, calloc in ld.so is called first:

(gdb) bt
    consider_profiling=1) at dl-reloc.c:272
    user_entry=0xffffcf0c, auxv=0xffffd098) at rtld.c:2074
    start_argptr=start_argptr@entry=0xffffcfa0,
    dl_main=dl_main@entry=0xf7fda6c0 <dl_main>) at
../elf/dl-sysdep.c:249
   from /export/build/gnu/glibc-32bit-test/build-i686-linux/elf/ld.so
(gdb)

and then the GOT entry of calloc is updated:

(gdb) bt
    skip_ifunc=<optimized out>, reloc_addr_arg=<optimized out>,
    version=<optimized out>, sym=<optimized out>, map=<optimized out>)
    at ../sysdeps/i386/dl-machine.h:329
out>,
    nrelative=<optimized out>, relsize=<optimized out>,
    reladdr=<optimized out>, map=<optimized out>) at do-rel.h:137
reloc_mode=reloc_mode@entry=0,
    consider_profiling=1, consider_profiling@entry=0) at dl-reloc.c:258
    user_entry=0xffffcf0c, auxv=0xffffd098) at rtld.c:2133
    start_argptr=start_argptr@entry=0xffffcfa0,
    dl_main=dl_main@entry=0xf7fda6c0 <dl_main>) at
../elf/dl-sysdep.c:249
   from /export/build/gnu/glibc-32bit-test/build-i686-linux/elf/ld.so
(gdb)

After that, since calloc isn't called from ld.so nor any other modules,
magic in tst-audit2 isn't updated.  Both orders are correct.  This patch
makes sure that calloc in tst-audit2.c is called at least once from ld.so.

[BZ #18422]
* Makefile ($(objpfx)tst-audit2): Depend on $(libdl).
($(objpfx)tst-audit2.out): Also depend on
$(objpfx)tst-auditmod9b.so.
* elf/tst-audit2.c: Include <dlfcn.h>.
(calloc_called): New.
(calloc): Allow to be called more than once.
(do_test): dllopen/dlclose $ORIGIN/tst-auditmod9b.so.

9 years ago2015-05-28 Wilco Dijkstra <wdijkstr@arm.com>
Wilco Dijkstra [Thu, 28 May 2015 10:42:55 +0000 (11:42 +0100)]
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.

9 years agoFix monetary.h comment
Marko Myllynen [Wed, 27 May 2015 02:37:07 +0000 (08:07 +0530)]
Fix monetary.h comment

On 2015-05-26 21:24, Siddhesh Poyarekar wrote:
> On Tue, May 26, 2015 at 05:13:07PM +0300, Marko Myllynen wrote:
>> this should be obvious, please commit if looks to be ok.
>>
>> 2015-05-26  Marko Myllynen  <myllynen@redhat.com>
>>
>>  * stdlib/monetary.h: Fix comment.
>
> Patch didn't apply to master, but I've fixed it up and pushed it.

sorry about that (a whitespace hickup) - but your patch changed the
wrong comment, so here's a new patch to fix the fix.

9 years agotile: use better variable naming in INLINE_SYSCALL
Chris Metcalf [Wed, 27 May 2015 00:29:56 +0000 (20:29 -0400)]
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.

9 years agoNaCl: Fix thinko in last change.
Roland McGrath [Tue, 26 May 2015 23:11:46 +0000 (16:11 -0700)]
NaCl: Fix thinko in last change.

9 years agoNaCl: Add NaCl-specific __lll_timedlock_wait.
Roland McGrath [Tue, 26 May 2015 22:30:47 +0000 (15:30 -0700)]
NaCl: Add NaCl-specific __lll_timedlock_wait.

9 years agoSplit timed-wait functions out of nptl/lowlevellock.c.
Roland McGrath [Tue, 26 May 2015 21:49:13 +0000 (14:49 -0700)]
Split timed-wait functions out of nptl/lowlevellock.c.

9 years agoConsolidate gettimeofday across aarch64/s390/tile
Adhemerval Zanella [Fri, 17 Apr 2015 14:48:51 +0000 (11:48 -0300)]
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.

9 years agoFix sorting order for Ukrainian locale (BZ 17293)
Andriy Rysin [Tue, 26 May 2015 18:21:18 +0000 (23:51 +0530)]
Fix sorting order for Ukrainian locale (BZ 17293)

In the introduction for the official orthography rules for Ukrainian
language (http://spelling.ulif.org.ua/peredmova.htm) there's a note
that only apostrophe does not affect order of the words when sorting.
As could be seen from the official alphabet the soft sign
(U+044C/U+042C) has its hard position and thus affects the order and
also letters "е" and "є" (CYR-IE: U+0435/U+0415 and UKR-IE:
U+0454/U+0404) have their own positions and should have separate place
when sorting.
This also corresponds to official Unicode collation chart for these
letters: http://unicode.org/charts/collation/chart_Cyrillic.html

9 years agoFix monetary.h comment
Siddhesh Poyarekar [Tue, 26 May 2015 18:08:17 +0000 (23:38 +0530)]
Fix monetary.h comment

9 years agostruct stat is not posix conform
Szabolcs Nagy [Tue, 26 May 2015 16:57:23 +0000 (22:27 +0530)]
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.

9 years agoConsolidate vDSO macros and usage
Adhemerval Zanella [Fri, 17 Apr 2015 13:58:31 +0000 (10:58 -0300)]
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.

9 years agoLocalplt testing for vector math library and libmvec_hidden_* macro series.
Andrew Senkevich [Mon, 25 May 2015 18:20:20 +0000 (21:20 +0300)]
Localplt testing for vector math library and libmvec_hidden_* macro series.

    * elf/Makefile (localplt-built-dso): libmvec added to localplt test.
    * include/libc-symbols.h: libmvec_hidden_* macro series added.

9 years agoDon't issue an error if DT_PLTRELSZ is missing
H.J. Lu [Sat, 23 May 2015 00:46:42 +0000 (17:46 -0700)]
Don't issue an error if DT_PLTRELSZ is missing

A shared object doesn't need PLT if there are no PLT relocations.  It
shouldn't be an error if DT_PLTRELSZ is missing.

[BZ #18410]
* elf/dl-reloc.c (_dl_relocate_object): Don't issue an error
for missing DT_PLTRELSZ.

9 years agoRemove obsolete aliases that broke 'locale -a'
Paul Eggert [Fri, 22 May 2015 21:57:11 +0000 (14:57 -0700)]
Remove obsolete aliases that broke 'locale -a'

[BZ #18412]
* intl/locale.alias: Remove obsolete aliases "bokmål" and "français"
which caused 'locale -a' to output Latin-1 data in UTF-8 locales,
breaking some applications that use 'locale -a' output.
Change the encoding of this file from Latin-1 to ASCII to avoid
other potential problems with people grepping this file.

9 years agoRemove socket.S implementation
Adhemerval Zanella [Fri, 22 May 2015 11:36:08 +0000 (08:36 -0300)]
Remove socket.S implementation

This patch removes the socket.S implementation for all ports and replace
it by a C implementation using socketcall.  For ports that implement
the syscall directly, there is no change.

The patch idea is to simplify the socket function implementation that
uses the socketcall to be based on C implemetation instead of a pseudo
assembly implementation with arch specific parts.  The patch then remove
the assembly implementatation for the ports which uses socketcall
(i386, microblaze, mips, powerpc, sparc, m68k, s390 and sh).

I have cross-build GLIBC for afore-mentioned ports and tested on both
i386 and ppc32 without regressions.

9 years agoFix soft-fp fma for -Wuninitialized.
Joseph Myers [Fri, 22 May 2015 20:28:50 +0000 (20:28 +0000)]
Fix soft-fp fma for -Wuninitialized.

The soft-fp implementations of fma produce -Wuninitialized warnings
because, in the cases where the result is not a nonzero finite value,
the soft-fp does not set the exponent of the result since the (cooked)
packing will do so, but the compiler does not then see that the
exponent is always set in packing before it's used if it wasn't set
earlier.  This patch uses DIAG_* macros to suppress those warnings.

Tested for mips64.  (In fact this allows the mips64 build to complete
with the -Wno-uninitialized removed from math/Makefile, but more
cleanups are still needed in the ldbl-128ibm code for uninitialized
warnings there.)

* soft-fp/fmadf4.c: Include <libc-internal.h>.
(__fma): Ignore uninitialized warnings around packing.
* soft-fp/fmasf4.c: Include <libc-internal.h>.
(__fmaf): Ignore uninitialized warnings around packing.
* soft-fp/fmatf4.c: Include <libc-internal.h>.
(__fmal): Ignore uninitialized warnings around packing.

9 years agoFix ldbl-128 / ldbl-128ibm tanl for -Wuninitialized.
Joseph Myers [Fri, 22 May 2015 20:13:44 +0000 (20:13 +0000)]
Fix ldbl-128 / ldbl-128ibm tanl for -Wuninitialized.

The ldbl-128 and ldbl-128ibm implementations of tanl produce
uninitialized variable warnings with -Wuninitialized because of a
variable that is initialized only conditionally, then used under the
same conditions under which it is set.  This patch uses DIAG_* macros
to suppress those warnings.

Tested for powerpc and mips64.

* sysdeps/ieee754/ldbl-128/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

9 years agoFix ldbl-128 / ldbl-128ibm erfcl for -Wuninitialized
Joseph Myers [Fri, 22 May 2015 17:48:45 +0000 (17:48 +0000)]
Fix ldbl-128 / ldbl-128ibm erfcl for -Wuninitialized

The ldbl-128 and ldbl-128ibm implementations of erfcl produce
uninitialized variable warnings with -Wuninitialized because of switch
statements where in fact one of the cases will always be executed, but
the compiler does not see that these cases cover all possibilities
(and because the reasoning that it does involves inequalities on the
representation of a floating point value leading to a set of possible
values for 8.0 times that value, converted to int, it's highly
nontrivial for the compiler to see that).  This patch fixes those
warnings by converting the last case in those switch statements to a
"default" case.

Tested for powerpc and mips64.

* sysdeps/ieee754/ldbl-128/s_erfl.c (__erfcl): Make case 9 in
switch statement into default case.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfcl): Likewise.

9 years agoFix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized.
Joseph Myers [Fri, 22 May 2015 17:36:52 +0000 (17:36 +0000)]
Fix ldbl-128 / ldbl-128ibm asinl for -Wuninitialized.

The ldbl-128 and ldbl-128ibm implementations of asinl produce
uninitialized variable warnings with -Wuninitialized because the code
for small arguments in fact always returns but the compiler cannot see
this and instead sees that a variable would be uninitialized if the
"if (huge + x > one)" conditional used to force the "inexact"
exception were false.

All the code in libm trying to force "inexact" for functions that are
not exactly defined is suspect and should be removed at some point
given that we now have a clear definition of the accuracy goals for
libm functions which, following C99/C11, does not require anything
about "inexact" for most functions (likewise, the multi-precision code
that tries to give correctly-rounded results, very slowly, for
functions for which the goals clearly do not include correct rounding,
if the faster paths are accurate enough).  However, for now this patch
simply changes the code to use math_force_eval, rather than "if", to
ensure the evaluation of the inexact computation.

Tested for powerpc and mips64.

* sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Don't use
a conditional in forcing "inexact".
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl):
Likewise.

9 years agoFix nptl-init.c use of INTERNAL_SYSCALL_DECL.
Roland McGrath [Fri, 22 May 2015 17:18:17 +0000 (10:18 -0700)]
Fix nptl-init.c use of INTERNAL_SYSCALL_DECL.

9 years agoRestore _POSIX2_C_VERSION definition (bug 438).
Joseph Myers [Fri, 22 May 2015 17:14:04 +0000 (17:14 +0000)]
Restore _POSIX2_C_VERSION definition (bug 438).

My review of conformtest expectations for POSIX showed up that the
_POSIX2_C_VERSION macro, required by POSIX and XPG standards before
2001, was missing in unistd.h, having been removed on 2003-04-03
despite those standards still being supported.  This patch adds it
back.  As it's in the implementation namespace, there's no need for it
to be conditional, and other such macros aren't conditional in this
header either.

Tested for x86_64 and x86 (testsuite).  Note that this *does* change
the installed libraries, because it affects the sysconf support
(present all along) for _SC_2_C_VERSION.

[BZ #438]
* posix/unistd.h (_POSIX2_C_VERSION): New macro.
* conform/Makefile (test-xfail-POSIX/unistd.h/conform): Remove
variable.

9 years agoFix pathconf basename namespace (bug 18444).
Joseph Myers [Fri, 22 May 2015 17:09:36 +0000 (17:09 +0000)]
Fix pathconf basename namespace (bug 18444).

pathconf (sysdeps/unix/sysv/linux/pathconf.c) uses basename.  But
pathconf is in POSIX back to 1990 while basename is only reserved with
external linkage in those standards including XPG functions.  This
patch fixes this namespace issue in the usual way, renaming basename
to __basename and making it into a weak alias.

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

[BZ #18444]
* string/basename.c (basename): Rename to __basename and define as
weak alias of __basename.  Use libc_hidden_weak.
* include/string.h (__basename): Declare.  Use libc_hidden_proto.
* sysdeps/unix/sysv/linux/pathconf.c (distinguish_extX): Call
__basename instead of basename.
* conform/Makefile (test-xfail-POSIX2008/unistd.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K8/unistd.h/linknamespace): Likewise.

9 years agoFix indentation to match nesting in previous commit
Florian Weimer [Fri, 22 May 2015 11:35:45 +0000 (13:35 +0200)]
Fix indentation to match nesting in previous commit

9 years agoAvoid some aliasing violations in libio
Florian Weimer [Mon, 18 May 2015 11:58:54 +0000 (13:58 +0200)]
Avoid some aliasing violations in libio

9 years agoFix lgamma implementations for -Wuninitialized.
Joseph Myers [Thu, 21 May 2015 23:44:33 +0000 (23:44 +0000)]
Fix lgamma implementations for -Wuninitialized.

If you remove the "override CFLAGS += -Wno-uninitialized" in
math/Makefile, you get errors from lgamma implementations of the form:

../sysdeps/ieee754/dbl-64/e_lgamma_r.c: In function '__ieee754_lgamma_r':
../sysdeps/ieee754/dbl-64/e_lgamma_r.c:297:13: error: 'nadj' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if(hx<0) r = nadj - r;

This is one of the standard kinds of false positive uninitialized
warnings: nadj is set under a certain condition, and then later used
under the same condition.  This patch uses DIAG_* macros to suppress
the warning on the use of nadj.  The ldbl-128 / ldbl-128ibm
implementation has a substantially different structure that avoids
this issue.

Tested for x86_64.  (In fact this patch eliminates the need for that
-Wno-uninitialized on x86_64, but I want to test on more architectures
before removing it.)

* sysdeps/ieee754/dbl-64/e_lgamma_r.c: Include <libc-internal.h>.
(__ieee754_lgamma_r): Ignore uninitialized warnings around use of
NADJ.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c: Include <libc-internal.h>.
(__ieee754_lgammaf_r): Ignore uninitialized warnings around use of
NADJ.
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c: Include <libc-internal.h>.
(__ieee754_lgammal_r): Ignore uninitialized warnings around use of
NADJ.

9 years agoFix sysdeps/ieee754/dbl-64/mpa.c for -Wuninitialized.
Joseph Myers [Thu, 21 May 2015 23:05:45 +0000 (23:05 +0000)]
Fix sysdeps/ieee754/dbl-64/mpa.c for -Wuninitialized.

If you remove the "override CFLAGS += -Wno-uninitialized" in
math/Makefile, one of the errors you get is:

../sysdeps/ieee754/dbl-64/mpa.c: In function '__mp_dbl.part.0':
../sysdeps/ieee754/dbl-64/mpa.c:183:5: error: 'c' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   c *= X[0];

The problem is that the p < 5 case initializes c if p is 1, 2, 3 or 4
but not otherwise, and in fact p is positive for all calls to this
function so the uninitialized case can't actually occur.  This patch
replaces the "if (p == 4)" last case with a comment so the compiler
can see that all paths do initialize c.

Tested for x86_64.

* sysdeps/ieee754/dbl-64/mpa.c (norm): Remove if condition on
(p == 4) case.

9 years agolinknamespace: whitelist re_syntax_options.
Joseph Myers [Thu, 21 May 2015 16:24:24 +0000 (16:24 +0000)]
linknamespace: whitelist re_syntax_options.

This patch adds re_syntax_options (bug 18442) to the set of symbols
that are whitelisted in the linknamespace tests because, while the
references to them are genuine bugs that should be fixed, the
involvement of data symbols makes them harder to fix than most such
bugs.

Tested for x86_64 and x86.

* conform/linknamespace.pl (@whitelist): Add re_syntax_options.
* conform/Makefile (test-xfail-UNIX98/regex.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/regex.h/linknamespace): Likewise.
(test-xfail-POSIX2008/regex.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/regex.h/linknamespace): Likewise.

9 years agovfprintf: Remove label name switching for the jump table
Florian Weimer [Thu, 21 May 2015 14:48:46 +0000 (15:48 +0100)]
vfprintf: Remove label name switching for the jump table

Different labels are no longer needed because the tables are now in
separate functions.

9 years agovfprintf: Introduce printf_positional function
Florian Weimer [Thu, 21 May 2015 14:46:46 +0000 (15:46 +0100)]
vfprintf: Introduce printf_positional function

This splits a considerable chunk of code from the main vfprintf
function.  This will make it easier to remove the use of extend_alloca
from the positional argument handling code.

9 years agovfprintf: Move jump table definition and the macros out of function
Florian Weimer [Thu, 21 May 2015 14:45:09 +0000 (15:45 +0100)]
vfprintf: Move jump table definition and the macros out of function

The second jump table will be moved to a separate function
in the next commit.

9 years agoAdd sprintf benchmark.
Carlos O'Donell [Thu, 21 May 2015 14:01:34 +0000 (10:01 -0400)]
Add sprintf benchmark.

Tests position and non-positional arguments with two
test string.

9 years agoSimplify handling of nameserver configuration in resolver
Andreas Schwab [Thu, 19 Feb 2015 14:52:08 +0000 (15:52 +0100)]
Simplify handling of nameserver configuration in resolver

Remove use of ext.nsmap member of struct __res_state and always use
an identity mapping betwen the nsaddr_list array and the ext.nsaddrs
array.  The fact that a nameserver has an IPv6 address is signalled by
setting nsaddr_list[].sin_family to zero.

This page took 0.153738 seconds and 5 git commands to generate.