platform/upstream/glibc.git
9 years agoFix namespace conformance issue with Bessel functions.
Chris Metcalf [Mon, 22 Dec 2014 20:24:17 +0000 (15:24 -0500)]
Fix namespace conformance issue with Bessel functions.

[BZ #17747]
The y0/y1/yn and j0/j1/jn functions provided a strong_alias
to the "l"-suffixed variants when no long double support is
being compiled.  This breaks namespace conformance when the
basename versions conform but the l-suffixed ones don't.
Fixed by making them weak aliases instead.

9 years agotilegx: remove implicit boolean conversion in strstr.
Chris Metcalf [Mon, 22 Dec 2014 19:50:26 +0000 (14:50 -0500)]
tilegx: remove implicit boolean conversion in strstr.

[BZ #17746]
The __builtin_expect() truncated a uint64_t to a 32-bit long
in ILP32 mode, discarding the high 32 bits, and potentially
missing the NUL terminator that we were searching for with SIMD
operations.  Explicitly compare to zero to fix the problem.

9 years agoUpdate NEWS and ChangeLog with two tile bug fixes.
Chris Metcalf [Mon, 22 Dec 2014 19:45:02 +0000 (14:45 -0500)]
Update NEWS and ChangeLog with two tile bug fixes.

I committed fixes without references to bug numbers.

Bug 17744: commit 95dee05f.
Bug 17745: commit e969965a.

9 years ago2014-12-22 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Mon, 22 Dec 2014 18:49:56 +0000 (10:49 -0800)]
2014-12-22  Steve Ellcey  <sellcey@imgtec.com>

* sysdeps/unix/mips/sysdep.h (__mips_isa_rev): Set
to zero if not already defined.

9 years agoSplit __kernel_standard* functions (fixes bug 17724).
Joseph Myers [Mon, 22 Dec 2014 18:45:50 +0000 (18:45 +0000)]
Split __kernel_standard* functions (fixes bug 17724).

Bug 17724 reports references to fesetround being brought in by
ldbl-128ibm rintl via references to __rintl from __kernel_standard_l.
Because all three __kernel_standard* functions are in the same file,
this gets brought in even though only the long double version
__kernel_standard_l needs __rintl, and the C90 functions use only
__kernel_standard.

This patch fixes this by splitting the three versions into separate
files; it's fine for long double functions to refer to fe* functions
directly, unless they get called by C90 double functions.

Tested for x86_64 (testsuite; the reordering of code means disassembly
of shared libraries can't usefully be compared).  Tested for powerpc
that the relevant issue disappears from the linknamespace test
output.

[BZ #17724]
* sysdeps/ieee754/k_standard.c: Don't include <float.h>.
(__kernel_standard_f): Remove.  Moved to k_standardf.c.
(__kernel_standard_l): Remove.  Moved to k_standardl.c with
(char *) casts added.
* sysdeps/ieee754/k_standardf.c: New file.
* sysdeps/ieee754/k_standardl.c: Likewise.
* math/Makefile (libm-support): Remove k_standard.
(libm-calls): Add k_standard.

9 years agoRemove trailing whitespace.
Steve Ellcey [Mon, 22 Dec 2014 18:36:49 +0000 (10:36 -0800)]
Remove trailing whitespace.

9 years agoAdd missing ChangeLog entries from Friday (Dec 19, 2014).
Steve Ellcey [Mon, 22 Dec 2014 18:35:32 +0000 (10:35 -0800)]
Add missing ChangeLog entries from Friday (Dec 19, 2014).

9 years agoOptimize to avoid an unnecessary FPCR read.
Wilco Dijkstra [Mon, 22 Dec 2014 17:11:18 +0000 (17:11 +0000)]
Optimize to avoid an unnecessary FPCR read.

9 years agoOptimize to reduce FPCR/FPSR accesses.
Wilco Dijkstra [Mon, 22 Dec 2014 17:07:16 +0000 (17:07 +0000)]
Optimize to reduce FPCR/FPSR accesses.

9 years agoCall libc_fetestexcept_aarch64.
Wilco Dijkstra [Mon, 22 Dec 2014 17:01:33 +0000 (17:01 +0000)]
Call libc_fetestexcept_aarch64.

9 years agoCall libc_fesetround_aarch64.
Wilco Dijkstra [Mon, 22 Dec 2014 16:57:41 +0000 (16:57 +0000)]
Call libc_fesetround_aarch64.

9 years agoFix resolver bind, getsockname namespace (bug 17733).
Joseph Myers [Mon, 22 Dec 2014 12:46:27 +0000 (12:46 +0000)]
Fix resolver bind, getsockname namespace (bug 17733).

On Linux architectures using socketcall, the resolver ends up bringing
in strong symbols for bind and getsockname, which are not in
POSIX.1-1996.  This causes linknamespace test failures:

FAIL: conform/POSIX/pthread.h/linknamespace
FAIL: conform/POSIX/sched.h/linknamespace
FAIL: conform/POSIX/time.h/linknamespace

These functions are defined as strong symbols with __bind and
__getsockname as weak aliases.  This patch switches this to the other
way round by removing the NO_WEAK_ALIAS definitions and so letting the
default case in socket.S act; I see no reason for the existing
arrangements.

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

[BZ #17733]
* sysdeps/unix/sysv/linux/bind.S (NO_WEAK_ALIAS): Do not define.
(__bind): Do not define as weak alias.
* sysdeps/unix/sysv/linux/getsockname.S (NO_WEAK_ALIAS): Do not
define.
(__getsockname): Do not define as weak alias.

9 years agoRequire bison 2.7 or newer for regenerating intl/plural.y
Will Newton [Thu, 11 Dec 2014 17:27:34 +0000 (17:27 +0000)]
Require bison 2.7 or newer for regenerating intl/plural.y

The merge of the latest gettext code introduced changes to the yacc
parser source that are incompatible with versions of bison older
than 2.7. Add a configure check for the appropriate versions and
document the requirement in INSTALL.

ChangeLog:

2014-12-22  Will Newton  <will.newton@linaro.org>

* manual/install.texi: Document that we require bison 2.7
or above.
* INSTALL: Regenerate.
* configure.ac: Use AC_CHECK_PROG_VER instead of
AC_PATH_PROG when checking for bison and check for
version 2.7 or above.
* configure: Regenerate.

9 years agotile: separate ffsll from ffs
Chris Metcalf [Sun, 21 Dec 2014 21:11:39 +0000 (16:11 -0500)]
tile: separate ffsll from ffs

This avoids a linknamespace failure when ffs is legal
but ffsll is not.

9 years agotile: remove localplt.data and use generic one again.
Chris Metcalf [Sun, 21 Dec 2014 21:09:36 +0000 (16:09 -0500)]
tile: remove localplt.data and use generic one again.

With the __tls_get_addr removed, it works for tile.

9 years agoAdd hidden __tls_get_addr/___tls_get_addr alias
H.J. Lu [Sun, 21 Dec 2014 17:12:04 +0000 (09:12 -0800)]
Add hidden __tls_get_addr/___tls_get_addr alias

__tls_get_addr/___tls_get_addr is always defined in ld.so.  There is
no need to call them via PLT inside ld.so.  This patch adds the hidden
__tls_get_addr/___tls_get_addr aliases and calls them directly from
_dl_tlsdesc_dynamic.  There is no need to set up the EBX register in
i386 _dl_tlsdesc_dynamic when calling the hidden ___tls_get_addr.

* elf/dl-tls.c (__tls_get_addr): Provide the hidden definition
if not defined.
* sysdeps/i386/dl-tls.h (___tls_get_addr): Provide the hidden
definition.
* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
hidden ___tls_get_addr.
* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
hidden __tls_get_addr.
* sysdeps/generic/localplt.data (__tls_get_addr): Removed.
* sysdeps/unix/sysv/linux/i386/localplt.data (___tls_get_addr):
Likewise.

9 years agom68k: remove @PLTPC from _dl_init call
Andreas Schwab [Sun, 21 Dec 2014 14:06:27 +0000 (15:06 +0100)]
m68k: remove @PLTPC from _dl_init call

9 years agoFix changelog typo
Andreas Schwab [Sun, 21 Dec 2014 14:05:09 +0000 (15:05 +0100)]
Fix changelog typo

9 years agoRemove @PLT from "call _dl_init@PLT" in _dl_start_user
H.J. Lu [Sun, 21 Dec 2014 13:27:31 +0000 (05:27 -0800)]
Remove @PLT from "call _dl_init@PLT" in _dl_start_user

_dl_start_user in ld.so calls the local function _dl_init.  There is no
need to go through PLT.

* sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
from "call _dl_init@PLT".
* sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
from "call _dl_init@PLT".

9 years agomanual: Correct guarantee about pointers compared by qsort()
Anders Kaseorg [Thu, 11 Dec 2014 10:33:22 +0000 (05:33 -0500)]
manual: Correct guarantee about pointers compared by qsort()

C99, C11, POSIX, and the glibc implementation do guarantee that the
pointers passed to the qsort comparison function lie within the array.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
9 years agotile: provide localplt.data with __tls_get_addr optional
Chris Metcalf [Sat, 20 Dec 2014 18:56:57 +0000 (13:56 -0500)]
tile: provide localplt.data with __tls_get_addr optional

9 years agotilegx: fix strstr to build and link better
Chris Metcalf [Sat, 20 Dec 2014 03:46:52 +0000 (22:46 -0500)]
tilegx: fix strstr to build and link better

The two_way_short_needle() routine included from str-two-way.h
is not used, so mark it so to avoid compiler warnings.

Calling strnlen() breaks linknamespace tests, so change it
to __strnlen().

9 years agoRemove trailing white space.
Steve Ellcey [Fri, 19 Dec 2014 22:40:29 +0000 (14:40 -0800)]
Remove trailing white space.

9 years ago2014-12-19 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Fri, 19 Dec 2014 22:39:18 +0000 (14:39 -0800)]
2014-12-19  Steve Ellcey  <sellcey@imgtec.com>

* sysdeps/mips/addmul_1.S (__mpn_addmul_1): Use mulu/muhu instead
of multu on MIPSr6.
* sysdeps/mips/mul_1.S (__mpn_mul_1): Ditto.
* sysdeps/mips/submul_1.S (__mpn_submul_1): Ditto.
* sysdeps/mips/mips64/addmul_1.S (__mpn_addmul_1): Ditto.
* sysdeps/mips/mips64/mul_1.S (__mpn_mul_1): Ditto.
* sysdeps/mips/mips64/submul_1.S (__mpn_submul_1): Ditto.

9 years ago2014-12-19 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Fri, 19 Dec 2014 22:37:44 +0000 (14:37 -0800)]
2014-12-19  Steve Ellcey  <sellcey@imgtec.com>

* sysdeps/mips/sys/asm.h (PTR_ADDU): Use addu on mips32r6/mips64r6.
(PTR_ADDIU): Use addiu for mips32r6/mips64r6.
(PTR_SUBU): Use subu for mips32r6/mips64r6.
(PTR_SUBIU): Use subu for mips32r6/mips64r6 (subiu does not exist).
* sysdeps/mips/machine-gmon.h (PTR_ADDU_STRING) Use addu for
mips32r6/mips64r6.
(PTR_SUBU_STRING) Use subu for mips32r6/mips64r6.

9 years ago Simplify strncat.
Ondřej Bílka [Fri, 19 Dec 2014 22:09:40 +0000 (23:09 +0100)]
 Simplify strncat.

We rewrite strncat to use strnlen and malloc calls which simplifies code
an is faster as these functions are better optimized than original code.

9 years agoFix soft-fp build warning on sparc about strict aliasing.
David S. Miller [Fri, 19 Dec 2014 21:34:30 +0000 (13:34 -0800)]
Fix soft-fp build warning on sparc about strict aliasing.

* sysdeps/sparc/sparc32/soft-fp/q_neg.c (_Q_neg): Use a union to
access the quad as both a long double and as a series of 4 words.

9 years agoFix array bounds warnings in elf_get_dyanmic_info() on sparc with gcc-4.6
David S. Miller [Fri, 19 Dec 2014 21:23:40 +0000 (13:23 -0800)]
Fix array bounds warnings in elf_get_dyanmic_info() on sparc with gcc-4.6

* get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a
link_map->l_info array access.

9 years agoiconvdata/tst-loading: bump up timeout to 10s
Chris Metcalf [Fri, 19 Dec 2014 21:36:00 +0000 (16:36 -0500)]
iconvdata/tst-loading: bump up timeout to 10s

9 years agomath: increase timeout for math/atest-*.c
Chris Metcalf [Fri, 19 Dec 2014 20:11:04 +0000 (15:11 -0500)]
math: increase timeout for math/atest-*.c

These tests run in the 2-5 second range on tilegx, so just bump
up the timeout to 10 seconds generically.

9 years agoReplace -Wno-error with -fno-builtin-lround
H.J. Lu [Fri, 19 Dec 2014 16:32:05 +0000 (08:32 -0800)]
Replace -Wno-error with -fno-builtin-lround

9 years agoi386: Move futex functions from lowlevellock.h to lowlevellock-futex.h.
Torvald Riegel [Wed, 17 Dec 2014 18:09:04 +0000 (19:09 +0100)]
i386: Move futex functions from lowlevellock.h to lowlevellock-futex.h.

9 years agoUse generic lowlevellock-futex.h in x86_64 lowlevellock.h.
Torvald Riegel [Wed, 17 Dec 2014 17:55:19 +0000 (18:55 +0100)]
Use generic lowlevellock-futex.h in x86_64 lowlevellock.h.

9 years agosh: Remove custom lowlevellock, barrier, condvar, and rwlock implementations.
Torvald Riegel [Wed, 17 Dec 2014 22:28:38 +0000 (23:28 +0100)]
sh: Remove custom lowlevellock, barrier, condvar, and rwlock implementations.

9 years agoCompile s_llround.c with -Wno-error for x32 build
H.J. Lu [Fri, 19 Dec 2014 13:37:29 +0000 (05:37 -0800)]
Compile s_llround.c with -Wno-error for x32 build

Since x32 returns 32-bit long int and 64-bit long long int in the
same 64-bit register, we make the 32b-bit lround an alias of the
64-bit llround.  Add -Wno-error for x32 build to silence the compiler.

9 years agoReplace 1L with (mp_limb_t) 1
H.J. Lu [Fri, 19 Dec 2014 13:28:06 +0000 (05:28 -0800)]
Replace 1L with (mp_limb_t) 1

X86-64 and x32 use sysdeps/i386/ldbl2mpn.c.  res_ptr is a pointer
to mp_limb_t, which is long for i386 and x86-64 and long long for
x32.  On x32, I got

../sysdeps/x86_64/../i386/ldbl2mpn.c: In function ‘__mpn_extract_long_double’:
../sysdeps/x86_64/../i386/ldbl2mpn.c:72:4: error: left shift count >= width of type [-Werror]
    res_ptr[N - 1] &= ~(1L << ((LDBL_MANT_DIG - 1) % BITS_PER_MP_LIMB));
    ^
cc1: all warnings being treated as errors

This patch replaces 1L with (mp_limb_t) 1.  Verified on x32, i686 and
x86-64 with GCC 4.8.3.

9 years agoLabel CVE-2014-9402 in NEWS
Allan McRae [Thu, 18 Dec 2014 01:01:43 +0000 (11:01 +1000)]
Label CVE-2014-9402 in NEWS

9 years agoNPTL: Move fork state variables to initializer files.
Roland McGrath [Wed, 17 Dec 2014 22:33:28 +0000 (14:33 -0800)]
NPTL: Move fork state variables to initializer files.

9 years agoNPTL: Remove gratuitous Linuxisms from gai_misc.h.
Roland McGrath [Wed, 17 Dec 2014 22:07:18 +0000 (14:07 -0800)]
NPTL: Remove gratuitous Linuxisms from gai_misc.h.

9 years agoFix stub __if_freenameindex build error.
Roland McGrath [Wed, 17 Dec 2014 21:22:41 +0000 (13:22 -0800)]
Fix stub __if_freenameindex build error.

9 years agoRemove explicit inline on malloc perturb functions.
Roland McGrath [Wed, 17 Dec 2014 18:41:28 +0000 (10:41 -0800)]
Remove explicit inline on malloc perturb functions.

9 years agoFix profil_counter namespace (bug 17725).
Joseph Myers [Wed, 17 Dec 2014 18:10:37 +0000 (18:10 +0000)]
Fix profil_counter namespace (bug 17725).

On ARM, where profil_counter is not static, it is brought in by
references to various standard functions, as noted in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00890.html>, although
it is not a standard function itself.  I don't know if this also
causes test failures on SPARC, although I see no reason for it not to
do so.

This patch fixes this namespace issue.  profil_counter is renamed to
__profil_counter and made a weak alias on ARM and SPARC.  Because of
the uses in profil.c / sprofil.c it seems simplest to make the rename
globally, including on the other architectures for which
profil_counter was static and so the change is of no substance.  The
variant names profil_counter_* used in sprofil.c are also renamed to
start with __ so that undesired function names do not get exported in
static libc.

As I noted in bug 17726, profil_counter should probably be a compat
symbol on ARM and SPARC, so it wouldn't exist at all in static libc
even as a weak alias.  Since defining a compat symbol still requires
an internal name as a target of an alias, this patch still seems
reasonable as an intermediate step towards that goal: it wouldn't be
possible for the function simply to be static profil_counter on ARM
and SPARC with profil_counter also being the exported compat symbol
name, so profil.c / sprofil.c would still need to be prepared to call
the function under another name (here, __profil_counter).

Tested for x86_64 (testsuite, and that stripped installed shared
libraries are unchanged by the patch) and ARM (ABI and linknamespace
tests - this patch reduces the number of linknamespace failures I see
on ARM from 227 to 5, the residue being math.h failures for fe*
functions and for j0l/j1n/jnl/y0l/y1l/ynl aliases).

2014-12-17  Joseph Myers  <joseph@codesourcery.com>

[BZ #17725]
* sysdeps/generic/profil-counter.h (profil_counter): Rename to
__profil_counter.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h (profil_counter):
Likewise.
* sysdeps/unix/sysv/linux/i386/profil-counter.h (profil_counter):
Likewise.
* sysdeps/unix/sysv/linux/ia64/profil-counter.h (profil_counter):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/profil-counter.h
(profil_counter): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/profil-counter.h
(profil_counter): Likewise.
* sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter):
Likewise.
* sysdeps/unix/sysv/linux/tile/profil-counter.h (profil_counter):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/profil-counter.h
(profil_counter): Likewise.
* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
Likewise.
[!__profil_counter] (profil_counter): Define as weak alias of
__profil_counter.
* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h
(profil_counter): Rename to __profil_counter.
[!__profil_counter] (profil_counter): Define as weak alias of
__profil_counter.
* sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h
(profil_counter): Rename to __profil_counter.
[!__profil_counter] (profil_counter): Define as weak alias of
__profil_counter.
* sysdeps/posix/profil.c: Update comment referring to
profil_counter.
(__profil): Use __profil_counter instead of profil_counter.
* sysdeps/posix/sprofil.c (profil_counter): Rename to
__profil_counter.  Use __profil_counter_ushort and
__profil_counter_uint in definitions.
(__sprofil): Use __profil_counter_uint and __profil_counter_ushort
instead of profil_counter_uint and profil_counter_ushort.

9 years agoFix resolver inet_* namespace (bug 17722).
Joseph Myers [Wed, 17 Dec 2014 18:09:11 +0000 (18:09 +0000)]
Fix resolver inet_* namespace (bug 17722).

Parts of the resolver brought in by pthreads (at least) use inet_*
functions that aren't in the 1995/6 edition of POSIX that introduced
pthreads (or in one case, use __inet_aton which is then defined in the
same file as non-weak inet_addr).  This patch fixes this by making the
affected functions into weak alias for __inet_* and using those names
in the problematic resolver code.

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

[BZ #17722]
* inet/inet_mkadr.c (inet_makeaddr): Rename to __inet_makeaddr and
define as weak alias of __inet_makeaddr.
* resolv/inet_addr.c (inet_addr): Rename to __inet_addr and define
as weak alias of __inet_addr.
* resolv/inet_pton.c (inet_pton): Rename to __inet_pton and define
as weak alias of __inet_pton.  Use libc_hidden_weak.
* include/arpa/inet.h (__inet_pton): Declare.  Use
libc_hidden_proto.
(inet_makeaddr): Don't use libc_hidden_proto.
(__inet_makeaddr): Declare.  Use libc_hidden_proto.
* resolv/res_init.c (__res_vinit): Use __inet_pton instead of
inet_pton.  Use __inet_makeaddr instead of inet_makeaddr.
* conform/Makefile (test-xfail-POSIX/pthread.h/linknamespace):
Remove variable.
(test-xfail-POSIX/sched.h/linknamespace): Likewise.
(test-xfail-POSIX/time.h/linknamespace): Likewise.

9 years ago2014-12-17 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Wed, 17 Dec 2014 18:00:37 +0000 (10:00 -0800)]
2014-12-17  Steve Ellcey  <sellcey@imgtec.com>

* inet/getnetgrent_r.c: Move while loop to be inside if statement.

9 years agoGet rid of format warning in bug-vfprintf-nargs.c.
Stefan Liebler [Wed, 17 Dec 2014 15:43:34 +0000 (16:43 +0100)]
Get rid of format warning in bug-vfprintf-nargs.c.

9 years agoGet rid of format warning in tst-widetext.c.
Stefan Liebler [Wed, 17 Dec 2014 15:42:51 +0000 (16:42 +0100)]
Get rid of format warning in tst-widetext.c.

9 years agoFix printf format error
Andreas Schwab [Wed, 17 Dec 2014 12:04:07 +0000 (13:04 +0100)]
Fix printf format error

9 years agoUse PTR_MANGLE on libgcc unwinder function pointers.
Roland McGrath [Tue, 16 Dec 2014 23:14:03 +0000 (15:14 -0800)]
Use PTR_MANGLE on libgcc unwinder function pointers.

9 years agoRevert "Use pragmas rather than makefiles for necessary options for unwind code."
Roland McGrath [Tue, 16 Dec 2014 23:46:00 +0000 (15:46 -0800)]
Revert "Use pragmas rather than makefiles for necessary options for unwind code."

This reverts commit c324fcfe75c3976ae0b16943df00710e1d0d74f7.

9 years agoUse pragmas rather than makefiles for necessary options for unwind code.
Roland McGrath [Tue, 16 Dec 2014 22:31:24 +0000 (14:31 -0800)]
Use pragmas rather than makefiles for necessary options for unwind code.

9 years agoFix x86_64 memrchr namespace (bug 17719).
Joseph Myers [Tue, 16 Dec 2014 18:31:31 +0000 (18:31 +0000)]
Fix x86_64 memrchr namespace (bug 17719).

On x86_64, memrchr (not a standard function) is defined as a strong
symbol, instead of a weak alias of __memrchr as on other
architectures.  This results in linknamespace test failures from the
use of __memrchr from dirname.  (Not a conformance issue because of
the mem* reservation, but contrary to glibc conventions.)  This patch
makes x86_64 follow other architectures by defining memrchr as a weak
alias.

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

[BZ #17719]
* sysdeps/x86_64/memrchr.S (memrchr): Rename to __memrchr and
define as weak alias of __memrchr.
(__memrchr): Do not define as strong alias of memrchr.
* conform/Makefile (test-xfail-XPG4/libgen.h/linknamespace):
Remove variable.
(test-xfail-UNIX98/libgen.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/libgen.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/libgen.h/linknamespace): Likewise.

9 years agoFix resolver if_* namespace (bug 17717).
Joseph Myers [Tue, 16 Dec 2014 18:18:49 +0000 (18:18 +0000)]
Fix resolver if_* namespace (bug 17717).

Resolver code, brought in by pthreads (at least), uses if_* interfaces
that weren't in POSIX before 2001, resulting in linknamespace
failures.  This patch changes those interfaces to be weak aliases of
__if_* and makes the resolver use __if_* directly.

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

[BZ #17717]
* inet/if_index.c (if_nametoindex): Rename to __if_nametoindex and
define as weak alias of __if_nametoindex.  Use libc_hidden_weak.
(if_indextoname): Rename to __if_indextoname and define as weak
alias of __if_indextoname.  Use libc_hidden_weak.
(if_freenameindex): Rename to __if_freenameindex and define as
weak alias of __if_freenameindex.
(if_nameindex): Rename to __if_nameindex and define as weak alias
of __if_nameindex.
* sysdeps/mach/hurd/if_index.c (if_nametoindex): Rename to
__if_nametoindex and define as weak alias of __if_nametoindex.
Use libc_hidden_weak.
(if_freenameindex): Rename to __if_freenameindex and define as
weak alias of __if_freenameindex.
(if_nameindex): Rename to __if_nameindex and define as weak alias
of __if_nameindex.
(if_indextoname): Rename to __if_indextoname and define as weak
alias of __if_indextoname.  Use libc_hidden_weak.
* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Rename to
__if_nametoindex and define as weak alias of __if_nametoindex.
Use libc_hidden_weak.
(if_freenameindex): Rename to __if_freenameindex and define as
weak alias of __if_freenameindex.  Use libc_hidden_weak.
(if_nameindex_netlink): Use __if_freenameindex instead of
if_freenameindex.
(if_nameindex): Rename to __if_nameindex and define as weak alias
of __if_nameindex.  Use libc_hidden_weak.
(if_indextoname): Rename to __if_indextoname and define as weak
alias of __if_indextoname.  Use libc_hidden_weak.
* include/net/if.h [!_ISOMAC] (__if_nametoindex): Declare and use
libc_hidden_proto.
[!_ISOMAC] (__if_freenameindex): Likewise.
* resolv/res_init.c (__res_vinit): Use __if_nametoindex instead of
if_nametoindex.
* conform/Makefile (test-xfail-XPG4/grp.h/linknamespace): Remove
variable.
(test-xfail-XPG4/pwd.h/linknamespace): Likewise.
(test-xfail-UNIX98/aio.h/linknamespace): Likewise.
(test-xfail-UNIX98/grp.h/linknamespace): Likewise.
(test-xfail-UNIX98/pthread.h/linknamespace): Likewise.
(test-xfail-UNIX98/pwd.h/linknamespace): Likewise.
(test-xfail-UNIX98/sched.h/linknamespace): Likewise.
(test-xfail-UNIX98/time.h/linknamespace): Likewise.

9 years agoRemove some semaphore.h linknamespace XFAILs.
Joseph Myers [Tue, 16 Dec 2014 16:25:08 +0000 (16:25 +0000)]
Remove some semaphore.h linknamespace XFAILs.

Roland's recent sem_* changes introduced some XPASSes for semaphore.h
linknamespace tests by removing a non-static variable "mountpoint".
This patch removes the XFAILs for the fixed bug.

Tested for x86_64.

* conform/Makefile (test-xfail-UNIX98/semaphore.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/semaphore.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/semaphore.h/linknamespace): Likewise.

9 years agoFix the 'array subscript is above array bounds' warning correctly
Siddhesh Poyarekar [Tue, 16 Dec 2014 14:10:47 +0000 (19:40 +0530)]
Fix the 'array subscript is above array bounds' warning correctly

Use DIAG_IGNORE_NEEDS_COMMENT instead since the compiler should have
seen that NS never goes beyond MAXNS.

9 years agoFix 'array subscript is above array bounds' warning in res_send.c
Siddhesh Poyarekar [Tue, 16 Dec 2014 11:23:05 +0000 (16:53 +0530)]
Fix 'array subscript is above array bounds' warning in res_send.c

I see this warning in my build on F21 x86_64, which seems to be due to
a weak check for array bounds.  Fixed by making the bounds check
stronger.

This is not an actual bug since nscount is never set to anything
greater than MAXNS.  The compiler however does not know this, so we
need the stronger bounds check to quieten the compiler.

9 years agoModify libio/tst-fopenloc.c to use test-skeleton.c
Arjun Shankar [Tue, 16 Dec 2014 09:51:01 +0000 (15:21 +0530)]
Modify libio/tst-fopenloc.c to use test-skeleton.c

This test would earlier fail when run under test-skeleton.c due to
bug #17522 in 'fputws'. That bug is now fixed and so this test may
be modified.

9 years agoModify stdlib/tst-bsearch.c to use test-skeleton.c
Arjun Shankar [Tue, 16 Dec 2014 09:49:51 +0000 (15:19 +0530)]
Modify stdlib/tst-bsearch.c to use test-skeleton.c

This test used to define a 'struct entry' that conflicts with the
definition in search.h included in test-skeleton. The struct is
now renamed 'item'.

9 years agoModify stdio-common/tst-fseek.c to use test-skeleton.c
Arjun Shankar [Tue, 16 Dec 2014 09:48:46 +0000 (15:18 +0530)]
Modify stdio-common/tst-fseek.c to use test-skeleton.c

This test needs a TIMEOUT longer than the default 2 seconds since it
sleeps twice for a second each.

9 years agoIgnore warning in string/tester.c.
Torvald Riegel [Mon, 15 Dec 2014 19:13:11 +0000 (20:13 +0100)]
Ignore warning in string/tester.c.

9 years agoFix warning in misc/tst-mntent2.c.
Torvald Riegel [Mon, 15 Dec 2014 21:11:56 +0000 (22:11 +0100)]
Fix warning in misc/tst-mntent2.c.

9 years agoFix warning in elf/tst-unique4lib.cc.
Torvald Riegel [Mon, 15 Dec 2014 21:05:06 +0000 (22:05 +0100)]
Fix warning in elf/tst-unique4lib.cc.

9 years agoAvoid infinite loop in nss_dns getnetbyname [BZ #17630]
Florian Weimer [Mon, 15 Dec 2014 16:41:13 +0000 (17:41 +0100)]
Avoid infinite loop in nss_dns getnetbyname [BZ #17630]

9 years agostdio-common/Makefile: readd bug26 testcase
Allan McRae [Tue, 16 Dec 2014 03:20:25 +0000 (13:20 +1000)]
stdio-common/Makefile: readd bug26 testcase

This testcase was accidentally removed in commit a5357b7c.

9 years agoReturn allocated array instead of unallocated.
Ondřej Bílka [Mon, 15 Dec 2014 23:09:32 +0000 (00:09 +0100)]
Return allocated array instead of unallocated.

In locale/programs/ld-ctype.c we returned array that was on stack.
Fixed by returning static array instead.

9 years agoAdd comments for the generic lowlevellock implementation.
Torvald Riegel [Mon, 15 Dec 2014 21:49:29 +0000 (22:49 +0100)]
Add comments for the generic lowlevellock implementation.

Patch by Bernard Ogden <bernie.ogden@linaro.org>.

9 years agoFix nptl/tst-sem4: always start with a fresh semaphore.
Torvald Riegel [Tue, 29 Jul 2014 19:44:58 +0000 (21:44 +0200)]
Fix nptl/tst-sem4: always start with a fresh semaphore.

9 years agoFix nptl/tst-mutex5.c: Do not skip tests if elision is enabled.
Torvald Riegel [Mon, 15 Dec 2014 21:09:55 +0000 (22:09 +0100)]
Fix nptl/tst-mutex5.c: Do not skip tests if elision is enabled.

9 years agostdio-common: Include <libc-internal.h> in some tests
Adhemerval Zanella [Mon, 15 Dec 2014 17:29:09 +0000 (11:29 -0600)]
stdio-common: Include <libc-internal.h> in some tests

This patch adds the missing libc-internal.h include on test-vprintf.c
tst-sprintf.c.

9 years agoRemove custom pthread_once implementation on s390.
Torvald Riegel [Mon, 8 Dec 2014 17:32:14 +0000 (18:32 +0100)]
Remove custom pthread_once implementation on s390.

9 years agoCVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
Jeff Law [Mon, 15 Dec 2014 09:09:32 +0000 (10:09 +0100)]
CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]

A larger number of format specifiers coudld cause a stack overflow,
potentially allowing to bypass _FORTIFY_SOURCE format string
protection.

9 years agoBump required version of texinfo to 4.7
Will Newton [Thu, 11 Dec 2014 17:59:45 +0000 (17:59 +0000)]
Bump required version of texinfo to 4.7

It seems we require texinfo 4.7 for the --plaintext option, so
document that and check for the correct version in configure.

ChangeLog:

2014-12-15  Will Newton  <will.newton@linaro.org>

* manual/install.texi: Bump required version of texinfo
to 4.7 from 4.5.
* INSTALL: Regenerated.
* configure.ac: Check for makeinfo version 4.7 and above.
* configure: Regenerated.

9 years agoNPTL: Refactor named semaphore code to use shm-directory.h
Roland McGrath [Fri, 12 Dec 2014 21:17:21 +0000 (13:17 -0800)]
NPTL: Refactor named semaphore code to use shm-directory.h

9 years agoNPTL: Add stubs for Linux-only extension functions.
Roland McGrath [Fri, 12 Dec 2014 22:52:14 +0000 (14:52 -0800)]
NPTL: Add stubs for Linux-only extension functions.

9 years agoFix NPTL build for !__ASSUME_SET_ROBUST_LIST case.
Roland McGrath [Fri, 12 Dec 2014 22:00:37 +0000 (14:00 -0800)]
Fix NPTL build for !__ASSUME_SET_ROBUST_LIST case.

9 years agoresolv: Suppress maybe uninitialized warning
Stefan Liebler [Thu, 11 Dec 2014 12:38:01 +0000 (07:38 -0500)]
resolv: Suppress maybe uninitialized warning

In send_vc function at resolv/res_send.c, There is the
following warning on some architectures:

  'resplen' may be used uninitialized in this function
  [-Wmaybe-uninitialized]

And this is a false positive.  This patch suppress the
compiler warning.

9 years agoGet rid of warning comparision will always evaluate as true
Stefan Liebler [Fri, 12 Dec 2014 10:13:09 +0000 (11:13 +0100)]
Get rid of warning comparision will always evaluate as true

9 years agoFix for test "malloc_usable_size: expected 7 but got 11"
James Lemke [Fri, 12 Dec 2014 00:38:15 +0000 (16:38 -0800)]
Fix for test "malloc_usable_size: expected 7 but got 11"

[BZ #17581] Revert this fix while investigating a problem.

9 years agoRefactor shm_{open,unlink} code to separate Linux-specific directory choice from...
Roland McGrath [Thu, 11 Dec 2014 22:15:51 +0000 (14:15 -0800)]
Refactor shm_{open,unlink} code to separate Linux-specific directory choice from POSIX-generic code.

9 years ago* Fix SH specific compiler warnings which are for integer-pointer
Kaz Kojima [Thu, 11 Dec 2014 23:07:35 +0000 (08:07 +0900)]
* Fix SH specific compiler warnings which are for integer-pointer
  type conversions without cast.

9 years agoMove semaphore.h to sysdeps/pthread/.
Joseph Myers [Thu, 11 Dec 2014 22:58:48 +0000 (22:58 +0000)]
Move semaphore.h to sysdeps/pthread/.

Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch moves nptl/semaphore.h to sysdeps/pthread/semaphore.h so
that it can be found by builds from all glibc subdirectories; it's not
in any way NPTL-specific.  (I left the Makefile setting to install
this header in nptl/, but maybe it should move as well - it's just not
clear to me what ifeq ($(subdir),...) conditional should be used to
select the directory to associate the header with for installation
purposes.  The path in the toplevel Makefile used for begin-end-check
also remains hardcoded; it's a known todo issue to rework that test to
run in each subdirectory checking the headers installed from that
subdirectory, rather than a separate hardcoded list.)

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

* nptl/semaphore.h: Move to ...
* sysdeps/pthread/semaphore.h: ... here.
* Makefile (installed-headers): Change nptl/semaphore.h to
sysdeps/pthread/semaphore.h.

9 years agoSuppress -Wformat-security in tst-error1.c.
Roland McGrath [Thu, 11 Dec 2014 21:52:57 +0000 (13:52 -0800)]
Suppress -Wformat-security in tst-error1.c.

9 years agoEliminate -Wno-format from printf/scanf tests.
Roland McGrath [Thu, 11 Dec 2014 21:46:21 +0000 (13:46 -0800)]
Eliminate -Wno-format from printf/scanf tests.

9 years agoAdd more headers to include/ for conform tests.
Joseph Myers [Thu, 11 Dec 2014 21:41:30 +0000 (21:41 +0000)]
Add more headers to include/ for conform tests.

Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch adds wrappers for two of the affected headers to include/,
which is the normal way to make headers visible when building or
testing in directories other than the one containing the header (I
suppose these headers weren't needed in any such directories except
conform/, or other build or test failures would have resulted).  I
believe the same issue applies at least to regexp.h and re_comp.h - we
don't currently have conform/ expectations for those, but when such
expectations are added we'll also need to add header wrappers.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

* include/cpio.h: New file.
* include/fmtmsg.h: Likewise.

9 years agoClean up localedata tests printf formats, don't use -Wno-format.
Joseph Myers [Thu, 11 Dec 2014 21:15:08 +0000 (13:15 -0800)]
Clean up localedata tests printf formats, don't use -Wno-format.

9 years agoFix -Wformat-security warnings in posix/regexbug1.c
Roland McGrath [Thu, 11 Dec 2014 21:08:26 +0000 (13:08 -0800)]
Fix -Wformat-security warnings in posix/regexbug1.c

9 years agotile: add inhibit_loop_to_libcall to string functions
Chris Metcalf [Thu, 11 Dec 2014 20:13:48 +0000 (15:13 -0500)]
tile: add inhibit_loop_to_libcall to string functions

Without this, on gcc 4.8.2 the built glibc crashes when memcpy
or memset are invoked, since they call themselves recursively.
See commit 85c2e6110c9a01ec for the generic inhibit_loop_to_libcall.

9 years agoFix __sendmmsg prototype guards
Adhemerval Zanella [Thu, 11 Dec 2014 19:54:22 +0000 (14:54 -0500)]
Fix __sendmmsg prototype guards

Add __USE_GNU guards on 'socket/sys/socket.h' __sendmmsg prototype.

9 years ago * sysdeps/mips/dl-trampoline.c: Modify switch expression to have
Steve Ellcey [Thu, 11 Dec 2014 18:23:01 +0000 (10:23 -0800)]
* sysdeps/mips/dl-trampoline.c: Modify switch expression to have
integer value instead of boolean.

9 years ago2014-12-11 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Thu, 11 Dec 2014 16:14:17 +0000 (08:14 -0800)]
2014-12-11  Steve Ellcey  <sellcey@imgtec.com>

* malloc/malloc.c: Fix powerof2 check.

9 years agoGet rid of warning inlining failed in call to maybe_swap_uint32
Stefan Liebler [Thu, 11 Dec 2014 16:03:37 +0000 (17:03 +0100)]
Get rid of warning inlining failed in call to maybe_swap_uint32

9 years agoS/390: Get rid of assembler warning value truncated.
Stefan Liebler [Thu, 11 Dec 2014 16:02:24 +0000 (17:02 +0100)]
S/390: Get rid of assembler warning value truncated.

9 years agoConstify string parameters
Andreas Schwab [Thu, 11 Dec 2014 15:00:49 +0000 (16:00 +0100)]
Constify string parameters

9 years agopowerpc: Fix lgammal_r overflow warnings
Adhemerval Zanella [Thu, 11 Dec 2014 12:17:11 +0000 (07:17 -0500)]
powerpc: Fix lgammal_r overflow warnings

ldbl-128ibm uses ldbl-128 e_lgammal_r implementation as is, however some
constants definitions overflows for IBM long double range.  This patch
suppress the compiler warnings until the ldbl-128ibm implementation is
fixed.

9 years agoRemove obsolete comment
Andreas Schwab [Thu, 11 Dec 2014 11:45:57 +0000 (12:45 +0100)]
Remove obsolete comment

9 years agoProperly handle forced elision in pthread_mutex_trylock (bug 16657)
Andreas Schwab [Tue, 4 Mar 2014 12:00:26 +0000 (13:00 +0100)]
Properly handle forced elision in pthread_mutex_trylock (bug 16657)

9 years agoRemove duplication from gconv-modules
Andreas Schwab [Thu, 11 Dec 2014 11:33:15 +0000 (12:33 +0100)]
Remove duplication from gconv-modules

9 years agointl: Merge with gettext version 0.19.3
Will Newton [Wed, 10 Dec 2014 12:03:53 +0000 (12:03 +0000)]
intl: Merge with gettext version 0.19.3

This patch merges the latest release of gettext into the intl
subdirectory. The initial motivation was to include the plural.y
changes which enable building with bison 3.0, but the majority
of the other changes are merely cosmetic so it seemed like merging
the whole directory was simpler than trying to take it piecemeal.

The merge was done by copying across the latext gettext code and
adding in a few small glibc changes that have been added over the
years that seemed beneficial, as well as a couple of small build
fixes that should be merged back to gettext. I also reverted the
gettext commit:

commit 279b57fc367251666f00e8e2b599b83703451afb
Author: Bruno Haible <bruno@clisp.org>
Date:   Fri Jun 14 12:03:49 2002 +0000

    Make absolute pathnames inside $LANGUAGE work.

As it caused localedata/tst-setlocale3 to fail and it wasn't clear
that glibc wanted that behaviour.

The merge has dropped many uses of __glibc_likely/unlikely. This is
intentional given that it eases merging. It seems to me that the cost
of continually rewriting these lines when merging and the risk of adding
bugs when doing so outweighs the benefits of using these macros when
code is shared with another project.

Tested with make check on x86_64.

ChangeLog:

2014-12-11  Will Newton  <will.newton@linaro.org>

Merge gettext 0.19.3 into intl/.

This involves a number of cosmetic changes to comments
and ANSI function definitions and prototypes throughout
all the files. The gettext copyright header is used but
with the date ranges taken from the glibc copy.

* NEWS: Add gettext merge to 2.21.
* intl/bindtextdom.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
Use __builtin_expect rather than __glibc_likely/unlikely.
* intl/dcgettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/dcigettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(INTDIV0_RAISES_SIGFPE): New define.
Use gl_* locking primitives rather than __libc_* ones.
Include eval-plural.h instead of plural-eval.c.
Use __builtin_expect rather than __glibc_likely/unlikely.
* intl/dcngettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/dgettext.c: Likewise.
* intl/dngettext.c: Likewise.
* intl/plural-eval.c: Renamed to...
* intl/eval-plural.h: ...this.
* intl/explodename.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_explode_name): Use strchr instead of __rawmemchr.
* intl/finddomain.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
(_nl_find_domain): Use malloc rather than alloca for
allocation of temporary locale name.
* intl/gettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/gettextP.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.
* intl/gmo.h: Switch to gettext copyright.
(struct sysdep_string): Move struct segment_pair outside of
struct definition.
* intl/hash-string.c: Use ANSI definitions and prototypes.
* intl/hash-string.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/l10nflist.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_normalize_codeset): Avoid integer overflow.
* intl/loadinfo.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(LIBINTL_DLL_EXPORTED): New define.
(PATH_SEPARATOR): New define.
* intl/loadmsgcat.c: Switch to gettext copyright.
* intl/localealias.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(_nl_expand_alias): Use PATH_SEPARATOR.
* intl/ngettext.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
* intl/plural-exp.c: Likewise.
* intl/plural-exp.h: Switch to gettext copyright.
Use ANSI definitions and prototypes.
(struct expression): Move definition of enum operator outside
of struct definition.
* intl/plural.c: Regenerate.
* intl/plural.y: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Port to bison 3.0.
* intl/textdomain.c: Switch to gettext copyright.
Use ANSI definitions and prototypes.
Use gl_* locking primitives rather than __libc_* ones.

9 years ago2014-12-10 Steve Ellcey <sellcey@imgtec.com>
Steve Ellcey [Wed, 10 Dec 2014 21:46:28 +0000 (13:46 -0800)]
2014-12-10  Steve Ellcey  <sellcey@imgtec.com>

* debug/warning-nop.c: Add used atrribute.

9 years agoFix MIPS waitid build.
Joseph Myers [Wed, 10 Dec 2014 18:50:07 +0000 (18:50 +0000)]
Fix MIPS waitid build.

As previously discussed in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, MIPS (o32)
waitid has build warnings (now errors) because a function is declared
inline but functions with five-argument syscalls cannot be inlined for
MIPS o32.

This patch disables the -Winline warnings for waitid.c using a
MIPS-specific wrapper file.  As it's whole-file disabling, there's no
point in using push and pop, so just DIAG_IGNORE_NEEDS_COMMENT is
used.

* sysdeps/unix/sysv/linux/mips/mips32/waitid.c: New file.

9 years agoFix MIPS sigaction build.
Joseph Myers [Wed, 10 Dec 2014 18:45:03 +0000 (18:45 +0000)]
Fix MIPS sigaction build.

Building MIPS sigaction (for ABIs other than o32) fails because of
"'restore_rt' used but never defined", arising from static functions
being defined in asms and referred to from C code.  There is no
corresponding -W option for that warning, so this patch uses
-Wno-error for building sigaction.c.

* sysdeps/unix/sysv/linux/mips/mips64/Makefile
[$(subdir) == signal] (CFLAGS-sigaction.c): New variable.
[$(subdir) == nptl] (CFLAGS-sigaction.c): Likewise.