]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
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).

7 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.

7 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].

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.)

7 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.

7 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.

7 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.

7 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.

7 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.

7 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".

7 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.

7 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.

7 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.

7 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.)

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

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

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

7 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.

7 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.

7 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

7 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.

7 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

7 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.

7 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.

7 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.

7 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)

7 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.

7 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).

7 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

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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

7 years agoRemove __ASSUME_OFF_DIFF_OFF64 definition
Adhemerval Zanella [Tue, 28 Jun 2016 12:48:18 +0000 (09:48 -0300)] 
Remove __ASSUME_OFF_DIFF_OFF64 definition

This patch removes the __ASSUME_OFF_DIFF_OFF64 define introduced in
p{read,write} consolidation patch.  This define was added based on
the idea 32 bits ports would continue to follow previous off{64}_t
definition where off_t size differs from off64_t one.

However, with recent AArch64/ILP32 patch submission and also with
discussion for RISCV kernel interface, 32 bits ports now may aim
to use off_t and off64_t with the same size as 64 bits.

So current assumption for both p{read,write} and p{read,write}v
are not compatible with new type definition.  This patch now makes
the syscall wrappers to only depend on __OFF_T_MATCHES_OFF64_T to
define the default and 64-suffix variant, as follow:

  <function>.c
  #ifndef __OFF_T_MATCHES_OFF64_T
  /* build <function> */
  #endif

  and

  <function>64.c

  /* build <function>64 */
  #ifdef __OFF_T_MATCHES_OFF64_T
  weak_alias (fallocate64, fallocate)
  #endif

Tested on x86_64, i686, x32, and armhf.

* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_OFF_DIFF_OFF64): Remove define.
* sysdeps/unix/sysv/linux/pread.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pread): Replace by
__OFF_T_MATCHES_OFF64_T.
* sysdeps/unix/sysv/linux/pread64.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pread64): Likewise.
* sysdeps/unix/sysv/linux/preadv.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (preadv): Likewise.
* sysdeps/unix/sysv/linux/preadv64.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (preadv64): Likewise.
* sysdeps/unix/sysv/linux/pwrite.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pwrite): Likewise.
* sysdeps/unix/sysv/linux/pwrite64.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pwrite64): Likewise.
* sysdeps/unix/sysv/linux/pwritev.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pwritev): Likewise.
* sysdeps/unix/sysv/linux/pwritev64.c
[__WORDSIZE != 64 || __ASSUME_OFF_DIFF_OFF64] (pwritev64): Likewise.

7 years agoAdd pretty printers for the NPTL lock types
Martin Galvan [Fri, 8 Jul 2016 14:31:55 +0000 (20:01 +0530)] 
Add pretty printers for the NPTL lock types

This patch adds pretty printers for the following NPTL types:

- pthread_mutex_t
- pthread_mutexattr_t
- pthread_cond_t
- pthread_condattr_t
- pthread_rwlock_t
- pthread_rwlockattr_t

To load the pretty printers into your gdb session, do the following:

python
import sys
sys.path.insert(0, '/path/to/glibc/build/nptl/pretty-printers')
end

source /path/to/glibc/source/pretty-printers/nptl-printers.py

You can check which printers are registered and enabled by issuing the
'info pretty-printer' gdb command. Printers should trigger automatically when
trying to print a variable of one of the types mentioned above.

The printers are architecture-independent, and were manually tested on both
the gdb CLI and Eclipse CDT.

In order to work, the printers need to know the values of various flags that
are scattered throughout pthread.h and pthreadP.h as enums and #defines. Since
replicating these constants in the printers file itself would create a
maintenance burden, I wrote a script called gen-py-const.awk that Makerules uses
to extract the constants. This script is pretty much the same as gen-as-const.awk,
except it doesn't cast the constant values to 'long' and is thorougly documented.
The constants need only to be enumerated in a .pysym file, which is then referenced
by a Make variable called gen-py-const-headers.

As for the install directory, I discussed this with Mike Frysinger and Siddhesh
Poyarekar, and we agreed that it can be handled in a separate patch, and it shouldn't
block merging of this one.

In addition, I've written a series of test cases for the pretty printers.
Each lock type (mutex, condvar and rwlock) has two test programs, one for itself
and other for its related 'attributes' object. Each test program in turn has a
PExpect-based Python script that drives gdb and compares its output to the
expected printer's. The tests run on the glibc host, which is assumed to have
both gdb and PExpect; if either is absent the tests will fail with code 77
(UNSUPPORTED). For cross-testing you should use cross-test-ssh.sh as test-wrapper.
I've tested the printers on both a native build and a cross build using a Beaglebone
Black, with the build system's filesystem shared with the board through NFS.

Finally, I've written a README that explains all this and more.

Hopefully this should be good to go in now. Thanks.

ChangeLog:

2016-07-04  Martin Galvan  <martin.galvan@tallertechnologies.com>

* Makeconfig (build-hardcoded-path-in-tests): Set to 'yes' for shared builds
if tests-need-hardcoded-path is defined.
(all-subdirs): Add pretty-printers.
* Makerules ($(py-const)): New rule.
* Rules (others): Add $(py-const), if defined.
* nptl/Makefile (gen-py-const-headers): Define.
* nptl/nptl-printers.py: New file.
* nptl/nptl_lock_constants.pysym: Likewise.
* pretty-printers/Makefile: Likewise.
* pretty-printers/README: Likewise.
* pretty-printers/test-condvar-attributes.c: Likewise.
* pretty-printers/test-condvar-attributes.p: Likewise.
* pretty-printers/test-condvar-printer.c: Likewise.
* pretty-printers/test-condvar-printer.py: Likewise.
* pretty-printers/test-mutex-attributes.c: Likewise.
* pretty-printers/test-mutex-attributes.py: Likewise.
* pretty-printers/test-mutex-printer.c: Likewise.
* pretty-printers/test-mutex-printer.py: Likewise.
* pretty-printers/test-rwlock-attributes.c: Likewise.
* pretty-printers/test-rwlock-attributes.py: Likewise.
* pretty-printers/test-rwlock-printer.c: Likewise.
* pretty-printers/test-rwlock-printer.py: Likewise.
* pretty-printers/test_common.py: Likewise.
* scripts/gen-py-const.awk: Likewise.

7 years agotile: only define __ASSUME_ALIGNED_REGISTER_PAIRS for 32-bit
Chris Metcalf [Fri, 8 Jul 2016 14:30:59 +0000 (10:30 -0400)] 
tile: only define __ASSUME_ALIGNED_REGISTER_PAIRS for 32-bit

The previous uses of this symbol were all in wordsize-32 code.
In commit eeddfa91cbb1 ("Consolidate off_t/off64_t syscall
argument passing") it was expanded to be used in pread/pwrite.
Accordingly, we only define it in 32-bit compilation modes now.
Both tilepro and tilegx32 follow this convention for the
kernel ABI.  tilegx64 follows it for passing 128-bit values,
but there are no such ABIs in the kernel.

7 years agoDefine __USE_KERNEL_IPV6_DEFS macro for non-Linux kernels
Aurelien Jarno [Fri, 8 Jul 2016 09:24:34 +0000 (11:24 +0200)] 
Define __USE_KERNEL_IPV6_DEFS macro for non-Linux kernels

Commit 1c1e7fb6 changed the __USE_KERNEL_IPV6_DEFS tests from 'ifdef'
to 'if'. As inet/netinet.in.h is a generic file, this causes a warning
on non-Linux kernels (for example Hurd). To fix that define it in the
generic bits/in.h file.

Changelog:
* bits/in.h (__USE_KERNEL_IPV6_DEFS): Define to 0.

7 years agoppc: Fix modf (sNaN) for pre-POWER5+ CPU (bug 20240).
Aurelien Jarno [Fri, 8 Jul 2016 09:24:34 +0000 (11:24 +0200)] 
ppc: Fix modf (sNaN) for pre-POWER5+ CPU (bug 20240).

Commit a6a4395d fixed modf implementation by compiling s_modf.c and
s_modff.c with -fsignaling-nans. However these files are also included
from the pre-POWER5+ implementation, and thus these files should also
be compiled with -fsignaling-nans.

Changelog:
[BZ #20240]
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(CFLAGS-s_modf-ppc32.c): New variable.
(CFLAGS-s_modff-ppc32.c): Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
(CFLAGS-s_modf-ppc64.c): Likewise.
(CFLAGS-s_modff-ppc64.c): Likewise.

7 years agolocaledata: fix de_LI locale
Aurelien Jarno [Thu, 7 Jul 2016 12:47:02 +0000 (14:47 +0200)] 
localedata: fix de_LI locale

Fix the postal_fmt and country_name entries to continue on the following
line without indentation.

localedata/Changelog:
* locales/de_LI (postal_fmt): Fix indentation.
(country_name): Likewise.

7 years agoAdd test case for bug 20263
Andreas Schwab [Thu, 16 Jun 2016 11:58:02 +0000 (13:58 +0200)] 
Add test case for bug 20263

7 years agoFix robust mutex daedlock [BZ #20263]
Jiyoung Yun [Wed, 29 Jun 2016 16:15:44 +0000 (01:15 +0900)] 
Fix robust mutex daedlock [BZ #20263]

In Linux/ARM environment, a robust mutex can't catch the timeout result
when it is already owned by other thread and requests to try lock with
a specific time value(pthread_mutex_timedlock). The futex already returns
the ETIMEDOUT result but there is no check the return value and it makes
a deadlock.

* nptl/lowlevelrobustlock.c: Implement ETIMEDOUT logic.

7 years agoAdd missing changelog part
Samuel Thibault [Wed, 6 Jul 2016 19:28:43 +0000 (21:28 +0200)] 
Add missing changelog part

7 years agoNew locale de_LI
Aurelien Jarno [Wed, 6 Jul 2016 16:17:03 +0000 (18:17 +0200)] 
New locale de_LI

The Principality of Liechtenstein currently does not have a corresponding
locale. Given the links with Switzerland, the best is to base the locale
on the de_CH one (German is the official language) and only change the
country related categories: LC_ADDRESS. and LC_TELEPHONE.

localedata/Changelog:
* locales/de_LI: New locale.
* SUPPORTED: Add de_LI.

7 years agoS390: Use DT_JUMPREL in prelink undo code.
Stefan Liebler [Wed, 6 Jul 2016 13:22:35 +0000 (15:22 +0200)] 
S390: Use DT_JUMPREL in prelink undo code.

On s390, the current prelink undo code in elf_machine_lazy_rel()
has the requirement, that the plt stubs use the first got slots
after the 3 reserved ones.

In case of undoing prelink, the plt got slots are reset to the correct
addresses whithin the corresponding plt-stub. Therefore the address
is calculated by the address of the first plt-stub-address which
was written by prelink (see l->l_mach.plt) to got[1] and index of
current relocation multiplied with 32 (=size of one plt slot).
The index was calculated with &current-got-slot - &got[3].

This patch removes the requirement, that the plt-got-slots are
starting at got[3]. The index is now calculated with
&current-reloc - &reloc[0]. The first struct Elf64_Rela is stored
at DT_JMPREL.

This patch is needed to prepare for partial relro support.

Ulrich Weigand suggested this approach to use DT_JMPREL - Thanks.

ChangeLog:

* sysdeps/s390/linkmap.h (struct link_map_machine):
Remove member gotplt and add member jmprel.
* sysdeps/s390/s390-32/dl-machine.h
(elf_machine_runtime_setup): Setup member jmprel with DT_JMPREL
instead of gotplt with &got[3].
(elf_machine_lazy_rel): Calculate address with reloc and jmprel.
* sysdeps/s390/s390-64/dl-machine.h: Likewise.

7 years agohppa: Update libm-test-ulps.
John David Anglin [Wed, 6 Jul 2016 12:45:23 +0000 (14:45 +0200)] 
hppa: Update libm-test-ulps.

Changelog:
* sysdeps/hppa/fpu/libm-test-ulps: Regenerate.

7 years agohurd: Fix PTR_{,DE}MANGLE calls
Samuel Thibault [Wed, 6 Jul 2016 09:43:54 +0000 (11:43 +0200)] 
hurd: Fix PTR_{,DE}MANGLE calls

* libio/iofopncook.c (_IO_cookie_read, _IO_cookie_write,
_IO_cookie_seek, _IO_cookie_close, _IO_old_cookie_seek)
[!PTR_DEMANGLE]: Do not call PTR_DEMANGLE.
(set_callbacks) [!PTR_MANGLE]: Do not call PTR_MANGLE.
* libio/vtables.c (_IO_vtable_check)
[!PTR_DEMANGLE]: Do not call PTR_DEMANGLE.
* libio/libioP.h (IO_set_accept_foreign_vtables)
[!PTR_MANGLE]: Do not call PTR_MANGLE.

7 years agoMake copies of cstdlib/cmath and use them [BZ #20314]
H.J. Lu [Tue, 5 Jul 2016 22:01:33 +0000 (15:01 -0700)] 
Make copies of cstdlib/cmath and use them [BZ #20314]

If C++ headers <cstdlib> or <cmath> are used, GCC 6 will include
/usr/include/stdlib.h or /usr/include/math.h from "#include_next"
(instead of stdlib/stdlib.h or math/math.h in the glibc source
directory), and this turns up as a make dependency.  An implicit
rule will kick in and make will try to install stdlib/stdlib.h or
math/math.h as /usr/include/stdlib.h or /usr/include/math.h because
the target is out of date.  We make a copy of <cstdlib> and <cmath>
in the glibc build directory so that stdlib/stdlib.h and math/math.h
will be used instead of /usr/include/stdlib.h and /usr/include/math.h.

[BZ #20314]
* Makeconfig (CXXFLAGS): Prepend -I$(common-objpfx).
* Makerules (before-compile): Add $(common-objpfx)cstdlib and
$(common-objpfx)cmath.
($(common-objpfx)cstdlib): New target.
($(common-objpfx)cmath): Likewise.

7 years agoBump up tst-malloc-thread-fail timeout from 20 to 30s
Chris Metcalf [Tue, 5 Jul 2016 21:05:28 +0000 (17:05 -0400)] 
Bump up tst-malloc-thread-fail timeout from 20 to 30s

Right now tilegx is right on the verge of timeout when it runs,
so adding a bit of headroom seems like the right thing; we
see failures when running tests in parallel.

7 years agopowerpc: Fix return code of strcasecmp for unaligned inputs
Rajalakshmi Srinivasaraghavan [Tue, 5 Jul 2016 15:50:41 +0000 (21:20 +0530)] 
powerpc: Fix return code of strcasecmp for unaligned inputs

If the input values are unaligned and if there are null characters in the
memory before the starting address of the input values, strcasecmp
gives incorrect return code. Fixed it by adding mask the bits that
are not part of the string.

7 years agonptl: Add more coverage in tst-cancel4
Adhemerval Zanella [Tue, 14 Jun 2016 15:18:32 +0000 (12:18 -0300)] 
nptl: Add more coverage in tst-cancel4

This patch adds early cancel test for open syscall through a FIFO
(thus makign subsequent call to open block until the other end is
also opened).

It also cleanup the sigpause tests by using sigpause along with
SIGINT instead of __xpg_sigpause and SIGCANCEL.  Since the idea
is just to test the cancellation handling there is no need to expose
internal glibc implementation details to the test through pthreadP.h
inclusion.

Tested x86_64.

* nptl/tst-cancel4-common.c (do_test): Add temporary fifo creation.
* nptl/tst-cancel4-common.h (fifoname): New variable.
(fifofd): Likewise.
(cl_fifo): New function.
* nptl/tst-cancel4.c (tf_sigpause): Replace SIGCANCEL usage by
SIGINT.
(tf_open): Add early cancel test.

7 years agom68k: suppress -Wframe-address warning
Andreas Schwab [Mon, 4 Jul 2016 21:11:49 +0000 (23:11 +0200)] 
m68k: suppress -Wframe-address warning

7 years agolocaledata: id_ID: Februari instead of Pebruari [BZ #20316]
Gunnar Hjalmarsson [Fri, 1 Jul 2016 00:54:53 +0000 (02:54 +0200)] 
localedata: id_ID: Februari instead of Pebruari [BZ #20316]

7 years agoTreat STV_HIDDEN and STV_INTERNAL symbols as STB_LOCAL
Maciej W. Rozycki [Sat, 7 May 2016 01:29:54 +0000 (02:29 +0100)] 
Treat STV_HIDDEN and STV_INTERNAL symbols as STB_LOCAL

In a reference to PR ld/19908 make ld.so respect symbol export classes
aka visibility and treat STV_HIDDEN and STV_INTERNAL symbols as local,
preventing such symbols from preempting exported symbols.

According to the ELF gABI[1] neither STV_HIDDEN nor STV_INTERNAL symbols
are supposed to be present in linked binaries:

"A hidden symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

"An internal symbol contained in a relocatable object must be either
removed or converted to STB_LOCAL binding by the link-editor when the
relocatable object is included in an executable file or shared object."

however some GNU binutils versions produce such symbols in some cases.
PR ld/19908 is one and we also have this note in scripts/abilist.awk:

so clearly there is linked code out there which contains such symbols
which is prone to symbol table misinterpretation, and it'll be more
productive if we handle this gracefully, under the Robustness Principle:
"be liberal in what you accept, and conservative in what you produce",
especially as this is a simple (STV_HIDDEN|STV_INTERNAL) => STB_LOCAL
mapping.

References:

[1] "System V Application Binary Interface - DRAFT - 24 April 2001",
    The Santa Cruz Operation, Inc., "Symbol Table",
    <http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html>

* sysdeps/generic/ldsodefs.h
(dl_symbol_visibility_binds_local_p): New inline function.
* elf/dl-addr.c (determine_info): Treat hidden and internal
symbols as local.
* elf/dl-lookup.c (do_lookup_x): Likewise.
* elf/dl-reloc.c (RESOLVE_MAP): Likewise.

7 years agoSPARC: fix nearbyint on sNaN input
Aurelien Jarno [Thu, 30 Jun 2016 19:18:34 +0000 (21:18 +0200)] 
SPARC: fix nearbyint on sNaN input

nearbyint and nearbyintf should not trigger inexact exceptions, but
should still trigger an invalid exception for a sNaN input.

The SPARC specific implementations of these functions save the FSR at
the beginning of the function and restore it at the end to not trigger
an inexact exception. This however doesn't work for an sNaN input which
need to trigger an invalid exception. Fix that by adding a fcmp
instruction using the input value before saving FSR, so that an invalid
exception is triggered for a sNaN input.

This fixes the math/test-nearbyint-except test on SPARC.

Changelog:
* sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint): Trigger an
invalid exception for a sNaN input.
* sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf): Likewise.
* sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S
(__nearbyint_vis3): Likewise
* sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S
(__nearbyintf_vis3): Likewise
* sparc/sparc64/fpu/s_nearbyint.S (__nearbyint): Likewise.
* sparc/sparc64/fpu/s_nearbyintf.S (__nearbyintf): Likewise.
* sparc/sparc64/fpu/multiarch/s_nearbyint-vis3.S (__nearbyint_vis3):
Likewise.
* sparc/sparc64/fpu/multiarch/s_nearbyintf-vis3.S (__nearbyintf_vis3):
Likewise.

7 years agoRequire binutils 2.24 to build x86-64 glibc [BZ #20139]
H.J. Lu [Fri, 1 Jul 2016 12:54:43 +0000 (05:54 -0700)] 
Require binutils 2.24 to build x86-64 glibc [BZ #20139]

If assembler doesn't support AVX512DQ, _dl_runtime_resolve_avx is used
to save the first 8 vector registers, which only saves the lower 256
bits of vector register, for lazy binding.  When it is called on AVX512
platform, the upper 256 bits of ZMM registers are clobbered.  Parameters
passed in ZMM registers will be wrong when the function is called the
first time.  This patch requires binutils 2.24, whose assembler can store
and load ZMM registers, to build x86-64 glibc.  Since mathvec library
needs assembler support for AVX512DQ,  we disable mathvec if assembler
doesn't support AVX512DQ.

[BZ #20139]
* config.h.in (HAVE_AVX512_ASM_SUPPORT): Renamed to ...
(HAVE_AVX512DQ_ASM_SUPPORT): This.
* sysdeps/x86_64/configure.ac: Require assembler from binutils
2.24 or above.
(HAVE_AVX512_ASM_SUPPORT): Removed.
(HAVE_AVX512DQ_ASM_SUPPORT): New.
* sysdeps/x86_64/configure: Regenerated.
* sysdeps/x86_64/dl-trampoline.S: Make HAVE_AVX512_ASM_SUPPORT
check unconditional.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Likewise.
* sysdeps/x86_64/multiarch/memcpy.S: Likewise.
* sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
* sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S:
Likewise.
* sysdeps/x86_64/multiarch/memmove-avx512-unaligned-erms.S:
Likewise.
* sysdeps/x86_64/multiarch/memmove.S: Likewise.
* sysdeps/x86_64/multiarch/memmove_chk.S: Likewise.
* sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
* sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
* sysdeps/x86_64/multiarch/memset-avx512-no-vzeroupper.S:
Likewise.
* sysdeps/x86_64/multiarch/memset-avx512-unaligned-erms.S:
Likewise.
* sysdeps/x86_64/multiarch/memset.S: Likewise.
* sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S: Check
HAVE_AVX512DQ_ASM_SUPPORT instead of HAVE_AVX512_ASM_SUPPORT.
* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx51:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S:
Likewise.

7 years agoFixed wrong vector sincos/sincosf ABI to have it compatible with
Andrew Senkevich [Fri, 1 Jul 2016 11:15:38 +0000 (14:15 +0300)] 
Fixed wrong vector sincos/sincosf ABI to have it compatible with
current vector function declaration "#pragma omp declare simd notinbranch",
according to which vector sincos should have vector of pointers for second and
third parameters. It is fixed with implementation as wrapper to version
having second and third parameters as pointers.

    [BZ #20024]
    * sysdeps/x86/fpu/test-math-vector-sincos.h: New.
    * sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S: Fixed ABI
    of this implementation of vector function.
    * 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/multiarch/svml_s_sincosf16_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/svml_d_sincos2_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos4_core_avx.S: Likewise.
    * sysdeps/x86_64/fpu/svml_d_sincos8_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf16_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf4_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core.S: Likewise.
    * sysdeps/x86_64/fpu/svml_s_sincosf8_core_avx.S: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen2-wrappers.c: Use another wrapper
    for testing vector sincos with fixed ABI.
    * sysdeps/x86_64/fpu/test-double-vlen4-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-vlen8-wrappers.c: Likewise.
    * 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-vlen8-avx2-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-vlen8-wrappers.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx.c: New test.
    * sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-libmvec-sincos-avx512.c: Likewise.
    * sysdeps/x86_64/fpu/test-double-libmvec-sincos.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx2.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-libmvec-sincosf-avx512.c: Likewise.
    * sysdeps/x86_64/fpu/test-float-libmvec-sincosf.c: Likewise.
    * sysdeps/x86_64/fpu/Makefile: Added new tests.

7 years agoSPARC64: update localplt.data
Aurelien Jarno [Thu, 30 Jun 2016 14:06:10 +0000 (16:06 +0200)] 
SPARC64: update localplt.data

Commits d81f90cc and 89faa0340 replaced called to __isnan and __isinf
by the corresponding GCC builtins. In turns GCC emits calls to _Qp_cmp.
We should therefore add _Qp_cmp to localplt.data as otherwise the
elf/check-localplt test fails with:

   Extra PLT reference: libc.so: _Qp_cmp

A similar change has already been done for SPARC32 in commit 6ef1cb95.

Changelog:
* sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data: Add _Qp_cmp.

7 years agopowerpc: Add a POWER8-optimized version of sinf()
Anton Blanchard [Tue, 28 Jun 2016 11:59:40 +0000 (21:59 +1000)] 
powerpc: Add a POWER8-optimized version of sinf()

This uses the implementation of sinf() in sysdeps/x86_64/fpu/s_sinf.S
as inspiration.

7 years agopowerpc: Add a POWER8-optimized version of expf()
Tulio Magno Quites Machado Filho [Mon, 27 Jun 2016 19:03:10 +0000 (16:03 -0300)] 
powerpc: Add a POWER8-optimized version of expf()

This implementation is based on the one already used at
sysdeps/x86_64/fpu/e_expf.S.

This implementation improves the performance by ~14% on average in synthetic
benchmarks at the cost of decreasing accuracy to 1 ULP.

7 years agohppa: fix loading of global pointer in _start [BZ #20277]
John David Anglin [Tue, 21 Jun 2016 22:35:22 +0000 (18:35 -0400)] 
hppa: fix loading of global pointer in _start [BZ #20277]

The patched change fixes a regression for executables compiled with the
-p option and linked with gcrt1.o.  The executables crash on startup.

This regression was introduced in 2.22 and was noticed in the gcc testsuite.

7 years agoCheck Prefer_ERMS in memmove/memcpy/mempcpy/memset
H.J. Lu [Thu, 30 Jun 2016 14:57:07 +0000 (07:57 -0700)] 
Check Prefer_ERMS in memmove/memcpy/mempcpy/memset

Although the Enhanced REP MOVSB/STOSB (ERMS) implementations of memmove,
memcpy, mempcpy and memset aren't used by the current processors, this
patch adds Prefer_ERMS check in memmove, memcpy, mempcpy and memset so
that they can be used in the future.

* sysdeps/x86/cpu-features.h (bit_arch_Prefer_ERMS): New.
(index_arch_Prefer_ERMS): Likewise.
* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Return
__memcpy_erms for Prefer_ERMS.
* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
(__memmove_erms): Enabled for libc.a.
* ysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Return
__memmove_erms or Prefer_ERMS.
* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Return
__mempcpy_erms for Prefer_ERMS.
* sysdeps/x86_64/multiarch/memset.S (memset): Return
__memset_erms for Prefer_ERMS.

7 years agoReturn proper status from _nss_nis_initgroups_dyn (bug 20262)
Andreas Schwab [Thu, 16 Jun 2016 10:44:29 +0000 (12:44 +0200)] 
Return proper status from _nss_nis_initgroups_dyn (bug 20262)

7 years agoCorrect bug number in ChangeLog [BZ #18960]
Florian Weimer [Thu, 30 Jun 2016 09:43:58 +0000 (11:43 +0200)] 
Correct bug number in ChangeLog [BZ #18960]

This updates commit 5fa268239b46e127f941c3510ad200ce5ef8df45.

7 years agoCompile tst-cleanupx4 test with -fexceptions
H.J. Lu [Thu, 30 Jun 2016 03:24:30 +0000 (20:24 -0700)] 
Compile tst-cleanupx4 test with -fexceptions

tst-cleanupx4 is linked with tst-cleanupx4.o and tst-cleanup4aux.o.
Since tst-cleanupx4.o is compiled from tst-cleanup4.c with -fexceptions,
tst-cleanup4aux.c should also be compiled with -fexceptions.

Tested on x86-64 and i686.

[BZ #18645]
* nptl/Makefile (extra-test-objs): Add tst-cleanupx4aux.o.
(test-extras): Add tst-cleanupx4aux.
(CFLAGS-tst-cleanupx4aux.c): New.  Set to -fexceptions.
($(objpfx)tst-cleanupx4): Replace tst-cleanup4aux.o with
tst-cleanupx4aux.o.
* nptl/tst-cleanupx4aux.c: New file.

7 years agoi686/multiarch: Regenerate ulps
Aurelien Jarno [Wed, 29 Jun 2016 22:31:11 +0000 (00:31 +0200)] 
i686/multiarch: Regenerate ulps

This comes from running “make regen-ulps” on AMD Opteron 6272 CPUs.

Changelog:
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.

7 years agoAvoid array-bounds warning for strncat on i586 (bug 20260)
Andreas Schwab [Tue, 28 Jun 2016 10:54:59 +0000 (12:54 +0200)] 
Avoid array-bounds warning for strncat on i586 (bug 20260)

7 years agoelf.h: Add declarations for BPF
Richard Henderson [Mon, 20 Jun 2016 22:49:32 +0000 (15:49 -0700)] 
elf.h: Add declarations for BPF

The EM_BPF number has been officially assigned, though it
has not yet been posted to the gabi webpage yet.

        * elf/elf.h (EM_BPF): New.
        (EM_NUM): Update.
        (R_BPF_NONE, R_BPF_MAP_FD): New.

7 years agoelf.h: Sync with the gabi webpage
Richard Henderson [Mon, 20 Jun 2016 22:06:48 +0000 (15:06 -0700)] 
elf.h: Sync with the gabi webpage

  http://www.sco.com/developers/gabi/latest/ch4.eheader.html

Retrieved 2016-06-20.

        * elf/elf.h (EM_IAMCU, EM_SPU, EM_PDP10, EM_PDP11, EM_ARC_COMPACT,
        EM_VIDEOCORE, EM_TMM_GPP, EM_NS32K, EM_TPC, EM_SNP1K, EM_ST200,
        EM_IP2K, EM_MAX, EM_CR, EM_F2MC16, EM_MSP430, EM_BLACKFIN, EM_SE_C33,
        EM_SEP, EM_ARCA, EM_UNICORE, EM_EXCESS, EM_DXP, EM_ALTERA_NIOS2,
        EM_CRX, EM_XGATE, EM_C166, EM_M16C, EM_DSPIC30F, EM_CE, EM_M32C,
        EM_TSK3000, EM_RS08, EM_SHARC, EM_ECOG2, EM_SCORE7, EM_DSP24,
        EM_VIDEOCORE3, EM_LATTICEMICO32, EM_SE_C17, EM_TI_C6000, EM_TI_C2000,
        EM_TI_C5500, EM_TI_ARP32, EM_TI_PRU, EM_MMDSP_PLUS, EM_CYPRESS_M8C,
        EM_R32C, EM_TRIMEDIA, EM_QDSP6, EM_8051, EM_STXP7X, EM_NDS32,
        EM_ECOG1X, EM_MAXQ30, EM_XIMO16, EM_MANIK, EM_CRAYNV2, EM_RX,
        EM_METAG, EM_MCST_ELBRUS, EM_ECOG16, EM_CR16, EM_ETPU, EM_SLE9X,
        EM_L10M, EM_K10M, EM_AVR32, EM_STM8, EM_TILE64, EM_CUDA,
        EM_CLOUDSHIELD, EM_COREA_1ST, EM_COREA_2ND, EM_ARC_COMPACT2,
        EM_OPEN8, EM_RL78, EM_VIDEOCORE5, EM_78KOR, EM_56800EX, EM_BA1,
        EM_BA2, EM_XCORE, EM_MCHP_PIC, EM_KM32, EM_KMX32, EM_EMX16, EM_EMX8,
        EM_KVARC, EM_CDP, EM_COGE, EM_COOL, EM_NORC, EM_CSR_KALIMBA, EM_Z80,
        EM_VISIUM, EM_FT32, EM_MOXIE, EM_AMDGPU, EM_RISCV): New.
        (EM_NUM): Update.

7 years agoS390: Fix relocation of _nl_current_LC_CATETORY_used in static build. [BZ #19860]
Stefan Liebler [Tue, 28 Jun 2016 10:23:35 +0000 (12:23 +0200)] 
S390: Fix relocation of _nl_current_LC_CATETORY_used in static build. [BZ #19860]

With shared libc, all locale categories are always loaded.
For static libc they aren't, but there exist a weak
_nl_current_LC_CATEGORY_used symbol for each category.
If the category is used, the locale/lc-CATEGORY.o is linked in
where _NL_CURRENT_DEFINE (LC_CATEGORY) defines and sets the
_nl_current_LC_CATEGORY_used symbol to one.

As reported by Marcin
"Bug 18960 - s390: _nl_locale_subfreeres uses larl opcode on misaligned symbol"
(https://sourceware.org/bugzilla/show_bug.cgi?id=18960)
In function _nl_locale_subfreeres (locale/setlocale.c) for each category
a check - &_nl_current_LC_CATEGORY_used != 0 - decides whether the category
is used or not.
There is also a second usage with the same mechanism in function __uselocale
(locale/uselocale.c).

On s390 a larl instruction with R_390_PC32DBL relocation is used to
get the address of _nl_current_LC_CATEGORY_used symbols. As larl loads the
address relative in halfwords and the code is always 2-byte aligned,
larl can only load even addresses.
At the end, the relocated address is always zero and never one.

Marcins patch (see bugzilla) uses the following declaration in locale/setlocale.c:
extern char _nl_current_##category##_used __attribute__((__aligned__(1)));
In function _nl_locale_subfreeres all categories are checked and therefore gcc
is now building an array of addresses in rodata section with an R_390_64
relocation for every address. This array is loaded with larl instruction and
each address is accessed by index.
This fixes only the usage in _nl_locale_subfreeres. Each user has to add the
alignment attribute.

This patch set the _nl_current_LC_CATEGORY_used symbols to two instead of one.
This way gcc can use larl instruction and the check against zero works on
every usage.

ChangeLog:

[BZ #19860]
* locale/localeinfo.h (_NL_CURRENT_DEFINE):
Set _nl_current_LC_CATEGORY_used to two instead of one.

7 years agoMIPS: run tst-mode-switch-{1,2,3}.c using test-skeleton.c
Aurelien Jarno [Mon, 27 Jun 2016 14:45:45 +0000 (16:45 +0200)] 
MIPS: run tst-mode-switch-{1,2,3}.c using test-skeleton.c

For some reasons I have not investigated yet, tst-mode-switch-1 hangs on
a MIPS UTM-8 machine running an o32 userland and a 3.6.1 kernel.

This patch changes the test so that it runs under the test-skeleton
framework, causing the test to fail after a timeout instead of hanging
the whole testsuite. At the same time, also change the tst-mode-switch-2
and tst-mode-switch-3 tests.

Changelog:
* sysdeps/mips/tst-mode-switch-1.c (main): Converted to ...
(do_test): ... this.
(TEST_FUNCTION): New macro.
 Include test-skeleton.c.
* sysdeps/mips/tst-mode-switch-2.c (main): Likewise.
* sysdeps/mips/tst-mode-switch-3.c (main): Likewise.

7 years agoAvoid "inexact" exceptions in i386/x86_64 trunc functions (bug 15479).
Joseph Myers [Mon, 27 Jun 2016 17:26:52 +0000 (17:26 +0000)] 
Avoid "inexact" exceptions in i386/x86_64 trunc functions (bug 15479).

As discussed in
<https://sourceware.org/ml/libc-alpha/2016-05/msg00577.html>, TS
18661-1 disallows ceil, floor, round and trunc functions from raising
the "inexact" exception, in accordance with general IEEE 754 semantics
for when that exception is raised.  Fixing this for x87 floating point
is more complicated than for the other versions of these functions,
because they use the frndint instruction that raises "inexact" and
this can only be avoided by saving and restoring the whole
floating-point environment.

As I noted in
<https://sourceware.org/ml/libc-alpha/2016-06/msg00128.html>, I have
now implemented a GCC option -fno-fp-int-builtin-inexact for GCC 7,
such that GCC will inline these functions on x86, without caring about
"inexact", when the default -ffp-int-builtin-inexact is in effect.
This allows users to get optimized code depending on the options they
pass to the compiler, while making the out-of-line functions follow TS
18661-1 semantics and avoid "inexact".

This patch duly fixes the out-of-line trunc function implementations
to avoid "inexact", in the same way as the nearbyint implementations.

I do not know how the performance of implementations such as these
based on saving the environment and changing the rounding mode
temporarily compares to that of the C versions or SSE 4.1 versions (of
course, for 32-bit x86 SSE implementations still need to get the
return value in an x87 register); it's entirely possible other
implementations could be faster in some cases.

Tested for x86_64 and x86.

[BZ #15479]
* sysdeps/i386/fpu/s_trunc.S (__trunc): Save and restore
floating-point environment rather than just control word.
* sysdeps/i386/fpu/s_truncf.S (__truncf): Likewise.
* sysdeps/i386/fpu/s_truncl.S (__truncl): Save and restore
floating-point environment, with "invalid" exceptions merged in,
rather than just control word.
* sysdeps/x86_64/fpu/s_truncl.S (__truncl): Likewise.
* math/libm-test.inc (trunc_test_data): Do not allow spurious
"inexact" exceptions.

7 years agoAvoid "inexact" exceptions in i386/x86_64 floor functions (bug 15479).
Joseph Myers [Mon, 27 Jun 2016 17:25:47 +0000 (17:25 +0000)] 
Avoid "inexact" exceptions in i386/x86_64 floor functions (bug 15479).

As discussed in
<https://sourceware.org/ml/libc-alpha/2016-05/msg00577.html>, TS
18661-1 disallows ceil, floor, round and trunc functions from raising
the "inexact" exception, in accordance with general IEEE 754 semantics
for when that exception is raised.  Fixing this for x87 floating point
is more complicated than for the other versions of these functions,
because they use the frndint instruction that raises "inexact" and
this can only be avoided by saving and restoring the whole
floating-point environment.

As I noted in
<https://sourceware.org/ml/libc-alpha/2016-06/msg00128.html>, I have
now implemented a GCC option -fno-fp-int-builtin-inexact for GCC 7,
such that GCC will inline these functions on x86, without caring about
"inexact", when the default -ffp-int-builtin-inexact is in effect.
This allows users to get optimized code depending on the options they
pass to the compiler, while making the out-of-line functions follow TS
18661-1 semantics and avoid "inexact".

This patch duly fixes the out-of-line floor function implementations
to avoid "inexact", in the same way as the nearbyint implementations.

I do not know how the performance of implementations such as these
based on saving the environment and changing the rounding mode
temporarily compares to that of the C versions or SSE 4.1 versions (of
course, for 32-bit x86 SSE implementations still need to get the
return value in an x87 register); it's entirely possible other
implementations could be faster in some cases.

Tested for x86_64 and x86.

[BZ #15479]
* sysdeps/i386/fpu/s_floor.S (__floor): Save and restore
floating-point environment rather than just control word.
* sysdeps/i386/fpu/s_floorf.S (__floorf): Likewise.
* sysdeps/i386/fpu/s_floorl.S (__floorl): Save and restore
floating-point environment, with "invalid" exceptions merged in,
rather than just control word.
* sysdeps/x86_64/fpu/s_floorl.S (__floorl): Likewise.
* math/libm-test.inc (floor_test_data): Do not allow spurious
"inexact" exceptions.

7 years agoAvoid "inexact" exceptions in i386/x86_64 ceil functions (bug 15479).
Joseph Myers [Mon, 27 Jun 2016 17:23:19 +0000 (17:23 +0000)] 
Avoid "inexact" exceptions in i386/x86_64 ceil functions (bug 15479).

As discussed in
<https://sourceware.org/ml/libc-alpha/2016-05/msg00577.html>, TS
18661-1 disallows ceil, floor, round and trunc functions from raising
the "inexact" exception, in accordance with general IEEE 754 semantics
for when that exception is raised.  Fixing this for x87 floating point
is more complicated than for the other versions of these functions,
because they use the frndint instruction that raises "inexact" and
this can only be avoided by saving and restoring the whole
floating-point environment.

As I noted in
<https://sourceware.org/ml/libc-alpha/2016-06/msg00128.html>, I have
now implemented a GCC option -fno-fp-int-builtin-inexact for GCC 7,
such that GCC will inline these functions on x86, without caring about
"inexact", when the default -ffp-int-builtin-inexact is in effect.
This allows users to get optimized code depending on the options they
pass to the compiler, while making the out-of-line functions follow TS
18661-1 semantics and avoid "inexact".

This patch duly fixes the out-of-line ceil function implementations to
avoid "inexact", in the same way as the nearbyint implementations.

I do not know how the performance of implementations such as these
based on saving the environment and changing the rounding mode
temporarily compares to that of the C versions or SSE 4.1 versions (of
course, for 32-bit x86 SSE implementations still need to get the
return value in an x87 register); it's entirely possible other
implementations could be faster in some cases.

Tested for x86_64 and x86.

[BZ #15479]
* sysdeps/i386/fpu/s_ceil.S (__ceil): Save and restore
floating-point environment rather than just control word.
* sysdeps/i386/fpu/s_ceilf.S (__ceilf): Likewise.
* sysdeps/i386/fpu/s_ceill.S (__ceill): Save and restore
floating-point environment, with "invalid" exceptions merged in,
rather than just control word.
* sysdeps/x86_64/fpu/s_ceill.S (__ceill): Likewise.
* math/libm-test.inc (ceil_test_data): Do not allow spurious
"inexact" exceptions.