platform/upstream/glibc.git
7 years agoargp: Do not override GCC keywords with macros [BZ #16907]
Florian Weimer [Thu, 18 Aug 2016 09:15:42 +0000 (11:15 +0200)]
argp: Do not override GCC keywords with macros [BZ #16907]

glibc provides fallback definitions already.  It is not necessary to
suppress warnings for unknown attributes because GCC does this
automatically for system headers.

This commit does not sync with gnulib because gnulib has started to use
_GL_* macros in the header file, which are arguably in the gnulib
implementation space and not suitable for an installed glibc header
file.

7 years agoldbl-128: Remove unused sqrtl declaration in e_asinl.c
Paul E. Murphy [Tue, 16 Aug 2016 15:49:39 +0000 (10:49 -0500)]
ldbl-128: Remove unused sqrtl declaration in e_asinl.c

This did not alter compilation for s390x and aarch64
targets.

7 years agoSupport for type-generic libm function implementations libm
Paul E. Murphy [Tue, 14 Jun 2016 16:44:14 +0000 (11:44 -0500)]
Support for type-generic libm function implementations libm

This defines a new classes of libm objects.  The
<func>_template.c file which is used in conjunction
with the new makefile hooks to derive variants for
each type supported by the target machine.

The headers math-type-macros-TYPE.h are used to supply
macros to a common implementation of a function in
a file named FUNC_template.c and glued togethor via
a generated file matching existing naming in the
build directory.

This has the properties of preserving the existing
override mechanism and not requiring any arcane
build system twiddling.  Likewise, it enables machines
to override these files without any additional work.

I have verified the built objects for ppc64, x86_64,
alpha, arm, and m68k do not change in any meaningful
way with these changes using the Fedora cross toolchains.
I have verified the x86_64 and ppc64 changes still run.

7 years agonptl/tst-once5: Reduce time to expected failure
Florian Weimer [Wed, 17 Aug 2016 14:14:02 +0000 (16:14 +0200)]
nptl/tst-once5: Reduce time to expected failure

7 years agoDo not override objects in libc.a in other static libraries [BZ #20452]
Florian Weimer [Wed, 17 Aug 2016 12:57:00 +0000 (14:57 +0200)]
Do not override objects in libc.a in other static libraries [BZ #20452]

With this change, we no longer add sysdep.o and similar objects which
are present in libc.a to other static libraries.

7 years agoFix soft-fp extended.h unpacking (GCC bug 77265).
Joseph Myers [Tue, 16 Aug 2016 17:11:46 +0000 (17:11 +0000)]
Fix soft-fp extended.h unpacking (GCC bug 77265).

soft-fp unpacking for x86 "extended" fails to clear the implicit
mantissa high bit that is explicit in that format, resulting in
problems for operations that expect this bit to be clear in raw
unpacked values.  Specifically, the code for this format is used only
for conversions to and from TFmode (__float128) in libgcc, where this
issue results in GCC bug 77265, extension of long double infinity to
__float128 wrongly produces a NaN.

This patch fixes this by always masking out the implicit bit on
unpacking, so that the results of unpacking meet the expectations of
the rest of the soft-fp code for a normal IEEE format.

Tested for x86_64 in libgcc in conjunction with a GCC testcase for
this issue (this code isn't used in glibc, only in libgcc).

* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_E):
Mask implicit bit out of unpacked value.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_EP): Likewise.

7 years agoAdd fesetexcept: sparc.
Joseph Myers [Tue, 16 Aug 2016 16:25:57 +0000 (16:25 +0000)]
Add fesetexcept: sparc.

This patch adds a SPARC version of fesetexcept.  Untested.

* sysdeps/sparc/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: sh.
Joseph Myers [Tue, 16 Aug 2016 16:25:10 +0000 (16:25 +0000)]
Add fesetexcept: sh.

This patch adds an SH version of fesetexcept.  Untested.

* sysdeps/sh/sh4/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: s390.
Joseph Myers [Tue, 16 Aug 2016 16:24:11 +0000 (16:24 +0000)]
Add fesetexcept: s390.

This patch adds an S/390 version of fesetexcept.  Tested and corrected
by Stefan Liebler.

* sysdeps/s390/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: powerpc.
Joseph Myers [Tue, 16 Aug 2016 16:22:12 +0000 (16:22 +0000)]
Add fesetexcept: powerpc.

This patch adds PowerPC versions of fesetexcept.

* sysdeps/powerpc/fpu/fesetexcept.c: New file.
* sysdeps/powerpc/nofpu/fesetexcept.c: Likewise.
* sysdeps/powerpc/powerpc32/e500/nofpu/fesetexcept.c: Likewise.

7 years agoAdd fesetexcept: mips.
Joseph Myers [Tue, 16 Aug 2016 16:21:21 +0000 (16:21 +0000)]
Add fesetexcept: mips.

This patch adds a MIPS version of fesetexcept.

* sysdeps/mips/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: m68k.
Joseph Myers [Tue, 16 Aug 2016 16:20:33 +0000 (16:20 +0000)]
Add fesetexcept: m68k.

This patch adds an M68K version of fesetexcept.  Untested.

* sysdeps/m68k/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: ia64.
Joseph Myers [Tue, 16 Aug 2016 16:19:55 +0000 (16:19 +0000)]
Add fesetexcept: ia64.

This patch adds an IA64 version of fesetexcept.  Untested.

* sysdeps/ia64/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: hppa.
Joseph Myers [Tue, 16 Aug 2016 16:19:03 +0000 (16:19 +0000)]
Add fesetexcept: hppa.

This patch adds an HPPA version of fesetexcept.  Untested.

* sysdeps/hppa/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: arm.
Joseph Myers [Tue, 16 Aug 2016 16:18:24 +0000 (16:18 +0000)]
Add fesetexcept: arm.

This patch adds an ARM version of fesetexcept.

* sysdeps/arm/fesetexcept.c: New file.

7 years agoAdd fesetexcept: alpha.
Joseph Myers [Tue, 16 Aug 2016 16:17:42 +0000 (16:17 +0000)]
Add fesetexcept: alpha.

This patch adds an Alpha version of fesetexcept.  Untested.

* sysdeps/alpha/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept: aarch64.
Joseph Myers [Tue, 16 Aug 2016 16:16:57 +0000 (16:16 +0000)]
Add fesetexcept: aarch64.

This patch adds an AArch64 version of fesetexcept.  Untested.

* sysdeps/aarch64/fpu/fesetexcept.c: New file.

7 years agoAdd fesetexcept.
Joseph Myers [Tue, 16 Aug 2016 16:16:10 +0000 (16:16 +0000)]
Add fesetexcept.

TS 18661-1 defines an fesetexcept function for setting floating-point
exception flags without the side-effect of causing enabled traps to be
taken.

This patch series implements this function for glibc.  The present
patch adds the fallback stub implementation, x86 and x86_64
implementations, documentation, tests and ABI baseline updates.  The
remaining patches, some of them untested, add implementations for
other architectures.  The implementations generally follow those of
the fesetexceptflag function.

As for fesetexceptflag, the approach taken for architectures where
setting flags causes enabled traps to be taken is to set the flags
(and potentially cause traps) rather than refusing to set the flags
and returning an error.  Since ISO C and TS 18661 provide no way to
enable traps, this is formally in accordance with the standards.

The NEWS entry should be considered a placeholder, since this patch
series is intended to be followed by further such series adding other
TS 18661-1 features, so that the NEWS entry would end up looking more
like

* New <fenv.h> features from TS 18661-1:2014 are added to libm: the
  fesetexcept, fetestexceptflag, fegetmode and fesetmode functions,
  the femode_t type and the FE_DFL_MODE macro.

with hopefully more such entries for other features, rather than
having an entry for a single function in the end.

I believe we have consensus for adding TS 18661-1 interfaces as per
<https://sourceware.org/ml/libc-alpha/2016-06/msg00421.html>.

Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500).

* math/fesetexcept.c: New file.
* sysdeps/i386/fpu/fesetexcept.c: Likewise.
* sysdeps/x86_64/fpu/fesetexcept.c: Likewise.
* math/fenv.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetexcept): New function
declaration.
* manual/arith.texi (fesetexcept): Document function.
* math/Versions (fesetexcept): New libm symbol at version
GLIBC_2.25.
* math/Makefile (libm-support): Add fesetexcept.
(tests): Add test-fesetexcept and test-fesetexcept-traps.
* math/test-fesetexcept.c: New file.
* math/test-fesetexcept-traps.c: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

7 years agoAdd CVE-2016-6323 missing from NEWS entry
Florian Weimer [Tue, 16 Aug 2016 09:18:06 +0000 (11:18 +0200)]
Add CVE-2016-6323 missing from NEWS entry

7 years agoAdd NEWS entry for CVE-2016-6323
Florian Weimer [Tue, 16 Aug 2016 09:15:09 +0000 (11:15 +0200)]
Add NEWS entry for CVE-2016-6323

7 years agonptl/tst-tls3-malloc: Force freeing of thread stacks
Florian Weimer [Tue, 16 Aug 2016 09:06:13 +0000 (11:06 +0200)]
nptl/tst-tls3-malloc: Force freeing of thread stacks

It turns out that due to the reduced stack size in tst-tls3 and the
(fixed) default stack cache size, allocated TLS variables are never
freed, so the test coverage for tst-tls3-malloc is less than complete.
This change increases the thread stack size for tst-tls3-malloc only,
to make sure thread stacks and TLS variables are freed.

7 years agoarm: mark __startcontext as .cantunwind (bug 20435)
Andreas Schwab [Mon, 8 Aug 2016 07:29:18 +0000 (09:29 +0200)]
arm: mark __startcontext as .cantunwind (bug 20435)

__startcontext marks the bottom of the call stack of the contexts created
by makecontext.

7 years agolocales: et_EE: locale has wrong {p,n}_cs_precedes value [BZ #20459]
Märt Põder [Mon, 15 Aug 2016 09:46:21 +0000 (11:46 +0200)]
locales: et_EE: locale has wrong {p,n}_cs_precedes value [BZ #20459]

According to "Requirements of information technology in Estonian
language and cultural environment" the monetary symbol should be
written after the amount number:

  https://www.evs.ee/products/evs-8-2008

7 years agoAdd comment from sysdeps/powerpc/fpu/fraiseexcpt.c to fsetexcptflg.c.
Joseph Myers [Fri, 12 Aug 2016 17:49:07 +0000 (17:49 +0000)]
Add comment from sysdeps/powerpc/fpu/fraiseexcpt.c to fsetexcptflg.c.

* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Add
comment from fraiseexcpt.c.

7 years agoFix test-fexcept when "inexact" implicitly raised.
Joseph Myers [Fri, 12 Aug 2016 17:34:01 +0000 (17:34 +0000)]
Fix test-fexcept when "inexact" implicitly raised.

ISO C allows feraiseexcept to raise "inexact", in addition to the
requested exceptions, when requested to raise "overflow" or
"underflow".  Testing on ARM and PowerPC e500 (where glibc's
feraiseexcept has this property) showed that the new test-fexcept test
failed to allow for this; this patch fixes it, by wrapping
feraiseexcept to clear FE_INEXACT if implicitly raised and not raised
before the call.  (It would also be possible to do this with
fesetexcept, which always affects exactly the requested flags, but
this patch avoids making this fix depend on the fesetexcept changes.)

Tested for x86_64, x86, arm and e500.

* math/test-fexcept.c (feraiseexcept_exact): New function.
(test_set): Call feraiseexcept_exact instead of feraiseexcept.
(test_except): Likewise.

7 years agoAdd missing reference to bug 20452
Florian Weimer [Thu, 11 Aug 2016 12:39:03 +0000 (14:39 +0200)]
Add missing reference to bug 20452

7 years agoFix powerpc fesetexceptflag clearing FE_INVALID (bug 20455).
Joseph Myers [Wed, 10 Aug 2016 21:47:35 +0000 (21:47 +0000)]
Fix powerpc fesetexceptflag clearing FE_INVALID (bug 20455).

As shown by the test math/test-fexcept, the powerpc fesetexceptflag
implementation fails to clear a previously set FE_INVALID flag, when
that flag is clear in the saved exceptions and FE_INVALID is included
in the mask of flags to restore, because it fails to mask out the
sub-exceptions of FE_INVALID from the FPSCR state.  This patch fixes
the masking logic accordingly.

Tested for powerpc.

[BZ #20455]
* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Mask out
all FE_INVALID sub-exceptions from FPSCR when FE_INVALID specified
to be restored.

7 years agoAdd tests for fegetexceptflag, fesetexceptflag.
Joseph Myers [Wed, 10 Aug 2016 21:01:08 +0000 (21:01 +0000)]
Add tests for fegetexceptflag, fesetexceptflag.

I noticed that there was no meaningful test coverage for
fegetexceptflag and fesetexceptflag (one test ensures that calls to
them compile and link, but nothing to verify they work correctly).
This patch adds tests for these functions.

fesetexceptflag is meant to set the relevant exception flag bits to
the saved state without causing enabled traps to be taken.  On some
architectures, it is not possible to set exception flag bits without
causing enabled traps to occur.  Such architectures need to define
EXCEPTION_SET_FORCES_TRAP to 1 in their math-tests.h, as is done in
this patch for powerpc.  x86 avoids needing to define this because the
traps resulting from setting exception bits don't occur until the next
floating-point operation or fwait instruction.

Tested for x86_64, x86 and powerpc.  Note that test-fexcept fails for
powerpc because of a pre-existing bug in fesetexceptflag for powerpc,
which I'll fix separately.

* math/test-fexcept-traps.c: New file.
* math/test-fexcept.c: Likewise.
* math/Makefile (tests): Add test-fexcept and test-fexcept-traps.
* sysdeps/generic/math-tests.h (EXCEPTION_SET_FORCES_TRAP): New
macro.
* sysdeps/powerpc/math-tests.h [!__NO_FPRS__]
(EXCEPTION_SET_FORCES_TRAP): Likewise.

7 years agolocales: en_CA: update d_fmt [BZ #9842]
Martin Pitt [Fri, 14 Aug 2015 05:22:37 +0000 (01:22 -0400)]
locales: en_CA: update d_fmt [BZ #9842]

The date format in en_CA/LC_TIME specifies the date format as "%d/%m/%y".
However, it should be "%Y-%m-%d".  This is the standard date format in
Canada as specified by the Canadian Standards Association in CSA Z234.5:1989,
which adopts the ISO 8601 standard.

Here's the web page from the National Research Council of Canada
citing ISO 8601 as the standard date/time format in Canada:
http://www.nrc-cnrc.gc.ca/eng/services/time/faq/#Q8
 International Standard ISO 8601 specifies numeric representations
 of date and time. The recommended full format is of the form
 2001-12-31 23:59:28.73 UTC. The intent of this standard is to avoid
 confusion in international communications which can arise with the
 many different national notations. This format has the advantage
 that it permits dates to be readily sorted in chronological order
 by computer systems.

Windows 8+ and OS X also switched to this format.

7 years agoChangeLog: change Winblowz to Windows
Mike Frysinger [Tue, 9 Aug 2016 16:49:28 +0000 (00:49 +0800)]
ChangeLog: change Winblowz to Windows

7 years agolocaledata: change M$ to Microsoft
Mike Frysinger [Tue, 9 Aug 2016 16:49:14 +0000 (00:49 +0800)]
localedata: change M$ to Microsoft

7 years agoAdd atomic operations required by the new condition variable.
Torvald Riegel [Wed, 25 May 2016 22:57:27 +0000 (00:57 +0200)]
Add atomic operations required by the new condition variable.

* include/atomic.h (atomic_fetch_and_relaxed,
atomic_fetch_and_release, atomic_fetch_or_release,
atomic_fetch_xor_release): New.

7 years agoFix recvmsg returning SIGLOST on PF_LOCAL sockets
Samuel Thibault [Mon, 8 Aug 2016 23:42:50 +0000 (01:42 +0200)]
Fix recvmsg returning SIGLOST on PF_LOCAL sockets

when msg_name is not NULL.

* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Cope with aport being
MACH_PORT_NULL.

7 years agosparc32/sparcv9: add a VIS3 version of fdim
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc32/sparcv9: add a VIS3 version of fdim

sparc32 passes floating point values in the integer registers. VIS3
instructions gives access to the movwtos instruction to directly
transfer a value from an integer register to a floating point register.
Therefore it makes sense to provide a VIS3 version consisting in the
generic version compiled with -mvis3.

Changelog:
* math/s_fdim.c: Avoid alias renamed.
* math/s_fdimf.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Add s_fdimf-vis3, s_fdim-vis3.
(CFLAGS-s_fdimf-vis3.c): New. Set to -Wa,-Av9d -mvis3.
(CFLAGS-s_fdim-vis3.c): Likewise.
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c: New file.
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.

7 years agosparc: remove fdim sparc specific implementations
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc: remove fdim sparc specific implementations

The fdim and fdimf functions on sparc do not fully follow the standard
and do not set errno to ERANGE when the result overflows. Since glibc
2.24 this causes the two following tests to fail:

  Failure: fdim (max_value, -max_value): errno set to 0, expected 34 (ERANGE)
  Failure: fdim_upward (max_value, -max_value): errno set to 0, expected 34 (ERANGE)

It happens that using GCC with the generic C code generates very similar
code to the sparc specific implementations. Therefore this patches
remove them. Note it might still worth adding a vis3 specific version of
fdim on sparc32/sparcv9, this is done in a following patch to ease
backporting.

Changelog:
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Remove s_fdimf-vis3, s_fdim-vis3.
* sysdeps/sparc/sparc32/fpu/s_fdim.S: Delete file.
* sysdeps/sparc/sparc32/fpu/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_fdim.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_fdimf.S: Likewise.

7 years agosparc: build with -mvis on sparc32/sparcv9 and sparc64
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc: build with -mvis on sparc32/sparcv9 and sparc64

When building for sparc32/sparcv9 or sparc64, we assume that VIS
instructions are available and use them in the sparc specific assembly
code. However we do not tell GCC to use such instructions, resulting in
slightly suboptimal code.

Fix that by passing -Wa,-Av9a -mvis to GCC.

Changelog:
* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
-Wa,-Av9a -mvis.

7 years agoImprove gen-libm-test.pl LIT() application
Paul E. Murphy [Fri, 15 Jul 2016 15:57:07 +0000 (10:57 -0500)]
Improve gen-libm-test.pl LIT() application

When bootstrapping float128, this exposed a number of areas where
the L suffix is incorrectly applied to simple expressions when it
should be applied to each constant in the expression.

In order to stave off more macros in libm-test.inc, apply_lit is
made slightly more intelligent.  It will now split expressions
based on space characters, and attempt to apply LIT() to each
token.

Having done this, there are numerous spacing issues within
libm-test.inc which have been fixed.

The above is problematic when the L real suffix is not the most
expressive modifier, and the compiler complains (i.e ppc64) or
silently truncates a value (i.e ppc64).

7 years agoFix math.h comment about bits/mathdef.h.
Joseph Myers [Fri, 5 Aug 2016 18:15:00 +0000 (18:15 +0000)]
Fix math.h comment about bits/mathdef.h.

math.h has a comment about definitions from <bits/mathdef.h>.  This
comment is in the wrong place in math.h, far below the inclusion of
<bits/mathdef.h>.  It was originally above the inclusion, but the
inclusion was moved by

1998-11-05  Ulrich Drepper  <drepper@cygnus.com>

        * math/math.h: Unconditionally include bits/mathdef.h.  Declare
        long double functions only if __NO_LONG_DOUBLE_MATH is not
        defined.
        [...]

without moving the comment.  Furthermore, the comment refers
incorrectly to FLT_EVAL_METHOD and DECIMAL_DIG, which are actually
<float.h> macros, and INFINITY, which is in <bits/inf.h>.

This patch moves the comment back above the include it refers to and
removes the description of macros not defined by the header.

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

* math/math.h: Move comment about <bits/mathdef.h> definitions
above inclusion of <bits/mathdef.h>.  Do not mention
FLT_EVAL_METHOD, INFINITY or DECIMAL_DIG in that comment.

7 years agoAdd atomic_exchange_relaxed.
Torvald Riegel [Thu, 21 Jul 2016 12:31:28 +0000 (14:31 +0200)]
Add atomic_exchange_relaxed.

* include/atomic.h (atomic_exchange_relaxed): New.

7 years agoDo not call __nan in scalb functions.
Joseph Myers [Thu, 4 Aug 2016 20:50:31 +0000 (20:50 +0000)]
Do not call __nan in scalb functions.

When libm functions return a NaN: if it is for NaN input, it should be
computed from that input (e.g. adding it to itself), so that payloads
are propagated and signaling NaNs quieted, while if it is for non-NaN
input, it should be produced by a computation such as
(x - x) / (x - x), which raises "invalid" at the same time as
producing an appropriate NaN, so avoiding any need for a call to
feraiseexcept.

Various libm functions, however, call __nan ("") (or __nanf or __nanl)
to determine the NaN to return, together with using feraiseexcept
(FE_INVALID) to raise the exception.  sysdeps/generic/math_private.h
has an optimization for those functions with constant "" argument so
this doesn't actually involve a call to the __nan function, but it is
still not the preferred approach for producing NaNs.  (The optimized
code also always uses the NAN macro, i.e. produces a default NaN for
float converted to whatever the target type is, and on some
architectures that may not be the same as the preferred default NaN
for double or long double.)

This patch fixes the scalb functions to use the conventional method of
generating NaNs and raising "invalid" with an appropriate
computation.  (Most instances of this issue are in the complex
functions, where it can more readily be fixed once they have been made
type-generic and so only a third as many places need fixing.  Some of
the complex functions use __nan ("") + __nan (""), where the addition
serves no purpose whatsoever.)

Tested for x86_64 and x86.

* math/e_scalb.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.
* math/e_scalbf.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.
* math/e_scalbl.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.

7 years agoUpdate PO files.
Carlos O'Donell [Thu, 4 Aug 2016 15:40:21 +0000 (11:40 -0400)]
Update PO files.

Update the PO files from the latest available from the Translation
Project.

7 years agox86: Use sysdep.o from libc.a in static libraries
Florian Weimer [Thu, 4 Aug 2016 09:10:57 +0000 (11:10 +0200)]
x86: Use sysdep.o from libc.a in static libraries

Static libraries can use the sysdep.o copy in libc.a without
a performance penalty.  This results in a visible difference
if libpthread.a is relinked into a single object file (which
is needed to support libraries which check for the presence
of certain symbols to enable threading support, which generally
fails with static linking unless libpthread.a is relinked).

8 years agoAlso handle __STDC_WANT_IEC_60559_BFP_EXT__ in <tgmath.h>.
Joseph Myers [Wed, 3 Aug 2016 22:56:54 +0000 (22:56 +0000)]
Also handle __STDC_WANT_IEC_60559_BFP_EXT__ in <tgmath.h>.

My __STDC_WANT_IEC_60559_BFP_EXT__ patch omitted to update the
conditions on the nextup and nextdown type-generic macros in
<tgmath.h>.  This patch updates those conditions accordingly.  (As
glibc doesn't currently have an exp10 type-generic macro, no such
changes are needed relating to __STDC_WANT_IEC_60559_FUNCS_EXT__;
adding such a type-generic macro would be a new feature.)

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

* math/tgmath.h (nextdown): Define if
[__GLIBC_USE (IEC_60559_BFP_EXT)], not if [__USE_GNU].
(nextup): Likewise.

8 years agoSupport __STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro.
Joseph Myers [Wed, 3 Aug 2016 22:21:37 +0000 (22:21 +0000)]
Support __STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro.

This patch implements support for the
__STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro, following the
__GLIBC_USE approach used for other ISO C feature test macros.
Currently this only affects the exp10 functions (which glibc has had
for a long time).

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

* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_FUNCS_EXT): New
macro.
* include/features.h (__STDC_WANT_IEC_60559_FUNCS_EXT__):
Document.
* manual/creature.texi (__STDC_WANT_IEC_60559_FUNCS_EXT__):
Document macro.
* manual/math.texi (exp10): Document as ISO from TS 18661-4:2015.
(exp10f): Likewise.
(exp10l): Likewise.
* math/bits/mathcalls.h (exp10): Declare if
[__GLIBC_USE (IEC_60559_FUNCS_EXT)], not [__USE_GNU].

8 years agoFix typo in last arith.texi change.
Joseph Myers [Wed, 3 Aug 2016 21:15:51 +0000 (21:15 +0000)]
Fix typo in last arith.texi change.

* manual/arith.texi (nextup): Fix typo in last change.

8 years agoDeprecate inclusion of <sys/sysmacros.h> by <sys/types.h>
Zack Weinberg [Tue, 10 May 2016 15:07:42 +0000 (11:07 -0400)]
Deprecate inclusion of <sys/sysmacros.h> by <sys/types.h>

The macros defined by <sys/sysmacros.h> are not part of POSIX nor XSI, and
their names frequently collide with user code; see for instance glibc bug
19239 and Red Hat bug 130601.  <stdlib.h> includes <sys/types.h> under
_GNU_SOURCE, and C++ code presently cannot avoid being compiled under
_GNU_SOURCE, exacerbating the problem.

* NEWS: Inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
* misc/sys/sysmacros.h: If __SYSMACROS_DEPRECATED_INCLUSION is defined,
define major, minor, and makedev to issue deprecation warnings on use.
If __SYSMACROS_DEPRECATED_INCLUSION is *not* defined, suppress
previously-activated deprecation warnings for these macros and prevent
subsequent inclusions of this header from having any effect.
* posix/sys/types.h: Define __SYSMACROS_DEPRECATED_INCLUSION before
including <sys/sysmacros.h>, and undefine it again afterward.

8 years agoMinimize sysdeps code involved in defining major/minor/makedev.
Zack Weinberg [Thu, 28 Apr 2016 16:29:55 +0000 (12:29 -0400)]
Minimize sysdeps code involved in defining major/minor/makedev.

Presently sys/sysmacros.h is entirely defined in sysdeps.  This would
mean that the deprecation logic coming up in the next patch would have
to be written twice (in generic/ and unix/sysv/linux/).  To avoid that,
hoist all but the unavoidably system-dependent logic to misc/, leaving a
bits/ header behind.  This also promotes the Linux-specific encoding of
dev_t, which accommodates 32-bit major and minor numbers in a 64-bit dev_t,
to generic, as glibc's dev_t is always 64 bits wide.

The former Linux implementation used inline functions to avoid evaluating
arguments more than once.  After this change, all platforms use inline
functions, which means that three new symbols are added to the generic ABI.
(These symbols are in the user namespace, which is how they have always
been on Linux.  They begin with "gnu_dev_", so collisions with user code
are pretty unlikely.)

New ports henceforth need only provide a bits/sysmacros.h defining
internal macros __SYSMACROS_{DECLARE,DEFINE}_{MAJOR,MINOR,MAKEDEV}.
This is only necessary if the kernel encoding is incompatible with
the now-generic encoding (for instance, it would be necessary for
FreeBSD).

While I was at it, I added a basic round-trip test for these functions.

* sysdeps/generic/sys/sysmacros.h: Delete file.
* sysdeps/unix/sysv/linux/makedev.c: Delete file.
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Move file ...
* bits/sysmacros.h: ... here; this encoding is now the generic
encoding.  Now defines only the following macros:
__SYSMACROS_DECLARE_MAJOR, __SYSMACROS_DEFINE_MAJOR,
__SYSMACROS_DECLARE_MINOR, __SYSMACROS_DEFINE_MINOR,
__SYSMACROS_DECLARE_MAKEDEV, __SYSMACROS_DEFINE_MAKEDEV.

* misc/sys/sysmacros.h, misc/makedev.c: New files that use
bits/sysmacros.h and the above new macros to generate the
public implementations of major, minor, and makedev.
* misc/tst-makedev.c: New test.
* include/sys/sysmacros.h: New wrapper.

* misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h.
(routines): Add makedev.
(tests): Add tst-makedev.
* misc/Versions [GLIBC_2.25]: Add gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev.
* posix/Makefile (headers): Remove sys/sysmacros.h.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove makedev.

* sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.25,
gnu_dev_major, gnu_dev_makedev, gnu_dev_minor.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/microblaze/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/nios2/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add GLIBC_2.25.

8 years agoAdd utility macros for clang detection, and deprecation with messages.
Zack Weinberg [Thu, 28 Apr 2016 15:07:58 +0000 (11:07 -0400)]
Add utility macros for clang detection, and deprecation with messages.

There are three new macros added to features.h and sys/cdefs.h:

 * __glibc_clang_prereq: just like __GNUC_PREREQ, but for clang.
 * __glibc_clang_has_extension: wraps clang's intrinsic __has_extension.
   Writing "#if defined __clang__ && __has_extension (...)" doesn't work,
   because compilers other than clang will object to the unknown macro
   __has_extension even though they don't need to evaluate it.
   Instead, write "#if __glibc_clang_has_extension (...)".

 * __attribute_deprecated_msg__(msg): like __attribute_deprecated__, but
   if possible, prints a message.

The first two are used to define the third.  The third will be used
in subsequent patches.

* include/features.h (__glibc_clang_prereq): New macro.
* misc/sys/cdefs.h (__glibc_clang_has_extension)
(__attribute_deprecated_msg__): New macros.

8 years agoSupport __STDC_WANT_IEC_60559_BFP_EXT__ feature test macro.
Joseph Myers [Wed, 3 Aug 2016 17:30:41 +0000 (17:30 +0000)]
Support __STDC_WANT_IEC_60559_BFP_EXT__ feature test macro.

This patch implements support for the __STDC_WANT_IEC_60559_BFP_EXT__
feature test macro from ISO/IEC 18661-1:2014, following the
__GLIBC_USE approach now used for __STDC_WANT_LIB_EXT2__.  For this
macro, the relevant consideration is whether it is defined or
undefined when an affected header is included (not what its value is
if defined, and not whether it's defined or undefined when any other
unaffected system header is included).

Currently this macro only affects the issignaling macro and the nextup
and nextdown functions (so they can be enabled by defining this macro,
not just by defining _GNU_SOURCE as previously).  Any further features
from this TS added in future would also be conditioned on this macro.

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

* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_BFP_EXT): New
macro.
* include/features.h (__STDC_WANT_IEC_60559_BFP_EXT__): Document.
* manual/arith.texi (issignaling): Document as ISO from TS
18661-1:2014.
(nextup): Likewise.
(nextupf): Likewise.
(nextupl): Likewise.
(nextdown): Likewise.
(nextdownf): Likewise.
(nextdownl): Likewise.
* manual/creature.texi (__STDC_WANT_IEC_60559_BFP_EXT__): Document
macro.
* math/math.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(issignaling): Define if [__GLIBC_USE (IEC_60559_BFP_EXT)], not
[__USE_GNU].
* math/bits/mathcalls.h (nextdown): Declare if
[__GLIBC_USE (IEC_60559_BFP_EXT)], not [__USE_GNU].
(nextup): Likewise.
(__issignaling): Likewise.

8 years agoUnify drift between _Complex function type variants
Paul E. Murphy [Fri, 1 Jul 2016 18:17:09 +0000 (13:17 -0500)]
Unify drift between _Complex function type variants

While trying to convert the _Complex function wrappers
into a single generic implementation, a few minor
variations between identical versions emerged.

8 years agoRefactor part of math Makefile
Paul E. Murphy [Fri, 3 Jun 2016 20:44:12 +0000 (15:44 -0500)]
Refactor part of math Makefile

In order to support more types, the Makefile needs a few bits
shuffled.

F is explictly used as a placeholder to substitute for the
appropriate type suffix.  This removes the need to demangle
_r suffixed objects.

The variable libm-compat-calls is added to house any objects which
are only built to provide compat symbols within libm.  That is,
no newly added type should ever attempt building these.  Note,
k_standard* files have been added there.  By consensus they are
deprecated; in practice, we haven't gotten there yet.

New types would be added as noted in the comments preceding
type-TYPE-{suffix,routines,yes} variables.  However, some manual
additions will still need to be done to add appropriate flags
when building the various variants of libm-test.c for a new type.

Likewise, test-ildoubl is renamed test-ildouble for consistency's
sake.

8 years agoRemove tacit double usage in ldbl-128
Paul E. Murphy [Tue, 2 Aug 2016 18:32:06 +0000 (13:32 -0500)]
Remove tacit double usage in ldbl-128

There is quiet truncation to double arithmetic in several
files.  I noticed them when building ldbl-128 in a
soft-fp context.  This did not change any test results.

8 years agoUpdate and install proc_service.h [BZ #20311]
Tom Tromey [Wed, 3 Aug 2016 14:26:32 +0000 (16:26 +0200)]
Update and install proc_service.h [BZ #20311]

This adds an include guard and __BEGIN/__END_DECLS to proc_service.h,
removes some extraneous "const"s, and then arranges to install the
header.  The idea here is to make it more convenient to implement the
proc_service.h API.

8 years agoelf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]
Florian Weimer [Wed, 3 Aug 2016 14:16:57 +0000 (16:16 +0200)]
elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]

Instead, call malloc and explicitly align the pointer.

There is no external location to store the original (unaligned)
pointer, and this commit increases the allocation size to store
the pointer at a fixed location relative to the TCB pointer.

The manual alignment means that some space goes unused which
was previously made available for subsequent allocations.
However, in the TLS_DTV_AT_TP case, the manual alignment code
avoids aligning the pre-TCB to the TLS block alignment.  (Even
while using memalign, the allocation had some unused padding
in front.)

This concludes the removal of memalign calls from the TLS code,
and the new tst-tls3-malloc test verifies that only core malloc
routines are used.

8 years agoelf: Avoid using memalign for TLS allocations [BZ #17730]
Florian Weimer [Wed, 3 Aug 2016 14:15:38 +0000 (16:15 +0200)]
elf: Avoid using memalign for TLS allocations [BZ #17730]

Instead of a flag which indicates the pointer can be freed, dtv_t
now includes the pointer which should be freed.  Due to padding,
the size of dtv_t does not increase.

To avoid using memalign, the new allocate_dtv_entry function
allocates a sufficiently large buffer so that a sub-buffer
can be found in it which starts with an aligned pointer.  Both
the aligned and original pointers are kept, the latter for calling
free later.

8 years agoelf: dl-minimal malloc needs to respect fundamental alignment
Florian Weimer [Wed, 3 Aug 2016 14:11:01 +0000 (16:11 +0200)]
elf: dl-minimal malloc needs to respect fundamental alignment

The dynamic linker currently uses __libc_memalign for TLS-related
allocations.  The goal is to switch to malloc instead.  If the minimal
malloc follows the ABI fundamental alignment, we can assume that malloc
provides this alignment, and thus skip explicit alignment in a few
cases as an optimization.

It was requested on libc-alpha that MALLOC_ALIGNMENT should be used,
although this results in wasted space if MALLOC_ALIGNMENT is larger
than the fundamental alignment.  (The dynamic linker cannot assume
that the non-minimal malloc will provide an alignment of
MALLOC_ALIGNMENT; the ABI provides _Alignof (max_align_t) only.)

8 years agoDefine UDP_ENCAP_* from Linux 4.7 in netinet/udp.h.
Joseph Myers [Wed, 3 Aug 2016 12:13:16 +0000 (12:13 +0000)]
Define UDP_ENCAP_* from Linux 4.7 in netinet/udp.h.

This patch adds the new UDP_ENCAP_GTP0 and UDP_ENCAP_GTP1U from Linux
4.7 to sysdeps/gnu/netinet/udp.h.

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

* sysdeps/gnu/netinet/udp.h (UDP_ENCAP_GTP0): New macro.
(UDP_ENCAP_GTP1U): Likewise.

8 years agoDefine PF_QIPCRTR, AF_QIPCRTR from Linux 4.7 in bits/socket.h.
Joseph Myers [Wed, 3 Aug 2016 12:12:22 +0000 (12:12 +0000)]
Define PF_QIPCRTR, AF_QIPCRTR from Linux 4.7 in bits/socket.h.

This patch adds the new PF_QIPCRTR and AF_QIPCRTR from Linux 4.7 to
sysdeps/unix/sysv/linux/bits/socket.h.

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

* sysdeps/unix/sysv/linux/bits/socket.h (PF_QIPCRTR): New macro.
(PF_MAX): Update value.
(AF_QIPCRTR): New macro.

8 years agosparc64: add a VIS3 version of ceil, floor and trunc
Aurelien Jarno [Sun, 31 Jul 2016 21:45:52 +0000 (23:45 +0200)]
sparc64: add a VIS3 version of ceil, floor and trunc

sparc64 passes floating point values in the floating point registers.
As the the generic ceil, floor and trunc functions use integer
instructions, it makes sense to provide a VIS3 version consisting in
the the generic version compiled with -mvis3. GCC will then use
movdtox, movxtod, movwtos and movstow instructions.

sparc32 passes the floating point values in the integer registers, so it
doesn't make sense to do the same.

Changelog:
* sysdeps/ieee754/dbl-64/s_trunc.c: Avoid alias renamed.
* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Likewise.
* sysdeps/ieee754/flt-32/s_truncf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Add s_ceilf-vis3, s_ceil-vis3, s_floorf-vis3, s_floor-vis3,
s_truncf-vis3, s_trunc-vis3.
(CFLAGS-s_ceilf-vis3.c): New. Set to -Wa,-Av9d -mvis3.
(CFLAGS-s_ceil-vis3.c): Likewise.
(CFLAGS-s_floorf-vis3.c): Likewise.
(CFLAGS-s_floor-vis3.c): Likewise.
(CFLAGS-s_truncf-vis3.c): Likewise.
(CFLAGS-s_trunc-vis3.c): Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c: New file.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.

8 years agoFix sNaN handling in nearbyint on 32-bit sparc.
David S. Miller [Wed, 3 Aug 2016 04:00:21 +0000 (21:00 -0700)]
Fix sNaN handling in nearbyint on 32-bit sparc.

* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S
(__nearbyint_vis3): Don't check for sNaN before float register is
loaded with the incoming argument.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S
(__nearbyintf_vis3): Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint):
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf):
Likewise.

8 years agoFix wide-char testsuite SIGBUS on platforms such as Sparc.
David S. Miller [Wed, 3 Aug 2016 00:46:58 +0000 (17:46 -0700)]
Fix wide-char testsuite SIGBUS on platforms such as Sparc.

* string/test-strncmp.c (do_test_limit): Make sure the test data
stream is aligned as required for the type "CHAR".
(do_test): Likewise.

8 years agopowerpc: fix ifunc-sel.h fix asm constraints and clobber list
Aurelien Jarno [Tue, 2 Aug 2016 22:22:44 +0000 (00:22 +0200)]
powerpc: fix ifunc-sel.h fix asm constraints and clobber list

As pointer out on the mailing list, the inline assembly code in
sysdeps/powerpc/ifunc-sel.h doesn't have a list of clobbered registers
and used wrong constraints.

This patch fixes that. I verified it doesn't introduce any change in the
generated code.

Changelog:
* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the
clobber list. Use "i" constraint instead of "X".
(ifunc_one): Add "12" to the clobber list. Use "i" constraint instead
of "X".

8 years agopowerpc: fix ifunc-sel.h with GCC 6
Aurelien Jarno [Tue, 2 Aug 2016 22:22:44 +0000 (00:22 +0200)]
powerpc: fix ifunc-sel.h with GCC 6

On 32-bit PowerPC GCC 6 always saves the PIC register on the stack in
the prologue and adjust the stack in the epilogue. It is therefore not
possible anymore to just exit the function in the inline asm code,
otherwise it corrupts the stack pointer. This causes the following tests
to fail when using GCC 6:

FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1picstatic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1staticpic
FAIL: elf/ifuncmain1staticpie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain2pic
FAIL: elf/ifuncmain2picstatic
FAIL: elf/ifuncmain3
FAIL: elf/ifuncmain4picstatic
FAIL: elf/ifuncmain5
FAIL: elf/ifuncmain5picstatic
FAIL: elf/ifuncmain5staticpic

The solution is to replace the beqlr instructions by a beq to the end
of the inline asm code. This fixes all the above failures.

ChangeLog:
* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Replace beqlr instructions
by beq instructions jumping to the end of the function.

8 years agoSupport __STDC_WANT_LIB_EXT2__ feature test macro.
Joseph Myers [Tue, 2 Aug 2016 17:40:35 +0000 (17:40 +0000)]
Support __STDC_WANT_LIB_EXT2__ feature test macro.

This patch implements support for the __STDC_WANT_LIB_EXT2__ feature
test macro from ISO/IEC TR 24731-2:2010, thereby implementing one
possible approach for supporting ISO C feature test macros.

Recall that, as described in
<https://sourceware.org/ml/libc-alpha/2016-05/msg00486.html>, these
macros work based on the definition when affected headers are
included, so cannot be handled once when the first system header is
included because that might not be one of the headers the particular
macro in question affects.
<https://sourceware.org/ml/libc-alpha/2016-05/msg00680.html> expresses
views on possible approaches for implementation and
<https://sourceware.org/ml/libc-alpha/2016-06/msg00039.html> follows
up on that.

This patch arranges things so that the relevant condition is
__GLIBC_USE (LIB_EXT2), following one of the suggestions given.
Headers using these macros include <bits/libc-header-start.h>, which
in turn includes <features.h>.  Headers must define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION before including
<bits/libc-header-start.h>, to discourage inclusion outside glibc as
requested.  __USE_GNU conditions on affected functions are changed to
__GLIBC_USE (LIB_EXT2), while it's added as an additional alternative
on the conditions for functions already enabled for some POSIX
versions.

It would be possible to convert existing __USE_* conditionals to
__GLIBC_USE (with the relevant __GLIBC_USE_* being defined in
<features.h> where __USE_* are presently defined), and so make them
typo-proof (given -Wundef -Werror in glibc builds) because __GLIBC_USE
is used with #if not #ifdef / #if defined.

No attempt is made to enforce the rule about diagnosing different
definitions of __STDC_WANT_LIB_EXT2__ when affected headers are
included; such a diagnostic is incompatible with multiple-include
guards on the affected headers, unless compiler extensions are added
to support it.

As previously noted, glibc does not implement all features from TR
24731-2:2010: the functions aswprintf vaswprintf getwdelim getwline
are not in glibc, although they would be appropriate to add if someone
wished to do so.  But I think it makes sense to support the feature
test macro if *any* of the controlled features are present in glibc.

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

* bits/libc-header-start.h: New file.
* Makefile (headers): Add bits/libc-header-start.h.
* include/features.h (__STDC_WANT_LIB_EXT2__): Document.
(__GLIBC_USE): New macro.
* libio/stdio.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(fmemopen): Declare also if [__GLIBC_USE (LIB_EXT2)].
(open_memstream): Likewise.
(vasprintf): Declare if [__GLIBC_USE (LIB_EXT2)], not [__USE_GNU].
(__asprintf): Likewise.
(asprintf): Likewise.
(__getdelim): Declare also if [__GLIBC_USE (LIB_EXT2)].
(getdelim): Likewise.
(getline): Likewise.
* string/string.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(strdup): Declare also if [__GLIBC_USE (LIB_EXT2)]
(strndup): Likewise.
* wcsmbs/wchar.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(open_wmemstream): Declare also if [__GLIBC_USE (LIB_EXT2)].
* manual/creature.texi (__STDC_WANT_LIB_EXT2__): Document macro.

8 years agoAdd support for referencing specific symbol versions
Florian Weimer [Tue, 2 Aug 2016 15:18:08 +0000 (17:18 +0200)]
Add support for referencing specific symbol versions

This is needed for writing tests of compat symbols.

8 years agomalloc: Run tests without calling mallopt [BZ #19469]
Florian Weimer [Tue, 2 Aug 2016 15:01:02 +0000 (17:01 +0200)]
malloc: Run tests without calling mallopt [BZ #19469]

The compiled tests no longer refer to the mallopt symbol
from their main functions.  (Some tests still call mallopt
explicitly, which is fine.)

8 years agox86_64: Call finite scalar versions in vectorized log, pow, exp (bz #20033).
Andrew Senkevich [Tue, 2 Aug 2016 13:35:25 +0000 (16:35 +0300)]
x86_64: Call finite scalar versions in vectorized log, pow, exp (bz #20033).

Vector math functions require -ffast-math which sets -ffinite-math-only,
so it is needed to call finite scalar versions (which are called from
vector functions in some cases).

Since finite version of pow() returns qNaN instead of 1.0 for several
inputs, those inputs are excluded for tests of vector math functions.

    [BZ #20033]
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core_sse4.S: Call
    finite version.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core_sse4.S: Likewise.
    * sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core_avx2.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_exp2_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_log2_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_pow2_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_expf4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_logf4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_powf4_core.S: Likewise.
    * math/libm-test.inc (pow_test_data): Exclude tests for qNaN
    in power zero.

8 years agomalloc: Preserve arena free list/thread count invariant [BZ #20370]
Florian Weimer [Tue, 2 Aug 2016 10:24:50 +0000 (12:24 +0200)]
malloc: Preserve arena free list/thread count invariant [BZ #20370]

It is necessary to preserve the invariant that if an arena is
on the free list, it has thread attach count zero.  Otherwise,
when arena_thread_freeres sees the zero attach count, it will
add it, and without the invariant, an arena could get pushed
to the list twice, resulting in a cycle.

One possible execution trace looks like this:

Thread 1 examines free list and observes it as empty.
Thread 2 exits and adds its arena to the free list,
  with attached_threads == 0).
Thread 1 selects this arena in reused_arena (not from the free list).
Thread 1 increments attached_threads and attaches itself.
  (The arena remains on the free list.)
Thread 1 exits, decrements attached_threads,
  and adds the arena to the free list.

The final step creates a cycle in the usual way (by overwriting the
next_free member with the former list head, while there is another
list item pointing to the arena structure).

tst-malloc-thread-exit exhibits this issue, but it was only visible
with a debugger because the incorrect fix in bug 19243 removed
the assert from get_free_list.

8 years agoalpha: fix trunc for big input values
Aurelien Jarno [Tue, 2 Aug 2016 07:18:59 +0000 (09:18 +0200)]
alpha: fix trunc for big input values

The alpha specific version of trunc and truncf always add and subtract
0x1.0p23 or 0x1.0p52 even for big values. This causes this kind of
errors in the testsuite:

  Failure: Test: trunc_towardzero (0x1p107)
  Result:
   is:          1.6225927682921334e+32   0x1.fffffffffffffp+106
   should be:   1.6225927682921336e+32   0x1.0000000000000p+107
   difference:  1.8014398509481984e+16   0x1.0000000000000p+54
   ulp       :  0.5000
   max.ulp   :  0.0000

Change this by returning the input value when its absolute value is
greater than 0x1.0p23 or 0x1.0p52. NaN have to go through the add and
subtract operations to get possibly silenced.

Finally remove the code to handle inexact exception, trunc should never
generate such an exception.

Changelog:
* sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value
when its absolute value is greater than 0x1.0p52.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value
when its absolute value is greater than 0x1.0p23.
[_IEEE_FP_INEXACT] Remove.

8 years agoalpha: fix rint on sNaN input
Aurelien Jarno [Tue, 2 Aug 2016 07:18:59 +0000 (09:18 +0200)]
alpha: fix rint on sNaN input

The alpha version of rint wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.

Changelog:
* sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself
when it is a NaN.
* sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise.

8 years agoalpha: fix floor on sNaN input
Aurelien Jarno [Tue, 2 Aug 2016 07:18:59 +0000 (09:18 +0200)]
alpha: fix floor on sNaN input

The alpha version of floor wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.

Finally remove the code to handle inexact exception, floor should never
generate such an exception.

Changelog:
* sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise.

8 years agoalpha: fix ceil on sNaN input
Aurelien Jarno [Tue, 2 Aug 2016 07:18:59 +0000 (09:18 +0200)]
alpha: fix ceil on sNaN input

The alpha version of ceil wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.

Finally remove the code to handle inexact exception, ceil should never
generate such an exception.

Changelog:
* sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise.

8 years agoOpen development for 2.25.
Carlos O'Donell [Tue, 2 Aug 2016 03:00:21 +0000 (23:00 -0400)]
Open development for 2.25.

8 years agoUpdate for glibc 2.24 release. upstream-2.24 upstream/2.24
Carlos O'Donell [Tue, 2 Aug 2016 02:01:36 +0000 (22:01 -0400)]
Update for glibc 2.24 release.

8 years agoUpdate libc.pot and NEWS.
Carlos O'Donell [Tue, 2 Aug 2016 01:24:59 +0000 (21:24 -0400)]
Update libc.pot and NEWS.

8 years agosparc: remove ceil, floor, trunc sparc specific implementations
Aurelien Jarno [Sun, 31 Jul 2016 21:17:47 +0000 (23:17 +0200)]
sparc: remove ceil, floor, trunc sparc specific implementations

The ceil, floor and trunc functions on sparc do not fully follow the
standard and trigger an inexact exception when presented a value which
is not an integer. Since glibc 2.24 this causes a few tests to fail,
for instance:

  testing double (without inline functions)
  Failure: ceil (lit_pi): Exception "Inexact" set
  Failure: ceil (-lit_pi): Exception "Inexact" set
  Failure: ceil (min_subnorm_value): Exception "Inexact" set
  Failure: ceil (min_value): Exception "Inexact" set
  Failure: ceil (0.1): Exception "Inexact" set
  Failure: ceil (0.25): Exception "Inexact" set
  Failure: ceil (0.625): Exception "Inexact" set
  Failure: ceil (-min_subnorm_value): Exception "Inexact" set
  Failure: ceil (-min_value): Exception "Inexact" set
  Failure: ceil (-0.1): Exception "Inexact" set
  Failure: ceil (-0.25): Exception "Inexact" set
  Failure: ceil (-0.625): Exception "Inexact" set

I tried to fix that by using the same strategy than used on other
architectures, that is by saving the FSR register at the beginning
and restoring it at the end of the function. When doing so I noticed
a comment that this operation might be very costly, so I decided to
do some benchmarks.

The benchmarks below represent the time required to run each of the
function 60 millions of times with different input value. I have done
that in the basic V9 code, the VIS2 code, and using the default C
implementation of the libc, for both sparc32 and sparc64, on a Niagara
T1 based machine and an UltraSparc IIIi. Given I don't have access to a
more recent machine), I haven't been able to test the VIS3 version. Also
it should be noted that it doesn't make sense to do this benchmark for
V8 or earlier as in that case we use the default C implementation. The
results are available in the table below, the "+ fix" version correspond
to the one saving and restoring the FSR.

  Niagara T1 / sparc32
  --------------------
              ceilf    ceil     floorf   floor    truncf   trunc
  V9          19.10    22.48    19.10    22.48    16.59    19.27
  V9 + fix    19.77    23.34    19.77    23.33    17.27    20.12
  VIS2        16.87    19.62    16.87    19.62
  VIS2 + fix  17.55    20.47    17.55    20.47
  C impl      11.39    13.80    11.40    13.80    10.88    10.84

  Niagara T1 / sparc64
  --------------------
              ceilf    ceil     floorf   floor    truncf   trunc
  V9          18.14    22.23    18.14    22.23    15.64    19.02
  V9 + fix    18.82    23.08    18.82    23.08    16.32    19.87
  VIS2        15.92    19.37    15.92    19.37
  VIS2 + fix  16.59    20.22    16.59    20.22
  C impl      11.39    13.60    11.39    15.36    10.88    12.65

  UltraSparc IIIi / sparc32
  -------------------------
              ceilf    ceil     floorf   floor    truncf   trunc
  V9           4.81     7.09     6.61    11.64     4.91     7.05
  V9 + fix     7.20    10.42     7.14    10.54     6.76     9.47
  VIS2         4.81     7.03     4.76     7.13
  VIS2 + fix   6.76     9.51     6.71     9.63
  C impl       3.88     8.62     3.90     9.45     3.57     6.62

  UltraSparc IIIi / sparc64
  -------------------------
              ceilf    ceil     floorf   floor    truncf   trunc
  V9           3.48     4.39     3.48     4.41     3.01     3.85
  V9 + fix     4.76     5.90     4.76     5.90     4.86     6.26
  VIS2         2.95     3.61     2.95     3.61
  VIS2 + fix   4.24     5.37     4.30     7.97
  C impl       3.63     4.89     3.62     6.38     3.33     4.03

The first thing that should be noted is that the C implementation is
always faster on the Niagara T1 based machine. On the UltraSparc IIIi
the float version on sparc32 is also faster.

Coming back about the fix saving and restoring the FSR, it appears
it has a big impact as expected. In that case the C implementation is
always faster than the fixed implementations.

This patch therefore removes the sparc specific implementations in
favor of the generic ones.

Changelog:
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
[$(subdir) = math] (libm-sysdep_routines): Remove.
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Remove s_ceilf-vis3, s_ceil-vis3, s_floorf-vis3, s_floor-vis3,
s_truncf-vis3, s_trunc-vis3.
* sysdeps/sparc/sparc64/fpu/multiarch/Makefile: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis2.S: Delete
file.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceil.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis2.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_ceilf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis2.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floor.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis2.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_floorf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_trunc.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_truncf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_ceil.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_ceilf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_floor.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_floorf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_trunc.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_truncf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis2.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis2.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis2.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis2.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.S: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_ceil.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_ceilf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_floor.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_floorf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_trunc.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_truncf.S: Likewise.

8 years agoCVE-2016-5417 was assigned to bug 19257
Florian Weimer [Fri, 29 Jul 2016 21:34:17 +0000 (17:34 -0400)]
CVE-2016-5417 was assigned to bug 19257

8 years agoDon't compile do_test with -mavx/-mavx/-mavx512
H.J. Lu [Wed, 27 Jul 2016 18:51:33 +0000 (11:51 -0700)]
Don't compile do_test with -mavx/-mavx/-mavx512

Don't compile do_test with -mavx, -mavx nor -mavx512 since they won't run
on non-AVX machines.

[BZ #20384]
* sysdeps/x86_64/fpu/Makefile (extra-test-objs): Add
test-double-libmvec-sincos-avx-main.o,
test-double-libmvec-sincos-avx2-main.o,
test-double-libmvec-sincos-main.o,
test-float-libmvec-sincosf-avx-main.o,
test-float-libmvec-sincosf-avx2-main.o and
test-float-libmvec-sincosf-main.o.
test-float-libmvec-sincosf-avx512-main.o.
($(objpfx)test-double-libmvec-sincos): Also link with
$(objpfx)test-double-libmvec-sincos-main.o.
($(objpfx)test-double-libmvec-sincos-avx): Also link with
$(objpfx)test-double-libmvec-sincos-avx-main.o.
($(objpfx)test-double-libmvec-sincos-avx2): Also link with
$(objpfx)test-double-libmvec-sincos-avx2-main.o.
($(objpfx)test-float-libmvec-sincosf): Also link with
$(objpfx)test-float-libmvec-sincosf-main.o.
($(objpfx)test-float-libmvec-sincosf-avx): Also link with
$(objpfx)test-float-libmvec-sincosf-avx2-main.o.
[$(config-cflags-avx512) == yes] (extra-test-objs): Add
test-double-libmvec-sincos-avx512-main.o and
($(objpfx)test-double-libmvec-sincos-avx512): Also link with
$(objpfx)test-double-libmvec-sincos-avx512-main.o.
($(objpfx)test-float-libmvec-sincosf-avx512): Also link with
$(objpfx)test-float-libmvec-sincosf-avx512-main.o.
(CFLAGS-test-double-libmvec-sincos.c): Removed.
(CFLAGS-test-float-libmvec-sincosf.c): Likewise.
(CFLAGS-test-double-libmvec-sincos-main.c): New.
(CFLAGS-test-double-libmvec-sincos-avx-main.c): Likewise.
(CFLAGS-test-double-libmvec-sincos-avx2-main.c): Likewise.
(CFLAGS-test-float-libmvec-sincosf-main.c): Likewise.
(CFLAGS-test-float-libmvec-sincosf-avx-main.c): Likewise.
(CFLAGS-test-float-libmvec-sincosf-avx2-main.c): Likewise.
(CFLAGS-test-float-libmvec-sincosf-avx512-main.c): Likewise.
(CFLAGS-test-double-libmvec-sincos-avx.c): Set to -DREQUIRE_AVX.
(CFLAGS-test-float-libmvec-sincosf-avx.c ): Likewise.
(CFLAGS-test-double-libmvec-sincos-avx2.c): Set to
-DREQUIRE_AVX2.
(CFLAGS-test-float-libmvec-sincosf-avx2.c ): Likewise.
(CFLAGS-test-double-libmvec-sincos-avx512.c): Set to
-DREQUIRE_AVX512F.
(CFLAGS-test-float-libmvec-sincosf-avx512.c): Likewise.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos.c: Rewritten.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c: Likewise.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx-main.c: New
file.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-double-libmvec-sincos-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512-main.c:
Likewise.
* sysdeps/x86_64/fpu/test-float-libmvec-sincosf-main.c:
Likewise.

8 years agoNios II localplt.data update: remove __eqsf2
Chung-Lin Tang [Wed, 27 Jul 2016 18:42:13 +0000 (11:42 -0700)]
Nios II localplt.data update: remove __eqsf2

8 years agopowerpc: Fix missing verb and typo in comment about AT_HWCAP entry
Gustavo Romero [Mon, 18 Jul 2016 15:44:02 +0000 (12:44 -0300)]
powerpc: Fix missing verb and typo in comment about AT_HWCAP entry

Fix missing verb and typo in comment about AT_HWCAP entry, in the context
of mcontext_t struct definition for PPC64 Linux kernels.

8 years ago[AArch64] Update libm-test-ulps
Szabolcs Nagy [Thu, 21 Jul 2016 08:48:45 +0000 (09:48 +0100)]
[AArch64] Update libm-test-ulps

This partly reverts commit f8238ae3c7701dbd9c04028861916de64e578114
that regenerated the ulps, to make the max ulps good for gcc-5,
gcc-6 and gcc-trunk as well.

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

8 years agoS390: Do not clobber r13 with memcpy on 31bit with copies >1MB.
Stefan Liebler [Wed, 20 Jul 2016 06:29:43 +0000 (08:29 +0200)]
S390: Do not clobber r13 with memcpy on 31bit with copies >1MB.

If the default memcpy variant is called with a length of >1MB on 31bit,
r13 is clobbered as the algorithm is switching to mvcle. The mvcle code
returns without restoring r13. All other cases are restoring r13.

If memcpy is called from outside libc the ifunc resolver will only select
this variant if running on machines older than z10.
Otherwise or if memcpy is called from inside libc, this default memcpy
variant is called.
The testcase timezone/tst-tzset is triggering this issue in some combinations
of gcc versions and optimization levels.

This bug was introduced in commit 04bb21ac93e90d7696bcaf8febe2b2dd2d83585a
and thus is a regression compared to former glibc 2.23 release.

This patch removes the usage of r13 at all. Thus it is not saved and restored.
The base address for execute-instruction is now stored in r5 which is obtained
after r5 is not needed anymore as 256byte block counter.

ChangeLog:

* sysdeps/s390/s390-32/memcpy.S (memcpy): Eliminate the usage
of r13 as it is not restored in mvcle case.

8 years agomicroblaze: fix variable name collision with syscall macros
Mike Frysinger [Tue, 19 Jul 2016 16:09:36 +0000 (21:39 +0530)]
microblaze: fix variable name collision with syscall macros

If a function passes in a variable named "ret", the code will miscompile
when it declares a local ret variable.  In some cases, it's even a build
failure like so:
../sysdeps/unix/sysv/linux/spawni.c: In function '__spawni_child':
../sysdeps/unix/sysv/linux/spawni.c:289:5: error: address of register variable 'ret' requested
while (write_not_cancel (p, &ret, sizeof ret) < 0)

8 years agoelf/elf.h: Add missing Meta relocations
Will Newton [Tue, 19 Jul 2016 14:53:35 +0000 (15:53 +0100)]
elf/elf.h: Add missing Meta relocations

2016-07-19   Will Newton  <will.newton@gmail.com>

* elf/elf.h (R_METAG_REL8, R_METAG_REL16, R_METAG_TLS_GD
R_METAG_TLS_LDM, R_METAG_TLS_LDO_HI16, R_METAG_TLS_LDO_LO16,
R_METAG_TLS_LDO, R_METAG_TLS_IE, R_METAG_TLS_IENONPIC,
R_METAG_TLS_IENONPIC_HI16, R_METAG_TLS_IENONPIC_LO16,
R_METAG_TLS_LE, R_METAG_TLS_LE_HI16, R_METAG_TLS_LE_LO16): New.

8 years agoi386: Compile rtld-*.os with -mno-sse -mno-mmx -mfpmath=387
H.J. Lu [Mon, 18 Jul 2016 22:16:11 +0000 (15:16 -0700)]
i386: Compile rtld-*.os with -mno-sse -mno-mmx -mfpmath=387

Compile i386 rtld-*.os with -mno-sse -mno-mmx -mfpmath=387 so that no
code in ld.so uses mm/xmm/ymm/zmm registers on i386 since the first 3
mm/xmm/ymm/zmm registers are used to pass vector parameters which must
be preserved.

* sysdeps/i386/Makefile (rtld-CFLAGS): New.
[subdir == elf] (CFLAGS-.os): Replace -mno-sse -mno-mmx
-mfpmath=387 with $(rtld-CFLAGS).
[subdir != elf] (CFLAGS-.os): Compile rtld-*.os with
$(rtld-CFLAGS).

8 years agoelf: Define missing Meta architecture specific relocations
Khem Raj [Thu, 14 Jul 2016 15:10:53 +0000 (08:10 -0700)]
elf: Define missing Meta architecture specific relocations

8 years agoFix cos computation for multiple precision fallback (bz #20357)
Siddhesh Poyarekar [Mon, 18 Jul 2016 17:03:09 +0000 (22:33 +0530)]
Fix cos computation for multiple precision fallback (bz #20357)

During the sincos consolidation I made two mistakes, one was a logical
error due to which cos(0x1.8475e5afd4481p+0) returned
sin(0x1.8475e5afd4481p+0) instead.

The second issue was an error in negating inputs for the correct
quadrants for sine.  I could not find a suitable test case for this
despite running a program to search for such an input for a couple of
hours.

Following patch fixes both issues.  Tested on x86_64.  Thanks to Matt
Clay for identifying the issue.

[BZ #20357]
* sysdeps/ieee754/dbl-64/s_sin.c (sloww): Fix up condition
to call __mpsin/__mpcos and to negate values.
* math/auto-libm-test-in: Add test.
* math/auto-libm-test-out: Regenerate.

8 years agoDon't install the internal header grp-merge.h
Zack Weinberg [Mon, 18 Jul 2016 12:33:21 +0000 (09:33 -0300)]
Don't install the internal header grp-merge.h

grp-merge.h was introduced in Stephen Gallagher's patch adding the
"group merging" feature to NSS.  It declares two functions, __copy_grp
and __merge_grp, both of which are tagged 'internal_function', which
means that nobody can even compile the contents of the header without
access to libc-symbols.h, which is not installed.  (Also, these
functions are GLIBC_PRIVATE exports from libc.so.)  Hence I believe
grp-merge.h should not be installed either.

This really needs to be in 2.24, so that no released version of the
library installs this header.

I hope that what I did to the ChangeLog diff will allow it to be
applied without hassle.

* grp/Makefile: Don't install the internal header grp-merge.h.

8 years ago[AArch64] Regenerate libm-test-ulps
Szabolcs Nagy [Mon, 18 Jul 2016 10:42:52 +0000 (11:42 +0100)]
[AArch64] Regenerate libm-test-ulps

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

8 years agoFix TABDLY value
Samuel Thibault [Wed, 13 Jul 2016 20:41:40 +0000 (22:41 +0200)]
Fix TABDLY value

* bits/termios.h (TABDLY): Change macro to include TAB3 bit too.

8 years agoRefactor Linux raise implementation (BZ#15368)
Adhemerval Zanella [Fri, 22 Apr 2016 12:25:20 +0000 (09:25 -0300)]
Refactor Linux raise implementation (BZ#15368)

This patch changes both the nptl and libc Linux raise implementation
to avoid the issues described in BZ#15368.  The strategy used is
summarized in bug report first comment:

 1. Block all signals (including internal NPTL ones);
 2. Get pid and tid directly from syscall (not relying on cached
    values);
 3. Call tgkill;
 4. Restore old signal mask.

Tested on x86_64 and i686.

[BZ #15368]
* sysdeps/unix/sysv/linux/nptl-signals.h
(__nptl_clear_internal_signals): New function.
(__libc_signal_block_all): Likewise.
(__libc_signal_block_app): Likewise.
(__libc_signal_restore_set): Likewise.
* sysdeps/unix/sysv/linux/pt-raise.c (raise): Use Linux raise.c
implementation.
* sysdeps/unix/sysv/linux/raise.c (raise): Reimplement to not use
the cached pid/tid value in pthread structure.

8 years agoRegenerate i686 libm-test-ulps with GCC 6.1 at -O3 [BZ #20347]
H.J. Lu [Wed, 13 Jul 2016 15:02:10 +0000 (08:02 -0700)]
Regenerate i686 libm-test-ulps with GCC 6.1 at -O3 [BZ #20347]

This fixes with GCC 6.1 and -O3 on i686:

Failure: Test: j0_downward (0xap+0)
Result:
 is:         -2.45935813e-01  -0x1.f7ad32p-3
 should be:  -2.45935768e-01  -0x1.f7ad2cp-3
 difference:  4.47034835e-08   0x1.800000p-25
 ulp       :  3.0000
 max.ulp   :  2.0000
Maximal error of `j0_downward'
 is      : 3 ulp
 accepted: 2 ulp

[BZ #20347]
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.

8 years agox86-64: Add p{read,write}[v]64 to syscalls.list [BZ #20348]
H.J. Lu [Tue, 12 Jul 2016 16:21:36 +0000 (09:21 -0700)]
x86-64: Add p{read,write}[v]64 to syscalls.list [BZ #20348]

64-bit off_t in pread64, preadv, pwrite64 and pwritev syscalls is passed
in one 64-bit register for both x32 and x86-64.  Since the inline
asm statement only passes long, which is 32-bit for x32, in registers,
64-bit off_t is truncated to 32-bit on x32.  Since __ASSUME_PREADV and
__ASSUME_PWRITEV are defined unconditionally, these syscalls can be
implemented in syscalls.list to pass 64-bit off_t in one 64-bit register.

Tested on x86-64 and x32 with off_t > 4GB on pread64/pwrite64 and
preadv64/pwritev64.

[BZ #20348]
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Add pread64,
preadv64, pwrite64 and pwritev64.

8 years agoTest p{read,write}64 with offset > 4GB
H.J. Lu [Tue, 12 Jul 2016 15:29:06 +0000 (08:29 -0700)]
Test p{read,write}64 with offset > 4GB

Test p{read,write}64 with offset > 4GB.  Since it is not an error for a
successful pread/pwrite call to transfer fewer bytes than requested, we
should check if the return value is -1.   No need to close and unlink
temporary file, which is handled by test-skeleton.c.

[BZ #20350]
* posix/tst-preadwrite.c: Renamed to ...
* posix/tst-preadwrite-common.c: This.
(PREAD): Removed.
(PWRITE): Likewise.
(STRINGIFY): Likewise.
(STRINGIFY2): Likewise.
(do_prepare): Make it static and remove function arguments.
(do_test): Likewise.
(PREPARE): Updated.
(TEST_FUNCTION): New.
(name): Make it static.
(fd): Likewise.
(do_prepare): Use create_temp_file.
(do_test): Renamed to ...
(do_test_with_offset): This.  Make it static and accept offset.
Properly check return value of PWRITE and PREAD.  Return bytes
read.  Don't close fd nor unlink name.
* posix/tst-preadwrite.c: Rewrite.
* posix/tst-preadwrite64.c: Likewise.

8 years agox86-64: Properly align stack in _dl_tlsdesc_dynamic [BZ #20309]
H.J. Lu [Tue, 12 Jul 2016 13:29:54 +0000 (06:29 -0700)]
x86-64: Properly align stack in _dl_tlsdesc_dynamic [BZ #20309]

Since _dl_tlsdesc_dynamic is called via PLT, we need to add 8 bytes for
push in the PLT entry to align the stack.

[BZ #20309]
* configure.ac (have-mtls-dialect-gnu2): Set to yes if
-mtls-dialect=gnu2 works.
* configure: Regenerated.
* elf/Makefile [have-mtls-dialect-gnu2 = yes]
(tests): Add tst-gnu2-tls1.
(modules-names): Add tst-gnu2-tls1mod.
($(objpfx)tst-gnu2-tls1): New.
(tst-gnu2-tls1mod.so-no-z-defs): Likewise.
(CFLAGS-tst-gnu2-tls1mod.c): Likewise.
* elf/tst-gnu2-tls1.c: New file.
* elf/tst-gnu2-tls1mod.c: Likewise.
* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Add 8
bytes for push in the PLT entry to align the stack.

8 years agoX86-64: Define LO_HI_LONG to skip pos_h [BZ #20349]
H.J. Lu [Mon, 11 Jul 2016 22:32:10 +0000 (15:32 -0700)]
X86-64: Define LO_HI_LONG to skip pos_h [BZ #20349]

Define LO_HI_LONG to skip pos_h since it is ignored by kernel:

static inline loff_t pos_from_hilo(unsigned long high, unsigned long low)
{
 #define HALF_LONG_BITS (BITS_PER_LONG / 2)
        return (((loff_t)high << HALF_LONG_BITS) << HALF_LONG_BITS) | low;
}

where size of loff_t == size of long.

[BZ #20349]
* sysdeps/unix/sysv/linux/x86_64/sysdep.h (LO_HI_LONG): New.

8 years agoRevert "Add pretty printers for the NPTL lock types"
Siddhesh Poyarekar [Mon, 11 Jul 2016 15:02:12 +0000 (20:32 +0530)]
Revert "Add pretty printers for the NPTL lock types"

This reverts commit 62ce266b0b261def2c6329be9814ffdcc11964d6.

The change is not mature enough because it needs the following fixes:

1. Redirect test output to a file like other tests

2. Eliminate the need to use a .gdbinit because distributions will
   break without it.  I should have caught that but I was in too much
   of a hurry to get the patch in :/

3. Feature checking during configure to determine things like minimum
   required gdb version, python-pexpect version, etc. to make sure
   that tests work correctly.

8 years ago[AArch64] Add bits/hwcap.h for aarch64 linux
Szabolcs Nagy [Mon, 11 Jul 2016 08:57:02 +0000 (09:57 +0100)]
[AArch64] Add bits/hwcap.h for aarch64 linux

AArch64 uses HWCAP bits but they are not defined in sys/auxv.h.
This patch adds a copy of the linux v4.6 arm64 uapi asm/hwcap.h
definitions.

* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h: New.

8 years ago[AArch64] Fix libc internal asm profiling code
Szabolcs Nagy [Mon, 11 Jul 2016 08:46:08 +0000 (09:46 +0100)]
[AArch64] Fix libc internal asm profiling code

When glibc is built with --enable-profile, the ENTRY of
asm functions includes CALL_MCOUNT for profiling.
(matters for binaries static linked against libc_p.a.)

CALL_MCOUNT did not save/restore argument registers
around the _mcount call so it clobbered them.
(it is enough to only save/restore the arguments passed
to a given asm function, but that would be too many asm
changes so it is simpler to always save all argument
registers in this macro.)

float args are not saved: mcount does not clobber the
float regs and currently no asm function takes float
arguments anyway.

[BZ #18707]
* sysdeps/aarch64/Makefile (CFLAGS-mcount.c): Add -mgeneral-regs-only.
* sysdeps/aarch64/sysdep.h (CALL_MCOUNT): Save argument registers.

8 years agoFix LO_HI_LONG definition
Adhemerval Zanella [Mon, 4 Jul 2016 14:34:35 +0000 (11:34 -0300)]
Fix LO_HI_LONG definition

The p{read,write}v{64} consolidation patch [1] added a wrong guard
for LO_HI_LONG definition.  It currently uses both
'__WORDSIZE == 64' and 'defined __ASSUME_WORDSIZE64_ILP32' to set
the value to be passed in one argument, otherwise it will be split
in two.

However it fails on MIPS64n32 where syscalls n32 uses the compat
implementation in the kernel meaning the off_t arguments are passed
in two separate registers.

GLIBC already defines a macro for such cases (__OFF_T_MATCHES_OFF64_T),
so this patch uses it instead.

Checked on x86_64, i686, x32, aarch64, armhf, and s390.

* sysdeps/unix/sysv/linux/sysdep.h
[__WORDSIZE == 64 || __ASSUME_WORDSIZE64_ILP32] (LO_HI_LONG): Remove
guards.
* misc/tst-preadvwritev-common.c: New file.
* misc/tst-preadvwritev.c: Use tst-preadvwritev-common.c.
* misc/tst-preadvwritev64.c: Use tst-preadwritev-common.c and add
a check for files larger than 2GB.

[1] 4751bbe2ad4d1bfa05774e29376d553ecfe563b0