platform/upstream/glibc.git
9 years agoFix locale memmem namespace (bug 17585).
Joseph Myers [Wed, 12 Nov 2014 22:41:03 +0000 (22:41 +0000)]
Fix locale memmem namespace (bug 17585).

Locale code, brought in by ISO C functions, calls memmem, which is not
an ISO C function.  This isn't an ISO C conformance bug, because all
mem* names are reserved, but glibc practice is not to rely on that
reservation (thus, memmem is only declared in string.h if __USE_GNU
even though ISO C would allow it to be declared unconditionally, for
example).  This patch changes that code to use __memmem.

Note: there are uses of memmem elsewhere in glibc that I didn't
change, although it may turn out some of those also need to use
__memmem.

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

[BZ #17585]
* string/memmem.c [!_LIBC] (__memmem): Define to memmem.
(memmem): Rename to __memmem and define as weak alias of
__memmem.  Use libc_hidden_weak.
(__memmem): Use libc_hidden_def.
* include/string.h (__memmem): Declare.  Use libc_hidden_proto.
* locale/findlocale.c (valid_locale_name): Use __memmem instead of
memmem.

9 years agoFix __get_nprocs fgets_unlocked namespace (bug 17582).
Joseph Myers [Wed, 12 Nov 2014 22:39:36 +0000 (22:39 +0000)]
Fix __get_nprocs fgets_unlocked namespace (bug 17582).

__get_nprocs is called from malloc code, but calls fgets_unlocked,
which is not an ISO C or POSIX function.  This patch fixes it to call
a new __fgets_unlocked name instead.

Note: there are various other uses of fgets_unlocked in glibc's
libraries, and I haven't yet investigated which others might also be
problematic (called directly or indirectly from standard functions)
and so need to change to use __fgets_unlocked.

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

[BZ #17582]
* libio/iofgets.c [weak_alias && !_IO_MTSAFE_IO]
(__fgets_unlocked): Add alias of _IO_fgets.  Use libc_hidden_def.
* libio/iofgets_u.c (fgets_unlocked): Rename to __fgets_unlocked
and define as weak alias of __fgets_unlocked.  Use
libc_hidden_weak.
(__fgets_unlocked): Use libc_hidden_def.
* include/stdio.h (__fgets_unlocked): Declare.  Use
libc_hidden_proto.
* sysdeps/unix/sysv/linux/getsysstats.c (phys_pages_info): Use
__fgets_unlocked instead of fgets_unlocked.
* sysdeps/unix/sysv/linux/alpha/getsysstats.c
(GET_NPROCS_CONF_PARSER): Likewise.
* sysdeps/unix/sysv/linux/sparc/getsysstats.c
(GET_NPROCS_CONF_PARSER): Likewise.

9 years agoFix __printf_fp wmemset namespace (bug 17574).
Joseph Myers [Wed, 12 Nov 2014 22:38:11 +0000 (22:38 +0000)]
Fix __printf_fp wmemset namespace (bug 17574).

__printf_fp calls wmemset, but that is not an ISO C90 function.  This
patch fixes it to call a new __wmemset name instead (with wmemset
being a weak alias).

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

[BZ #17574]
* wcsmbs/wmemset.c (wmemset): Rename to __wmemset and define as
weak alias of __wmemset.  Use libc_hidden_weak.
(__wmemset): Use libc_hidden_def.
* include/wchar.h (__wmemset): Declare.  Use libc_hidden_proto.
* stdio-common/printf_fp.c (___printf_fp): Call __wmemset instead
of wmemset.

9 years agoFix stpcpy / mempcpy namespace (bug 17573).
Joseph Myers [Wed, 12 Nov 2014 22:36:34 +0000 (22:36 +0000)]
Fix stpcpy / mempcpy namespace (bug 17573).

Various glibc functions call __stpcpy and __mempcpy for namespace
reasons instead of plain stpcpy and mempcpy.  But __stpcpy and
__mempcpy are macros that call __builtin_stpcpy and __builtin_mempcpy,
and unless GCC optimizes the calls, they end up calling the C
functions stpcpy and mempcpy.

For calls from within shared libc, libc_hidden_builtin_proto ensures
that calls to those C functions are in turn mapped to call __GI_stpcpy
and __GI_mempcpy.  However, for static libc, and for calls from shared
libraries other than libc, the ELF symbols stpcpy and mempcpy end up
getting called, breaking the ISO C namespace (in the case of stpcpy)
or glibc conventions about not relying on the "future library
directions" reservations (in the case of mempcpy).

This patch fixes this by adding declarations of these functions to
include/string.h, under an appropriate condition, with __asm__ used to
change the assembler name used for calls (the mempcpy case was
previously discussed, and the approach for the fix is as I suggested
in <https://sourceware.org/ml/libc-alpha/2013-02/msg00063.html>).

Tested for x86_64 with the testsuite; also checked that dcigettext.o
(an example previously noted of undesired calls to stpcpy and mempcpy)
now calls __stpcpy and __mempcpy instead, as do non-libc shared
libraries (__stpcpy and __mempcpy were already exported from shared
libc).  Disassembly of installed shared libraries isn't easy to
compare because of reordered PLT entries resulting from the change in
functions called (libnsl, libnss_compat, libnss_dns, libnss_files,
libnss_hesiod, libnss_nis, libnss_nisplus, libpthread, librt all have
such changes).

[BZ #17573]
* include/string.h [NOT_IN_libc || !SHARED] (mempcpy): Declare
with asm name __mempcpy.
[NOT_IN_libc || !SHARED] (stpcpy): Declare with asm name __stpcpy.

9 years agoFix x86_64 rawmemchr namespace (bug 17572).
Joseph Myers [Wed, 12 Nov 2014 22:35:12 +0000 (22:35 +0000)]
Fix x86_64 rawmemchr namespace (bug 17572).

rawmemchr is not an ISO C function, but __rawmemchr is called from ISO
C functions, so rawmemchr should be a weak alias.  On most
architecture it is, but x86_64 defines the function as rawmemchr with
__rawmemchr as a strong alias.  This patch makes x86_64 follow the
same arrangements as other architectures.

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

[BZ #17572]
* sysdeps/x86_64/rawmemchr.S (rawmemchr): Rename to __rawmemchr
and define as weak alias of __rawmemchr.
(__rawmemchr): Do not define as strong alias of rawmemchr.

9 years agoFix qsort_r namespace (bug 17571).
Joseph Myers [Wed, 12 Nov 2014 22:33:41 +0000 (22:33 +0000)]
Fix qsort_r namespace (bug 17571).

qsort_r is defined in the same file as qsort, but is not an ISO C
function, so should be a weak alias for __qsort_r.  The uses in
getaddrinfo should also call __qsort_r, since getaddrinfo is a POSIX
function and qsort_r isn't.  This patch implements this.  Because nscd
uses the getaddrinfo sources outside libc, as do the tst-rfc3484
tests, a #define of __qsort_r to qsort_r is added there alongside the
similar defines for other libc-internal symbols used in getaddrinfo.

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

[BZ #17571]
* stdlib/msort.c (qsort_r): Rename to __qsort_r and define as weak
alias of __qsort_r.
(qsort): Call __qsort_r instead of qsort_r.
* include/stdlib.h (qsort_r): Do not call libc_hidden_proto.
(__qsort_r): Declare.  Call libc_hidden_proto.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Call __qsort_r
instead of qsort_r.
* nscd/gai.c (__qsort_r): Define to qsort_r.
* posix/tst-rfc3484.c (__qsort_r): Likewise.
* posix/tst-rfc3484-2.c (__qsort_r): Likewise.
* posix/tst-rfc3484-3.c (__qsort_r): Likewise.

9 years agoFix malloc_info namespace (bug 17570).
Joseph Myers [Wed, 12 Nov 2014 22:31:38 +0000 (22:31 +0000)]
Fix malloc_info namespace (bug 17570).

malloc_info is defined in the same file as malloc and free, but is not
an ISO C function, so should be a weak symbol.  This patch makes it
so.

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

[BZ #17570]
* malloc/malloc.c (malloc_info): Rename to __malloc_info and
define as weak alias of __malloc_info.

9 years agoFix __getcwd rewinddir namespace (bug 17584).
Joseph Myers [Wed, 12 Nov 2014 16:24:16 +0000 (16:24 +0000)]
Fix __getcwd rewinddir namespace (bug 17584).

__getcwd is called from dcigettext.o (brought in by various ISO C
functionality), but calls rewinddir, which is not an ISO C function.
This patch makes __getcwd call __rewinddir instead and makes rewinddir
a weak alias for __rewinddir.

Since getcwd.c is shared with gnulib (albeit not merged in either
direction for a long time, and omitted from gnulib's
config/srclist.txt list of shared files) I put in a #ifndef _LIBC
define of __rewinddir to rewinddir, although a future merged version
of getcwd could end up looking significantly different.

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

[BZ #17584]
* dirent/rewinddir.c (rewinddir): Rename to __rewinddir and define
as weak alias of __rewinddir.  Don't use libc_hidden_def.
(__rewinddir): Use libc_hidden_def.
* sysdeps/mach/hurd/rewinddir.c: Rename to __rewinddir and define
as weak alias of __rewinddir.  Don't use libc_hidden_def.
(__rewinddir): Use libc_hidden_def.
* sysdeps/posix/rewinddir.c: Rename to __rewinddir and define as
weak alias of __rewinddir.  Don't use libc_hidden_def.
(__rewinddir): Use libc_hidden_def.
* include/dirent.h (rewinddir): Don't use libc_hidden_proto.
(__rewinddir): Use libc_hidden_proto.
* sysdeps/posix/getcwd.c [!_LIBC] (__rewinddir): Define to
rewinddir.
(__getcwd): Use __rewinddir instead of rewinddir.

9 years agoFix tzfile.c namespace (bug 17583).
Joseph Myers [Wed, 12 Nov 2014 16:22:51 +0000 (16:22 +0000)]
Fix tzfile.c namespace (bug 17583).

tzfile.c is brought in by various ISO C functions, but calls fileno,
fread_unlocked and ftello, which are not ISO C functions.  This patch
adds names __fileno, __fread_unlocked and __ftello for those
functions, making tzfile.c use those new names.

Note: there are various uses of fileno elsewhere in glibc that I
didn't change, although it may turn out that some of those also need
to use __fileno.

Tested for x86_64 with the glibc testsuite.  Changed line numbers in
tzfile.c cause changes in assertions, and for some reason this ends up
with different instruction choice and register allocation, affecting
the size of __tzfile_read and so making comparison of disassembly for
libc.so problematic.

[BZ #17583]
* libio/fileno.c (fileno): Rename to __fileno and define as weak
alias of __fileno.  Use libc_hidden_weak.
(__fileno): Use libc_hidden_def.
[weak_alias] (fileno_unlocked): Define as weak alias of __fileno.
* libio/ftello.c (ftello): Rename to __ftello and define as weak
alias of __ftello.
[__OFF_T_MATCHES_OFF64_T] (ftello64): Define as weak alias of
__ftello.
* libio/iofread.c [weak_alias && !_IO_MTSAFE_IO]
(__fread_unlocked): Define as strong alias of _IO_fread.  Use
libc_hidden_def.
(fread_unlocked): Don't use libc_hidden_ver.
* libio/iofread_u.c (fread_unlocked): Rename to __fread_unlocked
and define as weak alias of __fread_unlocked.  Don't use
libc_hidden_def.
(__fread_unlocked): Use libc_hidden_def.
* include/stdio.h (__fileno): Declare.  Use libc_hidden_proto.
(ftello): Don't use libc_hidden_proto.
(__ftello): Declare.  Use libc_hidden_proto.
(fread_unlocked): Don't use libc_hidden_proto.
(__fread_unlocked): Declare.  Use libc_hidden_proto.
* time/tzfile.c (__tzfile_read): Use __fileno, __fread_unlocked
and __ftello instead of fileno, fread_unlocked and ftello.

9 years agoUse GOT instead of GOT12 all over
Siddhesh Poyarekar [Wed, 12 Nov 2014 09:02:41 +0000 (14:32 +0530)]
Use GOT instead of GOT12 all over

GOT12 is a synonym for GOT, so just use GOT everywhere for
consistency.  Generated code is unchanged on s390.

9 years agoFix stack alignment when loader is invoked directly
Siddhesh Poyarekar [Wed, 12 Nov 2014 14:00:24 +0000 (19:30 +0530)]
Fix stack alignment when loader is invoked directly

The s390 ABI requires the stack pointer to be aligned at 8-bytes.
When a program is invoked as an argument to the dynamic linker,
_dl_start_user adjusts the stack to remove the dynamic linker
arguments so that the program sees only its name and arguments.  This
may result in the stack being misaligned since each argument shift is
only a word and not a double-word.

This is now fixed shifting argv and envp down instead of shifting argc
up and reclaiming the stack.  This requires _dl_argv to be adjusted
and hence, is no longer relro.

9 years agoFix tst-strcoll-overflow returning before timeout (BZ #17506)
Leonhard Holz [Wed, 12 Nov 2014 11:40:21 +0000 (17:10 +0530)]
Fix tst-strcoll-overflow returning before timeout (BZ #17506)

Modifies the test examination in test-skeleton.c so that a test can be
successful if it is interrupted or it returns uninterrupted with the
expected status. For this both EXPECTED_SIGNAL and EXPECTED_STATUS
have to be set, as is done in tst-strcoll-overflow.c.

9 years agoNew Bhilodi and Tulu locales (BZ #17475)
Tatiana Udalova [Wed, 12 Nov 2014 11:36:39 +0000 (17:06 +0530)]
New Bhilodi and Tulu locales (BZ #17475)

9 years ago[AArch64] Add ipc.h.
Alan Hayward [Tue, 11 Nov 2014 16:32:34 +0000 (16:32 +0000)]
[AArch64] Add ipc.h.

Adding ipc.h for AArch64 adjusted to behave correctly on big endian
targets.

9 years agoFix ChangeLog formatting of previous commit.
Marcus Shawcroft [Tue, 11 Nov 2014 15:51:55 +0000 (15:51 +0000)]
Fix ChangeLog formatting of previous commit.

9 years ago[AArch64] End frame record chain correctly.
Renlin Li [Tue, 11 Nov 2014 15:02:02 +0000 (15:02 +0000)]
[AArch64] End frame record chain correctly.

9 years agoUpdate minimal required bunutils version to 2.22
Andrew Senkevich [Mon, 10 Nov 2014 19:16:46 +0000 (11:16 -0800)]
Update minimal required bunutils version to 2.22

9 years agom68k: don't expect PLT reference to __tls_get_addr
Andreas Schwab [Fri, 7 Nov 2014 16:36:36 +0000 (17:36 +0100)]
m68k: don't expect PLT reference to __tls_get_addr

9 years agoRemove __libc_waitpid function name.
Joseph Myers [Fri, 7 Nov 2014 01:27:16 +0000 (01:27 +0000)]
Remove __libc_waitpid function name.

Continuing the removal of unused __libc_* function names, this patch
removes the __libc_waitpid name.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch; __waitpid, which is exported from
shared libc, changes from weak to strong on some configurations, which
is of no significance).

* include/sys/wait.h (__libc_waitpid): Remove declaration.
* posix/waitpid.c (__libc_waitpid): Rename to __waitpid.
(__waitpid): Don't define as alias.  Use libc_hidden_def not
libc_hidden_weak.
(waitpid): Define as alias of __waitpid.
* sysdeps/unix/bsd/waitpid.c (__libc_waitpid): Rename to
__waitpid.
(__waitpid): Don't define as alias.  Use libc_hidden_def not
libc_hidden_weak.
(waitpid): Define as alias of __waitpid.
* sysdeps/unix/sysv/linux/i386/syscalls.list (waitpid): Remove
__libc_waitpid alias.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (waitpid): Likewise.
* sysdeps/unix/sysv/linux/powerpc/syscalls.list (waitpid):
Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (waitpid): Likewise.
* sysdeps/unix/sysv/linux/sparc/syscalls.list (waitpid): Likewise.
* sysdeps/unix/sysv/linux/tile/waitpid.S (__libc_waitpid): Remove
alias.
* sysdeps/unix/sysv/linux/waitpid.c (__libc_waitpid): Rename to
__waitpid.
(__waitpid): Don't define as alias.  Use libc_hidden_def not
libc_hidden_weak.
(waitpid): Define as alias of __waitpid.

9 years agomanual/llio.texi: Comment on write atomicity.
Carlos O'Donell [Thu, 6 Nov 2014 20:58:52 +0000 (15:58 -0500)]
manual/llio.texi: Comment on write atomicity.

We add Linux-realted comments about the atomicity of
write with respect to file offsets. As of Linux 3.14
the file offset update is atomic. That means that
multiple threads calling the write syscall can not possibly
get the same file offset. Therefore the writes should
not overlap and data should not be lost as is required
by POSIX.

9 years agoRun check-localpltk/textrel/execstack over ld.so.
Carlos O'Donell [Thu, 6 Nov 2014 20:48:44 +0000 (15:48 -0500)]
Run check-localpltk/textrel/execstack over ld.so.

For maximum paranoia we run ld.so through the normal set
of tests for all of the shared libraries. This includes
running ld.so through check-localplt, check-textrel, and
check-execstack. While none of these should trigger any
failures given the way ld.so is built, it might possibly
fail if a developer does something wrong. This paranoia
was triggered by a discussion over the use of __strcpy
vs. strcpy [1] and if the symbol could leak and use the
libc.so version.

The check-localplt test fails right away because localplt.data
needs updating for all arches. By default we add 6 new symbols:
__tls_get_addr, __libc_memalign, malloc, calloc, realloc and
free. Other machines like i386, power, and s390 require some
different symbol sets e.g. ___tls_get_addr vs. __tls_get_addr
for i386.

Verified for i386
Verified for x86_64
Verified for ppc32
Verified for ppc64
Verified for ppc64le
Verified for arm
Verified for aarch64
Verified for s390
Verified for s390x
Guessed for alpha
Guessed for ia64
Guessed for m68k
Guessed for microblaze
Guessed for sparc32
Guessed for sparc64
Defaults for sh
Defaults for mips
Defaults for hppa
Defaults for tile

Machine manintainers notified to double check the data
used in localplt.data.

[1] https://sourceware.org/ml/libc-alpha/2014-10/msg00548.html

9 years agoRemove INTDEF / INTUSE / INTVARDEF (bug 14132).
Joseph Myers [Wed, 5 Nov 2014 23:35:36 +0000 (23:35 +0000)]
Remove INTDEF / INTUSE / INTVARDEF (bug 14132).

Completing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch removes the final use - that for _dl_starting_up - replacing it
by rtld_hidden_def / rtld_hidden_proto.  Having removed the last use,
the mechanism itself is also removed.

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.  (This is not much of a test since this
variable is only defined and used in the !HAVE_INLINED_SYSCALLS case.)

[BZ #14132]
* include/libc-symbols.h (INTUSE): Remove macro.
(INTDEF): Likewise.
(INTVARDEF): Likewise.
(_INTVARDEF): Likewise.
(INTDEF2): Likewise.
(INTVARDEF2): Likewise.
* elf/rtld.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Use
rtld_hidden_def instead of INTVARDEF.
* sysdeps/generic/ldsodefs.h [IS_IN_rtld]
(_dl_starting_up_internal): Remove declaration.
(_dl_starting_up): Use rtld_hidden_proto.
* elf/dl-init.c [!HAVE_INLINED_SYSCALLS] (_dl_starting_up): Remove
declaration.
[!HAVE_INLINED_SYSCALLS] (_dl_starting_up_internal): Likewise.
(_dl_init) [!HAVE_INLINED_SYSCALLS]: Don't use INTUSE with
_dl_starting_up.
* elf/dl-writev.h (_dl_writev): Likewise.
* sysdeps/powerpc/powerpc64/dl-machine.h [!HAVE_INLINED_SYSCALLS]
(DL_STARTING_UP_DEF): Use __GI__dl_starting_up instead of
_dl_starting_up_internal.

9 years agolibio: Refactor tst-fmemopen to use test-skeleton.c
Adhemerval Zanella [Wed, 11 Jun 2014 18:00:14 +0000 (15:00 -0300)]
libio: Refactor tst-fmemopen to use test-skeleton.c

This patch refactor tst-fmemopen.c to use test-skeleton.c.  No logic
changes are added.

9 years agobenchtests: Add malloc microbenchmark
Will Newton [Wed, 11 Sep 2013 14:47:12 +0000 (15:47 +0100)]
benchtests: Add malloc microbenchmark

Add a microbenchmark for measuring malloc and free performance with
varying numbers of threads. The benchmark allocates and frees buffers
of random sizes in a random order and measures the overall execution
time and RSS. Variants of the benchmark are run with 1, 8, 16 and
32 threads.

The random block sizes used follow an inverse square distribution
which is intended to mimic the behaviour of real applications which
tend to allocate many more small blocks than large ones.

ChangeLog:

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

* benchtests/Makefile: (bench-malloc): Add malloc thread
scalability benchmark.
* benchtests/bench-malloc-threads.c: New file.

9 years ago[AArch64] Add optimized strchrnul.
Richard Earnshaw [Wed, 5 Nov 2014 13:51:56 +0000 (13:51 +0000)]
[AArch64] Add optimized strchrnul.

Here is an optimized implementation of __strchrnul.  The
simplification that we don't have to track precisely why the loop
terminates (match or end-of-string) means we have to do less work in
both setup and the core inner loop.  That means this should never be
slower than strchr.

As with strchr, the use of LD1 means we do not need different versions
for big-/little-endian.

9 years agopowerpc: Simplify encoding of POWER8 instruction
Adhemerval Zanella [Wed, 5 Nov 2014 13:01:09 +0000 (08:01 -0500)]
powerpc: Simplify encoding of POWER8 instruction

9 years agoModify several tests to use test-skeleton.c
Arjun Shankar [Wed, 5 Nov 2014 09:54:08 +0000 (15:24 +0530)]
Modify several tests to use test-skeleton.c

This patch modifies several test cases to use test-skeleton.c.
It was generated by a bash script written for this purpose and
thus excludes several other tests which I deemed worth a visual
inspection before making the change.

I intend to follow up with individual patches to the tests
skipped by the script.

The script itself resides at http://git.io/WODAmg and should
reproduce this very patch when run against master.

ChangeLog:

2014-10-30  Arjun Shankar  <arjun.is@lostca.se>

* catgets/test-gencat.c: Use test-skeleton.c.
* catgets/tst-catgets.c: Likewise.
* csu/tst-empty.c: Likewise.
* elf/tst-audit2.c: Likewise.
* elf/tst-global1.c: Likewise.
* elf/tst-pathopt.c: Likewise.
* elf/tst-piemod1.c: Likewise.
* elf/tst-tls10.c: Likewise.
* elf/tst-tls11.c: Likewise.
* elf/tst-tls12.c: Likewise.
* gnulib/tst-gcc.c: Likewise.
* iconvdata/tst-e2big.c: Likewise.
* iconvdata/tst-loading.c: Likewise.
* iconv/tst-iconv1.c: Likewise.
* iconv/tst-iconv2.c: Likewise.
* inet/test-inet6_opt.c: Likewise.
* inet/tst-gethnm.c: Likewise.
* inet/tst-network.c: Likewise.
* inet/tst-ntoa.c: Likewise.
* intl/tst-codeset.c: Likewise.
* intl/tst-gettext2.c: Likewise.
* intl/tst-gettext3.c: Likewise.
* intl/tst-ngettext.c: Likewise.
* intl/tst-translit.c: Likewise.
* io/test-stat.c: Likewise.
* libio/test-fmemopen.c: Likewise.
* libio/tst-freopen.c: Likewise.
* libio/tst-sscanf.c: Likewise.
* libio/tst-ungetwc1.c: Likewise.
* libio/tst-ungetwc2.c: Likewise.
* libio/tst-widetext.c: Likewise.
* localedata/tst-ctype.c: Likewise.
* localedata/tst-digits.c: Likewise.
* localedata/tst-leaks.c: Likewise.
* localedata/tst-mbswcs1.c: Likewise.
* localedata/tst-mbswcs2.c: Likewise.
* localedata/tst-mbswcs3.c: Likewise.
* localedata/tst-mbswcs4.c: Likewise.
* localedata/tst-mbswcs5.c: Likewise.
* localedata/tst-setlocale.c: Likewise.
* localedata/tst-trans.c: Likewise.
* localedata/tst-wctype.c: Likewise.
* localedata/tst-xlocale1.c: Likewise.
* login/tst-grantpt.c: Likewise.
* malloc/tst-calloc.c: Likewise.
* malloc/tst-malloc.c: Likewise.
* malloc/tst-mallocstate.c: Likewise.
* malloc/tst-mcheck.c: Likewise.
* malloc/tst-mtrace.c: Likewise.
* malloc/tst-obstack.c: Likewise.
* math/atest-exp2.c: Likewise.
* math/atest-exp.c: Likewise.
* math/atest-sincos.c: Likewise.
* math/test-matherr.c: Likewise.
* math/test-misc.c: Likewise.
* math/test-powl.c: Likewise.
* math/tst-definitions.c: Likewise.
* misc/tst-dirname.c: Likewise.
* misc/tst-efgcvt.c: Likewise.
* misc/tst-fdset.c: Likewise.
* misc/tst-hsearch.c: Likewise.
* misc/tst-mntent2.c: Likewise.
* nptl/tst-sem7.c: Likewise.
* nptl/tst-sem8.c: Likewise.
* nptl/tst-sem9.c: Likewise.
* nss/test-netdb.c: Likewise.
* posix/tst-fnmatch.c: Likewise.
* posix/tst-getlogin.c: Likewise.
* posix/tst-gnuglob.c: Likewise.
* posix/tst-mmap.c: Likewise.
* pwd/tst-getpw.c: Likewise.
* resolv/tst-inet_ntop.c: Likewise.
* rt/tst-timer.c: Likewise.
* stdio-common/test-fseek.c: Likewise.
* stdio-common/test-popen.c: Likewise.
* stdio-common/test-vfprintf.c: Likewise.
* stdio-common/tst-cookie.c: Likewise.
* stdio-common/tst-fileno.c: Likewise.
* stdio-common/tst-gets.c: Likewise.
* stdio-common/tst-obprintf.c: Likewise.
* stdio-common/tst-perror.c: Likewise.
* stdio-common/tst-sprintf2.c: Likewise.
* stdio-common/tst-sprintf3.c: Likewise.
* stdio-common/tst-sprintf.c: Likewise.
* stdio-common/tst-swprintf.c: Likewise.
* stdio-common/tst-tmpnam.c: Likewise.
* stdio-common/tst-unbputc.c: Likewise.
* stdio-common/tst-wc-printf.c: Likewise.
* stdlib/tst-environ.c: Likewise.
* stdlib/tst-fmtmsg.c: Likewise.
* stdlib/tst-limits.c: Likewise.
* stdlib/tst-rand48-2.c: Likewise.
* stdlib/tst-rand48.c: Likewise.
* stdlib/tst-random2.c: Likewise.
* stdlib/tst-random.c: Likewise.
* stdlib/tst-strtol.c: Likewise.
* stdlib/tst-strtoll.c: Likewise.
* stdlib/tst-tls-atexit.c: Likewise.
* stdlib/tst-xpg-basename.c: Likewise.
* string/test-ffs.c: Likewise.
* string/tst-bswap.c: Likewise.
* string/tst-inlcall.c: Likewise.
* string/tst-strtok.c: Likewise.
* string/tst-strxfrm.c: Likewise.
* sysdeps/x86_64/tst-audit10.c: Likewise.
* sysdeps/x86_64/tst-audit3.c: Likewise.
* sysdeps/x86_64/tst-audit4.c: Likewise.
* sysdeps/x86_64/tst-audit5.c: Likewise.
* time/tst-ftime_l.c: Likewise.
* time/tst-getdate.c: Likewise.
* time/tst-mktime3.c: Likewise.
* time/tst-mktime.c: Likewise.
* time/tst-posixtz.c: Likewise.
* time/tst-strptime2.c: Likewise.
* time/tst-strptime3.c: Likewise.
* wcsmbs/tst-btowc.c: Likewise.
* wcsmbs/tst-mbrtowc.c: Likewise.
* wcsmbs/tst-mbsrtowcs.c: Likewise.
* wcsmbs/tst-wchar-h.c: Likewise.
* wcsmbs/tst-wcpncpy.c: Likewise.
* wcsmbs/tst-wcrtomb.c: Likewise.
* wcsmbs/tst-wcsnlen.c: Likewise.
* wcsmbs/tst-wcstof.c: Likewise.

9 years agoDon't use INTDEF/INTUSE with _dl_mcount (bug 14132).
Joseph Myers [Wed, 5 Nov 2014 01:02:47 +0000 (01:02 +0000)]
Don't use INTDEF/INTUSE with _dl_mcount (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch replaces its use for _dl_mcount with use of rtld_hidden_def /
rtld_hidden_proto.

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

[BZ #14132]
* elf/dl-profile.c (_dl_mcount): Use rtld_hidden_def instead of
INTDEF.
* sysdeps/generic/ldsodefs.h (_dl_mcount_internal): Remove
declaration.
(_dl_mcount): Use rtld_hidden_proto.
* elf/dl-runtime.c (_dl_profile_fixup): Don't use INTUSE with
_dl_mcount.
* elf/rtld.c (_rtld_global_ro): Likewise.

9 years agoDon't use INTDEF/INTUSE with _dl_init (bug 14132).
Joseph Myers [Tue, 4 Nov 2014 23:26:39 +0000 (23:26 +0000)]
Don't use INTDEF/INTUSE with _dl_init (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch eliminates its use for _dl_init.  Since _dl_init was already
declared with hidden visibility, creating a second hidden alias for it
was completely pointless, so this patch replaces all uses of
_dl_init_internal with plain _dl_init instead of using hidden_proto /
hidden_def (which are only needed when you want a hidden alias for a
non-hidden symbol; it's quite possible there are cases where they are
used but don't need to be because the symbol in question is not part
of the public ABI and is only used within a single library, so using
attributes_hidden instead would suffice).

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

[BZ #14132]
* elf/dl-init.c (_dl_init): Don't use INTDEF.
* sysdeps/aarch64/dl-machine.h (RTLD_START): Use _dl_init instead
of _dl_init_internal.
* sysdeps/alpha/dl-machine.h (RTLD_START): Likewise.
* sysdeps/arm/dl-machine.h (RTLD_START): Likewise.
* sysdeps/hppa/dl-machine.h (RTLD_START): Likewise.
* sysdeps/i386/dl-machine.h (RTLD_START): Likewise.
* sysdeps/ia64/dl-machine.h (RTLD_START): Likewise.
* sysdeps/m68k/dl-machine.h (RTLD_START): Likewise.
* sysdeps/microblaze/dl-machine.h (RTLD_START): Likewise.
* sysdeps/mips/dl-machine.h (RTLD_START): Likewise.
* sysdeps/powerpc/powerpc32/dl-start.S (_start): Likewise.
* sysdeps/s390/s390-32/dl-machine.h (RTLD_START): Likewise.
* sysdeps/s390/s390-64/dl-machine.h (RTLD_START): Likewise.
* sysdeps/sh/dl-machine.h (RTLD_START): Likewise.
* sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise.
* sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise.
* sysdeps/tile/dl-start.S (_start): Likewise.
* sysdeps/x86_64/dl-machine.h (RTLD_START): Likewise.
* sysdeps/x86_64/x32/dl-machine.h (RTLD_START): Likewise.

9 years agoDon't use INTDEF/INTUSE with _dl_argv (bug 14132).
Joseph Myers [Tue, 4 Nov 2014 17:39:39 +0000 (17:39 +0000)]
Don't use INTDEF/INTUSE with _dl_argv (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch replaces its use for _dl_argv with rtld_hidden_data_def and
rtld_hidden_proto.  Some places in .S files that previously used
_dl_argv_internal or INTUSE(_dl_argv) now use __GI__dl_argv directly
(there are plenty of existing examples of such direct use of __GI_*).

A single place in rtld.c previously used _dl_argv without INTUSE,
apparently accidentally, while the rtld_hidden_proto mechanism avoids
such accidential omissions.  As a consequence, this patch *does*
change the contents of stripped ld.so.  However, the installed
stripped shared libraries are identical to those you get if instead of
this patch you change that single _dl_argv use to use INTUSE, without
any other changes.

Tested for x86_64 (testsuite as well as comparison of installed
stripped shared libraries as described above).

[BZ #14132]
* sysdeps/generic/ldsodefs.h (_dl_argv): Use rtld_hidden_proto.
[IS_IN_rtld] (_dl_argv_internal): Do not declare.
(rtld_progname): Make macro definition unconditional.
* elf/rtld.c (_dl_argv): Use rtld_hidden_data_def instead of
INTDEF.
(dlmopen_doit): Do not use INTUSE with _dl_argv.
(dl_main): Likewise.
* elf/dl-sysdep.c (_dl_sysdep_start): Likewise.
* sysdeps/alpha/dl-machine.h (RTLD_START): Use __GI__dl_argv
instead of _dl_argv_internal.
* sysdeps/powerpc/powerpc32/dl-start.S (_dl_start_user): Use
__GI__dl_argv instead of INTUSE(_dl_argv).
* sysdeps/powerpc/powerpc64/dl-machine.h (RTLD_START): Use
__GI__dl_argv instead of _dl_argv_internal.

9 years agosoft-fp: Add _FP_TO_INT_ROUND.
Joseph Myers [Tue, 4 Nov 2014 16:34:49 +0000 (16:34 +0000)]
soft-fp: Add _FP_TO_INT_ROUND.

Continuing the series of patches adding soft-fp features from the
kernel version of soft-fp to glibc so that glibc's version is able to
replace the old fork of soft-fp in the kernel, this patch adds the
last major such feature: _FP_TO_INT_ROUND, converting a floating-point
number to an integer with rounding according to the current rounding
direction (as opposed to truncating towards zero, which _FP_TO_INT
does).

The general structure of the implementation follows that of
_FP_TO_INT, but of course is more complicated.  As with glibc's
_FP_TO_INT it works with raw input (the kernel versions of these
macros predate the conversion of _FP_TO_INT and many other macros to
raw or semi-raw input).  I have not tried to work out what bugs there
might be in the kernel version that this might fix; it's a
from-scratch implementation based on _FP_TO_INT.

Tested for powerpc (soft-float) that there is no change to the
installed shared libraries; also tested with the libm tests with lrint
/ lrintf / llrint / llrintf made to use _FP_TO_INT_ROUND, to provide
some test of the functionality.  As we don't have benchmarks for those
functions, I haven't actually included the soft-fp versions of them,
although I expect them to be faster than the existing code (given that
the existing code involves adding and subtracting numbers such as
0x1p52 to achieve the desired rounding, which is not particularly
efficient when the underlying floating point is software floating
point).

2014-11-04  Joseph Myers  <joseph@codesourcery.com>

* soft-fp/op-common.h (_FP_TO_INT_ROUND): New macro.
* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_D): New
macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_D): Likewise.
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_E):
New macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_E): Likewise.
* soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_TO_INT_ROUND_Q): New
macro.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_ROUND_Q): Likewise.
* soft-fp/single.h (FP_TO_INT_ROUND_S): New macro.

9 years agoRemove unused include
Andreas Schwab [Wed, 17 Sep 2014 10:34:24 +0000 (12:34 +0200)]
Remove unused include

9 years agopowerpc: Fix encoding of POWER8 instruction
Adhemerval Zanella [Mon, 3 Nov 2014 12:26:33 +0000 (07:26 -0500)]
powerpc: Fix encoding of POWER8 instruction

This patch adds a binary encoding for 'mtvsrd' instruction to avoid
build failures when assembler does not support POWER8.

9 years agoDon't error out writing a multibyte character to an unbuffered stream (bug 17522)
Andreas Schwab [Thu, 30 Oct 2014 11:18:48 +0000 (12:18 +0100)]
Don't error out writing a multibyte character to an unbuffered stream (bug 17522)

9 years agoFix sparc struct fpu definition.
Jose E. Marchesi [Sat, 1 Nov 2014 20:45:02 +0000 (13:45 -0700)]
Fix sparc struct fpu definition.

* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct fpu): fix
the size of the fpu_fr.fpu_dregs[] array.

9 years agoRemove __libc_nanosleep function name.
Joseph Myers [Sat, 1 Nov 2014 12:26:09 +0000 (12:26 +0000)]
Remove __libc_nanosleep function name.

Continuing the removal of unused __libc_* function names, this patch
removes the __libc_nanosleep name.

Tested for x86_64 (testsuite, and that the disassembly of installed
shared libraries is unchanged by the patch; __nanosleep changes from
weak to strong, which is of no significance).

* posix/nanosleep.c (__libc_nanosleep): Rename to __nanosleep.
(__nanosleep): Do not define as alias.
(nanosleep): Define as alias of __nanosleep.
* sysdeps/unix/sysv/linux/syscalls.list (nanosleep): Remove
__libc_nanosleep name.

9 years agoMake aclocal.m4 comment mention updating install.texi for autoconf version.
Joseph Myers [Fri, 31 Oct 2014 22:44:17 +0000 (22:44 +0000)]
Make aclocal.m4 comment mention updating install.texi for autoconf version.

* aclocal.m4 (GLIBC_AUTOCONF_VERSION): Mention need to update
install.texi in comment.

9 years agopowerpc: Change atomic_write_barrier to have release semantics.
Torvald Riegel [Fri, 17 Oct 2014 23:01:58 +0000 (01:01 +0200)]
powerpc: Change atomic_write_barrier to have release semantics.

9 years agoAdd a hook to enable load-time inspection of program headers
Matthew Fortune [Wed, 1 Oct 2014 16:08:51 +0000 (17:08 +0100)]
Add a hook to enable load-time inspection of program headers

This hook can be used to perform additional compatibility checks
between shared libraries by inspecting custom program header
information.

* elf/dl-machine-reject-phdr.h: New file.
* elf/dl-load.c: #include that.
(open_verify): Call elf_machine_reject_phdr_p and ignore the file
if that returned true.

9 years agoBZ#17496: Fix gnu/lib-names.h dependency.
Roland McGrath [Fri, 31 Oct 2014 22:07:36 +0000 (15:07 -0700)]
BZ#17496: Fix gnu/lib-names.h dependency.

9 years agoUpdate autoconf version requirement in install.texi.
Joseph Myers [Fri, 31 Oct 2014 21:49:35 +0000 (21:49 +0000)]
Update autoconf version requirement in install.texi.

I noticed that install.texi was out of date with regard to the actual
autoconf version requirement for regenerating configure scripts.  This
patch updates the documentation.

* manual/install.texi (Tools for Compilation): Update autoconf
version requirements.
* INSTALL: Regenerated.

9 years agoRemove __libc_pselect alias.
Joseph Myers [Fri, 31 Oct 2014 21:22:35 +0000 (21:22 +0000)]
Remove __libc_pselect alias.

Continuing the removal of unused __libc_* function names, this patch
removes the __libc_pselect alias.

Tested for x86_64 that installed stripped shared libraries are
unchanged by this patch.

* misc/pselect.c [!__pselect] (__libc_pselect): Remove alias.
* sysdeps/unix/sysv/linux/pselect.c [__NR_pselect6]
(__libc_pselect): Likewise.

9 years agoAdd bug 15215 to NEWS; move bug 17344 to correct version's list in NEWS.
Joseph Myers [Fri, 31 Oct 2014 21:21:15 +0000 (21:21 +0000)]
Add bug 15215 to NEWS; move bug 17344 to correct version's list in NEWS.

9 years agoMove powerpc64 pread/pwrite definitions to syscalls.list (bug 14138).
Joseph Myers [Fri, 31 Oct 2014 21:13:32 +0000 (21:13 +0000)]
Move powerpc64 pread/pwrite definitions to syscalls.list (bug 14138).

Concluding the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch removes C definitions of pread, pread64, pwrite and
pwrite64 for powerpc64.  As far as I can tell, the existing
syscalls.list definitions in
sysdeps/unix/sysv/linux/wordsize-64/syscalls.list should suffice to
produce results equivalent to what these C files do.

[BZ #14138]
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c: Remove file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c: Likewise.

9 years agoFix SPARC atomic_write_barrier.
Torvald Riegel [Wed, 29 Oct 2014 18:14:14 +0000 (19:14 +0100)]
Fix SPARC atomic_write_barrier.

9 years agoClean up internal ctype.h header.
Roland McGrath [Thu, 30 Oct 2014 20:19:34 +0000 (13:19 -0700)]
Clean up internal ctype.h header.

9 years agoRemove __libc_readv and __libc_writev function names.
Joseph Myers [Thu, 30 Oct 2014 20:56:34 +0000 (20:56 +0000)]
Remove __libc_readv and __libc_writev function names.

Continuing the removal of __libc_* function names that are no longer
used anywhere, this patch removes the __libc_readv and __libc_writev
names.

Tested for x86_64 that stripped installed shared libraries are
unchanged by the patch.

* include/sys/uio.h (__libc_readv): Remove declaration.
(__libc_writev): Likewise.
* misc/readv.c (__libc_readv): Rename to __readv.
(__readv): Do not define as alias.
(readv): Define as alias of __readv.
* misc/writev.c (__libc_writev): Rename to __writev.
(__writev): Do not define as alias.
(writev): Define as alias of __writev.
* sysdeps/posix/readv.c (__libc_readv): Rename to __readv.
(__readv): Do not define as alias.
(readv): Define unconditionally as alias of __readv.
* sysdeps/posix/writev.c (__libc_writev): Rename to __writev.
(__writev): Do not define as alias.
(writev): Define unconditionally as alias of __writev.
* sysdeps/unix/syscalls.list (readv): Do not define __libc_readv
name.
(writev): Do not define __libc_writev name.

9 years agoClean up wchar_t conversion code in iconv program.
Roland McGrath [Thu, 30 Oct 2014 19:56:51 +0000 (12:56 -0700)]
Clean up wchar_t conversion code in iconv program.

9 years agoRemove __libc_creat function name.
Joseph Myers [Thu, 30 Oct 2014 19:44:31 +0000 (19:44 +0000)]
Remove __libc_creat function name.

glibc has lots of __libc_* function names that no longer serve any
purpose (are not used for any calls or exported at a public symbol
version).  This patch removes __libc_creat.  It has the effect of
creat becoming a strong symbol instead of a weak symbol in various
cases, but that's fine; in shared libraries it doesn't matter at all,
while for static linking the only other symbol sometimes defined in
the same object is creat64, and whenever creat64 is a reserved name so
is creat.

Other such cases of unnecessary __libc_* symbols are expected to be
dealt with in separate patches over time.

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

* include/fcntl.h (__libc_creat): Remove declaration.
* io/creat.c (__libc_creat): Rename to creat.
(creat): Do not define as alias.
* sysdeps/unix/sysv/linux/alpha/creat.c (creat64): Define as alias
of creat instead of __libc_creat.
* sysdeps/unix/sysv/linux/generic/creat.c (__libc_creat): Rename
to creat.
(creat): Do not define as alias.
[__WORDSIZE == 64] (creat64): Define as alias of creat instead of
__libc_creat.
* sysdeps/unix/sysv/linux/syscalls.list (creat): Do not define
__libc_creat name.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (creat):
Likewise.

9 years agomanual/llio.texi: Add Linux-specific comments for write().
Carlos O'Donell [Thu, 30 Oct 2014 00:39:07 +0000 (20:39 -0400)]
manual/llio.texi: Add Linux-specific comments for write().

Add Linux-specific comments about the atomicity of write() and
the POSIX requirements.

2014-10-29  Carlos O'Donell  <carlos@redhat.com>

* manual/llio.texi: Add comments discussing why write() may be
considered MT-unsafe on Linux.

9 years agoelf/dl-load.c: Use __strdup.
Carlos O'Donell [Tue, 28 Oct 2014 23:37:07 +0000 (19:37 -0400)]
elf/dl-load.c: Use __strdup.

During a refactoring pass several repeated blocks of code in dl-load.c
were turned into a call to a local function named local_strdup.  There
is no need for local_strdup, and the routines should instead call
__strdup.  This change does just that.  We call the internal symbol
__strdup because calling strdup is unsafe.  The user might be
using a standard that doesn't include strdup and may have defined this
symbol in their application. During a static link we might reference
the user defined symbol and crash if it doesn't implement a standards
conforming strdup. The resulting code is simpler to understand, and
makes it easier to debug.

No regressions on x86_64.

2014-10-28  Carlos O'Donell  <carlos@redhat.com>

* dl-load.c (local_strdup): Remove.
(expand_dynamic_string_token): Use __strdup.
(decompose_rpath): Likewise.
(_dl_map_object): Likewise.

9 years agoDon't use INTDEF/INTUSE in unwind-dw2-fde.c (bug 14132).
Joseph Myers [Tue, 28 Oct 2014 17:12:57 +0000 (17:12 +0000)]
Don't use INTDEF/INTUSE in unwind-dw2-fde.c (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch replaces its use in unwind-dw2-fde.c with hidden_def and
hidden_proto.

Tested for x86.  This patch does result in code generation differences
(for some reason GCC decides to partition __register_frame_info_bases
after the patch).

[BZ #14132]
* sysdeps/generic/unwind-dw2-fde.c
(__register_frame_info_bases_internal): Do not declare.
(__register_frame_info_table_bases_internal): Likewise.
(__deregister_frame_info_bases_internal): Likewise.
(__register_frame_info_bases): Declare and use hidden_proto before
definition.  Use hidden_def instead of INTDEF.
(__register_frame_info_table_bases): Likewise.
(__deregister_frame_info_bases): Likewise.
(__register_frame_info): Do not use INTUSE.
(__register_frame): Likewise.
(__register_frame_info_table): Likewise.
(__register_frame_table): Likewise.
(__deregister_frame_info): Likewise.
(__deregister_frame): Likewise.

9 years agoarm: Re-enable PI futex support for ARM kernels >= 3.14.3
Gratian Crisan [Mon, 27 Oct 2014 22:45:43 +0000 (22:45 +0000)]
arm: Re-enable PI futex support for ARM kernels >= 3.14.3

ARM linux kernels before 3.14.3 may or may not support
futex_atomic_cmpxchg_inatomic depending on the kernel configuration (e.g.
CONFIG_CPU_USE_DOMAINS && CONFIG_SMP configuration was not supported)

Starting with 3.14.3 the linux kernel unconditionally enables support for
ARM, and this re-enables the relevant __ASSUME_* macros.

Tested on ARM both with kernels >= 3.14.3 and older kernels.

* sysdeps/unix/sysv/linux/arm/kernel-features.h
[__LINUX_KERNEL_VERSION >= 0x030E03] (__ASSUME_FUTEX_LOCK_PI): Do
not undefine.
[__LINUX_KERNEL_VERSION >= 0x030E03] (__ASSUME_REQUEUE_PI):
Likewise.
[__LINUX_KERNEL_VERSION >= 0x030E03] (__ASSUME_SET_ROBUST_LIST):
Likewise.

9 years agoMove setfsgid/setfsuid definitions to syscalls.list (bug 14138).
Joseph Myers [Mon, 27 Oct 2014 12:24:42 +0000 (12:24 +0000)]
Move setfsgid/setfsuid definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves various definitions of setfsgid and setfsuid.

Tested for x86.

[BZ #14138]
* sysdeps/unix/sysv/linux/arm/setfsgid.c: Remove file.
* sysdeps/unix/sysv/linux/arm/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setfsgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setfsgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setfsgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setfsgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setfsuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/syscalls.list (setfsgid): Add
syscall.
(setfsuid): Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (setfsgid): Likewise.
(setfsuid): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (setfsgid): Likewise.
(setfsuid): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (setfsgid):
Likewise.
(setfsuid): Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (setfsgid): Likewise.
(setfsuid): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (setfsgid):
Likewise.
(setfsuid): Likewise.

9 years agoFix misdetected Slow_SSE4_2 cpu feature bit (bug 17501)
Andreas Schwab [Tue, 21 Oct 2014 09:09:19 +0000 (11:09 +0200)]
Fix misdetected Slow_SSE4_2 cpu feature bit (bug 17501)

9 years agoRework compiler version check in configure.
Roland McGrath [Fri, 24 Oct 2014 21:45:47 +0000 (14:45 -0700)]
Rework compiler version check in configure.

9 years agoPrototypify htonl and htons definitions.
Roland McGrath [Fri, 24 Oct 2014 19:37:36 +0000 (12:37 -0700)]
Prototypify htonl and htons definitions.

9 years agoThis patch improves strncat performance by using strlen. Strlen has a fast C implemen...
Wilco Dijkstra [Fri, 24 Oct 2014 16:12:12 +0000 (16:12 +0000)]
This patch improves strncat performance by using strlen. Strlen has a fast C implementation, so
this
will improve performance even on targets which don't have an optimized strlen. It is about twice
as
fast as the original strncat in bench-strncat.

9 years agoThis patch improves strcat performance by using strlen and strcpy. Strlen has a fast C
Wilco Dijkstra [Fri, 24 Oct 2014 16:08:42 +0000 (16:08 +0000)]
This patch improves strcat performance by using strlen and strcpy. Strlen has a fast C
implementation, so this improves performance even on targets which don't have an optimized
strlen and strcpy - it is 25% faster in bench-strcat. On targets which don't provide an
optimized strcat but which do have an optimized strlen and strcpy, performance gain is > 2x.

9 years agoCall libc_fetestexcept_aarch64 from math_private.h rather than duplicating functionality.
Wilco Dijkstra [Fri, 24 Oct 2014 13:23:12 +0000 (13:23 +0000)]
Call libc_fetestexcept_aarch64 from math_private.h rather than duplicating functionality.

9 years agoCall libc_feholdexcept_aarch64 from math_private.h rather than duplicating functionality.
Wilco Dijkstra [Fri, 24 Oct 2014 13:21:27 +0000 (13:21 +0000)]
Call libc_feholdexcept_aarch64 from math_private.h rather than duplicating functionality.

9 years agoCall get_rounding_mode rather than duplicating functionality.
Wilco Dijkstra [Fri, 24 Oct 2014 13:19:24 +0000 (13:19 +0000)]
Call get_rounding_mode rather than duplicating functionality.

9 years agoCleanup feenableexcept to use the same logic as the ARM version. No functional changes.
Wilco Dijkstra [Fri, 24 Oct 2014 13:07:17 +0000 (13:07 +0000)]
Cleanup feenableexcept to use the same logic as the ARM version. No functional changes.

9 years agoCleanup fedisableexcept to use the same logic as the ARM version. No functional changes.
Wilco Dijkstra [Fri, 24 Oct 2014 13:06:04 +0000 (13:06 +0000)]
Cleanup fedisableexcept to use the same logic as the ARM version. No functional changes.

9 years agoCleanup feclearexcept to use the same logic as the ARM version. No functional changes.
Wilco Dijkstra [Fri, 24 Oct 2014 13:01:38 +0000 (13:01 +0000)]
Cleanup feclearexcept to use the same logic as the ARM version. No functional changes.

9 years agoCleanup fesetexceptflag to use the same logic as the ARM version. No functional changes.
Wilco Dijkstra [Fri, 24 Oct 2014 12:59:44 +0000 (12:59 +0000)]
Cleanup fesetexceptflag to use the same logic as the ARM version. No functional changes.

9 years agoRemove an unused include.
Wilco Dijkstra [Fri, 24 Oct 2014 12:57:49 +0000 (12:57 +0000)]
Remove an unused include.

9 years agoMove get*id and getgroups definitions to syscalls.list (bug 14138).
Joseph Myers [Fri, 24 Oct 2014 13:01:17 +0000 (13:01 +0000)]
Move get*id and getgroups definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves various definitions of get*id functions and
getgroups.  The previous C definitions were because of the transition
to 32-bit uids and gids.

Tested for x86.

[BZ #14138]
* sysdeps/unix/sysv/linux/arm/getegid.c: Remove file.
* sysdeps/unix/sysv/linux/arm/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getresgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getresuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getegid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getresgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getresuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getegid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getresgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getresuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getegid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getegid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getresgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getresuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getegid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/geteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/syscalls.list (getegid): Add
syscall.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getresgid): Likewise.
(getresuid): Likewise.
(getgroups): Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (getegid): Likewise.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getresgid): Likewise.
(getresuid): Likewise.
(getgroups): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (getegid): Likewise.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getresgid): Likewise.
(getresuid): Likewise.
(getgroups): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (getegid):
Likewise.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getresgid): Likewise.
(getresuid): Likewise.
(getgroups): Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (getegid): Likewise.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getresgid): Likewise.
(getresuid): Likewise.
(getgroups): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (getegid):
Likewise.
(geteuid): Likewise.
(getgid): Likewise.
(getuid): Likewise.
(getgroups): Likewise.

9 years agoMove some chown / lchown / fchown definitions to syscalls.list (bug 14138).
Joseph Myers [Fri, 24 Oct 2014 12:57:59 +0000 (12:57 +0000)]
Move some chown / lchown / fchown definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves various definitions of chown, lchown and fchown.

In most cases the need for special syscalls.list entries (rather than
existing generic ones) is because these architectures use chown32,
lchown32 and fchown32 as syscall names.  Some architectures also have
symbol versioning compatibility for older versions of chown having
been equivalent to lchown.

The aliases specified for s390-32 had the effect of exporting
__chown@@GLIBC_2.1 (but not __chown@GLIBC_2.0) despite it not being
listed in Versions files.  (I'm not sure why versioned_symbol but not
compat_symbol were effective like that to create such __chown exports
in the absence of Versions entries.)  The natural way to preserve that
versioned export of __chown seems to be to add it in a Versions file,
so I did so.  (Maybe actually it should be a compat symbol,
__chown@GLIBC_2.1, unless there's a good reason for that export, but
this patch doesn't change anything there.)

Tested for x86.

[BZ #14138]
* sysdeps/unix/sysv/linux/i386/chown.c: Remove file.
* sysdeps/unix/sysv/linux/i386/fchown.c: Likewise.
* sysdeps/unix/sysv/linux/i386/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/chown.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/fchown.c: Remove file.
* sysdeps/unix/sysv/linux/s390/s390-32/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/sh/chown.c: Likewise.
* sysdeps/unix/sysv/linux/sh/fchown.c: Likewise.
* sysdeps/unix/sysv/linux/sh/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/chown.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/fchown.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Versions (GLIBC_2.1): Add
__chown.
* sysdeps/unix/sysv/linux/i386/syscalls.list (chown): Add syscall.
(lchown): Likewise.
(fchown): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (chown):
Likewise.
(lchown): Likewise.
(fchown): Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (chown): Likewise.
(lchown): Likewise.
(fchown): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list (chown):
Likewise.
(lchown): Likewise.
(fchown): Likewise.

9 years agoRemove spaces.
Wilco Dijkstra [Fri, 24 Oct 2014 12:53:19 +0000 (12:53 +0000)]
Remove spaces.

9 years agohppa: Make __SIGRTMIN 32 (ABI break).
Carlos O'Donell [Fri, 24 Oct 2014 03:14:12 +0000 (23:14 -0400)]
hppa: Make __SIGRTMIN 32 (ABI break).

In the Linux kernel version 3.17 the signal numbers were rearranged in
order to make hppa like every other arch. Previously we started
__SIGRTMIN at 37, and that meant several pieces of important software,
including systemd, would fail to build. To support systemd we removed
SIGEMT and SIGLOST, and rearranged the others according to expected
values. This is technically an ABI incompatible change, but because
zero applications use SIGSTKFLT, SIGXCPU, SIGXFSZ and SIGSYS nothing
broke.  Nothing uses SIGEMT and SIGLOST, and they were present for
HPUX compatibility which is no longer supported. Thus because nothing
breaks we don't do any compatibility work here.

Upstream kernel commit is 1f25df2eff5b25f52c139d3ff31bc883eee9a0ab.

Signed-off-by: Carlos O'Donell <carlos@systemhalted.org>
Signed-off-by: Helge Deller <deller@gmx.de>
2014-10-23  Carlos O'Donell  <carlos@systemhalted.org>
    Helge Deller <deller@gmx.de>

[BZ #17508]
* sysdeps/unix/sysv/linux/hppa/bits/signum.h: Remove SIGEMT.
Define SIGSTKFLT as 7. Define SIGSYS as 31. Define SIGXCPU as 12.
Remove SIGLOST. Define SIGXFSZ as 30. Define __SIGRTMIN as 32.

9 years agoDon't use INTDEF for powerpc32 compat symbols (bug 14132).
Joseph Myers [Thu, 23 Oct 2014 21:43:41 +0000 (21:43 +0000)]
Don't use INTDEF for powerpc32 compat symbols (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch removes the use of INTUSE to rename symbols in
sysdeps/powerpc/powerpc32/libgcc-compat.S.  As the names in question
are purely internal to this particular object and not used anywhere
else, it doesn't matter at all whether __*_v_glibc20 or __*_internal
is used, so this patch just removes the macros in question.

Tested for powerpc32 that stripped installed shared libraries are
unchanged by this patch.

[BZ #14132]
* sysdeps/powerpc/powerpc32/libgcc-compat.S (__ashldi3_v_glibc20):
Remove macro definition.
(__ashrdi3_v_glibc20): Likewise.
(__lshrdi3_v_glibc20): Likewise.
(__cmpdi2_v_glibc20): Likewise.
(__ucmpdi2_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__fixdfdi_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__fixsfdi_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__fixunsdfdi_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__fixunssfdi_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__floatdidf_v_glibc20): Likewise.
[!_SOFT_FLOAT && !__NO_FPRS__] (__floatdisf_v_glibc20): Likewise.

9 years agoRework some nscd code not to use variable-length struct types.
Roland McGrath [Wed, 22 Oct 2014 20:17:20 +0000 (13:17 -0700)]
Rework some nscd code not to use variable-length struct types.

9 years agoARM: Use movw/movt more when available
Roland McGrath [Wed, 22 Oct 2014 21:20:35 +0000 (14:20 -0700)]
ARM: Use movw/movt more when available

9 years agoMIPS: Avoid a dangling `vfork@GLIBC_2.0' reference
Maciej W. Rozycki [Wed, 22 Oct 2014 14:20:37 +0000 (15:20 +0100)]
MIPS: Avoid a dangling `vfork@GLIBC_2.0' reference

This satisfies a symbol reference created with:

.symver __libc_vfork, vfork@GLIBC_2.0

where `__libc_vfork' has not been defined or referenced.  In this case
the `vfork@GLIBC_2.0' reference is supposed to be discarded, however a
bug present in GAS since forever causes an undefined symbol table entry
to be created.  This in turn triggers a problem in the linker that can
manifest itself by link errors such as:

ld: libpthread.so: invalid string offset 2765592330 >= 5154 for section `.dynstr'

The GAS and linker bugs need to be resolved, but we can avoid them too
by providing a `__libc_vfork' definition just like our other platforms.

[BZ #17485]
* sysdeps/unix/sysv/linux/mips/vfork.S (__libc_vfork): Define.

9 years agoDon't use INTDEF with __ldexpf (bug 14132).
Joseph Myers [Tue, 21 Oct 2014 23:11:49 +0000 (23:11 +0000)]
Don't use INTDEF with __ldexpf (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch removes the use of INTDEF for __ldexpf.  As far as I can tell,
the resulting alias is completely unused.

Tested for x86_64 that stripped installed shared libraries are
unchanged by this patch.

[BZ #14132]
* math/s_ldexpf.c (__ldexpf): Do not use INTDEF.

9 years agoAvoid local PLT reference in __nptl_main.
Roland McGrath [Tue, 21 Oct 2014 17:18:17 +0000 (10:18 -0700)]
Avoid local PLT reference in __nptl_main.

9 years agoTiny refactoring in fts to eliminate a warning.
Roland McGrath [Mon, 20 Oct 2014 22:32:26 +0000 (15:32 -0700)]
Tiny refactoring in fts to eliminate a warning.

9 years agoNPTL: Clean up gratuitous Linuxism in libpthread.so entry point.
Roland McGrath [Mon, 20 Oct 2014 21:54:12 +0000 (14:54 -0700)]
NPTL: Clean up gratuitous Linuxism in libpthread.so entry point.

9 years agoNPTL: Add some missing #include's
Roland McGrath [Mon, 20 Oct 2014 21:46:00 +0000 (14:46 -0700)]
NPTL: Add some missing #include's

9 years agoMake internal lock-init macros return void.
Roland McGrath [Mon, 20 Oct 2014 21:13:14 +0000 (14:13 -0700)]
Make internal lock-init macros return void.

9 years agopthread_once: Add fast path and remove x86 variants.
Torvald Riegel [Sun, 19 Oct 2014 19:59:26 +0000 (21:59 +0200)]
pthread_once: Add fast path and remove x86 variants.

9 years agopthread_once: Clean up constants.
Torvald Riegel [Fri, 11 Oct 2013 15:58:04 +0000 (18:58 +0300)]
pthread_once: Clean up constants.

[BZ #15215] This just gives a name to the integer constants being used.

9 years agoMove readv and writev definitions to syscalls.list (bug 14138).
Joseph Myers [Mon, 20 Oct 2014 15:49:08 +0000 (15:49 +0000)]
Move readv and writev definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves definitions of readv and writev.

The relevant syscalls.list entries were already in
sysdeps/unix/syscalls.list, but to match the C files they needed to
have the names __libc_readv and __libc_writev added.  In fact, I don't
see anything making use of those names - as far as I can tell, these
functions could just be defined as __readv and __writev with aliases
readv and writev.  But cleaning up unnecessary aliases for functions
should be a separate matter from cleaning up unnecessary C syscall
wrappers.

Tested for x86_64.

[BZ #14138]
* sysdeps/unix/syscalls.list (readv): Use __libc_readv as strong
name.
(writev): Use __libc_writev as strong name.
* sysdeps/unix/sysv/linux/readv.c: Remove file.
* sysdeps/unix/sysv/linux/writev.c: Likewise.

9 years agoRemove obsolete TLS_DEFINE_INIT_TP fallback.
Roland McGrath [Fri, 17 Oct 2014 22:40:36 +0000 (15:40 -0700)]
Remove obsolete TLS_DEFINE_INIT_TP fallback.

9 years agoNPTL: Clean up THREAD_SYSINFO macros.
Roland McGrath [Fri, 17 Oct 2014 22:03:00 +0000 (15:03 -0700)]
NPTL: Clean up THREAD_SYSINFO macros.

9 years agoNPTL: Conditionalize direct futex syscall uses.
Roland McGrath [Fri, 17 Oct 2014 21:30:16 +0000 (14:30 -0700)]
NPTL: Conditionalize direct futex syscall uses.

9 years agoNPTL: Conditionalize more uses of SIGCANCEL and SIGSETXID.
Roland McGrath [Fri, 17 Oct 2014 20:40:46 +0000 (13:40 -0700)]
NPTL: Conditionalize more uses of SIGCANCEL and SIGSETXID.

9 years agoFix NPTL build error when missing __NR_set_robust_list.
Roland McGrath [Fri, 17 Oct 2014 18:30:15 +0000 (11:30 -0700)]
Fix NPTL build error when missing __NR_set_robust_list.

9 years agoFix up incorrect formatting in last commit
Siddhesh Poyarekar [Fri, 17 Oct 2014 10:22:46 +0000 (15:52 +0530)]
Fix up incorrect formatting in last commit

9 years agostrcoll: improve performance by removing the cache (#15884)
Leonhard Holz [Fri, 17 Oct 2014 10:17:23 +0000 (15:47 +0530)]
strcoll: improve performance by removing the cache (#15884)

this is a path that should solve bug 15884. It complains about the performance
of strcoll(). It was found out that the runtime of strcoll() is actually bound
to strlen which is needed for calculating the size of a cache that was
installed to improve the comparison performance.

The idea for this patch was that the cache is only useful in rare cases
(strings of same length and same first-level-chars) and that it would be
better to avoid memory allocation at all. To prove this I wrote a performance
test bench-strcoll.c with test data in benchtests-strcoll.tar.gz. Also
modifications in benchtests/Makefile and localedata/Makefile are necessary to
make it work.

After removing the cache the strcoll method showed the predicted behavior
(getting slightly faster) in all but the test case for hindi word sorting.
This was due the hindi text having much more equal words than the other ones.
For equal strings the performance was worse since all comparison levels were
run through and from the second level on the cache improved the comparison
performance of the original version.

Therefore I added a bytewise test via strcmp iff the first level comparison
found that both strings did match because in this case it is very likely that
equal strings are compared. This solved the problem with the hindi test case
and improved the performance of the others.

Performance comparison:

glibc files     -33.77%
vi_VN.UTF-8     -34.12%
en_US.UTF-8     -42.42%
ar_SA.UTF-8     -27.49%
zh_CN.UTF-8     +07.90%
cs_CZ.UTF-8     -29.67%
en_GB.UTF-8     -28.50%
da_DK.UTF-8     -36.57%
pl_PL.UTF-8     -39.31%
fr_FR.UTF-8     -28.57%
pt_PT.UTF-8     -22.82%
el_GR.UTF-8     -26.77%
ru_RU.UTF-8     -35.81%
iw_IL.UTF-8     -35.34%
es_ES.UTF-8     -34.46%
hi_IN.UTF-8     -00.38%
sv_SE.UTF-8     -36.99%
hu_HU.UTF-8     -16.35%
tr_TR.UTF-8     -27.80%
is_IS.UTF-8     -33.24%
it_IT.UTF-8     -24.39%
sr_RS.UTF-8     -37.55%
ja_JP.UTF-8     +02.84%

9 years agoRemove sysdeps/arm/soft-fp directory.
Roland McGrath [Thu, 16 Oct 2014 16:54:45 +0000 (09:54 -0700)]
Remove sysdeps/arm/soft-fp directory.

9 years agoconformtest: clean up POSIX expections for sys/utsname.h, sys/wait.h.
Joseph Myers [Tue, 14 Oct 2014 17:00:11 +0000 (17:00 +0000)]
conformtest: clean up POSIX expections for sys/utsname.h, sys/wait.h.

Continuing the series of patches to clean up conformtest expectations
for "POSIX" (1995/6) based on review of the expectations against the
standard, this patch cleans up expectations for sys/utsname.h and
sys/wait.h.  Tested x86_64; a new XFAIL for sys/wait.h is added.

* conform/data/sys/utsname.h-data (*_t): Allow.
* conform/data/sys/wait.h-data [POSIX] (uid_t): Do not define.
[POSIX] (WEXITED): Do not expect constant.
[POSIX] (WSTOPPED): Likewise.
[POSIX] (WNOHANG): Likewise.
[POSIX] (WNOWAIT): Likewise.
[POSIX] (siginfo_t): Do not expect type or elements.
[POSIX] (pid_t): Do not expect type.
[POSIX] (signal.h): Do not allow header.
[POSIX] (sys/resource.h): Likewise.
[POSIX] (si_*): Do not allow pattern.
[POSIX] (W*): Likewise.
[POSIX] (P_*): Likewise.
[POSIX] (BUS_*): Likewise.
[POSIX] (CLD_*): Likewise.
[POSIX] (FPE_*): Likewise.
[POSIX] (ILL_*): Likewise.
[POSIX] (POLL_*): Likewise.
[POSIX] (SEGV_*): Likewise.
[POSIX] (SI_*): Likewise.
[POSIX] (TRAP_*): Likewise.
* conform/Makefile (test-xfail-POSIX/sys/wait.h/conform): New
variable.

9 years agoFix infinite loop in check_pf (BZ #12926)
Siddhesh Poyarekar [Tue, 14 Oct 2014 15:35:33 +0000 (21:05 +0530)]
Fix infinite loop in check_pf (BZ #12926)

The recvmsg could return 0 under some conditions and cause the
make_request function to be stuck in an infinite loop.

Thank you Jim King <jim.king@simplivity.com> for posting Paul's patch
on the list.

9 years agoRemove CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE.
Joseph Myers [Fri, 10 Oct 2014 17:05:58 +0000 (17:05 +0000)]
Remove CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE.

As far as I can tell, CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE are old
notes from the addition of cancellation support to glibc and are not
currently used by any glibc testcases or otherwise in the build
process, and it does not seem useful to me to keep them around.  This
patch removes them.

Tested for x86_64.

* CANCEL-FCT-WAIVE: Remove file.
* CANCEL-FILE-WAIVE: Likewise.

9 years agoDon't use INTVARDEF/INTUSE with __libc_enable_secure (bug 14132).
Joseph Myers [Fri, 10 Oct 2014 11:13:11 +0000 (11:13 +0000)]
Don't use INTVARDEF/INTUSE with __libc_enable_secure (bug 14132).

Continuing the removal of the obsolete INTDEF / INTVARDEF / INTUSE
mechanism, this patch replaces its use for __libc_enable_secure with
the use of rtld_hidden_data_def and rtld_hidden_proto.

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

[BZ #14132]
* elf/dl-sysdep.c (__libc_enable_secure): Use rtld_hidden_data_def
instead of INTVARDEF.
(_dl_sysdep_start): Do not use INTUSE with __libc_enable_secure.
* sysdeps/mach/hurd/dl-sysdep.c (__libc_enable_secure): Use
rtld_hidden_data_def instead of INTVARDEF.
(_dl_sysdep_start): Do not use INTUSE with __libc_enable_secure.
* elf/dl-deps.c (expand_dst): Likewise.
* elf/dl-load.c (_dl_dst_count): Likewise.
(_dl_dst_substitute): Likewise.
(decompose_rpath): Likewise.
(_dl_init_paths): Likewise.
(open_path): Likewise.
(_dl_map_object): Likewise.
* elf/rtld.c (dl_main): Likewise.
(process_dl_audit): Likewise.
(process_envvars): Likewise.
* include/unistd.h [IS_IN_rtld] (__libc_enable_secure_internal):
Remove declaration.
(__libc_enable_secure): Use rtld_hidden_proto.

9 years agoremove nested functions from elf/dl-load.c
Kostya Serebryany [Thu, 9 Oct 2014 18:15:24 +0000 (11:15 -0700)]
remove nested functions from elf/dl-load.c

9 years agosoft-fp: Use parentheses around macro arguments.
Joseph Myers [Thu, 9 Oct 2014 17:05:26 +0000 (17:05 +0000)]
soft-fp: Use parentheses around macro arguments.

This patch cleans up the soft-fp code to use parentheses around macro
arguments (where possible; many macro arguments are identifiers used
with ## rather than arbitrary expressions, so cannot be put in
parentheses).  (I'm not aware of any bugs caused by the lack of
parentheses, but this is generally good practice.  The patch is not
exhaustive regarding internal macros where the arguments always come
directly from the mantissa of a floating-point number, although
probably those should be cleaned up in this regard as well.)

Tested for powerpc-nofpu that the installed shared libraries are
unchanged by this patch.

* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use
parentheses around macro arguments.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_D): Likewise.
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_E):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_E): Likewise.
* soft-fp/op-1.h (_FP_FRAC_SRST_1): Likewise.
(_FP_FRAC_SRS_1): Likewise.
(_FP_FRAC_CLZ_1): Likewise.
(_FP_MUL_MEAT_1_imm): Likewise.
(_FP_MUL_MEAT_1_wide): Likewise.
(_FP_MUL_MEAT_1_hard): Likewise.
(_FP_SQRT_MEAT_1): Likewise.
(_FP_FRAC_ASSEMBLE_1): Likewise.
(_FP_FRAC_DISASSEMBLE_1): Likewise.
* soft-fp/op-2.h (_FP_FRAC_CLZ_2): Likewise.
(__FP_CLZ_2): Likewise.
(_FP_MUL_MEAT_2_wide): Likewise.
(_FP_MUL_MEAT_2_wide_3mul): Likewise.
(_FP_MUL_MEAT_2_gmp): Likewise.
(_FP_MUL_MEAT_2_120_240_double): Likewise.
(_FP_SQRT_MEAT_2): Likewise.
(_FP_FRAC_ASSEMBLE_2): Likewise.
(_FP_FRAC_DISASSEMBLE_2): Likewise.
* soft-fp/op-4.h (_FP_FRAC_SRS_4): Likewise.
(_FP_FRAC_CLZ_4): Likewise.
(_FP_MUL_MEAT_4_wide): Likewise.
(_FP_MUL_MEAT_4_gmp): Likewise.
(_FP_SQRT_MEAT_4): Likewise.
(_FP_FRAC_ASSEMBLE_4): Likewise.
(_FP_FRAC_DISASSEMBLE_4): Likewise.
* soft-fp/op-common.h (_FP_CMP): Likewise.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Likewise.
(_FP_TO_INT): Likewise.
(_FP_FROM_INT): Likewise.
[!__FP_CLZ] (__FP_CLZ): Likewise.
(_FP_DIV_HELP_imm): Likewise.
* soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_Q):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_Q): Likewise.
* soft-fp/single.h (FP_UNPACK_RAW_S): Likewise.
(FP_UNPACK_RAW_SP): Likewise.
(FP_PACK_RAW_S): Likewise.
(FP_PACK_RAW_SP): Likewise.
(FP_UNPACK_S): Likewise.
(FP_UNPACK_SP): Likewise.
(FP_UNPACK_SEMIRAW_S): Likewise.
(FP_UNPACK_SEMIRAW_SP): Likewise.
(FP_PACK_S): Likewise.
(FP_PACK_SP): Likewise.
(FP_PACK_SEMIRAW_S): Likewise.
(FP_PACK_SEMIRAW_SP): Likewise.
(_FP_SQRT_MEAT_S): Likewise.
(FP_CMP_S): Likewise.
(FP_CMP_EQ_S): Likewise.
(FP_CMP_UNORD_S): Likewise.
(FP_TO_INT_S): Likewise.
(FP_FROM_INT_S): Likewise.

9 years agosoft-fp: Support rsigned == 2 in _FP_TO_INT.
Joseph Myers [Thu, 9 Oct 2014 15:00:37 +0000 (15:00 +0000)]
soft-fp: Support rsigned == 2 in _FP_TO_INT.

Continuing the addition of soft-fp features in the Linux kernel
version, this patch adds _FP_TO_INT support for rsigned == 2 (reduce
overflowing results modulo 2^rsize to fit in the destination, used for
alpha emulation).

The kernel version is buggy; it can left shift by a negative amount
when right shifting is required in an overflow case (the kernel
version also has other bugs fixed long ago in glibc; at least,
spurious exceptions converting to the most negative integer).  This
version avoids that by handling overflow (other than to 0) for rsigned
== 2 along with the normal non-overflow case, which already properly
determines the direction in which to shift.

Tested for powerpc-nofpu.  Some functions get slightly bigger and some
get slightly smaller, no doubt as a result of the change to where in
the macro "inexact" is raised, but I don't think those changes are
significant.  Also tested for powerpc-nofpu with the relevant __fix*
functions changed to use rsigned == 2 (which is after all just as
valid as rsigned == 1 in IEEE terms), including verifying the results
and exceptions for various cases of conversions.

With these seven patches, the one remaining feature to add for the
soft-fp code to have all the features of the kernel version is
_FP_TO_INT_ROUND.

* soft-fp/op-common.h (_FP_TO_INT): Handle rsigned == 2.

9 years agosoft-fp: Support more precise "invalid" exceptions.
Joseph Myers [Thu, 9 Oct 2014 14:59:23 +0000 (14:59 +0000)]
soft-fp: Support more precise "invalid" exceptions.

As previously discussed
<https://sourceware.org/ml/libc-alpha/2013-10/msg00345.html>, it would
be desirable to be able to use the same version of the soft-fp code in
the Linux kernel as well as in glibc and libgcc (instead of an old
version in the kernel that's missing ten years of bug fixes,
performance improvements and new features), and to that end it is
useful to add to glibc's copy features in the kernel's copy, even when
they are not directly useful in glibc.

To that end, this patch adds one of those features: support for more
precise "invalid" exceptions describing the particular kind of invalid
operation.  These are relevant for powerpc emulation, and are also as
described in IEEE 754-2008 as sub-exceptions.

The set of sub-exceptions here is the union of those supported on
powerpc and those from IEEE 754-2008 (the former adds a distinction
between 0/0 and Inf/Inf; the latter adds a distinction between Inf*0
from multiplication and the same from fma).  This includes
sub-exceptions for sqrt, conversions to integer and comparisons that
are not supported in the kernel; I see no obvious reason for these
being missing from the kernel support, given that they are supported
on powerpc so accurate powerpc emulation should generate them.

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/soft-fp.h (FP_EX_INVALID_SNAN): New macro.
(FP_EX_INVALID_IMZ): Likewise.
(FP_EX_INVALID_IMZ_FMA): Likewise.
(FP_EX_INVALID_ISI): Likewise.
(FP_EX_INVALID_ZDZ): Likewise.
(FP_EX_INVALID_IDI): Likewise.
(FP_EX_INVALID_SQRT): Likewise.
(FP_EX_INVALID_CVI): Likewise.
(FP_EX_INVALID_VC): Likewise.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Specify more precise
"invalid" exceptions.
(_FP_CHECK_SIGNAN_SEMIRAW): Likewise.
(_FP_ADD_INTERNAL): Likewise.
(_FP_MUL): Likewise.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.
(_FP_CMP_CHECK_NAN): Likewise.
(_FP_SQRT): Likewise.
(_FP_TO_INT): Likewise.
(FP_EXTEND): Likewise.