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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tested for powerpc and mips64.

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

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

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

Tested for powerpc and mips64.

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

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

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

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

Tested for powerpc and mips64.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tested for x86_64.

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

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

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

Tested for x86_64 and x86.

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

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

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

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

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

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

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

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

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

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

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

9 years agoconformtest: use proper _POSIX_C_SOURCE value for POSIX.
Joseph Myers [Wed, 20 May 2015 23:14:53 +0000 (23:14 +0000)]
conformtest: use proper _POSIX_C_SOURCE value for POSIX.

The conform/ tests were using -D_POSIX_C_SOURCE=199912 to test "POSIX"
(1995/6).  This patch changes them to use 199506L, the proper value
from the relevant edition of POSIX.  (This doesn't make any difference
to features.h, but is the logically correct value to use.)  Tested for
x86_64.

* conform/GlibcConform.pm ($CFLAGS{"POSIX"}): Use
-D_POSIX_C_SOURCE=199506L.

9 years agoconformtest: correct POSIX expectations for locale.h.
Joseph Myers [Wed, 20 May 2015 22:56:27 +0000 (22:56 +0000)]
conformtest: correct POSIX expectations for locale.h.

When cleaning up conformtest expectations for POSIX for locale.h in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00382.html>, I missed
that locale.h had contents defined in POSIX.2:1993 as well as
POSIX.1:1995/6.  Thus, LC_MESSAGES *should* in fact be required for
POSIX, because POSIX.2 says so; this patch adds that expectation
back.  Tested for x86_64.

* conform/data/locale.h-data [POSIX] (LC_MESSAGES): Require.

9 years agoconformtest: clean up POSIX expectations for unistd.h.
Joseph Myers [Wed, 20 May 2015 22:47:03 +0000 (22:47 +0000)]
conformtest: clean up POSIX expectations for unistd.h.

Concluding the series of patches to clean up conformtest expectations
for "POSIX" (POSIX.1:1995/6, union with POSIX.2:1993), this patch
cleans up expectations for unistd.h.  Tested x86_64; the new XFAIL is
for missing _POSIX2_C_VERSION.

* conform/data/unistd.h-data (_POSIX_VERSION): Require.
(_POSIX2_C_VERSION): Require if [POSIX || XPG3 || XPG4 || UNIX98].
Do not mention otherwise.
[POSIX] (_XOPEN_VERSION): Do not expect.
[POSIX] (_XOPEN_XCU_VERSION): Likewise.
[POSIX] (_POSIX2_C_BIND): Likewise.
[POSIX] (_POSIX2_VERSION): Likewise.
[POSIX] (_XOPEN_XPG2): Likewise.
[POSIX] (_XOPEN_XPG3): Likewise.
[POSIX] (_XOPEN_XPG4): Likewise.
[POSIX] (_XOPEN_UNIX): Likewise.
[POSIX] (_POSIX_ADVISORY_INFO): Likewise.
[POSIX] (_POSIX_BARRIERS): Likewise.
[POSIX] (_POSIX_CLOCK_SELECTION): Likewise.
[POSIX] (_POSIX_CPUTIME): Likewise.
[POSIX] (_POSIX_MONOTONIC_CLOCK): Likewise.
[POSIX] (_POSIX_READER_WRITER_LOCKS): Likewise.
[POSIX] (_POSIX_SHELL): Likewise.
[POSIX] (_POSIX_SPAWN): Likewise.
[POSIX] (_POSIX_SPIN_LOCKS): Likewise.
[POSIX] (_POSIX_SPORADIC_SERVER): Likewise.
[POSIX] (_POSIX_THREAD_CPUTIME): Likewise.
[POSIX] (_POSIX_TYPED_MEMORY_OBJECTS): Likewise.
[POSIX] (_POSIX_THREAD_SPORADIC_SERVER): Likewise.
[POSIX] (_XBS5_ILP32_OFF32): Likewise.
[POSIX] (_XBS5_ILP32_OFBIG): Likewise.
[POSIX] (_XBS5_LP64_OFF64): Likewise.
[POSIX] (_XBS5_LPBIG_OFFBIG): Likewise.
[POSIX] (_POSIX_TIMEOUTS): Likewise.
[POSIX] (_POSIX2_PBS): Likewise.
[POSIX] (_POSIX2_PBS_ACCOUNTING): Likewise.
[POSIX] (_POSIX2_PBS_CHECKPOINT): Likewise.
[POSIX] (_POSIX2_PBS_LOCATE): Likewise.
[POSIX] (_POSIX2_PBS_MESSAGE): Likewise.
[POSIX] (_POSIX2_PBS_TRACK): Likewise.
[POSIX] (_POSIX_TIMESTAMP_RESOLUTION): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFF32_CFLAGS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFF32_LDFLAGS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFF32_LIBS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFF32_LINTFLAGS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFFBIG_CFLAGS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFFBIG_LDFLAGS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFFBIG_LIBS): Likewise.
[POSIX] (_CS_XBS5_ILP32_OFFBIG_LINTFLAGS): Likewise.
[POSIX] (_CS_XBS5_LP64_OFF64_CFLAGS): Likewise.
[POSIX] (_CS_XBS5_LP64_OFF64_LDFLAGS): Likewise.
[POSIX] (_CS_XBS5_LP64_OFF64_LIBS): Likewise.
[POSIX] (_CS_XBS5_LP64_OFF64_LINTFLAGS): Likewise.
[POSIX] (_CS_XBS5_LPBIG_OFFBIG_CFLAGS): Likewise.
[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LDFLAGS): Likewise.
[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LIBS): Likewise.
[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS): Likewise.
[POSIX] (_SC_2_C_BIND): Likewise.
[POSIX] (_SC_2_C_VERSION): Likewise.
[POSIX] (_SC_2_PBS): Likewise.
[POSIX] (_SC_2_PBS_ACCOUNTING): Likewise.
[POSIX] (_SC_2_PBS_CHECKPOINT): Likewise.
[POSIX] (_SC_2_PBS_LOCATE): Likewise.
[POSIX] (_SC_2_PBS_MESSAGE): Likewise.
[POSIX] (_SC_2_PBS_TRACK): Likewise.
[POSIX] (_SC_ATEXIT_MAX): Likewise.
[POSIX] (_SC_BARRIERS): Likewise.
[POSIX] (_SC_BASE): Likewise.
[POSIX] (_SC_CLOCK_SELECTION): Likewise.
[POSIX] (_SC_DEVICE_IO): Likewise.
[POSIX] (_SC_DEVICE_SPECIFIC): Likewise.
[POSIX] (_SC_DEVICE_SPECIFIC_R): Likewise.
[POSIX] (_SC_FD_MGMT): Likewise.
[POSIX] (_SC_FIFO): Likewise.
[POSIX] (_SC_FILE_ATTRIBUTES): Likewise.
[POSIX] (_SC_FILE_LOCKING): Likewise.
[POSIX] (_SC_FILE_SYSTEM): Likewise.
[POSIX] (_SC_IOV_MAX): Likewise.
[POSIX] (_SC_MONOTONIC_CLOCK): Likewise.
[POSIX] (_SC_NETWORKING): Likewise.
[POSIX] (_SC_PAGE_SIZE): Likewise.
[POSIX] (_SC_PASS_MAX): Likewise.
[POSIX] (_SC_PIPE): Likewise.
[POSIX] (_SC_READER_WRITER_LOCKS): Likewise.
[POSIX] (_SC_REGEXP): Likewise.
[POSIX] (_SC_SHELL): Likewise.
[POSIX] (_SC_SIGNALS): Likewise.
[POSIX] (_SC_SINGLE_PROCESS): Likewise.
[POSIX] (_SC_SPIN_LOCKS): Likewise.
[POSIX] (_SC_TYPED_MEMORY_OBJECTS): Likewise.
[POSIX] (_SC_USER_GROUPS): Likewise.
[POSIX] (_SC_USER_GROUPS_R): Likewise.
[POSIX] (_SC_STREAMS): Likewise.
[POSIX] (_SC_XBS5_ILP32_OFF32): Likewise.
[POSIX] (_SC_XBS5_ILP32_OFFBIG): Likewise.
[POSIX] (_SC_XBS5_LP64_OFF64): Likewise.
[POSIX] (_SC_XBS5_LPBIG_OFFBIG): Likewise.
[POSIX] (_SC_THREAD_ROBUST_PRIO_INHERIT): Likewise.
[POSIX] (_SC_THREAD_ROBUST_PRIO_PROTECT): Likewise.
[POSIX] (_PC_FILESIZEBITS): Likewise.
[POSIX] (_PC_REC_INCR_XFER_SIZE): Likewise.
[POSIX] (_PC_REC_MAX_XFER_SIZE): Likewise.
[POSIX] (_PC_REC_MIN_XFER_SIZE): Likewise.
[POSIX] (_PC_REC_XFER_ALIGN): Likewise.
[POSIX] (uid_t): Likewise.
[POSIX] (gid_t): Likewise.
[POSIX] (off_t): Likewise.
[POSIX] (pid_t): Likewise.
[POSIX] (cuserid): Allow.
(_SC_2_CHAR_TERM): Require constant.
(_POSIX_ASYNCHRONOUS_IO): Remove duplicate optional-constant.
* conform/Makefile (test-xfail-POSIX/unistd.h/conform): New
variable.

9 years agoNaCl: Set tid field to a unique value.
Roland McGrath [Wed, 20 May 2015 21:52:05 +0000 (14:52 -0700)]
NaCl: Set tid field to a unique value.

9 years agoMove usleep.c using nanosleep to sysdeps/posix.
Roland McGrath [Wed, 20 May 2015 21:18:21 +0000 (14:18 -0700)]
Move usleep.c using nanosleep to sysdeps/posix.

9 years agoi386: Remove six-argument specialized implementations
Adhemerval Zanella [Wed, 20 May 2015 19:37:52 +0000 (16:37 -0300)]
i386: Remove six-argument specialized implementations

This patch removes the specialized i386 assembly implementations for
fallocate{64}, pselect, and sync_file_range now that i386 have
support for 6 argument syscalls.

9 years agoAdd missing math_private includes.
Wilco Dijkstra [Wed, 20 May 2015 12:48:48 +0000 (12:48 +0000)]
Add missing math_private includes.

9 years agoBZ#18434: Mark fixed in NEWS.
Roland McGrath [Tue, 19 May 2015 23:51:27 +0000 (16:51 -0700)]
BZ#18434: Mark fixed in NEWS.

9 years agoFix ldbl-96 remquol (finite, Inf) (bug 18244).
Joseph Myers [Tue, 19 May 2015 23:44:28 +0000 (23:44 +0000)]
Fix ldbl-96 remquol (finite, Inf) (bug 18244).

ldbl-96 remquol wrongly handles the case where the first argument is
finite and the second infinite, because the check for the second
argument being a NaN fails to disregard the explicit high mantissa bit
and so wrongly interprets an infinity as being a NaN.  This patch
fixes this by masking off that bit, and improves test coverage for
both remainder and remquo (various cases were missing tests, or, as in
the case of the bug, were tested only for one of the two functions).

Tested for x86_64 and x86.

[BZ #18244]
* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Ignore explicit
high mantissa bit when testing whether P is a NaN.
* math/libm-test.inc (remainder_test_data): Add more tests.
(remquo_test_data): Likewise.

9 years agoFix i386 atanhl spurious underflows (bug 18049).
Joseph Myers [Tue, 19 May 2015 23:05:22 +0000 (23:05 +0000)]
Fix i386 atanhl spurious underflows (bug 18049).

The i386 implementation of atanhl, for small arguments, does a
calculation that involves computing twice the square of the argument,
resulting in spurious underflows for some arguments.  This patch fixes
this by just returning the argument when its exponent is below -32,
with underflow being forced as needed for subnormal arguments.

Tested for x86 and x86_64.

[BZ #18049]
* sysdeps/i386/fpu/e_atanhl.S (__ieee754_atanhl): For exponents
below -32, return the argument, with underflow if subnormal.
* math/auto-libm-test-in: Add more tests of atanh.
* math/auto-libm-test-out: Regenerated.

9 years agoBZ#18434: Fix sem_post EOVERFLOW check for [!__HAVE_64B_ATOMICS].
Roland McGrath [Tue, 19 May 2015 22:04:41 +0000 (15:04 -0700)]
BZ#18434: Fix sem_post EOVERFLOW check for [!__HAVE_64B_ATOMICS].

9 years agoFix typo in safety annotations in envz_remove
Siddhesh Poyarekar [Tue, 19 May 2015 21:06:13 +0000 (02:36 +0530)]
Fix typo in safety annotations in envz_remove

9 years ago * inet/rcmd.c (rresvport_af): Change ss to anonymous union
Steve Ellcey [Tue, 19 May 2015 20:09:01 +0000 (13:09 -0700)]
* inet/rcmd.c (rresvport_af): Change ss to anonymous union
in order to avoid strict alias warnings.
(iruserok_af): Ditto for ra.

9 years agoFix for test "malloc_usable_size: expected 7 but got 11"
James Lemke [Tue, 19 May 2015 19:10:26 +0000 (12:10 -0700)]
Fix for test "malloc_usable_size: expected 7 but got 11"

[BZ #17581] The checking chain of unused chunks was terminated by a hash of
    the block pointer, which was sometimes confused with the chunk length byte.
    We now avoid using a length byte equal to the magic byte.

9 years agosoft-fp: Fix alpha kernel build problem
Richard Henderson [Tue, 19 May 2015 18:23:56 +0000 (11:23 -0700)]
soft-fp: Fix alpha kernel build problem

 * soft-fp/op-common.h (_FP_FROM_INT): Don't write to R.

9 years agoalpha: Update libm-test-ulps
Richard Henderson [Tue, 19 May 2015 16:42:44 +0000 (09:42 -0700)]
alpha: Update libm-test-ulps

9 years agoAvoid deadlock in malloc on backtrace (BZ #16159)
Siddhesh Poyarekar [Tue, 19 May 2015 01:10:37 +0000 (06:40 +0530)]
Avoid deadlock in malloc on backtrace (BZ #16159)

When the malloc subsystem detects some kind of memory corruption,
depending on the configuration it prints the error, a backtrace, a
memory map and then aborts the process.  In this process, the
backtrace() call may result in a call to malloc, resulting in
various kinds of problematic behavior.

In one case, the malloc it calls may detect a corruption and call
backtrace again, and a stack overflow may result due to the infinite
recursion.  In another case, the malloc it calls may deadlock on an
arena lock with the malloc (or free, realloc, etc.) that detected the
corruption.  In yet another case, if the program is linked with
pthreads, backtrace may do a pthread_once initialization, which
deadlocks on itself.

In all these cases, the program exit is not as intended.  This is
avoidable by marking the arena that malloc detected a corruption on,
as unusable.  The following patch does that.  Features of this patch
are as follows:

- A flag is added to the mstate struct of the arena to indicate if the
  arena is corrupt.

- The flag is checked whenever malloc functions try to get a lock on
  an arena.  If the arena is unusable, a NULL is returned, causing the
  malloc to use mmap or try the next arena.

- malloc_printerr sets the corrupt flag on the arena when it detects a
  corruption

- free does not concern itself with the flag at all.  It is not
  important since the backtrace workflow does not need free.  A free
  in a parallel thread may cause another corruption, but that's not
  new

- The flag check and set are not atomic and may race.  This is fine
  since we don't care about contention during the flag check.  We want
  to make sure that the malloc call in the backtrace does not trip on
  itself and all that action happens in the same thread and not across
  threads.

I verified that the test case does not show any regressions due to
this patch.  I also ran the malloc benchmarks and found an
insignificant difference in timings (< 2%).

* malloc/Makefile (tests): New test case tst-malloc-backtrace.
* malloc/arena.c (arena_lock): Check if arena is corrupt.
(reused_arena): Find a non-corrupt arena.
(heap_trim): Pass arena to unlink.
* malloc/hooks.c (malloc_check_get_size): Pass arena to
malloc_printerr.
(top_check): Likewise.
(free_check): Likewise.
(realloc_check): Likewise.
* malloc/malloc.c (malloc_printerr): Add arena argument.
(unlink): Likewise.
(munmap_chunk): Adjust.
(ARENA_CORRUPTION_BIT): New macro.
(arena_is_corrupt): Likewise.
(set_arena_corrupt): Likewise.
(sysmalloc): Use mmap if there are no usable arenas.
(_int_malloc): Likewise.
(__libc_malloc): Don't fail if arena_get returns NULL.
(_mid_memalign): Likewise.
(__libc_calloc): Likewise.
(__libc_realloc): Adjust for additional argument to
malloc_printerr.
(_int_free): Likewise.
(malloc_consolidate): Likewise.
(_int_realloc): Likewise.
(_int_memalign): Don't touch corrupt arenas.
* malloc/tst-malloc-backtrace.c: New test case.

9 years agoSucceed if make check does not report any errors
Siddhesh Poyarekar [Tue, 19 May 2015 01:06:29 +0000 (06:36 +0530)]
Succeed if make check does not report any errors

The conditional that evaluates if there are any FAILed test cases
currently always fails, since we ensure it fails if we find any
unexpected results in tests.sum and it would obviously fail if it does
not find failed results in tests.sum.  This patch fixes this by simply
inverting the result of the egrep, i.e. succeed if egrep fails (to
find failed results) and fail if it succeeds.

Tested with 'make subdirs=localedata check' and 'make subdirs=locale
check' where all tests succeed and with 'make subdirs=elf check' where
a couple of tests fail for me.

 * Makefile (summarize-tests): Fix return value on success.

9 years agoAdd envz_remove to the libc manual
Siddhesh Poyarekar [Tue, 19 May 2015 01:05:37 +0000 (06:35 +0530)]
Add envz_remove to the libc manual

I was told that Ma Shimao submitted a patch to add envz_remove to the
libc manual, but the patch could not be accepted since he does not
have a copyright assignment in place.  I have been woefully behind on
libc-alpha recently and have not seen the patch or the discussion
thread.  I have also not read the man page for envz_remove, so
Alexandre Oliva asked me if I could write this independently and post
a patch.  The patch below is the result of the same - I have written
it based on the implementation in string/envz.c and Alex told me via
email that the function is AS, AC and MT-safe like envz_strip.

I assume Alex and Carlos cannot review this since they have been
tainted by the original patch (I haven't even tried to look for a link
to it since I don't want to be tainted) so someone else will have to
review this.  If there are no reviewers till the end of the week, I
will commit this since I believe there is a chance that there are no
other reviewers who haven't read that thread.

* manual/string.texi (Envz Functions): Add envz_remove.

9 years agoRefactor opendir.
Roland McGrath [Mon, 18 May 2015 22:44:53 +0000 (15:44 -0700)]
Refactor opendir.

9 years agoAdd *.pyc to .gitignore
Siddhesh Poyarekar [Mon, 18 May 2015 09:56:26 +0000 (15:26 +0530)]
Add *.pyc to .gitignore

Ignore generated *.pyc files, particularly in the benchtests
directory.

9 years agoEnsure `wint_t' is defined before use in include/stdio.h
Arjun Shankar [Mon, 18 May 2015 06:58:06 +0000 (12:28 +0530)]
Ensure `wint_t' is defined before use in include/stdio.h

While trying to get nptl/tst-initializers1.c to include the test skeleton, I
came across a couple of speed bumps. Firstly: after making the appropriate
changes to the test, running `make check' led to this error:

> In file included from ../malloc/malloc.h:24:0,
..
>                  from tst-initializers1.c:60:
> ../include/stdio.h:111:1: error: unknown type name `wint_t'
>  extern wint_t __getwc_unlocked (FILE *__fp);

So, `wint_t' is used before being defined. Question: Why did test-skeleton.c
not cause this error in any of the other tests that include it?

Anyway, I noticed include/stdio.h includes stddef.h, which in turn defines
`wint_t', but only if `__need_wint_t' is defined. So I put in a
`#define __need_wint_t' before the include to get rid of the error. Is that
the correct fix?

A subsequent `make && make check' led to this second error:

>                  from tst-initializers1-c89.c:1:
> ../test-skeleton.c: In function `main':
> ../test-skeleton.c:356:11: error: `for' loop initial declarations are only
>  allowed in C99 mode
>            for (struct temp_name_list *n = temp_name_list;

Although there seem to be several other C89 no-noes in test-skeleton.c, I
needed only to fix this specific one for gcc-4.8.3 to stop complaining.

9 years agoFix stdlib/tst-setcontext3 with dash [BZ#18418]
Adhemerval Zanella [Fri, 15 May 2015 19:50:09 +0000 (16:50 -0300)]
Fix stdlib/tst-setcontext3 with dash [BZ#18418]

This patch remove the non-portable array usage on tst-setcontext3.sh
script.

9 years agoFail locale installation if localedef fails.
Carlos O'Donell [Sat, 16 May 2015 06:14:49 +0000 (02:14 -0400)]
Fail locale installation if localedef fails.

If any locale fails to compile then the installation
of locales via `make localedata/install-locales`
also fails.

9 years agoFix bo_CN and bo_IN.
Marko Myllynen [Sat, 16 May 2015 05:40:04 +0000 (01:40 -0400)]
Fix bo_CN and bo_IN.

Both bo_CN and bo_IN were not compiling. The following fix
gets them into a usable state again giving a clean build
result for `make localedata/install-locales`.

9 years agoFix atanhl missing underflows (bug 16352).
Joseph Myers [Fri, 15 May 2015 22:07:57 +0000 (22:07 +0000)]
Fix atanhl missing underflows (bug 16352).

Similar to various other bugs in this area, some atanh 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.  (No change in this regard is needed
for the i386 implementation; special handling to force underflows in
these cases will only be needed there when the spurious underflows,
bug 18049, get fixed.)

Tested for x86_64, x86, powerpc and mips64.

[BZ #16352]
* sysdeps/i386/fpu/e_atanh.S (dbl_min): New object.
(__ieee754_atanh): Force underflow exception for results with
small absolute value.
* sysdeps/i386/fpu/e_atanhf.S (flt_min): New object.
(__ieee754_atanhf): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/dbl-64/e_atanh.c: Include <float.h>.
(__ieee754_atanh): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/flt-32/e_atanhf.c: Include <float.h>.
(__ieee754_atanhf): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/ldbl-128/e_atanhl.c: Include <float.h>.
(__ieee754_atanhl): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: Include <float.h>.
(__ieee754_atanhl): Force underflow exception for results with
small absolute value.
* sysdeps/ieee754/ldbl-96/e_atanhl.c: Include <float.h>.
(__ieee754_atanhl): Force underflow exception for results with
small absolute value.
* math/auto-libm-test-in: Do not allow missing underflow
exceptions from atanh.
* math/auto-libm-test-out: Regenerated.

9 years agoFix tanf spurious underflows (bug 18221).
Joseph Myers [Fri, 15 May 2015 17:47:29 +0000 (17:47 +0000)]
Fix tanf spurious underflows (bug 18221).

The flt-32 implementation of tanf produces spurious underflow
exceptions for some small arguments, through computing values on the
order of x^5.  This patch fixes this by adjusting the threshold for
returning x (or, as applicable, +/- 1/x) to 2**-13 (the next term in
the power series being x^3/3).

Tested for x86_64 and x86.

[BZ #18221]
* sysdeps/ieee754/flt-32/k_tanf.c (__kernel_tanf): Use 2**-13 not
2**-28 as threshold for returning x or +/- 1/x.
* math/auto-libm-test-in: Add more tests of tan.
* math/auto-libm-test-out: Regenerated.

9 years agoFix lgammaf spurious underflows (bug 18220).
Joseph Myers [Fri, 15 May 2015 17:21:08 +0000 (17:21 +0000)]
Fix lgammaf spurious underflows (bug 18220).

The flt-32 implementation of lgammaf produces spurious underflow
exceptions for some large arguments, because of calculations involving
x^-2 multiplied by small constants.  This patch fixes this by
adjusting the threshold for a simpler computation to 2**26 (the error
in the simpler computation is on the order of 0.5 * log (x), for a
result on the order of x * log (x)).

Tested for x86_64 and x86.

[BZ #18220]
* sysdeps/ieee754/flt-32/e_lgammaf_r.c (__ieee754_lgammaf_r): Use
2**26 not 2**58 as threshold for returning x * (log (x) - 1).
* math/auto-libm-test-in: Add another test of lgamma.
* math/auto-libm-test-out: Regenerated.

9 years agoAdd BZ #16704 as fixed
Adhemerval Zanella [Fri, 15 May 2015 11:49:12 +0000 (08:49 -0300)]
Add BZ #16704 as fixed

9 years agoRemove various ABS macros and replace uses with fabs (or in one case abs)
Wilco Dijkstra [Fri, 15 May 2015 10:53:55 +0000 (10:53 +0000)]
Remove various ABS macros and replace uses with fabs (or in one case abs)
which is more efficient on all targets.

9 years agoFix erfcf spurious underflows (bug 18217).
Joseph Myers [Fri, 15 May 2015 00:16:10 +0000 (00:16 +0000)]
Fix erfcf spurious underflows (bug 18217).

The flt-32 implementation of erfcf produces spurious underflow
exceptions for some arguments close to 0, because of calculations
squaring the argument and then multiplying by small constants.  This
patch fixes this by adjusting the threshold for arguments for which
the result is so close to 1 that 1 - x will give the right result from
2**-56 to 2**-26.  (If 1 - x * 2/sqrt(pi) were used, the errors would be
on the order of x^3 and a much larger threshold could be used.)

Tested for x86_64 and x86.

[BZ #18217]
* sysdeps/ieee754/flt-32/s_erff.c (__erfcf): Use 2**-26 not 2**-56
as threshold for returning 1 - x.
* math/auto-libm-test-in: Add more tests of erfc.
* math/auto-libm-test-out: Regenerated.

9 years agoFix atanf spurious underflows (bug 18196).
Joseph Myers [Thu, 14 May 2015 23:51:09 +0000 (23:51 +0000)]
Fix atanf spurious underflows (bug 18196).

The sysdeps/ieee754/flt-32 version of atanf produces spurious
underflow exceptions for some large arguments, because of computations
that compute x^-4.  This patch fixes this by adjusting the threshold
for large arguments (for which +/- pi/2 can just be returned, the
correct result being roughly +/- pi/2 - 1/x) from 2^34 to 2^25.

Tested for x86_64 and x86.

[BZ #18196]
* sysdeps/ieee754/flt-32/s_atanf.c (__atanf): Use 2^25 not 2^34 as
threshold for large arguments.
* math/auto-libm-test-in: Add another test of atan.
* math/auto-libm-test-out: Regenerated.

9 years agoFix log1p missing underflows (bug 16339).
Joseph Myers [Thu, 14 May 2015 23:38:07 +0000 (23:38 +0000)]
Fix log1p missing underflows (bug 16339).

Similar to various other bugs in this area, some log1p implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.  (The ldbl-128ibm implementation
doesn't currently need any change as it already generates this
exception, albeit through code that would generate spurious exceptions
in other cases; special code for this issue will only be needed there
when fixing the spurious exceptions.)

Tested for x86_64, x86, powerpc and mips64.

[BZ #16339]
* sysdeps/i386/fpu/s_log1p.S (dbl_min): New object.
(__log1p): Force underflow exception for results with small
absolute value.
* sysdeps/i386/fpu/s_log1pf.S (flt_min): New object.
(__log1pf): Force underflow exception for results with small
absolute value.
* sysdeps/ieee754/dbl-64/s_log1p.c: Include <float.h>.
(__log1p): Force underflow exception for results with small
absolute value.
* sysdeps/ieee754/flt-32/s_log1pf.c: Include <float.h>.
(__log1pf): Force underflow exception for results with small
absolute value.
* sysdeps/ieee754/ldbl-128/s_log1pl.c: Include <float.h>.
(__log1pl): Force underflow exception for results with small
absolute value.
* math/auto-libm-test-in: Do not allow missing underflow
exceptions from log1p.
* math/auto-libm-test-out: Regenerated.

9 years agoFix non-portable echo usage in sysdeps/unix/make-syscalls.sh
Adhemerval Zanella [Thu, 14 May 2015 17:59:23 +0000 (14:59 -0300)]
Fix non-portable echo usage in sysdeps/unix/make-syscalls.sh

This patch changes the way make-syscall-sh script uses echo to follow
POSIX spec.

9 years agoThis is update for configure, build and install of vector math library.
Andrew Senkevich [Thu, 14 May 2015 14:28:06 +0000 (17:28 +0300)]
This is update for configure, build and install of vector math library.
Installation of libm.so as linker script only in case of libmvec.so build.

2015-05-14  Andrew Senkevich  <andrew.n.senkevich@gmail.com>

    * Makeconfig (rpath-dirs, all-subdirs): Added mathvec folder.
    (libmvec): New variable.
    * configure.ac: Added option for mathvec build.
    * configure: Regenerated.
    * mathvec/Depend: New file.
    * mathvec/Makefile: New file.
    * shlib-versions: Added libmvec.
    * math/Makefile: Added rule for libm.so installation.

9 years agoThis patch adds infrastructure for addition of SIMD
Andrew Senkevich [Thu, 14 May 2015 14:26:49 +0000 (17:26 +0300)]
This patch adds infrastructure for addition of SIMD
declarations for math functions in math.h. Added new headers math-vector.h
(only generic version for now) and libm-simd-decl-stubs.h with empty
definitions required for proper unfolding of new macros __MATHCALL_VEC which
will be used for declaration of vector math functions.

2015-05-14  Andrew Senkevich  <andrew.senkevich@intel.com>

    * bits/math-vector.h: New file.
    * bits/libm-simd-decl-stubs.h: New header.
    * math/Makefile (headers): Added new header libm-simd-decl-stubs.h.
    * math/math.h (__MATHCALL_VEC): New macro.

9 years agoLast part of changes regarding to libm-test.inc: addition
Andrew Senkevich [Thu, 14 May 2015 14:14:45 +0000 (17:14 +0300)]
Last part of changes regarding to libm-test.inc: addition
of method for separation which exactly testing function needed to run with
help of generated during make check header with series of conditional
definitions.

2015-05-14  Andrew Senkevich  <andrew.senkevich@intel.com>

    * math/gen-libm-have-vector-test.sh: Script generates series of macros
    for conditions in testing functions.
    * math/Makefile: Added call of libm-have-vector-test.sh.
    * math/libm-test.inc (HAVE_VECTOR): New macros.

9 years agoRefactoring of START for conditions in individual tests
Andrew Senkevich [Thu, 14 May 2015 14:11:50 +0000 (17:11 +0300)]
Refactoring of START for conditions in individual tests
and addition of macros used for runtime architecture check.

2015-05-14  Andrew Senkevich  <andrew.senkevich@intel.com>

    * math/libm-test.inc: START refactored.
    * math/test-double.c (TEST_MATHVEC): Add define.
    * math/test-float.c: Likewise.
    * math/test-idouble.c: Likewise.
    * math/test-ifloat.c: Likewise.
    * math/test-ildoubl.c: Likewise.
    * math/test-ldouble.c: Likewise.
    * sysdeps/generic/math-tests-arch.h (INIT_ARCH_EXT, CHECK_ARCH_EXT):
    New helper macros for runtime architecture check.

9 years agoThis is the beginning of series of patches with addition
Andrew Senkevich [Thu, 14 May 2015 13:59:57 +0000 (16:59 +0300)]
This is the beginning of series of patches with addition
of vector math functions infrastructure and several x86_64 implementations.
This patch is preparatory change in libm-test.c - splitting of macros which
form name of tested functions for ability to use separate name for tested
functions and for functions used in test suite infrastructure.

2015-05-14  Andrew Senkevich  <andrew.senkevich@intel.com>

    * math/test-double.c (FUNC_TEST): New macro.
    * math/test-float.c: Likewise.
    * math/test-idouble.c: Likewise.
    * math/test-ifloat.c: Likewise.
    * math/test-ildoubl.c: Likewise.
    * math/test-ldouble.c: Likewise.
    * math/libm-test.inc: Use FUNC_TEST for name of tested functions.

9 years agoNaCl: Make fdopendir skip fcntl check.
Roland McGrath [Wed, 13 May 2015 19:50:25 +0000 (12:50 -0700)]
NaCl: Make fdopendir skip fcntl check.

9 years agoNit fixes in last change.
Roland McGrath [Wed, 13 May 2015 19:39:01 +0000 (12:39 -0700)]
Nit fixes in last change.

9 years agoRefactor scandir/scandirat to use common tail.
Roland McGrath [Wed, 13 May 2015 19:34:11 +0000 (12:34 -0700)]
Refactor scandir/scandirat to use common tail.

9 years agoBreak __scandir_cancel_handler out into its own file.
Roland McGrath [Wed, 13 May 2015 19:33:56 +0000 (12:33 -0700)]
Break __scandir_cancel_handler out into its own file.

9 years agoAdd a test case for scandir.
Roland McGrath [Wed, 13 May 2015 19:33:41 +0000 (12:33 -0700)]
Add a test case for scandir.

9 years agoRemove a trailing `\' in make-syscalls.sh
H.J. Lu [Wed, 13 May 2015 16:11:12 +0000 (09:11 -0700)]
Remove a trailing `\' in make-syscalls.sh

[BZ #18409]
* sysdeps/unix/make-syscalls.sh: Remove a trailing `\'.

9 years ago[AArch64] Fix inline asm clobber list in tls-macros.h
Szabolcs Nagy [Wed, 13 May 2015 14:46:24 +0000 (15:46 +0100)]
[AArch64] Fix inline asm clobber list in tls-macros.h

9 years agoMinor changelog fixup
Siddhesh Poyarekar [Wed, 13 May 2015 07:24:22 +0000 (12:54 +0530)]
Minor changelog fixup

9 years agoAdd strcoll benchmark
Leonhard Holz [Tue, 12 May 2015 17:22:14 +0000 (22:52 +0530)]
Add strcoll benchmark

9 years agoSplit locale generation snippet into a separate file
Leonhard Holz [Tue, 12 May 2015 15:02:50 +0000 (20:32 +0530)]
Split locale generation snippet into a separate file

This patch prepares for the strcoll benchmark by moving the makefile
code for generating the locale files into a standalone snippet that
can be used elsewhere.

9 years agoUse strspn/strcspn/strpbrk ifunc in internal calls.
Ondřej Bílka [Tue, 18 Mar 2014 10:01:38 +0000 (11:01 +0100)]
Use strspn/strcspn/strpbrk ifunc in internal calls.

To make a strtok faster and improve performance in general we need to do one
additional change.

A comment:

/* It doesn't make sense to send libc-internal strcspn calls through a PLT.
   The speedup we get from using SSE4.2 instruction is likely eaten away
   by the indirect call in the PLT.  */

Does not make sense at all because nobody bothered to check it. Gap
between these implementations is quite big, when haystack is empty a
sse2 is around 40 cycles slower because it needs to populate a lookup
table and difference only increases with size. That is much bigger than
plt slowdown which is few cycles.

Even benchtest show a gap which also may be reverse by branch
misprediction but my internal benchmark shown.

 simple_strspn stupid_strspn __strspn_sse42  __strspn_sse2
Length    0, alignment  0, acc len  6:  18.6562 35.2344 17.0469 61.6719
Length    6, alignment  0, acc len  6:  59.5469 72.5781 16.4219 73.625

This patch also handles strpbrk which is implemented by including a
x86_64/multiarch/strcspn.S file.

* sysdeps/x86_64/multiarch/strspn.S: Remove plt indirection.
* sysdeps/x86_64/multiarch/strcspn.S: Likewise.

9 years agoNaCl: Provide non-default values for uname.
Roland McGrath [Tue, 12 May 2015 17:54:47 +0000 (10:54 -0700)]
NaCl: Provide non-default values for uname.

9 years agoFix linknamespace test handling of architecture-specific st_other.
Joseph Myers [Tue, 12 May 2015 17:09:49 +0000 (17:09 +0000)]
Fix linknamespace test handling of architecture-specific st_other.

For mips16, some of the linknamespace tests were failing because
[MIPS16] annotations in readelf output were wrongly interpreted as
falling in the symbol index field, meaning symbol index values were
wrongly interpreted as symbol names and such names as 1 and 2 then
resulted in namespace test failures.

This patch fixes this by removing the annotations for such
architecture-specific st_other bits before splitting the readelf
output into fields.  Tested for x86_64 and mips16.

* conform/linknamespace.pl (list_syms): Remove \[.*?\] before
splitting into fields.

9 years agoImprove strcoll with strdiff.
Leonhard Holz [Tue, 12 May 2015 09:37:52 +0000 (11:37 +0200)]
Improve strcoll with strdiff.

This patch improves strcoll hot case by finding first byte that
mismatches. That is in likely case enough to determine comparison
result.

9 years agoFix mips16 __fpu_control static linking (bug 18397).
Joseph Myers [Mon, 11 May 2015 22:58:10 +0000 (22:58 +0000)]
Fix mips16 __fpu_control static linking (bug 18397).

Programs are supposed to be able to define the __fpu_control variable,
overriding the library's version to cause the floating-point control
word to be set to the chosen value at startup.

This is broken for mips16 for static linking because the library's
__fpu_control variable is in the same object file as the helper
functions used by fpu_control.h for mips16, so test-fpucw-ieee-static
fails to link with multiple definitions of __fpu_control.

This patch fixes this by putting the helpers in a separate file rather
than overriding fpu_control.c.  Tested for mips16 that this fixes the
link failure and the ABI tests still pass.

[BZ #18397]
* sysdeps/mips/mips32/fpu/fpu_control.c: Move to ....
* sysdeps/mips/mips32/fpu/fpucw-helpers.c: ... here.  Include
<fpu_control.h> instead of <math/fpu_control.c>.
* sysdeps/mips/mips32/fpu/Makefile: New file.

9 years agoSeparate internal state between getXXent and getXXbyYY NSS calls (bug 18007)
Andreas Schwab [Wed, 25 Mar 2015 15:35:46 +0000 (16:35 +0100)]
Separate internal state between getXXent and getXXbyYY NSS calls (bug 18007)

9 years agoAdjust tst-strfmon1 after da_DK locale change.
Stefan Liebler [Mon, 11 May 2015 07:15:36 +0000 (09:15 +0200)]
Adjust tst-strfmon1 after da_DK locale change.

This patch adjusts the expected currency symbol kr to kr. after commit
"Update currency_symbol in da_DK"
(92566b4922934676da1643bf496dc982791d54d0) which changed it.

* tst-strfmon1.c (tests): Update expected currency symbol.

9 years agoNaCl: Implement gethostname.
Roland McGrath [Fri, 8 May 2015 20:06:41 +0000 (13:06 -0700)]
NaCl: Implement gethostname.

9 years agoAdd more tests of csqrt, lgamma, log10, sinh.
Joseph Myers [Fri, 8 May 2015 17:55:11 +0000 (17:55 +0000)]
Add more tests of csqrt, lgamma, log10, sinh.

This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of csqrt, lgamma, log10
and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoBug 18125: Call exit after last linked context.
Carlos O'Donell [Fri, 8 May 2015 15:20:32 +0000 (11:20 -0400)]
Bug 18125: Call exit after last linked context.

There appears to be a discrepancy among the implementations
of setcontext with regards to the function called once the last
linked-to context has finished executing via setcontext.

The POSIX standard says:
~~~
If the uc_link member of the ucontext_t structure pointed to by
the ucp argument is equal to 0, then this context is the main
context, and the thread will exit when this context returns.
~~~

It says "exit" not "exit immediately" nor "exit without running
functions registered with atexit or on_exit."

Therefore the AArch64, ARM, hppa and NIOS II implementations are
wrong and no test detects it.

It is questionable if this should even be fixed or just documented
that the above 4 targets are wrong. The functions are deprecated
and nobody should be using them, but at the same time it silly to
have cross-target differences that make it hard to port old
applications from say x86_64 to AArch64.

Therefore I will ix the 4 arches, and checkin a regression
test to prevent it from changing again.

https://sourceware.org/ml/libc-alpha/2015-03/msg00720.html

9 years agoUpdate NEWS
Siddhesh Poyarekar [Thu, 7 May 2015 06:28:40 +0000 (11:58 +0530)]
Update NEWS

9 years agoUpdate currency_symbol in da_DK
Christian Schmidt [Thu, 7 May 2015 06:26:56 +0000 (11:56 +0530)]
Update currency_symbol in da_DK

9 years agoBZ#18383: Add test case for large alignment in TLS blocks.
Roland McGrath [Wed, 6 May 2015 20:32:18 +0000 (13:32 -0700)]
BZ#18383: Add test case for large alignment in TLS blocks.

9 years agoNaCl: Fix elf_loader file name in nacl-test-wrapper.sh
Roland McGrath [Wed, 6 May 2015 19:55:58 +0000 (12:55 -0700)]
NaCl: Fix elf_loader file name in nacl-test-wrapper.sh

9 years agoAdd more tests of acosh, atanh, cos, csqrt, erfc, sin, sincos.
Joseph Myers [Wed, 6 May 2015 17:30:18 +0000 (17:30 +0000)]
Add more tests of acosh, atanh, cos, csqrt, erfc, sin, sincos.

This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of acosh, atanh, cos,
csqrt, erfc, sin and sincos.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years ago2015-05-06 Szabolcs Nagy <szabolcs.nagy@arm.com>
Wilco Dijkstra [Wed, 6 May 2015 13:00:15 +0000 (13:00 +0000)]
2015-05-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>

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

9 years agoAdd further tests of libm functions.
Joseph Myers [Tue, 5 May 2015 22:59:41 +0000 (22:59 +0000)]
Add further tests of libm functions.

This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.  (This process
must eventually converge, when my random test generation stops finding
inputs that increase the listed ulps, except maybe for any cases
uncovered where the errors exceed the maximum allowed 9ulp error and
so indicate actual libm bugs needing fixing.)

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of acosh, atanh, clog,
clog10, csqrt, erfc, exp2, expm1, log10, log2 and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd __nonnull attribute to wcscpy and wcsncpy [BZ#18265]
Daniel Marjamäki [Tue, 5 May 2015 15:24:38 +0000 (17:24 +0200)]
Add __nonnull attribute to wcscpy and wcsncpy [BZ#18265]

9 years ago__ASSUME_FALLOCATE is always true on 32-bit architectures
Florian Weimer [Fri, 24 Apr 2015 11:50:18 +0000 (13:50 +0200)]
__ASSUME_FALLOCATE is always true on 32-bit architectures

This means we can clean up the generic code a bit.  The 64-bit
variant still needs to support !__ASSUME_FALLOCATE for alpha.

9 years agoi386: Remove fallocate, fallocate64, posix_fallocate, posix_fallocate64
Florian Weimer [Fri, 24 Apr 2015 11:26:09 +0000 (13:26 +0200)]
i386: Remove fallocate, fallocate64, posix_fallocate, posix_fallocate64

With 6-argument system call support, the generic Linux implementations of
these system calls work, and there is no need for i386-specific versions.

9 years agoAdd more tests of libm functions.
Joseph Myers [Sat, 2 May 2015 21:06:33 +0000 (21:06 +0000)]
Add more tests of libm functions.

This patch adds more randomly-generated tests of various libm
functions that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of atan, clog, clog10,
cos, csqrt, erf, erfc, exp2, lgamma, log1p, sin, sincos, 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 agoAdd more tests of tgamma.
Joseph Myers [Fri, 1 May 2015 23:15:07 +0000 (23:15 +0000)]
Add more tests of tgamma.

This patch adds some randomly-generated tests of tgamma that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of tgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of tanh.
Joseph Myers [Fri, 1 May 2015 23:06:44 +0000 (23:06 +0000)]
Add more tests of tanh.

This patch adds some randomly-generated tests of tanh that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of tanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of tan.
Joseph Myers [Fri, 1 May 2015 22:54:39 +0000 (22:54 +0000)]
Add more tests of tan.

This patch adds some randomly-generated tests of tan that are observed
to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of tan.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of cos, sin, sincos.
Joseph Myers [Fri, 1 May 2015 22:41:00 +0000 (22:41 +0000)]
Add more tests of cos, sin, sincos.

This patch adds some randomly-generated tests of cos, sin and sincos
that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of cos, sin and sincos.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd another test of pow.
Joseph Myers [Fri, 1 May 2015 22:31:24 +0000 (22:31 +0000)]
Add another test of pow.

This patch adds a randomly-generated test of pow that is observed to
increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add another test of pow.
* math/auto-libm-test-out: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.

9 years agoAdd more tests of lgamma.
Joseph Myers [Fri, 1 May 2015 22:17:19 +0000 (22:17 +0000)]
Add more tests of lgamma.

This patch adds some randomly-generated tests of lgamma that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of lgamma.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of log, log10, log1p, log2.
Joseph Myers [Fri, 1 May 2015 21:08:37 +0000 (21:08 +0000)]
Add more tests of log, log10, log1p, log2.

This patch adds some randomly-generated tests of log, log10, log1p and
log2 that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of log, log10, log2 and
log1p.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoelf.h: Add section compression constants and structures.
Mark Wielaard [Fri, 1 May 2015 14:21:55 +0000 (16:21 +0200)]
elf.h: Add section compression constants and structures.

Add SHF_COMPRESSED section flag, Elf32_Chdr and Elf64_Chdr structs and
ELFCOMPRESS constants to elf/elf.h.

9 years agoAdd more tests of exp, exp10, exp2, expm1.
Joseph Myers [Fri, 1 May 2015 20:33:04 +0000 (20:33 +0000)]
Add more tests of exp, exp10, exp2, expm1.

This patch adds some randomly-generated tests of exp, exp10, exp2 and
expm1 that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of exp, exp10, exp2 and
expm1.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.