external/glibc.git
9 years agoAdd missing ChangeLog entry for the last commit
H.J. Lu [Thu, 20 Aug 2015 19:56:22 +0000 (12:56 -0700)]
Add missing ChangeLog entry for the last commit

9 years agoRemove the unused IFUNC files
H.J. Lu [Thu, 20 Aug 2015 19:47:20 +0000 (12:47 -0700)]
Remove the unused IFUNC files

sysdeps/i386/i686/multiarch/strcasestr-c.c became unused after

commit 1818483b15d22016b0eae41d37ee91cc87b37510
Author: Andreas Schwab <schwab@suse.de>
Date:   Wed Dec 18 11:53:27 2013 +1000

    Remove use of SSE4.2 functions for strstr on i686

which contains

-sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
+sysdep_routines += strcspn-c strpbrk-c strspn-c

sysdeps/x86_64/multiarch/strcasestr.c became useless after

584b18eb4df61ccd447db2dfe8c8a7901f8c8598
Author: Ondřej Bílka <neleai@seznam.cz>
Date:   Sat Dec 14 19:33:56 2013 +0100

    Add strstr with unaligned loads. Fixes bug 12100.

which changes sysdeps/x86_64/multiarch/strcasestr.c to

libc_ifunc (__strcasestr, __strcasestr_sse2);

This patch removes these file.

* i386/i686/multiarch/strcasestr-c.c: Removed.
* x86_64/multiarch/strcasestr.c: Likewise.
* x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list):
Remove strcasestr.

9 years agoDon't use -Wno-uninitialized in math/.
Joseph Myers [Thu, 20 Aug 2015 18:00:09 +0000 (18:00 +0000)]
Don't use -Wno-uninitialized in math/.

The uninitialized variable warnings in math/ having been fixed for all
the supported floating-point formats, this patch removes the use of
-Wno-uninitialized there, continuing with the goal of avoiding -Wno-
options in makefiles as far as possible..

Tested for x86_64 and x86 (full build and testsuite runs), and for
powerpc and mips64 (verified that glibc builds without errors).

* math/Makefile (CFLAGS): Don't add -Wno-uninitialized.

9 years agoFix uninitialized variable use in ldbl-128ibm nearbyintl.
Joseph Myers [Thu, 20 Aug 2015 17:28:09 +0000 (17:28 +0000)]
Fix uninitialized variable use in ldbl-128ibm nearbyintl.

Removing the use of -Wno-uninitialized for math/ shows errors for
ldbl-128ibm:

../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: In function '__nearbyintl':
../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c:119:34: error: 'low' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       u.d[1].d = high - u.d[0].d + low;
                                  ^
../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c:119:23: error: 'high' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       u.d[1].d = high - u.d[0].d + low;
                       ^

These errors are correct: if the high part of the argument is a NaN,
and the low part is nonzero but has absolute value less than 2^52,
those variables can be used uninitialized.  This patch rearranges the
code so that the variables are always initialized with the natural
values, and then possibly modified later, to avoid this uninitialized
use.  (Note that there are still other issues with this code and NaNs
that are not fixed by this patch.)  No bug filed in Bugzilla or
testcase added for the uninitialized use since it wasn't user-visible
with the compiler I tried (that is, I still got a NaN result).

Tested for powerpc.

* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Always initialize
variables for high and low parts before possibly modifying them.

9 years agoMove x86_64 init-arch.h to sysdeps/x86/init-arch.h
H.J. Lu [Thu, 20 Aug 2015 11:29:23 +0000 (04:29 -0700)]
Move x86_64 init-arch.h to sysdeps/x86/init-arch.h

Move sysdeps/x86_64/multiarch/init-arch.h to sysdeps/x86/init-arch.h
which can be used for both i386 and x86_64.

* sysdeps/i386/i686/multiarch/init-arch.h: Removed.
* sysdeps/unix/sysv/linux/x86/init-arch.h: Likewise.
* sysdeps/x86_64/cacheinfo.c: Include <init-arch.h> instead
of "multiarch/init-arch.h".
* sysdeps/x86_64/multiarch/init-arch.h: Renamed to ...
* sysdeps/x86/init-arch.h: This.

9 years agoRemove x86 init-arch.c
H.J. Lu [Thu, 20 Aug 2015 11:19:59 +0000 (04:19 -0700)]
Remove x86 init-arch.c

Both files include sysdeps/x86_64/multiarch/init-arch.c which has been
removed.

* sysdeps/i386/i686/multiarch/init-arch.c: Removed.
* sysdeps/unix/sysv/linux/x86/init-arch.c: Likewise.

9 years agoFix exponents in manual.
Ondřej Bílka [Sun, 12 Jul 2015 09:32:56 +0000 (11:32 +0200)]
Fix exponents in manual.

* manual/macros.texi: Add twoexp macro.
* manual/filesys.texi: Fix exponents.
* manual/llio.texi: Likewise.
* manual/stdio.texi: Likewise.

9 years agonptl: Document crash due to incorrect use of locks
Florian Weimer [Thu, 20 Aug 2015 06:44:09 +0000 (08:44 +0200)]
nptl: Document crash due to incorrect use of locks

9 years agoFix csqrt missing underflows (bug 18370).
Joseph Myers [Wed, 19 Aug 2015 22:42:01 +0000 (22:42 +0000)]
Fix csqrt missing underflows (bug 18370).

The csqrt implementations in glibc can miss underflow exceptions when
the real or imaginary part of the result becomes tiny in the course of
scaling down (in particular, multiplication by 0.5) and that scaling
is exact although the relevant part of the mathematical result isn't.
This patch forces the exception in a similar way to previous fixes.

Tested for x86_64 and x86.

[BZ #18370]
* math/s_csqrt.c (__csqrt): Force underflow exception for results
whose real or imaginary part has small absolute value.
* math/s_csqrtf.c (__csqrtf): Likewise.
* math/s_csqrtl.c (__csqrtl): Likewise.
* math/auto-libm-test-in: Add more tests of csqrt.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

9 years agorelocate localedata ChangeLog entries
Mike Frysinger [Wed, 19 Aug 2015 21:55:06 +0000 (17:55 -0400)]
relocate localedata ChangeLog entries

9 years agoPowerPC: Extend Program Priority Register support
Gabriel F. T. Gomes [Mon, 10 Aug 2015 13:58:12 +0000 (10:58 -0300)]
PowerPC: Extend Program Priority Register support

This patch adds extra inline functions to change the Program Priority
Register from ISA 2.07.

2015-08-19  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

* sysdeps/powerpc/sys/platform/ppc.h (__ppc_set_ppr_med_high,
__ppc_set_ppr_very_low): New functions.
* manual/platform.texi: Add documentation about
__ppc_set_ppr_med_high and __ppc_set_ppr_very_low.

9 years agoMention BZ #18796 fix in NEWS.
Andrew Senkevich [Wed, 19 Aug 2015 16:48:52 +0000 (19:48 +0300)]
Mention BZ #18796 fix in NEWS.

9 years agoImprove stpncpy performance by using __strnlen/memcpy/memset rather than a
Wilco Dijkstra [Wed, 19 Aug 2015 15:28:21 +0000 (16:28 +0100)]
Improve stpncpy performance by using __strnlen/memcpy/memset rather than a
byte loop. Performance on bench-stpncpy is ~2x faster on average.

9 years ago [BZ #18796]
Andrew Senkevich [Wed, 19 Aug 2015 13:54:28 +0000 (16:54 +0300)]
[BZ #18796]
    * scripts/test-installation.pl: Don't add -lmvec to build options if
    libmvec wasn't built.

9 years agoAdd BZ #14341 to NEWS
H.J. Lu [Wed, 19 Aug 2015 13:01:58 +0000 (06:01 -0700)]
Add BZ #14341 to NEWS

9 years agoFix dynamic linker issue with bind-now
Petar Jovanovic [Tue, 19 Aug 2014 22:50:54 +0000 (00:50 +0200)]
Fix dynamic linker issue with bind-now

Fix the bind-now case when DT_REL and DT_JMPREL sections are separate
and there is a gap between them.

[BZ #14341]
* elf/dynamic-link.h (elf_machine_lazy_rel): Properly handle the
case when there is a gap between DT_REL and DT_JMPREL sections.
* sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc.
(LDFLAGS-tst-split-dynreloc): New.
(tst-split-dynreloc-ENV): Likewise.
* sysdeps/x86_64/tst-split-dynreloc.c: New file.
* sysdeps/x86_64/tst-split-dynreloc.lds: Likewise.

9 years agoMark __xstatXX_conv as hidden
H.J. Lu [Wed, 19 Aug 2015 11:40:35 +0000 (04:40 -0700)]
Mark __xstatXX_conv as hidden

__xstat_conv, __xstat64_conv and __xstat32_conv are internal to glibc.
They should be marked as hidden so that they can't be called without
PLT.

[BZ #18822]
* sysdeps/unix/sysv/linux/xstatconv.h (__xstat_conv): Add
attribute_hidden.
(__xstat64_conv): Likewise.
(__xstat32_conv): Likewise.

9 years agoCall __setcontext with HIDDEN_JUMPTARGET
H.J. Lu [Wed, 19 Aug 2015 11:39:47 +0000 (04:39 -0700)]
Call __setcontext with HIDDEN_JUMPTARGET

i386 __makecontext should call __setcontext with HIDDEN_JUMPTARGET.

[BZ #18822]
* sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext):
Don't load %ebx when calling __setcontext.  Call __setcontext
with HIDDEN_JUMPTARGET.
* sysdeps/unix/sysv/linux/i386/setcontext.S (__setcontext): Add
libc_hidden_def.

9 years agoUse x86-64 cacheinfo.c and sysconf.c for x86
H.J. Lu [Wed, 19 Aug 2015 11:27:04 +0000 (04:27 -0700)]
Use x86-64 cacheinfo.c and sysconf.c for x86

Since _dl_x86_cpu_features is always available, we can use x86-64
cacheinfo.c and sysconf.c for both i386 and x86-64.

* sysdeps/i386/i686/Makefile
[$(subdir) == string] (sysdep_routines): Moved to ...
* sysdeps/i386/Makefile: Here.
* sysdeps/i386/i686/cacheinfo.c: Moved to ...
* sysdeps/i386/cacheinfo.c: Here.
* sysdeps/unix/sysv/linux/i386/sysconf.c: Removed.
* sysdeps/unix/sysv/linux/i386/i686/sysconf.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysconf.c: Moved to ...
* sysdeps/unix/sysv/linux/x86/sysconf.c: Here.

9 years agoAlso check __i586__/__i686__ for HAS_I586/HAS_I686
H.J. Lu [Wed, 19 Aug 2015 11:19:58 +0000 (04:19 -0700)]
Also check __i586__/__i686__ for HAS_I586/HAS_I686

* sysdeps/x86/cpu-features.h (HAS_I586): Defined to 1 if
__i586__ is defined.
(HAS_I686): Defined to 1 if __i686__ is defined.

9 years agoFix -Wundef warnings in elf/tst-execstack.c.
Joseph Myers [Wed, 19 Aug 2015 00:51:07 +0000 (00:51 +0000)]
Fix -Wundef warnings in elf/tst-execstack.c.

To remove -Wno-error=undef, we need to fix the remaining cases where
there are -Wundef warnings in the testsuite.  One of those places is
in elf/tst-execstack.c.

tst-execstack.c tests USE_PTHREADS with #if.  nptl/tst-execstack.c
defines USE_PTHREADS to 1 before including ../elf/tst-execstack.c,
while elf/tst-execstack.c, when compiled directly, leaves it
undefined.

This patch adds a setting of CPPFLAGS-tst-execstack.c to
elf/Makefile.  An alternative approach would be to rename
tst-execstack.c to tst-execstack-main.c and have two different
tst-execstack.c files include it, each with an appropriate
USE_PTHREADS #define.

Tested for x86_64.

* elf/Makefile [$(have-z-execstack) = yes]
(CPPFLAGS-tst-execstack.c): New variable.

9 years agoFix -Wundef warnings in login/tst-utmp.c.
Joseph Myers [Wed, 19 Aug 2015 00:50:17 +0000 (00:50 +0000)]
Fix -Wundef warnings in login/tst-utmp.c.

To remove -Wno-error=undef, we need to fix the remaining cases where
there are -Wundef warnings in the testsuite.  One of those places is
in login/tst-utmp.c.

When included from tst-utmpx.c, <utmpx.h> is included instead of
<utmp.h>, meaning the _HAVE_UT_* macros are not defined.  The test is
prepared for them not being defined, in that all the relevant
conditionals also include "defined UTMPX".  However, they test the
_HAVE_UT_* macros first, so resulting in -Wundef warnings.

This patch does the minimal fix of swapping the || operands.  This is
logically correct - avoiding checking a macro we know will not be
defined in the case where it is not defined.  It won't fix such
warnings for the case where the toplevel bits/utmp.h is used and most
_HAVE_UT_* aren't defined at all even when <utmp.h> is included, but
that case doesn't apply to any current glibc configuration.  Fixing it
would also be tricky in that, while glibc itself consistently uses
_HAVE_UT_* in ways that would work with 0 instead of undefined,
external packages that use the macros expect defined / undefined
instead of 1 / 0 (codesearch.debian.net shows uses by util-linux,
python-utmp, libsys-utmp-perl).

Tested for x86_64.

* login/tst-utmp.c [_HAVE_UT_TYPE || defined UTMPX]: Change
conditional to [defined UTMPX || _HAVE_UT_TYPE].
[_HAVE_UT_TV || defined UTMPX]: Change conditional to [defined
UTMPX || _HAVE_UT_TV].
[_HAVE_UT_TV - 0 || defined UTMPX]: Change conditional to [defined
UTMPX || _HAVE_UT_TV - 0].

9 years agoFix MIPS -Wundef warnings for __mips_isa_rev.
Joseph Myers [Tue, 18 Aug 2015 21:52:22 +0000 (21:52 +0000)]
Fix MIPS -Wundef warnings for __mips_isa_rev.

This patch fixes -Wundef warnings relating to __mips_isa_rev being
undefined.

Tested for mips64 (all three ABIs) that there is a clean build and
testsuite run with -Wno-error=undef removed (and my other -Wundef
patches applied).

* sysdeps/mips/dl-machine.h [__mips_isa_rev < 6]: Change
conditionals to [!defined __mips_isa_rev || __mips_isa_rev < 6].
* sysdeps/mips/machine-gmon.h [__mips_isa_rev < 6]: Likewise.

9 years agopowerpc: Add missing hwcap strings.
Carlos Eduardo Seo [Thu, 13 Aug 2015 17:33:06 +0000 (14:33 -0300)]
powerpc: Add missing hwcap strings.

Some features in hwcap.h do not have matching string descriptors
to be displayed when LD_SHOW_AUXV=1.  This patch fixes the problem.

2015-08-13  Carlos Eduardo Seo  <cseo@linux.vnet.ibm.com>

* sysdeps/powerpc/dl-procinfo.c:
(_dl_powerpc_cap_flags): Added missing strings for some
hwcap features.
* sysdeps/powerpc/dl-procinfo.h: Updated hwcap bit count.

9 years agoPort the 0x7efe...feff pattern to GCC 6.
Paul Eggert [Wed, 22 Jul 2015 05:50:29 +0000 (22:50 -0700)]
Port the 0x7efe...feff pattern to GCC 6.

See Steve Ellcey's bug report in:
https://sourceware.org/ml/libc-alpha/2015-07/msg00673.html
* string/memrchr.c (MEMRCHR):
* string/rawmemchr.c (RAWMEMCHR):
* string/strchr.c (strchr):
* string/strchrnul.c (STRCHRNUL):
Rewrite code to avoid issues with signed shift overflow.

9 years agoDefine HAS_CPUID/HAS_I586/HAS_I686 from -march=
H.J. Lu [Tue, 18 Aug 2015 14:59:49 +0000 (07:59 -0700)]
Define HAS_CPUID/HAS_I586/HAS_I686 from -march=

cpuid, i586 and i686 instructions are available if the processor
specified by -march= supports them.  We can use this information
to determine whether those instructions can be used safely.

* sysdeps/x86/cpu-features.c (init_cpu_features): Check
whether cpuid is available only if HAS_CPUID is 0.
* sysdeps/x86/cpu-features.h (HAS_CPUID): New.
(HAS_I586): Likewise.
(HAS_I686): Likewise.

9 years agoFix lang_lib/lang_term as per ISO 639-2 [BZ #16973]
Marko Myllynen [Tue, 11 Aug 2015 07:54:25 +0000 (10:54 +0300)]
Fix lang_lib/lang_term as per ISO 639-2 [BZ #16973]

lang_lib (which reflects ISO 639-2/B (bibliographic) codes) and
lang_term (which reflects ISO 639-2/T (terminology) codes) should be
identical except for those languages for which ISO 639-2 specifies
separate bibliographic/terminology values.

I used this Library of Congress page as the source:
http://www.loc.gov/standards/iso639-2/php/code_list.php

9 years agoregexp.h: update Versions to match file usage [BZ #18681]
Zack Weinberg [Mon, 17 Aug 2015 15:28:46 +0000 (11:28 -0400)]
regexp.h: update Versions to match file usage [BZ #18681]

Since the new regexp.c code uses the GLIBC_2.23 symbol, make sure we
declare it to avoid warnings/errors.

9 years agoNEWS: note fixed bug
Mike Frysinger [Tue, 18 Aug 2015 06:59:37 +0000 (02:59 -0400)]
NEWS: note fixed bug

9 years agohppa: start.S: rework references to fix PIE TEXTRELs [BZ #18421]
Alan Modra [Sat, 15 Aug 2015 02:15:49 +0000 (22:15 -0400)]
hppa: start.S: rework references to fix PIE TEXTRELs [BZ #18421]

The startup code was not using PIC friendly references leading to TEXTRELs
in every PIE ELF.

9 years agohppa: timerfd.h: move to common sys/timerfd.h
Mike Frysinger [Sat, 15 Aug 2015 02:14:28 +0000 (22:14 -0400)]
hppa: timerfd.h: move to common sys/timerfd.h

Use the common sys/timerfd.h to avoid duplication and move the
arch-specific settings into bits/timerfd.h.

9 years agohppa: signalfd.h: move to common sys/signalfd.h
Mike Frysinger [Sat, 15 Aug 2015 02:14:16 +0000 (22:14 -0400)]
hppa: signalfd.h: move to common sys/signalfd.h

Use the common sys/signalfd.h to avoid duplication and move the
arch-specific settings into bits/signalfd.h.

9 years agohppa: inotify.h: move to common sys/inotify.h
Mike Frysinger [Sat, 15 Aug 2015 02:14:00 +0000 (22:14 -0400)]
hppa: inotify.h: move to common sys/inotify.h

Use the common sys/inotify.h to avoid duplication and move the
arch-specific settings into bits/inotify.h.

9 years agohppa: eventfd.h: move to common sys/eventfd.h
Mike Frysinger [Sat, 15 Aug 2015 02:13:37 +0000 (22:13 -0400)]
hppa: eventfd.h: move to common sys/eventfd.h

Use the common sys/eventfd.h to avoid duplication and move the
arch-specific settings into bits/eventfd.h.

9 years agohppa: epoll.h: move to common sys/epoll.h
Mike Frysinger [Sat, 15 Aug 2015 02:12:54 +0000 (22:12 -0400)]
hppa: epoll.h: move to common sys/epoll.h

Use the common sys/epoll.h to avoid duplication and move the arch-specific
settings into bits/epoll.h.

9 years agohppa: sigaction.h: update define export based on __USE_XOPEN2K8
Mike Frysinger [Sat, 15 Aug 2015 02:11:50 +0000 (22:11 -0400)]
hppa: sigaction.h: update define export based on __USE_XOPEN2K8

This brings hppa in line with other ports by exporting a few more defines
based on the __USE_XOPEN2K8 define and not just __USE_MISC.

9 years agohppa: shm.h: add SHM_EXEC
Mike Frysinger [Sat, 15 Aug 2015 02:11:03 +0000 (22:11 -0400)]
hppa: shm.h: add SHM_EXEC

This brings hppa in line with all the other arches.

9 years agohppa: drop __ASSUME_LWS_CAS define
Mike Frysinger [Sat, 15 Aug 2015 02:09:30 +0000 (22:09 -0400)]
hppa: drop __ASSUME_LWS_CAS define

We require recent enough kernels for this now, and we've been hardcoding
it to 1, so drop it entirely now.

9 years agohppa: assume TLS everywhere
Mike Frysinger [Sat, 15 Aug 2015 02:07:40 +0000 (22:07 -0400)]
hppa: assume TLS everywhere

This brings hppa inline with all the other arches and main code where we
require TLS support everywhere.  That means dropping the defines USE_TLS
and USE___THREAD, and dropping the binutils check (since we already have
a version requirement that is new enough).

9 years agoFix csqrt spurious underflows (bug 18823).
Joseph Myers [Mon, 17 Aug 2015 23:02:54 +0000 (23:02 +0000)]
Fix csqrt spurious underflows (bug 18823).

The csqrt functions scale up small arguments to avoid underflows when
calling hypot functions.  However, even when hypot does not underflow,
a subsequent calculation of 0.5 * hypot can underflow.  This patch
duly increases the threshold and scale factor to avoid such underflows
as well.

Tested for x86_64, x86 and mips64.

[BZ #18823]
* math/s_csqrt.c (__csqrt): Increase threshold and scale factor
for scaling up small arguments.
* math/s_csqrtf.c (__csqrtf): Likewise.
* math/s_csqrtl.c (__csqrtl): Likewise.
* math/auto-libm-test-in: Add more tests of csqrt.
* math/auto-libm-test-out: Regenerated.

9 years agoAdd version set GLIBC_2.19 for linux/powerpc
Andreas Schwab [Mon, 17 Aug 2015 14:20:46 +0000 (16:20 +0200)]
Add version set GLIBC_2.19 for linux/powerpc

9 years agoDesupport regexp.h (bug 18681)
Zack Weinberg [Sun, 12 Jul 2015 19:27:34 +0000 (15:27 -0400)]
Desupport regexp.h (bug 18681)

9 years agoFix BZ #18084 -- backtrace (..., 0) dumps core on x86.
Paul Pluzhnikov [Sat, 15 Aug 2015 18:42:43 +0000 (11:42 -0700)]
Fix BZ #18084 -- backtrace (..., 0) dumps core on x86.
Other architectures also had bugs, or did unnecessary work.

9 years agostpncpy: fix bug number [BZ #18795]
Mike Frysinger [Sat, 15 Aug 2015 02:43:52 +0000 (22:43 -0400)]
stpncpy: fix bug number [BZ #18795]

The previous commit used 18975 instead of 18795.

9 years agostpncpy: fix size checking [BZ #18975]
Zack Weinberg [Fri, 14 Aug 2015 13:21:44 +0000 (09:21 -0400)]
stpncpy: fix size checking [BZ #18975]

I think the last clause of the conditional,

|| __n <= __bos (__dest)

may be backward.  The code should call the runtime-checking function
if __n is not constant, or if __n is known to be LARGER than the size
of the destination.

9 years agoFix fma spurious underflows (bug 18824).
Joseph Myers [Fri, 14 Aug 2015 17:15:06 +0000 (17:15 +0000)]
Fix fma spurious underflows (bug 18824).

Various fma implementations have logic that, when computing fma (x, y,
z) where z is large (so care needs taking to avoid internal overflow)
but x * y is small, scale x * y up instead of down to avoid internal
underflows resulting from scaling down.  (In these cases, x * y is
small enough that only its sign actually matters rather than the exact
value.)

The threshold for scaling up instead of down was correct for "if the
unscaled values were multiplied, the low part of the multiplication
could underflow", and the scaling was sufficient to ensure that the
low part of the multiplication did not underflow (given that cases of
very small x * y - less than half the least subnormal - were
previously dealt with).  However, the choice in the functions wasn't
between scaling up or no scaling, but between scaling up and scaling
down (scaling down actually being needed when x * y isn't so small
compared to z and so the exact value does matter).  Thus a larger
threshold is needed to ensure that scaling down doesn't produce values
the multiplication of whose low parts underflows.  This patch
increases the thresholds accordingly.

Tested for x86_64, x86 and mips64 (with the MIPS version of s_fmal.c
removed so that the ldbl-128 version gets tested instead of the
soft-fp one).

[BZ #18824]
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Increase threshold for
scaling x * y up instead of down.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Likewise.
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Likewise.
* math/auto-libm-test-in: Add more tests of fma.
* math/auto-libm-test-out: Regenerated.

9 years agoRegenerated sysdeps/x86_64/fpu/libm-test-ulps with AVX2.
Paul Pluzhnikov [Fri, 14 Aug 2015 16:59:04 +0000 (09:59 -0700)]
Regenerated sysdeps/x86_64/fpu/libm-test-ulps with AVX2.

9 years agoRemove incorrect register mov in floorf/nearbyint on x86_64
Siddhesh Poyarekar [Fri, 14 Aug 2015 12:30:17 +0000 (05:30 -0700)]
Remove incorrect register mov in floorf/nearbyint on x86_64

The change in 0b5395f052ee09cd7e3d219af4e805c38058afb5 replaced calls
to __get_cpu_features@plt followed by a mov from rax to rdx, with a
single macro LOAD_RTLD_GLOBAL_RO_RDX.  It is pretty clear that there
was a typo in s_floorf and __nearbyint due to which the (now incorrect)
mov was not removed.  This patch removes that mov.

* sysdeps/x86_64/fpu/multiarch/s_floorf.S (__floorf): Remove
unnecessary movq.
* sysdeps/x86_64/fpu/multiarch/s_nearbyint.S (__nearbyint):
Likewise.

9 years agoAdd more random libm-test inputs.
Joseph Myers [Thu, 13 Aug 2015 23:23:23 +0000 (23:23 +0000)]
Add more random libm-test inputs.

This patch adds more test inputs to various libm functions found
through random generation to have larger ulps errors than previously
listed in libm-test-ulp, on at least one of x86_64 and x86.

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of acos, acosh, asin,
asinh, atan, atan2, atanh, cabs, cbrt, cosh, csqrt, erf, erfc,
exp, exp2, lgamma, log, log1p, log2, pow, sin, sincos, tan, tanh
and tgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoFix tanh missing underflows (bug 16520).
Joseph Myers [Thu, 13 Aug 2015 16:40:39 +0000 (16:40 +0000)]
Fix tanh missing underflows (bug 16520).

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

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16520]
* sysdeps/ieee754/dbl-64/s_tanh.c: Include <float.h>.
(__tanh): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/flt-32/s_tanhf.c: Include <float.h>.
(__tanhf): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-128/s_tanhl.c: Include <float.h>.
(__tanhl): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: Include <float.h>.
(__tanhl): Force underflow exception for arguments with small
absolute value.
* sysdeps/ieee754/ldbl-96/s_tanhl.c: Include <float.h>.
(__tanhl): Force underflow exception for arguments with small
absolute value.
* math/auto-libm-test-in: Add more tests of tanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

9 years agoCheck if cpuid is available in init_cpu_features
H.J. Lu [Thu, 13 Aug 2015 11:52:50 +0000 (04:52 -0700)]
Check if cpuid is available in init_cpu_features

Since not all i486 processors support cpuid, we call __get_cpuid_max to
check if cpuid is available before using it if not compiling for i586,
i686 nor x86-64.

* sysdeps/x86/cpu-features.c (init_cpu_features): Call
__get_cpuid_max if not compiling for i586, i686 nor x86-64.

9 years agoDon't include <cpuid.h> in elision-conf.h
H.J. Lu [Thu, 13 Aug 2015 10:46:13 +0000 (03:46 -0700)]
Don't include <cpuid.h> in elision-conf.h

Don't include the unused <cpuid.h> in Linux/x86 elision-conf.h.

* sysdeps/unix/sysv/linux/x86/elision-conf.h: Don't include
<cpuid.h>.

9 years agoUpdate x86 elision-conf.c for <cpu-features.h>
H.J. Lu [Thu, 13 Aug 2015 10:40:40 +0000 (03:40 -0700)]
Update x86 elision-conf.c for <cpu-features.h>

This patch updates x86 elision-conf.c to use the newly defined
HAS_CPU_FEATURE from <cpu-features.h>.

* sysdeps/unix/sysv/linux/x86/elision-conf.c (elision_init):
Replace HAS_RTM with HAS_CPU_FEATURE (RTM).

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

This patch updates libmvec multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE and LOAD_RTLD_GLOBAL_RO_RDX from
<cpu-features.h>.

* math/Makefile ($(addprefix $(objpfx), $(libm-vec-tests))):
Remove $(objpfx)init-arch.o.
* sysdeps/x86_64/fpu/Makefile (libmvec-support): Remove
init-arch.
* sysdeps/x86_64/fpu/math-tests-arch.h (avx_usable): Removed.
(INIT_ARCH_EXT): Defined as empty.
(CHECK_ARCH_EXT): Replace HAS_XXX with HAS_ARCH_FEATURE (XXX).
* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core.S: Remove
__init_cpu_features call.  Replace HAS_XXX with
HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core.S: Likewise.

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

This patch updates i686 multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE, LOAD_GOT_AND_RTLD_GLOBAL_RO and
LOAD_FUNC_GOT_EAX from <cpu-features.h>.

* sysdeps/i386/i686/fpu/multiarch/e_expf.c: Replace HAS_XXX
with HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Likewise.
* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Likewise.
* sysdeps/i386/i686/fpu/multiarch/s_sincosf.c: Likewise.
* sysdeps/i386/i686/fpu/multiarch/s_sinf.c: Likewise.
* sysdeps/i386/i686/multiarch/ifunc-impl-list.c: Likewise.
* sysdeps/i386/i686/multiarch/s_fma.c: Likewise.
* sysdeps/i386/i686/multiarch/s_fmaf.c: Likewise.
* sysdeps/i386/i686/multiarch/bcopy.S: Remove __init_cpu_features
call.  Merge SHARED and !SHARED.  Add LOAD_GOT_AND_RTLD_GLOBAL_RO.
Use LOAD_FUNC_GOT_EAX to load function address.  Replace HAS_XXX
with HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
* sysdeps/i386/i686/multiarch/bzero.S: Likewise.
* sysdeps/i386/i686/multiarch/memchr.S: Likewise.
* sysdeps/i386/i686/multiarch/memcmp.S: Likewise.
* sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
* sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
* sysdeps/i386/i686/multiarch/memmove.S: Likewise.
* sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
* sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
* sysdeps/i386/i686/multiarch/memrchr.S: Likewise.
* sysdeps/i386/i686/multiarch/memset.S: Likewise.
* sysdeps/i386/i686/multiarch/memset_chk.S: Likewise.
* sysdeps/i386/i686/multiarch/rawmemchr.S: Likewise.
* sysdeps/i386/i686/multiarch/strcasecmp.S: Likewise.
* sysdeps/i386/i686/multiarch/strcat.S: Likewise.
* sysdeps/i386/i686/multiarch/strchr.S: Likewise.
* sysdeps/i386/i686/multiarch/strcmp.S: Likewise.
* sysdeps/i386/i686/multiarch/strcpy.S: Likewise.
* sysdeps/i386/i686/multiarch/strcspn.S: Likewise.
* sysdeps/i386/i686/multiarch/strlen.S: Likewise.
* sysdeps/i386/i686/multiarch/strncase.S: Likewise.
* sysdeps/i386/i686/multiarch/strnlen.S: Likewise.
* sysdeps/i386/i686/multiarch/strrchr.S: Likewise.
* sysdeps/i386/i686/multiarch/strspn.S: Likewise.
* sysdeps/i386/i686/multiarch/wcschr.S: Likewise.
* sysdeps/i386/i686/multiarch/wcscmp.S: Likewise.
* sysdeps/i386/i686/multiarch/wcscpy.S: Likewise.
* sysdeps/i386/i686/multiarch/wcslen.S: Likewise.
* sysdeps/i386/i686/multiarch/wcsrchr.S: Likewise.
* sysdeps/i386/i686/multiarch/wmemcmp.S: Likewise.

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

This patch updates x86_64 multiarch functions to use the newly defined
HAS_CPU_FEATURE, HAS_ARCH_FEATURE and LOAD_RTLD_GLOBAL_RO_RDX from
<cpu-features.h>.

* sysdeps/x86_64/fpu/multiarch/e_asin.c: Replace HAS_XXX with
HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
* sysdeps/x86_64/fpu/multiarch/e_atan2.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_pow.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_fma.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_fmaf.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_ceil.S: Use
LOAD_RTLD_GLOBAL_RO_RDX and HAS_CPU_FEATURE (SSE4_1).
* sysdeps/x86_64/fpu/multiarch/s_ceilf.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floor.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floorf.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_nearbyint.S : Likewise.
* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_rintf.S: Likewise.
* sysdeps/x86_64/fpu/multiarch/s_rintf.S : Likewise.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Likewise.
* sysdeps/x86_64/multiarch/sched_cpucount.c: Likewise.
* sysdeps/x86_64/multiarch/strstr.c: Likewise.
* sysdeps/x86_64/multiarch/memmove.c: Likewise.
* sysdeps/x86_64/multiarch/memmove_chk.c: Likewise.
* sysdeps/x86_64/multiarch/test-multiarch.c: Likewise.
* sysdeps/x86_64/multiarch/memcmp.S: Remove __init_cpu_features
call.  Add LOAD_RTLD_GLOBAL_RO_RDX.  Replace HAS_XXX with
HAS_CPU_FEATURE/HAS_ARCH_FEATURE (XXX).
* sysdeps/x86_64/multiarch/memcpy.S: Likewise.
* sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
* sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
* sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
* sysdeps/x86_64/multiarch/memset.S: Likewise.
* sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
* sysdeps/x86_64/multiarch/strcat.S: Likewise.
* sysdeps/x86_64/multiarch/strchr.S: Likewise.
* sysdeps/x86_64/multiarch/strcmp.S: Likewise.
* sysdeps/x86_64/multiarch/strcpy.S: Likewise.
* sysdeps/x86_64/multiarch/strcspn.S: Likewise.
* sysdeps/x86_64/multiarch/strspn.S: Likewise.
* sysdeps/x86_64/multiarch/wcscpy.S: Likewise.
* sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.

9 years agoAdd _dl_x86_cpu_features to rtld_global
H.J. Lu [Thu, 13 Aug 2015 10:37:47 +0000 (03:37 -0700)]
Add _dl_x86_cpu_features to rtld_global

This patch adds _dl_x86_cpu_features to rtld_global in x86 ld.so
and initializes it early before __libc_start_main is called so that
cpu_features is always available when it is used and we can avoid
calling __init_cpu_features in IFUNC selectors.

* sysdeps/i386/dl-machine.h: Include <cpu-features.c>.
(dl_platform_init): Call init_cpu_features.
* sysdeps/i386/dl-procinfo.c (_dl_x86_cpu_features): New.
* sysdeps/i386/i686/cacheinfo.c
(DISABLE_PREFERRED_MEMORY_INSTRUCTION): Removed.
* sysdeps/i386/i686/multiarch/Makefile (aux): Remove init-arch.
* sysdeps/i386/i686/multiarch/Versions: Removed.
* sysdeps/i386/i686/multiarch/ifunc-defines.sym (KIND_OFFSET):
Removed.
* sysdeps/i386/ldsodefs.h: Include <cpu-features.h>.
* sysdeps/unix/sysv/linux/x86/Makefile
(libpthread-sysdep_routines): Remove init-arch.
* sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c: Include
<sysdeps/x86_64/dl-procinfo.c> instead of
sysdeps/generic/dl-procinfo.c>.
* sysdeps/x86/Makefile [$(subdir) == csu] (gen-as-const-headers):
Add cpu-features-offsets.sym and rtld-global-offsets.sym.
[$(subdir) == elf] (sysdep-dl-routines): Add dl-get-cpu-features.
[$(subdir) == elf] (tests): Add tst-get-cpu-features.
[$(subdir) == elf] (tests-static): Add
tst-get-cpu-features-static.
* sysdeps/x86/Versions: New file.
* sysdeps/x86/cpu-features-offsets.sym: Likewise.
* sysdeps/x86/cpu-features.c: Likewise.
* sysdeps/x86/cpu-features.h: Likewise.
* sysdeps/x86/dl-get-cpu-features.c: Likewise.
* sysdeps/x86/libc-start.c: Likewise.
* sysdeps/x86/rtld-global-offsets.sym: Likewise.
* sysdeps/x86/tst-get-cpu-features-static.c: Likewise.
* sysdeps/x86/tst-get-cpu-features.c: Likewise.
* sysdeps/x86_64/dl-procinfo.c: Likewise.
* sysdeps/x86_64/cacheinfo.c (__cpuid_count): Removed.
Assume USE_MULTIARCH is defined and don't check it.
(is_intel): Replace __cpu_features with GLRO(dl_x86_cpu_features).
(is_amd): Likewise.
(max_cpuid): Likewise.
(intel_check_word): Likewise.
(__cache_sysconf): Don't call __init_cpu_features.
(__x86_preferred_memory_instruction): Removed.
(init_cacheinfo): Don't call __init_cpu_features. Replace
__cpu_features with GLRO(dl_x86_cpu_features).
* sysdeps/x86_64/dl-machine.h: <cpu-features.c>.
(dl_platform_init): Call init_cpu_features.
* sysdeps/x86_64/ldsodefs.h: Include <cpu-features.h>.
* sysdeps/x86_64/multiarch/Makefile (aux): Remove init-arch.
* sysdeps/x86_64/multiarch/Versions: Removed.
* sysdeps/x86_64/multiarch/cacheinfo.c: Likewise.
* sysdeps/x86_64/multiarch/init-arch.c: Likewise.
* sysdeps/x86_64/multiarch/ifunc-defines.sym (KIND_OFFSET):
Removed.
* sysdeps/x86_64/multiarch/init-arch.h: Rewrite.

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

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

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

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

This patch fixes the missing enablement for stpcpy on POWER8.

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

9 years agopowerpc: Fix PPC64/POWER7 conform tests
Adhemerval Zanella [Fri, 31 Jul 2015 13:48:20 +0000 (10:48 -0300)]
powerpc: Fix PPC64/POWER7 conform tests

When building with --disable-multi-arch the memmove and strstr POWER7
optimization create and uses symbols that conflict with expect conform
tests.

* sysdeps/powerpc/powerpc64/power7/memmove.S (bcopy): Changing to
__bcopy and add a weak_alias to bcopy.
* sysdeps/powerpc/powerpc64/power7/strstr.S (strstr): Use __strnlen
for static build.

9 years agopowerpc: Use default strcpy optimization for POWER7
Adhemerval Zanella [Tue, 28 Jul 2015 20:12:25 +0000 (17:12 -0300)]
powerpc: Use default strcpy optimization for POWER7

This patches uses the default strcpy/stpcpy implementation for
POWER7/PPC64.  This is faster in mostly inputs for benchtests
and for multiarch the implementation uses the POWER7 strlen and
memcpy.

* string/stpcpy.c (__stpcpy): Use STPCPY to redefine symbol name and
cleanup macro usage.
* string/strcpy.c (strcpt): Use STRCPY to redefine symbol name.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.S: Remove file.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/stpcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.
* sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
[SHARED && IS_IN (libc)]: Include <string/strcpy.c>.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
[SHARED && IS_IN (libc)]: Include <string/stpcpy.c>.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power7.c: New file.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy-power7.c: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/strcpy.c: Likewise.

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

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

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

This patch fixes the strstr build with --disable-multi-arch option.
The optimization calls the __strstr_ppc symbol, which always build
for multiarch config but not if it is disable.  This patch fixes it
by adding the default C implementation object with the expected
symbol name.

* sysdeps/powerpc/powerpc64/power7/Makefile [$(subdir) = string]
(sysdep_routines): Add strstr-ppc64.
* sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c: New file.

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

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

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

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

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

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

9 years agoAdd more tests of various libm functions.
Joseph Myers [Tue, 11 Aug 2015 00:58:28 +0000 (00:58 +0000)]
Add more tests of various libm functions.

This patch adds more tests of various libm functions found through
random test generation to give increased ulps on 32-bit x86.

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of acosh, asin, asinh,
atanh, cabs, carg, cbrt, cosh, csqrt, erf, erfc, exp, exp10,
expm1, hypot, log, log10, log1p, log2, pow, sinh, tan and tgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoFix ldbl-128ibm tanhl inaccuracy (bug 18790).
Joseph Myers [Mon, 10 Aug 2015 20:35:30 +0000 (20:35 +0000)]
Fix ldbl-128ibm tanhl inaccuracy (bug 18790).

ldbl-128ibm tanhl uses a too-small threshold to decide when to return
+/-1, resulting in large errors.  This patch changes it to a more
appropriate threshold (the requirement is for 2*exp(-2|x|) to be small
in terms of ulps of 1).

Tested for x86_64, x86 and powerpc.

[BZ #18790]
* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Increase
threshold for returning +/- 1.
* math/auto-libm-test-in: Add more tests of tanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

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

9 years agoFix ldbl-128ibm sinhl inaccuracy near 0 (bug 18789).
Joseph Myers [Mon, 10 Aug 2015 15:25:10 +0000 (15:25 +0000)]
Fix ldbl-128ibm sinhl inaccuracy near 0 (bug 18789).

ldbl-128ibm sinhl uses a too-big threshold to decide when to return
the argument, resulting in large errors.  This patch fixes it to use a
more appropriate threshold.

Tested for x86_64, x86 and powerpc.

[BZ #18789]
* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Use
smaller threshold for returning the argument.
* math/auto-libm-test-in: Add more tests of sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

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

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

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

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

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

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

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

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

9 years agohppa: put custom madvise defines behind __USE_MISC
Mike Frysinger [Wed, 5 Aug 2015 09:17:29 +0000 (05:17 -0400)]
hppa: put custom madvise defines behind __USE_MISC

No other arch exports these defines, and having them in the default
namespace causes conformance header tests to fail.  Put them behind
the __USE_MISC define as that is what other arches seem to use.

9 years agohppa: Fix miscompilation of sched_setaffinity() [BZ #18480]
John David Anglin [Fri, 7 Aug 2015 15:54:19 +0000 (11:54 -0400)]
hppa: Fix miscompilation of sched_setaffinity() [BZ #18480]

The attached change fixes the miscompilation of sched_setaffinity() on
hppa.  This is an old problem that was fixed on other architectures using
a similar approach to the attached change.  See:
https://sourceware.org/ml/libc-hacker/2004-04/msg00016.html

Build tested on trunk.  Patch has been applied to debian glibc for some time.

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

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

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

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

As noted in the bug, the asm operands need to be copied to register
variables to avoid operand reloads in the principal asm of the macro.
See the arm implementation for reference.  Otherwise we get:
../sysdeps/unix/sysv/linux/hppa/bits/atomic.h:68:6: error:
can't find a register in class 'R1_REGS' while reloading 'asm'

Build tested on trunk with gcc-4.8.  Similar patch has been tested
with 2.19 on Debian hppa-unknown-linux-gnu.

9 years agomicroblaze: include unix/sysdep.h
Mike Frysinger [Thu, 6 Aug 2015 06:10:46 +0000 (02:10 -0400)]
microblaze: include unix/sysdep.h

The semi-recent SYSCALL_CANCEL inclusion broke microblaze due to the
sysdep.h header not including the unix/sysdep.h header.  Include it
here like all other ports.

9 years agoFix tan missing underflows (bug 16517).
Joseph Myers [Fri, 7 Aug 2015 23:10:35 +0000 (23:10 +0000)]
Fix tan missing underflows (bug 16517).

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

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16517]
* sysdeps/ieee754/dbl-64/s_tan.c: Include <float.h>.
(tan): Force underflow exception for arguments with small absolute
value.
* sysdeps/ieee754/flt-32/k_tanf.c: Include <float.h>.
(__kernel_tanf): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128/k_tanl.c: Include <float.h>.
(__kernel_tanl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <float.h>.
(__kernel_tanl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-96/k_tanl.c: Include <float.h>.
(__kernel_tanl): Force underflow exception for arguments with
small absolute value.
* math/auto-libm-test-in: Add more tests of tan.
* math/auto-libm-test-out: Regenerated.

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

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

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

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

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

Commit 2a6ad8142d14c998e6c5eb51418aac1f598b621e updated the headers and
the common dl-symaddr.c, but missed that hppa has its own dedicated source
file for this func.  Update that too to fix build errors due to missing
exports of the symbol.

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

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

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

9 years agoFix sinh missing underflows (bug 16519).
Joseph Myers [Thu, 6 Aug 2015 23:01:09 +0000 (23:01 +0000)]
Fix sinh missing underflows (bug 16519).

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

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16519]
* sysdeps/ieee754/dbl-64/e_sinh.c: Include <float.h>.
(__ieee754_sinh): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/flt-32/e_sinhf.c: Include <float.h>.
(__ieee754_sinhf): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128/e_sinhl.c: Include <float.h>.
(__ieee754_sinhl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Include <float.h>.
(__ieee754_sinhl): Force underflow exception for arguments with
small absolute value.
* sysdeps/ieee754/ldbl-96/e_sinhl.c: Include <float.h>.
(__ieee754_sinhl): Force underflow exception for arguments with
small absolute value.
* math/auto-libm-test-in: Add more tests of sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.

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

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

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

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

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

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

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

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

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

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

We should align stack to 16 bytes when calling __errno_location.

[BZ #18661]
* sysdeps/x86_64/fpu/s_cosf.S (__cosf): Align stack to 16 bytes
when calling __errno_location.
* sysdeps/x86_64/fpu/s_sincosf.S (__sincosf): Likewise.
* sysdeps/x86_64/fpu/s_sinf.S (__sinf): Likewise.

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

Subtract stack by 24 bytes instead of 16 bytes so that stack is aligned
to 16 bytes when calling __gettimeofday.

[BZ #18661]
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
(__lll_timedwait_tid): Align stack to 16 bytes when calling
__gettimeofday.

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

Don't use pop to restore %rdi so that stack is aligned to 16 bytes
when calling __setcontext.

[BZ #18661]
* sysdeps/unix/sysv/linux/x86_64/__start_context.S
(__start_context): Don't use pop to restore %rdi so that stack
is aligned to 16 bytes when calling __setcontext.

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

{memcpy,strcmp}-sse2-unaligned.S aren't needed in ld.so.

* sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: Compile
only for libc.
* sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: Likewise.

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

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