external/glibc.git
9 years agoS390: Regenerate ULPs.
Stefan Liebler [Tue, 7 Jul 2015 14:11:14 +0000 (16:11 +0200)]
S390: Regenerate ULPs.

Regenerated ulps after recent changes.
Tested on s390/s390x.
All math-tests passes on s390 after this patch.

ChangeLog:

* sysdeps/s390/fpu/libm-test-ulps: Regenerated.

9 years agoS390: Fix sem.h conformance test failures.
Stefan Liebler [Tue, 7 Jul 2015 14:11:14 +0000 (16:11 +0200)]
S390: Fix sem.h conformance test failures.

On s390 the following tests are failing due to unkown types time_t, pid_t:
FAIL: conform/UNIX98/sys/sem.h/conform
FAIL: conform/XOPEN2K/sys/sem.h/conform
FAIL: conform/XOPEN2K8/sys/sem.h/conform
FAIL: conform/XPG3/sys/sem.h/conform
FAIL: conform/XPG4/sys/sem.h/conform

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

ChangeLog:

* sysdeps/unix/sysv/linux/s390/bits/sem.h:
Include sys/types.h instead of bits/types.h.
Remove inclusion of bits/wordsize.h.

9 years agoAdd la_symbind32 to x86-64 audit tests
H.J. Lu [Tue, 7 Jul 2015 13:09:29 +0000 (06:09 -0700)]
Add la_symbind32 to x86-64 audit tests

la_symbind32 is used for x32 in x86-64 audit tests.  We should define
both la_symbind32 and la_symbind64 in x86-64 audit tests.

* sysdeps/x86_64/tst-auditmod10b.c (la_symbind32): New.
* sysdeps/x86_64/tst-auditmod4b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod5b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod6b.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod6c.c (la_symbind32): Likewise.
* sysdeps/x86_64/tst-auditmod7b.c (la_symbind32): Likewise.

9 years agoAdd and use sysdeps/i386/link-defines.sym
H.J. Lu [Tue, 7 Jul 2015 12:23:24 +0000 (05:23 -0700)]
Add and use sysdeps/i386/link-defines.sym

Define macros for fields in La_i86_regs and La_i86_retval and use them
in dl-trampoline.S, instead of hardcoded values.

* sysdeps/i386/Makefile (gen-as-const-headers)[elf]: Add
link-defines.sym.
* sysdeps/i386/dl-trampoline.S: Include <link-defines.h>.
(_dl_runtime_profile): Use LONG_DOUBLE_SIZE, LRV_SIZE,
LRV_EAX_OFFSET, LRV_EDX_OFFSET, LRV_ST0_OFFSET, LRV_ST1_OFFSET
and LR_SIZE.
* sysdeps/i386/link-defines.sym: New file.

9 years agoAdd a testcase for i386 LD_AUDIT
H.J. Lu [Tue, 7 Jul 2015 12:09:16 +0000 (05:09 -0700)]
Add a testcase for i386 LD_AUDIT

This patch adds a testcase for i386 LD_AUDIT to check function return
and parameters passed in registers.

* sysdeps/i386/Makefile (tests)[elf]: Add tst-audit3.
(modules-names): Add tst-auditmod3a tst-auditmod3b.
($(objpfx)tst-audit3): New rule.
($(objpfx)tst-audit3.out): Likewise.
* sysdeps/i386/tst-audit3.c: New file.
* sysdeps/i386/tst-audit3.h: Likewise.
* sysdeps/i386/tst-auditmod3a.c: Likewise.
* sysdeps/i386/tst-auditmod3b.c: Likewise.

9 years agoDo not create invalid pointers in C code of string functions.
Torvald Riegel [Fri, 3 Jul 2015 18:35:26 +0000 (20:35 +0200)]
Do not create invalid pointers in C code of string functions.

Some of the x86 string functions create pointers based on input strings
that may be outside of the input strings.  When this happens in C code,
the compiler can potentially detect this, leading to warnings in
application code when those string functions are inlined.  Perform those
operations in the assembly code instead of the C code to fix this.

9 years agoUpdate NEWS
Andreas Schwab [Tue, 7 Jul 2015 10:29:14 +0000 (12:29 +0200)]
Update NEWS

9 years agoSet errno to ENOMEM on overflow in sbrk (bug 18592)
Cyril Hrubis [Wed, 20 May 2015 11:50:00 +0000 (13:50 +0200)]
Set errno to ENOMEM on overflow in sbrk (bug 18592)

9 years agoInline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions.
Wilco Dijkstra [Mon, 6 Jul 2015 11:43:31 +0000 (12:43 +0100)]
Inline __ieee754_sqrt and __ieee754_sqrtf. Also add external definitions.

9 years agoRemove unused file sysdeps/ieee754/support.c
Wilco Dijkstra [Thu, 4 Jun 2015 12:11:43 +0000 (13:11 +0100)]
Remove unused file sysdeps/ieee754/support.c

9 years ago[AArch64] make setcontext etc functions consistent with the kernel
Szabolcs Nagy [Mon, 6 Jul 2015 11:46:43 +0000 (12:46 +0100)]
[AArch64] make setcontext etc functions consistent with the kernel

since
https://sourceware.org/ml/libc-alpha/2014-04/msg00006.html
setcontext etc is no longer tied to the kernel use of ucontext.

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

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

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

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

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

current:

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

fixed:

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

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

* sysdeps/unix/sysv/linux/aarch64/getcontext.S (__getcontext): Use q
registers instead of d ones so the layout is kernel abi compatible.
* sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext): Likewise.
* sysdeps/unix/sysv/linux/aarch64/swapcontext.S (__swapcontext):
Likewise.# Please enter the commit message for your changes. Lines starting

9 years agoRegenerate aarch64 libm-test-ulps
Szabolcs Nagy [Thu, 2 Jul 2015 13:58:12 +0000 (14:58 +0100)]
Regenerate aarch64 libm-test-ulps

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

9 years agoFix ldbl-128 expm1l (-min_subnorm) result sign (bug 18619).
Joseph Myers [Wed, 1 Jul 2015 22:27:49 +0000 (22:27 +0000)]
Fix ldbl-128 expm1l (-min_subnorm) result sign (bug 18619).

In the ldbl-128 implementation of expm1l, when expm1l's result should
underflow to 0 (argument minus the least subnormal, in some rounding
modes), it can be a zero of the wrong sign.  This patch fixes this in
the same way previously used for the x86 / x86_64 versions.

Tested for mips64.

[BZ #18619]
* sysdeps/ieee754/ldbl-128/s_expm1l.c (__expm1l): Force underflow
and return argument in case of subnormal argument.

9 years agoThe C++ 2011 std::call_once function is specified to allow
Martin Sebor [Wed, 1 Jul 2015 20:05:27 +0000 (14:05 -0600)]
The C++ 2011 std::call_once function is specified to allow
the initialization routine to exit by throwing an exception.
Such an execution, termed exceptional, requires call_once to
propagate the exception to its caller.  A program may contain
any number of exceptional executions but only one returning
execution (which, if it exists, must be the last execution
with the same once flag).

On POSIX systems such as Linux, std::call_once is implemented
in terms of pthread_once.  However, as discussed in libstdc++
bug 66146 - "call_once not C++11-compliant on ppc64le," GLIBC's
pthread_once hangs when the initialization function exits by
throwing an exception on at least arm and ppc64 (though
apparently not on x86_64).  This effectively prevents call_once
from conforming to the C++ requirements since there doesn't
appear to be a thread-safe way to work around this problem in
libstdc++.

This patch changes pthread_once to handle gracefully init
functions that exit by throwing exceptions. It was successfully
tested on ppc64, ppc64le, and x86_64.

        [BZ #18435]
        * nptl/Makefile: Add tst-once5.cc.
        * nptl/pthreadP.h (pthread_cleanup_push, pthread_cleanup_pop):
        Remove macro redefinitions.
        * nptl/tst-once5.cc: New test.

9 years agoRegenerate powerpc-nofpu libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 18:04:28 +0000 (18:04 +0000)]
Regenerate powerpc-nofpu libm-test-ulps.

* sysdeps/powerpc/nofpu/libm-test-ulps: Regenerated.

9 years agoRegenerate ARM libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 17:50:15 +0000 (17:50 +0000)]
Regenerate ARM libm-test-ulps.

* sysdeps/arm/libm-test-ulps: Regenerated.

9 years agoRegenerate MIPS libm-test-ulps.
Joseph Myers [Wed, 1 Jul 2015 17:24:37 +0000 (17:24 +0000)]
Regenerate MIPS libm-test-ulps.

* sysdeps/mips/mips32/libm-test-ulps: Regenerated.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.

9 years agoRemove documentation of lowlevellock systemtap probes.
Torvald Riegel [Tue, 30 Jun 2015 15:05:44 +0000 (17:05 +0200)]
Remove documentation of lowlevellock systemtap probes.

The probes are not provided on all architectures (and only partially by the
x86 assembly implementation), and we are not aware of actual uses of these
probes.
a need for them.

9 years agoClean up BUSY_WAIT_NOP and atomic_delay.
Torvald Riegel [Tue, 23 Jun 2015 13:22:25 +0000 (15:22 +0200)]
Clean up BUSY_WAIT_NOP and atomic_delay.

This patch combines BUSY_WAIT_NOP and atomic_delay into a new
atomic_spin_nop function and adjusts all clients.  The new function is
put into atomic.h because what is best done in a spin loop is
architecture-specific, and atomics must be used for spinning.  The
function name is meant to tell users that this has no effect on
synchronization semantics but is a performance aid for spinning.

9 years agoImprove tgamma accuracy (bug 18613).
Joseph Myers [Mon, 29 Jun 2015 23:29:35 +0000 (23:29 +0000)]
Improve tgamma accuracy (bug 18613).

In non-default rounding modes, tgamma can be slightly less accurate
than permitted by glibc's accuracy goals.

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

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

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

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

Tested for x86_64, x86, mips64 and powerpc.

[BZ #18613]
* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Take log of
X_ADJ not X when adjusting exponent.
(__ieee754_gamma_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Take log
of X_ADJ not X when adjusting exponent.
(__ieee754_gammaf_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive): Take
log of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive): Take
log of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive): Take log
of X_ADJ not X when adjusting exponent.
(__ieee754_gammal_r): Do intermediate computations in
round-to-nearest then adjust overflowing and underflowing results
as needed.  Use 1.0L not 1.0f as numerator of division.
* math/libm-test.inc (tgamma_test_data): Remove one test.  Moved
to auto-libm-test-in.
(tgamma_test): Use ALL_RM_TEST.
* math/auto-libm-test-in: Add one test of tgamma.  Mark some other
tests of tgamma with spurious-overflow.
* math/auto-libm-test-out: Regenerated.
* math/gen-libm-have-vector-test.sh: Do not check for START.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoFix ldbl-128 j1l spurious underflows (bug 18612).
Joseph Myers [Mon, 29 Jun 2015 17:51:32 +0000 (17:51 +0000)]
Fix ldbl-128 j1l spurious underflows (bug 18612).

The ldbl-128 implementation of j1l produces spurious underflow
exceptions for some small arguments, as a result of squaring the
argument.  This patch fixes it just to use a linear approximation for
sufficiently small arguments, and then to force an underflow exception
only in the cases where it is required.

Tested for mips64.

[BZ #18612]
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): For small
arguments, just return 0.5 times the argument, with underflow
forced as needed.
* math/auto-libm-test-in: Add more tests of j1.
* math/auto-libm-test-out: Regenerated.

9 years agoFix j1, jn missing underflows (bug 16559).
Joseph Myers [Mon, 29 Jun 2015 16:52:16 +0000 (16:52 +0000)]
Fix j1, jn missing underflows (bug 16559).

Similar to various other bugs in this area, j1 and jn implementations
can fail to raise the underflow exception when the internal
computation is exact although the actual function is inexact.  This
patch forces the exception in a similar way to other such fixes.  (The
ldbl-128 / ldbl-128ibm j1l implementation is different and doesn't
need a change for this until spurious underflows in it are fixed.)

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16559]
* sysdeps/ieee754/dbl-64/e_j1.c: Include <float.h>.
(__ieee754_j1): Force underflow exception for small results.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c: Include <float.h>.
(__ieee754_j1f): Force underflow exception for small results.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_j1l.c: Include <float.h>.
(__ieee754_j1l): Force underflow exception for small results.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* math/auto-libm-test-in: Add more tests of j1 and jn.
* math/auto-libm-test-out: Regenerated.

9 years agoUpdate headers for Linux 4.0, 4.1 definitions.
Joseph Myers [Mon, 29 Jun 2015 14:38:46 +0000 (14:38 +0000)]
Update headers for Linux 4.0, 4.1 definitions.

This patch updates installed glibc headers for new definitions from
Linux 4.0 and 4.1 that seem relevant to glibc headers.  In addition, I
noticed that PF_IB / AF_IB, added in Linux 3.11, were missing for no
obvious reason, so added those as well.

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

* sysdeps/unix/sysv/linux/bits/in.h (IP_CHECKSUM): New macro.
* sysdeps/unix/sysv/linux/bits/socket.h (PF_IB): Likewise.
(PF_MPLS): Likewise.
(AF_IB): Likewise.
(AF_MPLS): Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h (MS_LAZYTIME): New enum
value and macro.
(MS_RMT_MASK): Include MS_LAZYTIME.

9 years agomalloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE [BZ #18502]
Mel Gorman [Mon, 8 Jun 2015 12:36:13 +0000 (13:36 +0100)]
malloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE [BZ #18502]

mksquashfs was reported in openSUSE to be causing segmentation faults when
creating installation images. Testing showed that mksquashfs sometimes
failed and could be reproduced within 10 attempts. The core dump looked
like the heap top was corrupted and was pointing to an unmapped area. In
other cases, this has been due to an application corrupting glibc structures
but mksquashfs appears to be fine in this regard.

The problem is that heap_trim is "growing" the top into unmapped space.
If the top chunk == MINSIZE then top_area is -1 and this check does not
behave as expected due to a signed/unsigned comparison

  if (top_area <= pad)
    return 0;

The next calculation extra = ALIGN_DOWN(top_area - pad, pagesz) calculates
extra as a negative number which also is unnoticed due to a signed/unsigned
comparison. We then call shrink_heap(heap, negative_number) which crashes
later. This patch adds a simple check against MINSIZE to make sure extra
does not become negative. It adds a cast to hint to the reader that this
is a signed vs unsigned issue.

Without the patch, mksquash fails within 10 attempts. With it applied, it
completed 1000 times without error. The standard test suite "make check"
showed no changes in the summary of test results.

9 years agoAdd support for DT_MIPS_RLD_MAP_REL.
Matthew Fortune [Thu, 11 Jun 2015 09:43:48 +0000 (10:43 +0100)]
Add support for DT_MIPS_RLD_MAP_REL.

This tag allows debugging of MIPS position independent executables
and provides access to shared library information.

* elf/elf.h (DT_MIPS_RLD_MAP_REL): New macro.
(DT_MIPS_NUM): Update.
* sysdeps/mips/dl-machine.h (ELF_MACHINE_DEBUG_SETUP): Handle
DT_MIPS_RLD_MAP_REL.

9 years agoUse round-to-nearest internally in jn, test with ALL_RM_TEST (bug 18602).
Joseph Myers [Thu, 25 Jun 2015 21:46:02 +0000 (21:46 +0000)]
Use round-to-nearest internally in jn, test with ALL_RM_TEST (bug 18602).

Some existing jn tests, if run in non-default rounding modes, produce
errors above those accepted in glibc, which causes problems for moving
tests of jn to use ALL_RM_TEST.  This patch makes jn set rounding
to-nearest internally, as was done for yn some time ago, then computes
the appropriate underflowing value for results that underflowed to
zero in to-nearest, and moves the tests to ALL_RM_TEST.  It does
nothing about the general inaccuracy of Bessel function
implementations in glibc, though it should make jn more accurate on
average in non-default rounding modes through reduced error
accumulation.  The recomputation of results that underflowed to zero
should as a side-effect fix some cases of bug 16559, where jn just
used an exact zero, but that is *not* the goal of this patch and other
cases of that bug remain unfixed.

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

Tested for x86_64, x86, powerpc and mips64.

[BZ #16559]
[BZ #18602]
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Set
round-to-nearest internally then recompute results that
underflowed to zero in the original rounding mode.
* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_jnf): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise
* math/libm-test.inc (jn_test): Use ALL_RM_TEST.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoMore correct description of linking with vector math library.
Andrew Senkevich [Thu, 25 Jun 2015 16:46:50 +0000 (19:46 +0300)]
More correct description of linking with vector math library.

    * NEWS: Fixed description of link with vector math library.

9 years agoFix buffer overflow for writes to memory buffer stream (bug 18549)
Andreas Schwab [Thu, 25 Jun 2015 09:53:06 +0000 (11:53 +0200)]
Fix buffer overflow for writes to memory buffer stream (bug 18549)

9 years agoSupport compilers defaulting to PIE
H.J. Lu [Thu, 25 Jun 2015 09:37:04 +0000 (02:37 -0700)]
Support compilers defaulting to PIE

To support building glibc with GCC 6 configured with --enable-default-pie,
which generates PIE by default, we need to build programs as PIE.  But
elf/tst-dlopen-aout must not be built as PIE since it tests dlopen on
ET_EXEC file and PIE is ET_DYN.

[BZ #17841]
* Makeconfig (no-pie-ldflag): New.
(+link): Set to $(+link-pie) if default to PIE.
(+link-tests): Set to $(+link-pie-tests) if default to PIE.
* config.make.in (build-pie-default): New.
* configure.ac (libc_cv_pie_default): New.  Set to yes if -fPIE
is default.  AC_SUBST.
* configure: Regenerated.
* elf/Makefile (LDFLAGS-tst-dlopen-aout): New.

9 years agoNPTL: Use unsigned type for setxid_futex.
Roland McGrath [Thu, 25 Jun 2015 01:09:32 +0000 (18:09 -0700)]
NPTL: Use unsigned type for setxid_futex.

9 years agoUse unsigned types for counters in getaddrinfo_a code.
Roland McGrath [Thu, 25 Jun 2015 00:58:12 +0000 (17:58 -0700)]
Use unsigned types for counters in getaddrinfo_a code.

9 years agoUse unsigned types for counters in AIO code.
Roland McGrath [Thu, 25 Jun 2015 00:43:32 +0000 (17:43 -0700)]
Use unsigned types for counters in AIO code.

9 years agoAlign TCB offset to the maximum alignment
H.J. Lu [Thu, 7 May 2015 20:26:34 +0000 (13:26 -0700)]
Align TCB offset to the maximum alignment

We need to align TCB offset to the maximum alignment for TLS_TCB_AT_TP
targets, as _dl_allocate_tls_storage (in elf/dl-tls.c) does using
__libc_memalign and dl_tls_static_align.

[BZ #18383]
* csu/libc-tls.c (__libc_setup_tls) [TLS_TCB_AT_TP]: Align
TCB_OFFSET to MAX_ALIGN, not just TCBALIGN.  Add comment.
* elf/Makefile (test-xfail-tst-tlsalign{,-static}): Remove
comment for i386/x86-64.
(test-xfail-tst-tlsalign-extern-static): Removed.

9 years agoRefactor libm tests.
Joseph Myers [Wed, 24 Jun 2015 23:27:18 +0000 (23:27 +0000)]
Refactor libm tests.

This patch refactors the libm tests using libm-test.inc to reduce the
level of duplicate definitions.  New headers are created for the
definitions shared by tests for a particular type; by tests of inline
functions; by tests of non-inline functions; by scalar tests; and by
vector tests.  The unused MATHCONST macro is removed.  A new macro
VEC_LEN is added to the vector headers to allow the macros defining
wrappers for vector functions to be defined once, instead of six times
each (differing only in vector length) as before.  There is still
scope for further refactoring, but this seems a useful start.

Tested for x86_64.

* math/test-double.h: New file.
* math/test-float.h: Likewise.
* math/test-ldouble.h: Likewise.
* math/test-math-inline.h: Likewise.
* math/test-math-no-inline.h: Likewise.
* math/test-math-scalar.h: Likewise.
* math/test-math-vector.h: Likewise.
* math/test-vec-loop.h: Remove file.  Contents moved into
test-math-vector.h.
* math/libm-test.inc (MATHCONST): Do not document macro.
* math/test-double.c: Include test-double.h, test-math-no-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-float.c: Include test-float.h, test-math-no-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-idouble.c: Include test-double.h, test-math-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ifloat.c: Include test-float.h, test-math-inline.h and
test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ildoubl.c: Include test-ldouble.h, test-math-inline.h
and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_LDOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(TEST_INLINE): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-ldouble.c: Include test-ldouble.h,
test-math-no-inline.h and test-math-scalar.h.
(FUNC): Remove macro.
(FUNC_TEST): Likewise.
(FLOAT): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_LDOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
* math/test-double-vlen2.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-double-vlen4.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-double-vlen8.h: Include test-double.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_DOUBLE): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen4.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen8.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* math/test-float-vlen16.h: Include test-float.h,
test-math-no-inline.h and test-math-vector.h.
(FLOAT): Remove macro.
(FUNC): Likewise.
(MATHCONST): Likewise.
(PRINTF_EXPR): Likewise.
(PRINTF_XEXPR): Likewise.
(PRINTF_NEXPR): Likewise.
(TEST_FLOAT): Likewise.
(TEST_MATHVEC): Likewise.
(__NO_MATH_INLINES): Likewise.
(CNCT): Likewise.
(CONCAT): Likewise.
(WRAPPER_NAME): Likewise.
(WRAPPER_DECL): Likewise.
(WRAPPER_DECL_ff): Likewise.
(WRAPPER_DECL_fFF): Likewise.
(VECTOR_WRAPPER): Likewise.
(VECTOR_WRAPPER_ff): Likewise.
(VECTOR_WRAPPER_fFF): Likewise.
(VEC_LEN): New macro.
* sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Do not include
test-vec-loop.h.
* sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
* sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Likewise.

9 years agoNaCl: Fix glob.c build after getlogin_r -> __getlogin_r.
Roland McGrath [Wed, 24 Jun 2015 22:29:53 +0000 (15:29 -0700)]
NaCl: Fix glob.c build after getlogin_r -> __getlogin_r.

9 years agoFix cexp, ccos, ccosh, csin, csinh spurious underflows (bug 18594).
Joseph Myers [Wed, 24 Jun 2015 21:04:51 +0000 (21:04 +0000)]
Fix cexp, ccos, ccosh, csin, csinh spurious underflows (bug 18594).

cexp, ccos, ccosh, csin and csinh have spurious underflows in cases
where they compute sin of the smallest normal, that produces an
underflow exception (depending on which sin implementation is in use)
but the final result does not underflow.  ctan and ctanh may also have
such underflows, or they may be latent (the issue there is that
e.g. ctan (DBL_MIN) should, rounded upwards, be the next double value
above DBL_MIN, which under glibc's accuracy goals may not have an
underflow exception, but the intermediate computation of sin (DBL_MIN)
would legitimately underflow on before-rounding architectures).

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

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

Tested for x86_64 and x86 and ulps updated accordingly.

[BZ #18594]
* math/s_ccosh.c (__ccosh): Compare with least normal value
instead of comparing class with FP_SUBNORMAL.
* math/s_ccoshf.c (__ccoshf): Likewise.
* math/s_ccoshl.c (__ccoshl): Likewise.
* math/s_cexp.c (__cexp): Likewise.
* math/s_cexpf.c (__cexpf): Likewise.
* math/s_cexpl.c (__cexpl): Likewise.
* math/s_csin.c (__csin): Likewise.
* math/s_csinf.c (__csinf): Likewise.
* math/s_csinh.c (__csinh): Likewise.
* math/s_csinhf.c (__csinhf): Likewise.
* math/s_csinhl.c (__csinhl): Likewise.
* math/s_csinl.c (__csinl): Likewise.
* math/s_ctan.c (__ctan): Likewise.
* math/s_ctanf.c (__ctanf): Likewise.
* math/s_ctanh.c (__ctanh): Likewise.
* math/s_ctanhf.c (__ctanhf): Likewise.
* math/s_ctanhl.c (__ctanhl): Likewise.
* math/s_ctanl.c (__ctanl): Likewise.
* math/auto-libm-test-in: Add more tests of ccos, ccosh, cexp,
csin, csinh, ctan and ctanh.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (cexp_test): Use ALL_RM_TEST.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoPrint more information in tst-getcpu failure case.
Roland McGrath [Wed, 24 Jun 2015 20:56:46 +0000 (13:56 -0700)]
Print more information in tst-getcpu failure case.

9 years agoLine-wrap some log entries.
Roland McGrath [Wed, 24 Jun 2015 20:00:29 +0000 (13:00 -0700)]
Line-wrap some log entries.

9 years agoDon't issue errors on GDB Python files
H.J. Lu [Wed, 24 Jun 2015 10:21:29 +0000 (03:21 -0700)]
Don't issue errors on GDB Python files

Many packages, including GCC, install Python files for GDB in library
diretory. ldconfig reads them and issue errors since they aren't ELF
files:

ldconfig: /usr/gcc-5.1.1/lib/libstdc++.so.6.0.21-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

ldconfig: /usr/gcc-5.1.1/libx32/libstdc++.so.6.0.21-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

ldconfig: /usr/gcc-5.1.1/lib64/libstdc++.so.6.0.21-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

This patch silences ldconfig on GDB Python files by checking filenames
with -gdb.py suffix.

[BZ #18585]
* elf/readlib.c (is_gdb_python_file): New.
(process_file): Don't issue errors on filenames with -gdb.py
suffix.

9 years agoMove csin, csinh tests to auto-libm-test-in.
Joseph Myers [Wed, 24 Jun 2015 16:37:44 +0000 (16:37 +0000)]
Move csin, csinh tests to auto-libm-test-in.

This patch moves most tests of csin and csinh with finite inputs from
libm-test.inc to auto-libm-test-in.  The remaining two tests of each
function with small arguments are not moved because moving them causes
the time required by gen-auto-libm-tests to go up from under 8 seconds
to over 11 minutes for me.  (The current development version of MPC
has had speed improvements for mpc_sin for some time, but there hasn't
been a release containing those improvements yet.)

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of csin and csinh.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (csin_test_data): Remove tests moved to
auto-libm-test-in.
(csinh_test_data): Likewise.

9 years agoFix csin, csinh overflow in directed rounding modes (bug 18593).
Joseph Myers [Wed, 24 Jun 2015 16:20:48 +0000 (16:20 +0000)]
Fix csin, csinh overflow in directed rounding modes (bug 18593).

csin and csinh can produce bad results when overflowing in directed
rounding modes, because a multiplication that can overflow is followed
by a possible negation.  This patch fixes this by negating one of the
arguments of the multiplication before the multiplication instead of
negating the result.

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

Tested for x86_64 and x86 and ulps updated accordingly.

[BZ #18593]
* math/s_csin.c (__csin): Negate before rather than after possibly
overflowing multiplication.
* math/s_csinf.c (__csinf): Likewise.
* math/s_csinh.c (__csinh): Likewise.
* math/s_csinhf.c (__csinhf): Likewise.
* math/s_csinhl.c (__csinhl): Likewise.
* math/s_csinl.c (__csinl): Likewise.
* math/auto-libm-test-in: Add some tests of csin and csinh.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (csin_test_data): Use AUTO_TESTS_c_c.
(csinh_test_data): Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.

9 years agoFix ldbl-128 expl missing underflows (bug 18586).
Joseph Myers [Wed, 24 Jun 2015 15:12:03 +0000 (15:12 +0000)]
Fix ldbl-128 expl missing underflows (bug 18586).

Similar to various other bugs in this area, the ldbl-128 expl
implementation does not raise the underflow exception for all
subnormal results, if the scaling down is exact although the actual
result is inexact.  This patch fixes this by forcing the exception in
this case (the tests that failed before and pass after the test are
already in the testsuite).

Tested for mips64.

[BZ #18586]
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Force
underflow exception for small results.

9 years agoCombination of data tables for x86_64 vector functions sinf, cosf and sincosf.
Andrew Senkevich [Wed, 24 Jun 2015 14:44:35 +0000 (17:44 +0300)]
Combination of data tables for x86_64 vector functions sinf, cosf and sincosf.

    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Fixed files list.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core_sse4.S: Renamed variable
    and included header.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_trig_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_trig_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.S: Removed file.
    * sysdeps/x86_64/fpu/svml_s_cosf_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sinf_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.h: Likewise.

9 years agoFix sin, sincos missing underflows (bug 16526, bug 16538).
Joseph Myers [Tue, 23 Jun 2015 22:24:20 +0000 (22:24 +0000)]
Fix sin, sincos missing underflows (bug 16526, bug 16538).

Similar to various other bugs in this area, some sin and sincos
implementations do not raise the underflow exception for subnormal
arguments, when the result is tiny and inexact.  This patch forces the
exception in a similar way to previous fixes.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16526]
[BZ #16538]
* sysdeps/ieee754/dbl-64/s_sin.c: Include <float.h>.
(__sin): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/flt-32/k_sinf.c: Include <float.h>.
(__kernel_sinf): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128/k_sincosl.c: Include <float.h>.
(__kernel_sincosl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128/k_sinl.c: Include <float.h>.
(__kernel_sinl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: Include <float.h>.
(__kernel_sincosl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128ibm/k_sinl.c: Include <float.h>.
(__kernel_sinl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-96/k_sinl.c: Include <float.h>.
(__kernel_sinl): Force underflow exception for arguments with
small absolute value.
* sysdeps/powerpc/fpu/k_sinf.c: Include <float.h>.
(__kernel_sinf): Force underflow exception for arguments with
small absolute value.
* math/auto-libm-test-in: Add more tests of sin and sincos.
* math/auto-libm-test-out: Regenerated.

9 years agoFix spurious "inexact" exceptions from __kernel_standard_l (bug 18245, bug 18583).
Joseph Myers [Tue, 23 Jun 2015 17:26:46 +0000 (17:26 +0000)]
Fix spurious "inexact" exceptions from __kernel_standard_l (bug 18245, bug 18583).

__kernel_standard_l converts long double arguments to double for use
in SVID "struct exception".  This has special-case handling for when
that conversion would overflow or underflow but the original long
double function wouldn't.  However, it turns out that "inexact"
exceptions can be spurious here as well, when the function is exactly
determined and __kernel_standard_l is being called for a domain error.
This patch fixes this by using feholdexcept / fesetenv to avoid
exceptions from the conversion, replacing the previous special-case
logic for overflow and underflow (this covers all functions using
__kernel_standard_l, not just those that actually need a change, since
there doesn't seem to be much point in restricting things just to the
functions that mustn't get "inexact" here).

Tested for x86_64 and x86.

[BZ #18245]
[BZ #18583]
* sysdeps/ieee754/k_standardl.c: Include <fenv.h>.
(__kernel_standard_l): Use feholdexcept and fesetenv around
conversion to double instead of special-casing overflow and
underflow.
* math/libm-test.inc (fmod_test_data): Add more tests.
(remainder_test_data): Likewise.
(sqrt_test_data): Likewise.

9 years agoFix atomic_full_barrier on x86 and x86_64.
Torvald Riegel [Wed, 29 Oct 2014 09:34:36 +0000 (10:34 +0100)]
Fix atomic_full_barrier on x86 and x86_64.

This fixes BZ #17403 by defining atomic_full_barrier,
atomic_read_barrier, and atomic_write_barrier on x86 and x86_64.  A full
barrier is implemented through an atomic idempotent modification to the
stack and not through using mfence because the latter can supposedly be
somewhat slower due to having to provide stronger guarantees wrt.
self-modifying code, for example.

9 years agoFix math/Makefile dependency on libm-test.stmp for libmvec tests.
Joseph Myers [Tue, 23 Jun 2015 16:27:25 +0000 (16:27 +0000)]
Fix math/Makefile dependency on libm-test.stmp for libmvec tests.

Since the libmvec tests went in I've noticed build failures from
parallel testing in math/, when those tests start building before
libm-test.c has been fully generated.  (This only applies if libm test
sources have been modified after the original glibc build, because
otherwise libm-test.stmp was generated during the original build and
doesn't get regenerated during testing.)

Those tests depend on libm-test.stmp, but the dependency uses
$(libmvec-tests), which is set in the sysdeps Makefile fragments, and
appears before the inclusion of ../Rules, which is what includes those
fragments; thus, the dependency does not work and parallel make can
start building the vector tests too soon.  This patch moves the
dependency further down so that the required variable is defined when
the dependency is.

Tested for x86_64.

* math/Makefile [$(PERL) != no]
($(addprefix $(objpfx), $(addsuffix .o, $(libm-vec-tests)))): Move
dependency on libm-test.stmp below the inclusion of Rules.

9 years agoCombination of data tables for x86_64 vector functions sin, cos and sincos.
Andrew Senkevich [Tue, 23 Jun 2015 16:21:50 +0000 (19:21 +0300)]
Combination of data tables for x86_64 vector functions sin, cos and sincos.

    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Fixed files list.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core_sse4.S: Renamed variable
    and included header.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_trig_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_trig_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos2_core.S: Removed unneeded include.
    * sysdeps/x86_64/fpu/svml_d_cos4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos8_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_cos_data.S: Removed file.
    * sysdeps/x86_64/fpu/svml_d_cos_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sin_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sin_data.h: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.h: Likewise.

9 years agoFix csqrt spurious underflows (bug 18371).
Joseph Myers [Tue, 23 Jun 2015 16:01:54 +0000 (16:01 +0000)]
Fix csqrt spurious underflows (bug 18371).

The csqrt implementations in glibc can cause spurious underflows in
some cases as a side-effect of the scaling for large arguments (when
underflow is correct for the square root of the argument that was
scaled down to avoid overflow, but not for the original argument).
This patch arranges to avoid the underflowing intermediate computation
(eliminating a multiplication in 0.5 in the problem cases where a
subsequent scaling by 2 would follow).

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

[BZ #18371]
* math/s_csqrt.c (__csqrt): Avoid multiplication by 0.5 where
intermediate but not final result might underflow.
* math/s_csqrtf.c (__csqrtf): Likewise.
* math/s_csqrtl.c (__csqrtl): Likewise.
* math/auto-libm-test-in: Add more tests of csqrt.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

9 years agoFix exp2, exp2f spurious underflows (bug 18219).
Joseph Myers [Tue, 23 Jun 2015 14:35:18 +0000 (14:35 +0000)]
Fix exp2, exp2f spurious underflows (bug 18219).

The dbl-64 and flt-32 implementations of exp2 functions produce
spurious underflow exceptions.  The underlying reason is the same in
both cases: the computation works as (2^a - 1)*2^b + 2^b for suitably
chosen a and b, where a has small magnitude so 2^a - 1 can be computed
with a low-degree polynomial approximation, and (2^a - 1)*2^b can
underflow even when the final result does not.  This patch fixes this
by adjusting the threshold for when scaling is used to avoid
intermediate underflow so it works for any possible value of a where
the final result would not underflow.

Tested for x86_64 and x86.

[BZ #18219]
* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Reduce
threshold on absolute value of exponent for which scaling is used.
* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
* math/auto-libm-test-in: Add more tests of exp2.
* math/auto-libm-test-out: Regenerated.

9 years agoFix potential hanging of gethostbyaddr_r/gethostbyname_r
Dmitry V. Levin [Thu, 18 Jun 2015 21:40:46 +0000 (21:40 +0000)]
Fix potential hanging of gethostbyaddr_r/gethostbyname_r

When "reorder" resolver option is enabled, threads of a multi-threaded process
could hang in gethostbyaddr_r, gethostbyname_r, or gethostbyname2_r.

Due to a trivial bug in _res_hconf_reorder_addrs, simultaneous
invocations of this function in a multi-threaded process could result to
_res_hconf_reorder_addrs returning without releasing the lock it holds,
causing other threads to block indefinitely while waiting for the lock
that is not going to be released.

[BZ #17977]
* resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix unlocking
when initializing interface list, based on the bug analysis
and the patch proposed by Eric Newton.
* resolv/tst-res_hconf_reorder.c: New test.
* resolv/Makefile [$(have-thread-library) = yes] (tests): Add
tst-res_hconf_reorder.
($(objpfx)tst-res_hconf_reorder): Depend on $(libdl)
and $(shared-thread-library).
(tst-res_hconf_reorder-ENV): New variable.

9 years ago_res_hconf_reorder_addrs: fix typo in comment
Dmitry V. Levin [Mon, 22 Jun 2015 09:57:14 +0000 (09:57 +0000)]
_res_hconf_reorder_addrs: fix typo in comment

* resolv/res_hconf.c (_res_hconf_reorder_addrs): Fix typo in comment.

9 years agoFix expm1 missing underflows (bug 16353).
Joseph Myers [Mon, 22 Jun 2015 21:06:19 +0000 (21:06 +0000)]
Fix expm1 missing underflows (bug 16353).

Similar to various other bugs in this area, some expm1 implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

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

Tested for x86_64 and x86.

[BZ #16353]
* sysdeps/i386/fpu/s_expm1.S (dbl_min): New object.
(__expm1): Force underflow exception for arguments with small
absolute value.
* sysdeps/i386/fpu/s_expm1f.S (flt_min): New object.
(__expm1f): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/dbl-64/s_expm1.c: Include <float.h>.
(__expm1): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/flt-32/s_expm1f.c: Include <float.h>.
(__expm1f): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c (__ieee754_cosh):
Check for small arguments before calling __expm1.
* math/auto-libm-test-in: Do not mark underflow exceptions as
possibly missing for bug 16353.
* math/auto-libm-test-out: Regenerated.

9 years agoRecord TTL also for DNS PTR queries (bug 18513)
Andreas Schwab [Mon, 8 Jun 2015 13:21:18 +0000 (15:21 +0200)]
Record TTL also for DNS PTR queries (bug 18513)

This allows nscd to manage proper TTL for GETHOSTBYADDR[v6] requests.

9 years agoremove unnecessary memset in strcoll
Leonhard Holz [Mon, 22 Jun 2015 02:23:09 +0000 (07:53 +0530)]
remove unnecessary memset in strcoll

This patch avoids some initialization overhead in the hot path of strcoll by
replacing a memset with zero assignments. It improves the file listing benchmark
by 15% on x86. Tests are ok.

filelist#C              -1.30%
filelist#en_US.UTF-8    -15.08%
lorem_ipsum#vi_VN.UTF-8 -15.04%
lorem_ipsum#ar_SA.UTF-8 -11.83%
lorem_ipsum#en_US.UTF-8 -9.66%
lorem_ipsum#zh_CN.UTF-8 -8.63%
lorem_ipsum#cs_CZ.UTF-8 -8.28%
lorem_ipsum#en_GB.UTF-8 -18.07%
lorem_ipsum#da_DK.UTF-8 -11.13%
lorem_ipsum#pl_PL.UTF-8 -15.31%
lorem_ipsum#fr_FR.UTF-8 -12.26%
lorem_ipsum#pt_PT.UTF-8 -10.64%
lorem_ipsum#el_GR.UTF-8 -8.19%
lorem_ipsum#ru_RU.UTF-8 -0.65%
lorem_ipsum#iw_IL.UTF-8 -14.92%
lorem_ipsum#es_ES.UTF-8 -11.47%
lorem_ipsum#hi_IN.UTF-8 -1.05%
lorem_ipsum#sv_SE.UTF-8  6.44%
lorem_ipsum#hu_HU.UTF-8 -9.85%
lorem_ipsum#tr_TR.UTF-8 -14.96%
lorem_ipsum#is_IS.UTF-8 -10.35%
lorem_ipsum#it_IT.UTF-8 -11.33%
lorem_ipsum#sr_RS.UTF-8 -9.88%
lorem_ipsum#ja_JP.UTF-8 -3.23%

        * string/strcoll_l.c (STRCOLL): Remove unnecessary memset.

9 years agoremove now unused idxnow in strcoll
Leonhard Holz [Mon, 22 Jun 2015 02:16:37 +0000 (07:46 +0530)]
remove now unused idxnow in strcoll

The struct element idxnow is not used and can be removed. Tests show
no problems.

* string/strcoll_l.c: Remove unused struct element idxnow.

9 years agoFix x86_64 / x86 expm1l (-min_subnorm) result sign (bug 18569).
Joseph Myers [Sun, 21 Jun 2015 18:43:10 +0000 (18:43 +0000)]
Fix x86_64 / x86 expm1l (-min_subnorm) result sign (bug 18569).

In the x86 / x86_64 implementations of expm1l, when expm1l's result
should underflow to 0 (argument minus the least subnormal, in some
rounding modes), it can be a zero of the wrong sign.  This patch fixes
this by returning the argument with underflow forced in that case
(this is a 1ulp error relative to the correctly rounded result of -0,
which is OK in terms of the documented accuracy goals, whereas a
result with the wrong sign never is).

Tested for x86_64 and x86.

[BZ #18569]
* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]: Force
underflow and return argument in case of subnormal argument.
* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL) [USE_AS_EXPM1L]:
Likewise.
* math/auto-libm-test-in: Add more tests of expm1.
* math/auto-libm-test-out: Regenerated.

9 years agoCorrect ChangeLog syntax for conditional change within function.
Joseph Myers [Sun, 21 Jun 2015 18:41:12 +0000 (18:41 +0000)]
Correct ChangeLog syntax for conditional change within function.

9 years agoFix x86 / x86_64 expl, exp10l missing underflows (bug 16361).
Joseph Myers [Sun, 21 Jun 2015 17:48:04 +0000 (17:48 +0000)]
Fix x86 / x86_64 expl, exp10l missing underflows (bug 16361).

Similar to various other bugs in this area, the x86 and x86_64
implementations of expl / exp10l can fail to produce underflow
exceptions when the unscaled result has trailing 0 bits so the scaling
down to subnormal precision is exact.  This patch fixes this by
forcing the exception in the case of tiny results.

Tested for x86_64 and x86.

[BZ #16361]
* sysdeps/i386/fpu/e_expl.S [!USE_AS_EXPM1L] (cmin): New object.
[!USE_AS_EXPM1L] (IEEE754_EXPL): Force underflow exception for
tiny results.
* sysdeps/x86_64/fpu/e_expl.S [!USE_AS_EXPM1L] (cmin): New object.
[!USE_AS_EXPM1L] (IEEE754_EXPL): Force underflow exception for
tiny results.
* math/auto-libm-test-in: Add more tests of exp and exp10.  Do not
mark underflow exceptions as possibly missing for bug 16361.
* math/auto-libm-test-out: Regenerated.

9 years agoconformtest: Fix pselect expectations.
Joseph Myers [Fri, 19 Jun 2015 20:52:44 +0000 (20:52 +0000)]
conformtest: Fix pselect expectations.

conformtest expected pselect for XOPEN2K and POSIX2008 (correctly),
but not for XOPEN2K8 (wrongly).  This patch fixes the data to expect
it for XOPEN2K8 as well.

(As for all such fixes based on failures seen from the tests, there is
no guarantee that the data is fully correct for a particular standard
after the fix; headers and data may well have matching bugs.  So far
I've only reviewed ISO, ISO99, ISO11 and POSIX data in detail, though
I hope eventually to review the others.)

Tested for x86_64 and x86.

* conform/data/sys/select.h-data [XOPEN2K8] (pselect): Expect.
* conform/Makefile (test-xfail-XOPEN2K8/sys/select.h/conform):
Remove variable.
(test-xfail-XOPEN2K8/sys/time.h/conform): Likewise.
(test-xfail-XOPEN2K8/utmpx.h/conform).

9 years agoconformtest: Support xfail markers on individual assertions.
Joseph Myers [Fri, 19 Jun 2015 20:05:41 +0000 (20:05 +0000)]
conformtest: Support xfail markers on individual assertions.

Various conformtest tests fail because of known issues, filed in
Bugzilla, that are hard to fix (requiring new features, kernel
cooperation or involving changing types in ways that may involve care
around padding when interfacing to the kernel).  Such an issue has the
effect of making the whole test for the (standard, header) pair fail,
so hiding any other issues with that header for that standard
(possibly regressions or architecture-specific issues).

This patch adds a mechanism for individual conformtest test
expectations to start with xfail-, meaning that a failure of that
particular assertion does not cause the whole test to fail at the
makefile level and so failure at the makefile level can be used to
detect other issues that are likely to be easier to fix.  This is
similar to the whitelisted symbols in the linknamespace tests, or the
marking of particular libm tests as allowing spurious or missing
exceptions, for example.  The bugs filed in Bugzilla should still be
fixed, and the xfail- markers removed at that point, but xfail-
renders the tests more useful until that happens.

Note that there is no way to add such a marker for the assertion that
a header uses only symbols in the namespace of symbols it's meant to
use.  I don't think there's any need for a way to xfail those
namespace tests other than xfailing the whole (standard, header) pair
at the makefile level, since they are generally straightforward to fix
(add appropriate conditionals on the problem definitions).

The xfails in this patch do not necessarily cover all cases of
hard-to-fix header bugs filed in Bugzilla that currently show up in
conformtest failures; there may be more yet to add for existing open
bugs.

Tested for x86_64 and x86.

* conform/conformtest.pl ($xerrors): New variable.
(note_error): New function.
(compiletest): New argument $xfail.  Use not_error.
(runtest): Likewise.
(top level): Handle xfail- lines.  Update calls to compiletest and
runtest.  Handle xfail- and optional- in headers listed with
allow-header.
* conform/data/fcntl.h-data (O_TTY_INIT): Use xfail-.
(O_EXEC): Likewise.
(O_SEARCH): Likewise.
* conform/data/stropts.h-data (ioctl): Likewise.
* conform/data/sys/ipc.h-data (ipc_perm.mode): Likewise.
* conform/data/sys/sem.h-data (semid_ds.sem_nsems): Likewise.
* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Likewise.
(msghdr.msg_controllen): Likewise.
(cmsghdr.cmsg_len): Likewise.
* conform/data/utmpx.h-data (utmpx.ut_tv): Likewise.
* conform/Makefile (test-xfail-XPG3/sys/ipc.h/conform): Remove
variable.
(test-xfail-XPG3/sys/sem.h/conform): Likewise.
(test-xfail-XPG4/stropts.h/conform): Likewise.
(test-xfail-XPG4/sys/ipc.h/conform): Likewise.
(test-xfail-XPG4/sys/sem.h/conform): Likewise.
(test-xfail-XPG4/sys/socket.h/conform): Likewise.
(test-xfail-UNIX98/stropts.h/conform): Likewise.
(test-xfail-UNIX98/sys/ipc.h/conform): Likewise.
(test-xfail-UNIX98/sys/sem.h/conform): Likewise.
(test-xfail-UNIX98/sys/socket.h/conform): Likewise.
(test-xfail-XOPEN2K/stropts.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/ipc.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/sem.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/socket.h/conform): Likewise.
(test-xfail-XOPEN2K/utmpx.h/conform): Likewise.
(test-xfail-POSIX2008/fcntl.h/conform): Likewise.
(test-xfail-POSIX2008/stropts.h/conform): Likewise.
(test-xfail-XOPEN2K8/fcntl.h/conform): Likewise.
(test-xfail-XOPEN2K8/stropts.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/ipc.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/sem.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/socket.h/conform): Likewise.

9 years agoFixed powerpc64 build.
Andrew Senkevich [Fri, 19 Jun 2015 17:42:34 +0000 (20:42 +0300)]
Fixed powerpc64 build.

    * sysdeps/ieee754/ldbl-opt/s_sin.c (__DECL_SIMD_sincos_disable,
    __DECL_SIMD_sincos_disablef, __DECL_SIMD_sincos_disablel): Added empty
    definitions for proper unfolding of __MATHDECL_VEC.

9 years agoFix benchtests build failure after 'add benchmark for strcoll'
Stefan Liebler [Fri, 19 Jun 2015 11:47:59 +0000 (13:47 +0200)]
Fix benchtests build failure after 'add benchmark for strcoll'

This patch fixes implicit declaration of function strdup, strtok,
strcoll, strchr and removes unused variable res.

ChangeLog:

* benchtests/bench-strcoll.c:
Include string.h.
(main): Remove unused variable res.

9 years agoFix timezone tests run in parallel.
Stefan Liebler [Fri, 19 Jun 2015 11:47:59 +0000 (13:47 +0200)]
Fix timezone tests run in parallel.

The Makefile rule is called one time for target %/UTC or %/Universal.
If the tests are run in parallel, UTC or Universal can trigger the rule.
This patch patch generates the second test-result file as a copy of the
generated one.
Thus the testsuite can rely on the existence of the test-result files
regardless of which target has triggered the rule.

ChangeLog:

* timezone/Makefile (%/UTC %/Universal):
Generate test-result files for UTC and Universal.

9 years agoS/390: Regenerate ULPs
Stefan Liebler [Fri, 19 Jun 2015 11:47:59 +0000 (13:47 +0200)]
S/390: Regenerate ULPs

Regenerated ULPs after recent math test changes.

ChangeLog:

* sysdeps/s390/fpu/libm-test-ulps: Regenerated.

9 years agoFix asinh missing underflows (bug 16350).
Joseph Myers [Thu, 18 Jun 2015 23:27:41 +0000 (23:27 +0000)]
Fix asinh missing underflows (bug 16350).

Similar to various other bugs in this area, some asinh implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86 and mips64.

[BZ #16350]
* sysdeps/i386/fpu/s_asinh.S (__asinh): Force underflow exception
for arguments with small absolute value.
* sysdeps/i386/fpu/s_asinhf.S (__asinhf): Likewise.
* sysdeps/i386/fpu/s_asinhl.S (__asinhl): Likewise.
* sysdeps/ieee754/dbl-64/s_asinh.c: Include <float.h>.
(__asinh): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/flt-32/s_asinhf.c: Include <float.h>.
(__asinhf): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-128/s_asinhl.c: Include <float.h>.
(__asinhl): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: Include <float.h>.
(__asinhl): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-96/s_asinhl.c: Include <float.h>.
(__asinhl): Force underflow exception for arguments with small
absolute value.
* math/auto-libm-test-in: Do not mark underflow exceptions as
possibly missing for bug 16350.
* math/auto-libm-test-out: Regenerated.

9 years agoRemove include/bits/ipc.h.
Joseph Myers [Thu, 18 Jun 2015 23:08:15 +0000 (23:08 +0000)]
Remove include/bits/ipc.h.

Ten conformtest failures arise from the internal header
include/bits/ipc.h failing to condition internal declarations, outside
the public namespace of headers including bits/ipc.h, on [!_ISOMAC].
As discussed in
<https://sourceware.org/ml/libc-alpha/2015-06/msg00653.html>, the
internal declarations that are actually relevant are in ipc_priv.h and
so include/bits/ipc.h should not be needed at all; this patch removes
it.  (Ten further conformtest failures for other headers including
bits/ipc.h remain because of other conformance issues in those
headers.)

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

* include/bits/ipc.h: Remove file.
* conform/Makefile (test-xfail-XPG3/sys/msg.h/conform): Remove
variable.
(test-xfail-XPG3/sys/shm.h/conform): Likewise.
(test-xfail-XPG4/sys/msg.h/conform): Likewise.
(test-xfail-XPG4/sys/shm.h/conform): Likewise.
(test-xfail-UNIX98/sys/msg.h/conform): Likewise.
(test-xfail-UNIX98/sys/shm.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/msg.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/shm.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/msg.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/shm.h/conform): Likewise.

9 years agoRemove stray spurious-underflow markings from cexp test.
Joseph Myers [Thu, 18 Jun 2015 20:51:17 +0000 (20:51 +0000)]
Remove stray spurious-underflow markings from cexp test.

I noticed that I'd left a spurious-underflow allowance behind in
auto-libm-test-in for a bug that was fixed some time ago.  This patch
removes it.

Tested for x86_64 and x86.

* math/auto-libm-test-in: Remove spurious underflow allowance for
tests of cexp.
* math/auto-libm-test-out: Regenerated.

9 years agoFix netinet/in.h MCAST_* namespace (bug 18558).
Joseph Myers [Thu, 18 Jun 2015 19:48:22 +0000 (19:48 +0000)]
Fix netinet/in.h MCAST_* namespace (bug 18558).

sysdeps/unix/sysv/linux/bits/in.h (as included in netinet/in.h, and
via that in netdb.h and arpa/inet.h) defines a series of MCAST_*
macros, both under __USE_MISC and then again unconditionally.  These
are not POSIX macros, nor in any of the namespaces listed in POSIX as
reserved for this header, so should not be defined unconditionally.
This patch duly removes the unconditional definitions, leaving the
ones conditional on __USE_MISC.

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

[BZ #18558]
* sysdeps/unix/sysv/linux/bits/in.h (MCAST_JOIN_GROUP): Remove
unconditional definition.
(MCAST_BLOCK_SOURCE): Likewise.
(MCAST_UNBLOCK_SOURCE): Likewise.
(MCAST_LEAVE_GROUP): Likewise.
(MCAST_JOIN_SOURCE_GROUP): Likewise.
(MCAST_LEAVE_SOURCE_GROUP): Likewise.
(MCAST_MSFILTER): Likewise.
* conform/Makefile (test-xfail-XOPEN2K/arpa/inet.h/conform):
Remove variable.
(test-xfail-XOPEN2K/netdb.h/conform): Likewise.
(test-xfail-XOPEN2K/netinet/in.h/conform): Likewise.
(test-xfail-XOPEN2K8/arpa/inet.h/conform): Likewise.
(test-xfail-XOPEN2K8/netdb.h/conform): Likewise.
(test-xfail-XOPEN2K8/netinet/in.h/conform): Likewise.

9 years agoVector sincosf for x86_64 and tests.
Andrew Senkevich [Thu, 18 Jun 2015 17:11:27 +0000 (20:11 +0300)]
Vector sincosf for x86_64 and tests.

Here is implementation of vectorized sincosf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * NEWS: Mention addition of x86_64 vector sincosf.
    * math/test-float-vlen16.h: Added wrapper for sincosf tests.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added sincosf SIMD declaration.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core_sse4.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core.S
    * sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core_avx2.S
    * sysdeps/x86_64/fpu/svml_s_sincosf16_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf4_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core.S
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core_avx.S
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_sincosf_data.h: New file.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Added 3 argument wrappers.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: : Vector sincosf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.

9 years agoVector sincos for x86_64 and tests.
Andrew Senkevich [Thu, 18 Jun 2015 14:55:55 +0000 (17:55 +0300)]
Vector sincos for x86_64 and tests.

Here is implementation of vectorized sincos containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * NEWS: Mention addition of x86_64 vector sincos.
    * bits/libm-simd-decl-stubs.h: Added stubs for sincos.
    * math/math.h (__MATHDECL_VEC): New macro.
    * math/bits/mathcalls.h: Added sincos declaration with __MATHDECL_VEC.
    * math/gen-libm-have-vector-test.sh: Added generation of sincos wrapper
    declaration under condition.
    * math/test-vec-loop.h (TEST_VEC_LOOP): Refactored.
    * math/test-double-vlen2.h: Added wrapper for sincos tests, reflected
    TEST_VEC_LOOP change.
    * math/test-double-vlen4.h: Likewise.
    * math/test-double-vlen8.h: Likewise.
    * math/test-float-vlen16.h: Reflected TEST_VEC_LOOP change.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added sincos SIMD declaration.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos2_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.S: New file.
    * sysdeps/x86_64/fpu/svml_d_sincos_data.h: New file.
    * sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Added wrappers for sincos.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Vector sincos tests.
    * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.

9 years agoVector powf for x86_64 and tests.
Andrew Senkevich [Thu, 18 Jun 2015 14:04:07 +0000 (17:04 +0300)]
Vector powf for x86_64 and tests.

Here is implementation of vectorized powf containing SSE, AVX,
AVX2 and AVX512 versions according to Vector ABI
<https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4>.

    * sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: New symbols added.
    * sysdeps/x86/fpu/bits/math-vector.h: Added SIMD declaration and asm
    redirections for powf.
    * sysdeps/x86_64/fpu/Makefile (libmvec-support): Added new files.
    * sysdeps/x86_64/fpu/Versions: New versions added.
    * sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.
    * sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines):
    Added build of SSE, AVX2 and AVX512 IFUNC versions.
    * sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Added 2 argument wrappers.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core_sse4.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core.S: New file.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core_avx2.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf16_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf4_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf8_core.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf8_core_avx.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf_data.S: New file.
    * sysdeps/x86_64/fpu/svml_s_powf_data.h: New file.
    * sysdeps/x86_64/fpu/test-float-vlen16-wrappers.c: Vector powf tests.
    * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
    * math/test-float-vlen16.h: Fixed 2 argument macro.
    * math/test-float-vlen4.h: Likewise.
    * math/test-float-vlen8.h: Likewise.
    * NEWS: Mention addition of x86_64 vector powf.

9 years agoRemove ldbl-128ibm variants of complex math functions.
Joseph Myers [Wed, 17 Jun 2015 21:20:15 +0000 (21:20 +0000)]
Remove ldbl-128ibm variants of complex math functions.

sysdeps/ieee754/ldbl-128ibm has its own versions of cprojl, ctanhl and
ctanl.

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

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

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

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

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

* math/s_ctanhl.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
and redefine.
* math/s_ctanl.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
and redefine.
* sysdeps/ieee754/ldbl-128ibm/s_cprojl.c: Remove file.
* sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_ctanl.c: Likewise.

9 years agoFix nice getpriority, setpriority namespace (bug 18553).
Joseph Myers [Wed, 17 Jun 2015 20:22:39 +0000 (20:22 +0000)]
Fix nice getpriority, setpriority namespace (bug 18553).

nice (XPG3) calls getpriority and setpriority (in XPG4 but not XPG3,
i.e. UX-shaded in XPG4).  This patch fixes this by making those
functions into weak aliases of __* functions and calling the __*
versions as needed.

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

This completes cleaning up the unsorted linknamespace test XFAILs.

[BZ #18553]
* resource/getpriority.c (getpriority): Rename to __getpriority
and define as weak alias of __getpriority.
* resource/setpriority.c (setpriority): Rename to __setpriority
and define as weak alias of __setpriority.
* sysdeps/mach/hurd/getpriority.c (getpriority): Rename to
__getpriority and define as weak alias of __getpriority.
* sysdeps/mach/hurd/setpriority.c (setpriority): Rename to
__setpriority and define as weak alias of __setpriority.
* sysdeps/unix/syscalls.list (getpriority): Use __getpriority as
strong name.
(setpriority): Use __setpriority as strong name.
* sysdeps/unix/sysv/linux/getpriority.c (getpriority): Rename to
__getpriority and define as weak alias of __getpriority.
* include/sys/resource.h (__getpriority): Declare.  Use
libc_hidden_proto.
(__setpriority): Likewise.
(getpriority): Don't use libc_hidden_proto.
(setpriority): Likewise.
* sysdeps/posix/nice.c (nice): Call __getpriority instead of
getpriority.  Call __setpriority instead of setpriority.
* conform/Makefile (test-xfail-XPG3/unistd.h/linknamespace):
Remove variable.

9 years agoFix ttyslot namespace (bug 18547).
Joseph Myers [Wed, 17 Jun 2015 20:21:19 +0000 (20:21 +0000)]
Fix ttyslot namespace (bug 18547).

ttyslot (XPG4) calls the non-XPG4 functions endttyent, getttyent and
setttyent, which in turn bring in references to fgets_unlocked and
getttynam.  This patch fixes this by making these functions into weak
aliases and calling the __* names as needed.

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

[BZ #18547]
* misc/getttyent.c (getttynam): Rename to __getttynam and define
as weak alias of __getttynam.  Use prototype function definition.
Call __setttyent, __getttyent and __endttyent instead of
setttyent, getttyent and endttyent.
(getttyent): Rename to __getttyent and define as weak alias of
__getttyent.  Call __setttyent instead of setttyent.  Call
__fgets_unlocked instead of fgets_unlocked.
(setttyent): Rename to __setttyent and define as weak alias of
__setttyent.
(endttyent): Rename to __endttyent and define as weak alias of
__endttyent.
* include/ttyent.h (__getttyent): Declare.  Use libc_hidden_proto.
(__setttyent): Likewise.
(__endttyent): Likewise.
(getttyent): Don't use libc_hidden_proto.
(setttyent): Likewise.
(endttyent): Likewise.
* misc/ttyslot.c (ttyslot): Call __setttyent, __getttyent and
__endttyent instead of setttyent, getttyent and endttyent.
* conform/Makefile (test-xfail-XPG4/unistd.h/linknamespace):
Remove variable.

9 years agoFix mq_notify socket, recv namespace (bug 18546).
Joseph Myers [Wed, 17 Jun 2015 20:20:08 +0000 (20:20 +0000)]
Fix mq_notify socket, recv namespace (bug 18546).

mq_notify (in the 1996 edition of POSIX) brings in references to recv
and socket (not in POSIX until the 2001 edition).  This patch fixes
this by using __recv and __socket, exporting them from libc at version
GLIBC_PRIVATE.

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

[BZ #18546]
* socket/recv.c (__recv): Use libc_hidden_def.
* socket/socket.c (__socket): Likewise.
* sysdeps/mach/hurd/recv.c (__recv): Likewise.
* sysdeps/mach/hurd/socket.c (__socket): Likewise.
* sysdeps/unix/sysv/linux/generic/recv.c (__recv): Likewise.
* sysdeps/unix/sysv/linux/recv.c (__recv): Use libc_hidden_weak.
* sysdeps/unix/sysv/linux/socket.c (__socket): Use
libc_hidden_def.
* sysdeps/unix/sysv/linux/x86_64/recv.c (__recv): Use
libc_hidden_weak.
* include/sys/socket.h (__socket): Do not use attribute_hidden.
Use libc_hidden_proto.
(__recv): Likewise.
* socket/Versions (libc): Export __recv and __socket at version
GLIBC_PRIVATE.
* sysdeps/unix/sysv/linux/mq_notify.c (helper_thread): Call __recv
instead of recv.
(init_mq_netlink): Call __socket instead of socket.
* conform/Makefile (test-xfail-POSIX/mqueue.h/linknamespace):
Remove variable.

9 years agoFix mq_receive, mq_send mq_timed* namespace (bug 18545).
Joseph Myers [Wed, 17 Jun 2015 20:19:04 +0000 (20:19 +0000)]
Fix mq_receive, mq_send mq_timed* namespace (bug 18545).

mq_receive calls mq_timedreceive, and mq_send calls mq_timedsend.  But
mq_receive and mq_send were in POSIX by 1996, while mq_timed* were
added in the 2001 edition of POSIX.  This patch fixes this by making
mq_timed* into weak aliases for __mq_timed* and calling the
__mq_timed* names.

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

[BZ #18545]
* rt/mq_timedreceive.c (mq_timedreceive): Rename to
__mq_timedreceive and define as alias of __mq_timedreceive.  Use
hidden_weak.
* rt/mq_timedsend.c (mq_timedsend): Rename to __mq_timedsend and
define as alias of __mq_timedsend.  Use hidden_weak.
* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Use
__mq_timedsend as strong name.
(mq_timedreceive): Use __mq_timedreceive as strong name.
* include/mqueue.h (__mq_timedsend): Declare.  Use hidden_proto.
(__mq_timedreceive): Likewise.
* sysdeps/unix/sysv/linux/mq_receive.c (mq_receive): Call
__mq_timedreceive instead of mq_timedreceive.
* sysdeps/unix/sysv/linux/mq_send.c (mq_send): Call __mq_timedsend
instead of mq_timedsend.
* conform/Makefile (test-xfail-UNIX98/mqueue.h/linknamespace):
Remove variable.

9 years agoCreate hidden aliases for non-libc syscalls automatically.
Joseph Myers [Wed, 17 Jun 2015 20:17:49 +0000 (20:17 +0000)]
Create hidden aliases for non-libc syscalls automatically.

The syscall wrappers mechanism automatically creates hidden aliases
for syscalls with libc_hidden_def / libc_hidden_weak.  The use of
libc_hidden_* has the side-effect that for syscall wrappers in
non-libc libraries those aliases are not created.  In turn, this means
that three mq_* syscalls in sysdeps/unix/sysv/linux/syscalls.list list
the __GI_* names explicitly.

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

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

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

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

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

* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Use
hidden_def and hidden_weak instead of libc_hidden_def and
libc_hidden_weak.
(top level): Refer to hidden_def in comment.
* sysdeps/unix/syscall-template.S (syscall_hidden_def): New
macro.  Use it instead of libc_hidden_def.
* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Do not
specify __GI_* name explicitly.
(mq_timedreceive): Likewise.
(mq_setattr): Likewise.

9 years agoFix mq_notify pthread_barrier_* namespace (bug 18544).
Joseph Myers [Wed, 17 Jun 2015 20:16:56 +0000 (20:16 +0000)]
Fix mq_notify pthread_barrier_* namespace (bug 18544).

mq_notify (present in POSIX by 1996) brings in references to
pthread_barrier_init and pthread_barrier_wait (new in the 2001 edition
of POSIX).  This patch fixes this by making those functions into weak
aliases of __pthread_barrier_*, exporting the __pthread_barrier_*
names at version GLIBC_PRIVATE and using them in mq_notify.

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

[BZ #18544]
* nptl/pthread_barrier_init.c (pthread_barrier_init): Rename to
__pthread_barrier_init and define as weak alias of
__pthread_barrier_init.
* sysdeps/sparc/nptl/pthread_barrier_init.c
(pthread_barrier_init): Likewise.
* nptl/pthread_barrier_wait.c (pthread_barrier_wait): Rename to
__pthread_barrier_wait and define as weak alias of
__pthread_barrier_wait.
* sysdeps/sparc/nptl/pthread_barrier_wait.c
(pthread_barrier_wait): Likewise.
* sysdeps/sparc/sparc32/pthread_barrier_wait.c
(pthread_barrier_wait): Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
(pthread_barrier_wait): Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
(pthread_barrier_wait): Likewise.
* nptl/Versions (libpthread): Export __pthread_barrier_init and
__pthread_barrier_wait at version GLIBC_PRIVATE.
* include/pthread.h (__pthread_barrier_init): Declare.
(__pthread_barrier_wait): Likewise.
* sysdeps/unix/sysv/linux/mq_notify.c (notification_function):
Call __pthread_barrier_wait instead of pthread_barrier_wait.
(helper_thread): Likewise.
(init_mq_netlink): Call __pthread_barrier_init instead of
pthread_barrier_init.

9 years agoFix swscanf vswscanf namespace (bug 18542).
Joseph Myers [Wed, 17 Jun 2015 20:15:22 +0000 (20:15 +0000)]
Fix swscanf vswscanf namespace (bug 18542).

swscanf (added in C90 Amendment 1, present in UNIX98) calls vswscanf
(added in C99, not in C90 Amendment 1 or UNIX98).  This patch fixes
this by using __vswscanf instead and making vswscanf into a weak
alias.

(I intend to add conform/ test support for C90 Amendment 1 - and
various other standard versions supported by glibc but not yet by
conform/ tests - at some point, once the results for currently tested
standards are cleaner.)

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

[BZ #18542]
* libio/iovswscanf.c (__vswscanf): Use libc_hidden_def.
(vswscanf): Use ldbl_weak_alias instead of ldbl_strong_alias
* include/wchar.h (__vswscanf): Declare.  Use libc_hidden_proto.
* libio/swscanf.c (__swscanf): Call __vswscanf instead of
vswscanf.
* conform/Makefile (test-xfail-UNIX98/wchar.h/linknamespace):
Remove variable.

9 years agoFix getpass fflush_unlocked namespace (bug 18540).
Joseph Myers [Wed, 17 Jun 2015 20:14:18 +0000 (20:14 +0000)]
Fix getpass fflush_unlocked namespace (bug 18540).

The getpass function (XPG3 / XPG4 / UNIX98) calls fflush_unlocked (not
in any of those standards).  This patch fixes this by making
fflush_unlocked into a weak alias for __fflush_unlocked and calling
__fflush_unlocked from getpass.

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

[BZ #18540]
* libio/iofflush.c [!_IO_MTSAFE_IO] (__fflush_unlocked): Define as
strong alias of _IO_fflush.  Use libc_hidden_def.
* libio/iofflush_u.c (fflush_unlocked): Rename to
__fflush_unlocked and define as weak alias of __fflush_unlocked.
Use libc_hidden_weak.
* include/stdio.h (__fflush_unlocked): Declare.  Use
libc_hidden_proto.
* misc/getpass.c (getpass): Call __fflush_unlocked instead of
fflush_unlocked.
* conform/Makefile (test-xfail-UNIX98/unistd.h/linknamespace):
Remove variable.

9 years agoFix fmtmsg addseverity namespace (bug 18539).
Joseph Myers [Wed, 17 Jun 2015 20:13:07 +0000 (20:13 +0000)]
Fix fmtmsg addseverity namespace (bug 18539).

Use of fmtmsg (XSI POSIX) brings in addseverity (non-POSIX).  This
patch fixes this by making addseverity into a weak alias for
__addseverity.

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

[BZ #18539]
* stdlib/fmtmsg.c (addseverity): Rename to __addseverity and
define as weak alias of __addseverity.
* conform/Makefile (test-xfail-XPG4/fmtmsg.h/linknamespace):
Remove variable.
(test-xfail-UNIX98/fmtmsg.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/fmtmsg.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/fmtmsg.h/linknamespace): Likewise.

9 years agoFix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536).
Joseph Myers [Wed, 17 Jun 2015 20:11:58 +0000 (20:11 +0000)]
Fix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536).

The sem_* functions bring in references to tdelete, tfind, tsearch and
twalk.  But the t* functions are XSI-shaded, while sem_* aren't.  This
patch fixes this by using __t* instead, exporting those functions from
libc at version GLIBC_PRIVATE (since sem_* are in libpthread) and
using libc_hidden_* for the benefit of calls within libc.

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

[BZ #18536]
* misc/tsearch.c (__tsearch): Use libc_hidden_def.
(__tfind): Likewise.
(__tdelete): Likewise.
(__twalk): Likewise.
* misc/Versions (libc): Add __tdelete, __tfind, __tsearch and
__twalk to GLIBC_PRIVATE.
* include/search.h (__tsearch): Use libc_hidden_proto.
(__tfind): Likewise.
(__tdelete): Likewise.
(__twalk): Likewise.
* nptl/sem_close.c (sem_close): Call __twalk instead of twalk.
Call __tdelete instead of tdelete.
* nptl/sem_open.c (check_add_mapping): Call __tfind instead of
tfind.  Call __tsearch instead of tsearch.
* sysdeps/sparc/sparc32/sem_open.c (check_add_mapping): Likewise.
* conform/Makefile (test-xfail-POSIX/semaphore.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/semaphore.h/linknamespace): Likewise.

9 years agoFix syslog dprintf namespace (bug 18534).
Joseph Myers [Wed, 17 Jun 2015 20:10:50 +0000 (20:10 +0000)]
Fix syslog dprintf namespace (bug 18534).

syslog functions bring in references to dprintf, which wasn't added to
POSIX until the 2008 edition and so isn't in various standards
containing the syslog functions.  This patch fixes this by making
dprintf into a weak alias of __dprintf and using __dprintf as
appropriate.

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

[BZ #18534]
* stdio-common/dprintf.c (__dprintf): Use libc_hidden_def.
(dprintf): Define as a weak alias of __dprintf, not a strong
alias.
* include/stdio.h (__dprintf): Declare.  Use libc_hidden_proto.
* misc/syslog.c (__vsyslog_chk): Call __dprintf instead of
dprintf.
* conform/Makefile (test-xfail-XPG4/syslog.h/linknamespace):
Remove variable.
(test-xfail-UNIX98/syslog.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/syslog.h/linknamespace): Likewise.

9 years agoFix vsyslog namespace (bug 18533).
Joseph Myers [Wed, 17 Jun 2015 20:09:35 +0000 (20:09 +0000)]
Fix vsyslog namespace (bug 18533).

syslog functions (in POSIX) bring in the strong symbol vsyslog (not in
POSIX).  This patch fixes this by changing this symbol from a strong
alias to a weak alias.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).  (vsyslog becomes weak
in the static libraries, which is what's needed; the particular macro
sequence in use leaves it as strong in the shared libraries, hence
those libraries being completely unchanged, but it doesn't generally
matter whether symbols exported from the shared libraries are weak or
strong.)

[BZ #18533]
* misc/syslog.c (vsyslog): Define as a weak alias of __vsyslog,
not a strong alias.
* conform/Makefile (test-xfail-XOPEN2K8/syslog.h/linknamespace):
Remove variable.

9 years agoFix gethostbyaddr in6addr_any, in6addr_loopback namespace (bug 18532).
Joseph Myers [Wed, 17 Jun 2015 20:08:22 +0000 (20:08 +0000)]
Fix gethostbyaddr in6addr_any, in6addr_loopback namespace (bug 18532).

gethostbyaddr brings in references to in6addr_any and thereby
in6addr_loopback, which aren't in all the standards containing
gethostbyaddr (gethostbyaddr is in XPG4 and UNIX98, in6addr_any and
in6addr_loopback are new in POSIX.1:2001).  This patch fixes this by
making those symbols into weak aliases (safe in this case, unlike for
most data symbols, because these data symbols are const).

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  Disassembly is unchanged for
x86_64; for x86, I see some changes of stack offsets, but no other
code generation changes or code size differences.

[BZ #18532]
* inet/in6_addr.c (in6addr_any): Rename to __in6addr_any and
define as weak alias of __in6addr_any.  Use libc_hidden_data_weak.
(in6addr_loopback): Rename to __in6addr_loopback and define as
weak alias of __in6addr_loopback.  Use libc_hidden_data_weak.
* include/netinet/in.h (__in6addr_loopback): Declare.  Use
libc_hidden_proto.
(__in6addr_any): Likewise.
* inet/gethstbyad_r.c (PREPROCESS): Use __in6addr_any instead of
in6addr_any.
* conform/Makefile (test-xfail-XPG4/netdb.h/linknamespace): Remove
variable.
(test-xfail-UNIX98/netdb.h/linknamespace): Likewise.

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.