Roland McGrath [Thu, 3 Sep 2015 23:26:59 +0000 (16:26 -0700)]
Mark elf/tst-protected1[ab] as XFAIL.
Joseph Myers [Thu, 3 Sep 2015 20:33:46 +0000 (20:33 +0000)]
Rename bits/libc-tsd.h to libc-tsd.h (bug 14912).
It was noted in
<https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the
bits/*.h naming scheme should only be used for installed headers.
This patch renames bits/libc-tsd.h to plain libc-tsd.h to follow that
convention.
Tested for x86_64 (testing, and that installed stripped shared
libraries are unchanged by the patch).
[BZ #14912]
* bits/libc-tsd.h: Move to ...
* sysdeps/generic/libc-tsd.h: ...here.
(_GENERIC_BITS_LIBC_TSD_H): Rename macro to _GENERIC_LIBC_TSD_H.
* sysdeps/mach/hurd/bits/libc-tsd.h: Move to ...
* sysdeps/mach/hurd/libc-tsd.h: ...here.
(_BITS_LIBC_TSD_H): Rename macro to _LIBC_TSD_H.
* include/ctype.h: Include <libc-tsd.h> instead of
<bits/libc-tsd.h>.
* include/rpc/rpc.h: Likewise.
* locale/localeinfo.h: Likewise.
* sunrpc/rpc_thread.c: Likewise.
* sysdeps/mach/hurd/malloc-machine.h: Likewise.
* sysdeps/nptl/malloc-machine.h: Likewise.
Joseph Myers [Thu, 3 Sep 2015 20:25:55 +0000 (20:25 +0000)]
Don't install bits/libc-lock.h or bits/stdio-lock.h.
The bits/libc-lock.h and bits/stdio-lock.h headers are installed, but
not used by any other installed header.
Accordingly, this patch stops these headers from being installed. A
followup is intended to move these headers out of the bits/ namespace.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* Makefile (headers): Remove bits/libc-lock.h.
* libio/Makefile (headers): Remove bits/stdio-lock.h.
Joseph Myers [Thu, 3 Sep 2015 20:24:54 +0000 (20:24 +0000)]
Don't include <bits/stdio-lock.h> from installed <libio.h>.
Every so often someone gets confused by the fact that the installed
<bits/stdio-lock.h> header includes the non-installed <lowlevellock.h>
header.
This inclusion is not in fact a bug, because <bits/stdio-lock.h> only
gets included by any header that users should include directly if
_IO_MTSAFE_IO is defined, and that's an internal define used when
building libio, not a feature test macro it's valid for users to
define. However, on general principles it's best to have as little as
possible in the installed headers that is inapplicable for valid uses
of the installed glibc.
This patch moves the include of <bits/stdio-lock.h> to the internal
header include/libio.h, so that even if someone defines _IO_MTSAFE_IO
it won't get included. This is intended as preparation for stopping
<bits/stdio-lock.h> and <bits/libc-lock.h> from being installed at all
(after this patch they aren't used in any installed header; formally
of course they don't need to be installed even before this patch, but
stopping them being installed before removing the #include would just
exacerbate the confusion described above), and then moving those out
of the bits/ namespace in accordance with the principle that that
namespace is only for installed headers.
The tests scanf15.c and scanf17.c avoid the internal headers; after
this patch that means they need to undefine _IO_MTSAFE_IO as well as
_LIBC so as to get a working _IO_lock_t definition for libio.h. This
brings them closer to using the headers as an installed program would,
which clearly accords with the intent of those tests.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* libio/libio.h [_IO_MTSAFE_IO]: Remove include of
<bits/stdio-lock.h> and commented-out include of <comthread.h>.
* include/libio.h [!_ISOMAC && _IO_MTSAFE_IO]: Include
<bits/stdio-lock.h>.
* stdio-common/scanf15.c (_IO_MTSAFE_IO): Undefine.
* stdio-common/scanf17.c (_IO_MTSAFE_IO): Likewise.
Paul Pluzhnikov [Tue, 1 Sep 2015 15:48:15 +0000 (08:48 -0700)]
Fix BZ #18757.
Paul Pluzhnikov [Tue, 1 Sep 2015 15:35:38 +0000 (08:35 -0700)]
Filter out NULL entries.
Joseph Myers [Tue, 1 Sep 2015 13:47:25 +0000 (13:47 +0000)]
Add netinet/in.h values from Linux 4.2.
This patch adds new constants from Linux 4.2 to netinet/in.h:
IPPROTO_MPLS and IP_BIND_ADDRESS_NO_PORT (both in
include/uapi/linux/in.h in Linux; one directly in netinet/in.h, one in
bits/in.h in glibc).
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* inet/netinet/in.h (IPPROTO_MPLS): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/in.h (IP_BIND_ADDRESS_NO_PORT): New
macro.
Joseph Myers [Tue, 1 Sep 2015 13:45:49 +0000 (13:45 +0000)]
Add more TCP_* values to netinet/tcp.h.
This patch adds move TCP_* values to sysdeps/gnu/netinet/tcp.h to
bring it up to date with Linux 4.2. TCP_SAVE_SYN and TCP_SAVED_SYN
are new in 4.2, TCP_NOTSENT_LOWAT and TCP_CC_INFO are older (Szabolcs
previously noted in
<https://sourceware.org/ml/libc-alpha/2015-06/msg00938.html> that this
header was out of date in glibc).
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* sysdeps/gnu/netinet/tcp.h (TCP_NOTSENT_LOWAT): New macro.
(TCP_CC_INFO): Likewise.
(TCP_SAVE_SYN): Likewise.
(TCP_SAVED_SYN): Likewise.
Brett Neumeier [Mon, 31 Aug 2015 22:27:21 +0000 (15:27 -0700)]
Fix non-v9 32-bit sparc build.
[BZ #18870]
* sysdeps/sparc/sparc32/sem_open.c: Add missing #include
Paul Eggert [Wed, 26 Aug 2015 06:42:01 +0000 (23:42 -0700)]
Fix broken overflow check in posix_fallocate [BZ 18873]
* sysdeps/posix/posix_fallocate.c (posix_fallocate):
* sysdeps/posix/posix_fallocate64.c (__posix_fallocate64_l64):
Fix parenthesization typo.
Mike Frysinger [Sat, 29 Aug 2015 22:10:50 +0000 (18:10 -0400)]
NEWS: add #18887
Mike Frysinger [Fri, 28 Aug 2015 21:08:49 +0000 (17:08 -0400)]
getmntent: fix memory corruption w/blank lines [BZ #18887]
The fix for BZ #17273 introduced a single byte of memory corruption when
the line is entirely blank. It would walk back past the start of the
buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
buffer = '\n';
end_ptr = buffer;
while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
end_ptr--;
*end_ptr = '\0';
Fix that and rework the tests. Adding the testcase for BZ #17273 to the
existing \040 parser does not really make sense as it's unrelated, and
leads to confusing behavior: it implicitly relies on the new entry being
longer than the previous entry (since it just rewinds the FILE*). Split
it out into its own dedicated testcase instead.
Mike Frysinger [Sat, 29 Aug 2015 20:43:43 +0000 (16:43 -0400)]
de.po: fix SIGALRM typo [BZ #4404]
James Perkins [Mon, 17 Aug 2015 20:48:39 +0000 (13:48 -0700)]
time/tst-strptime2.c: test full input range +/- 0-9999
strptime's %z specifier parses a string consisting of a sign ('+'
or '-'), two hours digits, and optionally two minutes digits, into a
tm.tm_gmtoff field containing the signed number of seconds the time
zone is offset from UTC time.
The time/tst-strptime2.c program passes a short list of strings through
strptime, validating that either the gmtoff value returned matches an
expected value, or that strptime returns an expected NULL for invalid
strings (for example, when the minutes portion of the string is outside
of the range 00 to 59, or the sign is missing before the hours digits).
In review of strptime fixes, Carlos O'Donell expressed a wish that
the test function iterate through the entire range of all possible
numeric strings (-9999 to +9999) which could be passed to strptime %z,
and validate the correct response.
Specifically, the test will look for a NULL response from strptime
when:
* sign ('+' or '-') is not present before the first digit (invalid
format).
* A sign and no digits are found (invalid format).
* A sign and one digit are found (invalid format).
* A sign and three digits are found (invalid format).
* A sign and four digits (-9999 to +9999) are found but the last
two digits (minutes) are in the range 60 to 99.
The test will look for a success response from strptime with
tm.tm_gmtoff matching the calculated tm_gmtoff value when:
* A sign and four digits are found (-9999 to +9999), and the last
two digits (minutes) are in the range 00 to 59.
* A sign and two digit strings are found (-99 to +99).
The test's iteration over the possible digit values results in 22223
test strings prepared, tested, and passed by strptime.
The test supports a --verbose command line option which will show
the test results of every test input, and a final summary of all
tests. Here is some sample output:
PASS: input "
1113472456 1030", expected: invalid, return value NULL
PASS: input "
1113472456 +", expected: invalid, return value NULL
PASS: input "
1113472456 -", expected: invalid, return value NULL
PASS: input "
1113472456 +0", expected: invalid, return value NULL
PASS: input "
1113472456 -0", expected: invalid, return value NULL
PASS: input "
1113472456 +1", expected: invalid, return value NULL
...
PASS: input "
1113472456 +9", expected: invalid, return value NULL
PASS: input "
1113472456 -9", expected: invalid, return value NULL
PASS: input "
1113472456 +00", expected: valid, tm.tm_gmtoff 0
PASS: input "
1113472456 -00", expected: valid, tm.tm_gmtoff 0
PASS: input "
1113472456 +01", expected: valid, tm.tm_gmtoff 3600
PASS: input "
1113472456 -01", expected: valid, tm.tm_gmtoff -3600
PASS: input "
1113472456 +02", expected: valid, tm.tm_gmtoff 7200
...
PASS: input "
1113472456 +99", expected: valid, tm.tm_gmtoff 356400
PASS: input "
1113472456 -99", expected: valid, tm.tm_gmtoff -356400
PASS: input "
1113472456 +000", expected: invalid, return value NULL
PASS: input "
1113472456 -000", expected: invalid, return value NULL
PASS: input "
1113472456 +001", expected: invalid, return value NULL
...
PASS: input "
1113472456 +999", expected: invalid, return value NULL
PASS: input "
1113472456 -999", expected: invalid, return value NULL
PASS: input "
1113472456 +0000", expected: valid, tm.tm_gmtoff 0
PASS: input "
1113472456 -0000", expected: valid, tm.tm_gmtoff 0
PASS: input "
1113472456 +0001", expected: valid, tm.tm_gmtoff 60
PASS: input "
1113472456 -0001", expected: valid, tm.tm_gmtoff -60
...
PASS: input "
1113472456 +0059", expected: valid, tm.tm_gmtoff 3540
PASS: input "
1113472456 -0059", expected: valid, tm.tm_gmtoff -3540
PASS: input "
1113472456 +0060", expected: invalid, return value NULL
PASS: input "
1113472456 -0060", expected: invalid, return value NULL
...
PASS: input "
1113472456 +0099", expected: invalid, return value NULL
PASS: input "
1113472456 -0099", expected: invalid, return value NULL
PASS: input "
1113472456 +0100", expected: valid, tm.tm_gmtoff 3600
PASS: input "
1113472456 -0100", expected: valid, tm.tm_gmtoff -3600
PASS: input "
1113472456 +0101", expected: valid, tm.tm_gmtoff 3660
...
PASS: input "
1113472456 +9999", expected: invalid, return value NULL
PASS: input "
1113472456 -9999", expected: invalid, return value NULL
PASS: 22223 input strings: 0 fail, 22223 pass
Any failing test will result in printing the failed line to stdout, and
will trigger the printing of the summary line at the of all tests. For
example:
FAIL: input "
1113472456 1030", expected: invalid, return value NULL,
got: valid, tm.tm_gmtoff 37800
FAIL: 22223 input strings: 1 fail, 22222 pass
James Perkins [Mon, 17 Aug 2015 20:48:38 +0000 (13:48 -0700)]
strptime %z: fix rounding, extend range to +/-9959 [BZ #16141]
Topic: strptime supports a %z input field descriptor, which parses a
time zone offset from UTC time into the broken-out time field tm_gmtoff.
Problems:
1) In the current implementation, the minutes portion calculation is
correct only for minutes evenly divisible by 3. This is because the
minutes value is converted to decimal time, but inadequate precision
leads to rounding which calculates results that are too low for
some values.
For example, due to rounding, a +1159 offset string results in an
incorrect tm_gmtoff of 43128 (== 11 * 3600 + 58.8 * 60) seconds,
instead of 43140 (== 11 * 3600 + 59 * 60) seconds. In contrast,
a +1157 offset (minutes divisible by 3) does not cause the bug,
and results in a correct tm_gmtoff of 43020.
2) strptime's %z specifier will not parse time offsets less than
-1200 or greater than +1200, or if only hour digits are present, less
than -12 or greater than +12. It will return NULL for offsets outside
that range. These limits do not meet historical and modern use cases:
* Present day exceeds the +1200 limit:
- Pacific/Auckland (New Zealand) summer time is +1300.
- Pacific/Kiritimati (Christmas Island) is +1400.
- Pacific/Apia (Samoa) summer time is +1400.
* Historical offsets exceeded +1500/-1500.
* POSIX supports -2459 to +2559.
* Offsets up to +/-9959 may occasionally be useful.
* Paul Eggert's notes provide additional detail:
- https://sourceware.org/ml/libc-alpha/2014-12/msg00068.html
- https://sourceware.org/ml/libc-alpha/2014-12/msg00072.html
3) tst-strptime2, part of the 'make check' test suite, does not test
for the above problems.
Corrective actions:
1) In time/strptime_l.c, calculate the offset from the hour and
minute portions directly, without the rounding errors introduced by
decimal time.
2) Remove the +/-1200 range limit, permitting strptime to parse offsets
from -9959 through +9959.
3) Add zone offset values to time/tst-strptime2.c.
* Test minutes evenly divisible by three (+1157) and not evenly
divisible by three (+1158 and +1159).
* Test offsets near the old and new range limits (-1201, -1330, -2459,
-2500, -99, -9959, +1201, +1330, +1400, +1401, +2559, +2600, +99,
and +9959)
The revised strptime passes all old and new tst-strptime2 tests.
H.J. Lu [Fri, 28 Aug 2015 19:53:19 +0000 (12:53 -0700)]
Mention 15786 in NEWS
commit
f3dcae82d54e5097e18e1d6ef4ff55c2ea4e621e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Aug 25 04:33:54 2015 -0700
Save and restore vector registers in x86-64 ld.so
also fixed
https://sourceware.org/bugzilla/show_bug.cgi?id=15786
Adhemerval Zanella [Thu, 27 Aug 2015 19:44:04 +0000 (16:44 -0300)]
Fix wordsize-32 mmap offset for negative value (BZ#18877)
This patch fixes the default wordsize-32 mmap implementation offset
calculation for negative values. Current code uses signed shift
operation to calculate the multiple size to use with syscall and
it is implementation defined. Change it to use a division base
on mmap page size (default being as before, 4096).
Tested on armv7hf.
[BZ #18877]
* posix/Makefile (tests): Add tst-mmap-offset.
* posix/tst-mmap.c: New file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c (__mmap): Fix
offset calculation for negative values.
Joseph Myers [Thu, 27 Aug 2015 22:37:51 +0000 (22:37 +0000)]
Note bug 14941 as having been fixed in 2.18.
H.J. Lu [Thu, 27 Aug 2015 16:06:26 +0000 (09:06 -0700)]
Detect and select i586/i686 implementation at run-time
We detect i586 and i686 features at run-time by checking CX8 and CMOV
CPUID features bits. We can use these information to select the best
implementation in ix86 multiarch. HAS_I586/HAS_I686 is true if i586/i686
instructions are available on the processor.
Due to the reordering and the other nifty extensions in i686, it is not
really good to use heavily i586 optimized code on an i686. It's better
to use i486 code if it isn't an i586. USE_I586/USE_I686 is true if
i586/i686 implementation should be used for the processor. USE_I586
is true only if i686 instructions aren't available. If i686 instructions
are available, we always choose i686 or i486 implementation, in that order,
and we never choose i586 implementation for i686-class processors.
* sysdeps/i386/init-arch.h: New file.
* sysdeps/i386/i586/init-arch.h: Likewise.
* sysdeps/i386/i686/init-arch.h: Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Set bit_I586
bit if CX8 is available. Set bit_I686 bit if CMOV is available.
* sysdeps/x86/cpu-features.h (bit_I586): New.
(bit_I686): Likewise.
(bit_CX8): Likewise.
(bit_CMOV): Likewise.
(index_CX8): Likewise.
(index_CMOV): Likewise.
(index_I586): Likewise.
(index_I686): Likewise.
(reg_CX8): Likewise.
(reg_CMOV): Likewise.
(HAS_I586): Defined as HAS_ARCH_FEATURE (I586) if i586 isn't
available at compile-time.
(HAS_I686): Defined as HAS_ARCH_FEATURE (I686) if i686 isn't
available at compile-time.
* sysdeps/x86/init-arch.h (USE_I586): New macro.
(USE_I686): Likewise.
H.J. Lu [Thu, 27 Aug 2015 16:04:40 +0000 (09:04 -0700)]
Add i386 memset and memcpy assembly functions
Add i386 memset and memcpy assembly functions with REP MOVSB/STOSB
instructions.
* sysdeps/i386/bcopy.S: New file.
* sysdeps/i386/bzero.S: Likewise.
* sysdeps/i386/memcpy.S: Likewise.
* sysdeps/i386/memmove.S: Likewise.
* sysdeps/i386/mempcpy.S: Likewise.
* sysdeps/i386/memset.S: Likewise.
* sysdeps/i386/bzero.c: Removed.
* sysdeps/i386/memset.c: Likewise.
* sysdeps/i386/i586/memcpy_chk.S: Likewise.
* sysdeps/i386/i586/mempcpy_chk.S: Likewise.
* sysdeps/i386/i586/memset_chk.S: Likewise.
* sysdeps/i386/i686/memcpy_chk.S: Moved to ...
* sysdeps/i386/memcpy_chk.S: Here.
* sysdeps/i386/i686/memmove_chk.S: Moved to ...
* sysdeps/i386/memmove_chk.S: Here.
* sysdeps/i386/i686/mempcpy_chk.S: Moved to ...
* sysdeps/i386/mempcpy_chk.S: Likewise.
* sysdeps/i386/i686/memset_chk.S: Moved to ...
* sysdeps/i386/memset_chk.S: Likewise.
Steve Ellcey [Thu, 27 Aug 2015 15:09:49 +0000 (08:09 -0700)]
Fix undefined warning messages in GCC 6.
GCC 6 puts out warnings in a different location then GCC 5. Move the
DIAG macros so that the warnings are supressed for both compilers.
ChangeLog:
* soft-fp/fmasf4.c: Add include of sys/cdefs.h.
Move DIAG_PUSH_NEEDS_COMMENT, DIAG_IGNORE_NEEDS_COMMENT to front of
file, move DIAG_POP_NEEDS_COMMENT to end of file.
* soft-fp/fmadf4.c: Ditto.
* soft-fp/fmatf4.c: Ditto.
H.J. Lu [Thu, 27 Aug 2015 14:59:06 +0000 (07:59 -0700)]
Remove i486 subdirectory
Since glibc doesn't support i386 any more, we can remove i486 subdirectory.
* sysdeps/i386/i586/Implies: Removed.
* sysdeps/i386/i686/Implies: Likewise.
H.J. Lu [Thu, 27 Aug 2015 14:57:36 +0000 (07:57 -0700)]
Move i486/strlen.S to strlen.S
Since glibc doesn't support i386 any more, we can move i486/strlen.S
to strlen.S.
* sysdeps/i386/i486/strlen.S: Moved to ...
* sysdeps/i386/strlen.S: Here.
H.J. Lu [Thu, 27 Aug 2015 14:56:19 +0000 (07:56 -0700)]
Move i486/strcat.S to strcat.S
Since glibc doesn't support i386 any more, we can move i486/strcat.S
to strcat.S.
* sysdeps/i386/i486/strcat.S: Moved to ...
* sysdeps/i386/strcat.S: Here.
* sysdeps/i386/i686/multiarch/strcat.S: Updated.
H.J. Lu [Thu, 27 Aug 2015 14:55:13 +0000 (07:55 -0700)]
Move i486/pthread_spin_trylock.S to pthread_spin_trylock.S
Since glibc doesn't support i386 any more, we can move
i486/pthread_spin_trylock.S to pthread_spin_trylock.S
* sysdeps/i386/i486/pthread_spin_trylock.S: Moved to ...
* sysdeps/i386/pthread_spin_trylock.S: Here.
* sysdeps/i386/i586/pthread_spin_trylock.S: Removed.
* sysdeps/i386/i686/pthread_spin_trylock.S: Updated.
H.J. Lu [Thu, 27 Aug 2015 14:51:35 +0000 (07:51 -0700)]
Move i486/string-inlines.c to string-inlines.c
Since glibc doesn't support i386 any more, we can move
i486/string-inlines.c to string-inlines.c.
* sysdeps/i386/i486/string-inlines.c: Moved to ...
* sysdeps/i386/string-inlines.c: Here.
H.J. Lu [Thu, 27 Aug 2015 14:50:23 +0000 (07:50 -0700)]
Move i486/htonl.S to htonl.S
Since glibc doesn't support i386 any more, we can move i486/htonl.S to
htonl.S.
* sysdeps/i386/i486/htonl.S: Moved ...
* sysdeps/i386/htonl.S: here.
H.J. Lu [Thu, 27 Aug 2015 14:49:10 +0000 (07:49 -0700)]
Move i486/bits/atomic.h to bits/atomic.h
Since glibc doesn't support i386 any more, we can move i486/bits/atomic.h
to bits/atomic.h.
* sysdeps/i386/i486/bits/atomic.h: Moved to ...
* sysdeps/i386/bits/atomic.h: Here.
H.J. Lu [Thu, 27 Aug 2015 14:44:51 +0000 (07:44 -0700)]
Remove sysdeps/i386/i486/Versions
sysdeps/i386/i486/Versions isn't needed since it duplicates contents
in sysdeps/i386/Versions.
* sysdeps/i386/i486/Versions: Removed.
Gleb Fotengauer-Malinovskiy [Sun, 9 Aug 2015 09:11:36 +0000 (11:11 +0200)]
Mention mkdtemp as another secure alternative to mktemp
[BZ #2898]
* misc/mktemp.c: Add mkdtemp to the link_warning message.
Based on patch by Aurelien Jarno.
Stan Shebs [Wed, 26 Aug 2015 23:10:00 +0000 (16:10 -0700)]
Disable uninitialized warning with GCC 4.8
As with other spots in the code, GCC 4.8 unnecessarily complains about
an uninitialized variable in tanl calcs, so this patch disables. With
it, the library and sees the usual set of test passes.
* sysdeps/ieee754/ldbl-96/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
Roland McGrath [Wed, 26 Aug 2015 21:06:09 +0000 (14:06 -0700)]
Meaningless ChangeLog cleanup to trigger buildbot.
Carlos Eduardo Seo [Wed, 19 Aug 2015 04:42:55 +0000 (01:42 -0300)]
powerpc: Sync hwcap.h with kernel
Linux commit
b4b56f9ecab40f3b4ef53e130c9f6663be491894 introduced
a new HWCAP2 bit to indicate that the kernel now aborts a memory
transaction when a syscall is made. This patch adds that bit to
sysdeps/powerpc/bits/hwcap.h.
2015-08-26 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
* sysdeps/powerpc/bits/hwcap.h: Add PPC_FEATURE2_HTM_NOSC.
* sysdeps/powerpc/dl-procinfo.c:
(_dl_powerpc_cap_flags): Added descriptor for this hwcap
feature so it shows when LD_SHOW_AUXV=1.
Paul E. Murphy [Thu, 13 Aug 2015 21:21:05 +0000 (16:21 -0500)]
powerpc: Revert to default atomic ops in elision code
Power ISA 2.07B section B.5.5 relaxed the barrier requirement around a
TLE enabled lock. It is now identical to a traditional lock.
2015-08-26 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__arch_compare_and_exchange_val_32_acq): Remove and use common
definition. ISA 2.07B no longer requires full sync.
Mike Frysinger [Wed, 26 Aug 2015 04:26:10 +0000 (00:26 -0400)]
mips: siginfo.h: add SIGSYS details [BZ #18863]
Linux 3.13 added SIGSYS details to siginfo_t; update glibc's copy to
keep in sync with it.
H.J. Lu [Wed, 26 Aug 2015 15:00:47 +0000 (08:00 -0700)]
Replace BZERO_P/PIC with USE_AS_BZERO/SHARED
Replace BZERO_P with USE_AS_BZERO in i586/i686 memset.S to support i386
multi-arch memset. Also we should check SHARED not PIC for libc.so
since libc.a may be compiled with PIC.
* sysdeps/i386/i586/bzero.S (USE_AS_BZERO): New.
* sysdeps/i386/i686/bzero.S (USE_AS_BZERO): Likewise.
* sysdeps/i386/i586/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): New.
* sysdeps/i386/i686/memset.S (BZERO_P): Removed.
Check USE_AS_BZERO/SHARED instead of BZERO_P/PIC.
(__memset_zero_constant_len_parameter): Don't define if
__memset_chk or USE_AS_BZERO are defined.
H.J. Lu [Wed, 26 Aug 2015 14:59:15 +0000 (07:59 -0700)]
Replace MEMPCPY_P/PIC with USE_AS_MEMPCPY/SHARED
Replace MEMPCPY_P with USE_AS_MEMPCPY in i586 memcpy.S to support i386
multi-arch memcpy. Also we should check SHARED not PIC for libc.so
since libc.a may be compiled with PIC.
* sysdeps/i386/i586/memcpy.S (MEMPCPY_P): Removed.
Check USE_AS_MEMPCPY/SHARED instead of MEMPCPY_P/PIC.
* sysdeps/i386/i586/mempcpy.S (USE_AS_MEMPCPY): New.
H.J. Lu [Wed, 26 Aug 2015 14:55:42 +0000 (07:55 -0700)]
Don't disable SSE in x86-64 ld.so
Since x86-64 ld.so preserves vector registers now, we can use SSE in
x86-64 ld.so. We should run tst-ld-sse-use.sh only on i386.
* sysdeps/x86/Makefile [$(subdir) == elf] (CFLAGS-.os,
tests-special, $(objpfx)tst-ld-sse-use.out): Moved to ...
* sysdeps/i386/Makefile [$(subdir) == elf] (CFLAGS-.os,
tests-special, $(objpfx)tst-ld-sse-use.out): Here. Update
comments.
* sysdeps/x86_64/Makefile [$(subdir) == elf] (CFLAGS-.os): Add
-mno-mmx for $(all-rtld-routines).
* sysdeps/x86/tst-ld-sse-use.sh: Moved to ...
* sysdeps/i386/tst-ld-sse-use.sh: Here. Replace x86-64 with
i386.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)]
Adjust _Unwind_Word in unwind.h to version in libgcc.
Building glibc on s390-32 with gcc option -mzarch produces the error due to
sysdeps/s390/jmpbuf-unwind.h:37:10: (void *) (_Unwind_GetCFA (_context):
cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
Building on s390-32 in esa-mode or s390-64 is fine.
_Unwind_GetCFA returns an _Unwind_Word which is an unsigned
with a size of 4 bytes on s390-32 (esa-mode) and 8 bytes on s390-64.
On s390-32 (zarch-mode), _Unwind_Word has a size of 8 bytes, too.
_Unwind_Word is defined in sysdeps/generic/unwind.h as
typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
In libgcc unwind header (<gcc-src>/libgcc/unwind-generic.h) this typedef has
changed to "typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__)));"
in June 2008.
With this mode, _Unwind_Word has a size of 4 bytes on s390-32 (zarch-mode).
The same change applies to _Unwind_Sword.
Thus this patch updates the unwind header according to these changes.
Afterwards, the int-to-pointer-cast-warning is gone away on s390-32 (zarch-mode)
and the testsuite runs with the same test-failures as s390-32 (esa-mode)
plus FAIL: c++-types-check. Here register_t is expected to has a size of 4 bytes,
but it has a size of 8 bytes due to:
posix/sys/types.h:205:typedef int register_t __attribute__ ((__mode__ (__word__)));
The libgcc-patch for gcc 4.4 can be found here:
"[PATCH, spu, unwind] Remove attribute ((mode (word))) from unwind.h"
https://gcc.gnu.org/ml/gcc-patches/2008-06/msg00969.html
ChangeLog:
* sysdeps/generic/unwind.h
(_Unwind_Word): Use __mode__(__unwind_word__)
instead of __mode__(__word__).
(_Unwind_Sword): Likewise.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)]
S390: Fix build error with gcc6 in utf8_utf16-z9.c.
This patch fixes the build error with gcc6:
array subscript is above array bounds [-Werror=array-bounds]
While including loop.c to construct the SINGLE(LOOPFCT) method
for converting from UTF-16 to UTF-8, the bytebuf array with length
MAX_NEEDED_INPUT is used as inptr. MAX_NEEDED_INPUT defaults to
MIN_NEEDED_INPUT if not defined before including loop.c.
Thus bytebuf has a length of 2.
This patch defines MAX_NEEDED_INPUT to MAX_NEEDED_TO, which is 4.
ChangeLog:
* sysdeps/s390/s390-64/utf8-utf16-z9.c
(MAX_NEEDED_INPUT): New define.
(MAX_NEEDED_OUTPUT): New define.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)]
S390: Optimize string, wcsmbs and memory functions.
This patch set introduces optimized string, wcsmbs and memory functions for
S390/S390x. The functions are accelerated by the usage of the new z13 vector
instructions.
The Principles of Operations manual for IBM z13 is publically available:
http://publibfi.boulder.ibm.com/epubs/pdf/dz9zr010.pdf
The support for these instructions in assembler was introduced by commits:
-"[Committed] S/390: Add support for IBM z13."
(https://sourceware.org/ml/binutils/2015-01/msg00197.html)
-"[Committed] S/390: Add more IBM z13 instructions"
(https://sourceware.org/ml/binutils/2015-03/msg00088.html)
The first patches do preparation for the latter optimization patches.
The floating point exception handling - fetestexcept(), ... - is fixed and
the platform and hwcap strings are extended.
The current ifunc routines memset, memcpy and memcmp are refactored and the
ifunc test-framework is now enabled.
A S390 specific configure-check tests if the used binutils supports the new
vector instructions. The optimized functions are provided via ifunc if the
binutils supports the vector instructions. Otherwise a message is dumped to
configure output and only the currently used common code functions are
available.
The optimized functions are implemented in common for s390-32 and s390-64
and the few differences are handled via #ifdef.
The ifunc-resolvers are defined in files sysdeps/s390/multiarch/<func>.c,
which choose either the current implementation __<func>_c() or the vector
implementation __<func>_vx() depending on the HWCAP_S390_VX flag bit in
AT_HWCAP field. If the bit is set, the hardware and the kernel are supporting
vector registers and instructions. If the used binutils lacks vector-support,
then the default implementation in string or wcsmbs directory is included
here instead.
The file sysdeps/s390/multiarch/<func>-c.c includes the current implementation
and defines the function name __<func>_c.
The assembler files sysdeps/s390/multiarch/<func>-vx.S with the vector
instructions are using the directive '.machine "z13"' to allow building glibc
without option '-march=z13'. Additionally the directive '.machinemode
"zarch_nohighgprs"' is needed for the 31bit glibc. This mode does not set the
highgprs flag in ELF header, which would lead to an unloadable libc on a 31bit
kernel.
The most optimized string functions are structured in the same way:
The first 16 bytes of the string is loaded unaligned via vlbb - vector load
to block boundary (e.g. 4k). This instruction loads 16 bytes if possible.
In case of a page cross, it only loads the last bytes of the current page
without a segmentation fault.
Afterwards these first part of string is processed. If e.g. for strlen the end
of string is reached within this first part, the function returns. Otherwise
the pointer is aligned to 16 byte, so i can load a full vector register with vl
without checking for a page cross. Afterwards the first part of string is
processed. If e.g. for strlen the end of string is reached within this first
part, the function returns. Otherwise the pointer is aligned to 16 byte, so
a full vector register can be loaded with vl - vector load - without checking
for a page cross. The remaining string is processed in a four times unrolled
loop, because benchmark results measured improvements compared to a non
unrolled loop.
The optimized wide string functions can only handle 4byte aligned string
pointers. Although a wchar_t pointer should always be 4byte aligned, the most
current common code wide string functions can handle non aligned strings.
Thus the optimized functions will fall back to the common code functions in
case of a non aligned wide string to behave the same as before this patch.
Some string tests can test the string and the wide string version of a function.
The remaining ones are extended and new wide string tests are added.
This is the same in case of the benchtests.
ChangeLog:
* NEWS: New item for IBM z13 string optimizations.
Stefan Liebler [Wed, 26 Aug 2015 08:26:26 +0000 (10:26 +0200)]
S390: Optimize memrchr.
This patch provides optimized version of memrchr with the z13 vector
instructions.
ChangeLog:
* sysdeps/s390/multiarch/memrchr-c.c: New File.
* sysdeps/s390/multiarch/memrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/memrchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add memrchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memrchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)]
S390: Optimize wmemcmp.
This patch provides optimized version of wmemcmp with the z13 vector
instructions.
ChangeLog:
* sysdeps/s390/multiarch/wmemcmp-c.c: New File.
* sysdeps/s390/multiarch/wmemcmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemcmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add wmemcmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for wmemcmp.
* benchtests/bench-wmemcmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wmemcmp.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)]
S390: Optimize wmemset.
This patch provides optimized version of wmemset with the z13 vector
instructions.
ChangeLog:
* sysdeps/s390/multiarch/wmemset-c.c: New File.
* sysdeps/s390/multiarch/wmemset-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemset.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add wmemset functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for wmemset.
* wcsmbs/wmemset.c: Use WMEMSET if defined.
* string/test-memset.c: Add wmemset support.
* wcsmbs/test-wmemset.c: New File.
* wcsmbs/Makefile (strop-tests): Add wmemset.
* benchtests/bench-memset.c: Add wmemset support.
* benchtests/bench-wmemset.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wmemset.
Stefan Liebler [Wed, 26 Aug 2015 08:26:25 +0000 (10:26 +0200)]
S390: Optimize memccpy.
This patch provides optimized versions of memccpy with the z13 vector
instructions.
ChangeLog:
* sysdeps/s390/multiarch/memccpy-c.c: New File.
* sysdeps/s390/multiarch/memccpy-vx.S: Likewise.
* sysdeps/s390/multiarch/memccpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Add memccpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memccpy.
* string/memccpy.c: Use MEMCCPY if defined.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)]
S390: Optimize memchr, rawmemchr and wmemchr.
This patch provides optimized versions of memchr, rawmemchr and wmemchr with the
z13 vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/memchr-vx.S: New File.
* sysdeps/s390/multiarch/memchr.c: Likewise.
* sysdeps/s390/multiarch/rawmemchr-c.c: Likewise.
* sysdeps/s390/multiarch/rawmemchr-vx.S: Likewise.
* sysdeps/s390/multiarch/rawmemchr.c: Likewise.
* sysdeps/s390/multiarch/wmemchr-c.c: Likewise.
* sysdeps/s390/multiarch/wmemchr-vx.S: Likewise.
* sysdeps/s390/multiarch/wmemchr.c: Likewise.
* sysdeps/s390/s390-32/multiarch/memchr.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memchr, wmemchr
and rawmemchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list-common.c
(__libc_ifunc_impl_list_common): Add ifunc test for memchr, rawmemchr
and wmemchr.
* wcsmbs/wmemchr.c: Use WMEMCHR if defined.
* string/test-memchr.c: Add wmemchr support.
* wcsmbs/test-wmemchr.c: New File.
* wcsmbs/Makefile (strop-tests): Add wmemchr.
* benchtests/bench-memchr.c: Add wmemchr support.
* benchtests/bench-wmemchr.c: New File.
* benchtests/Makefile (wcsmbs-bench): wmemchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)]
S390: Optimize strcspn and wcscspn.
This patch provides optimized versions of strcspn and wcscspn with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strcspn-c.c: New File.
* sysdeps/s390/multiarch/strcspn-vx.S: Likewise.
* sysdeps/s390/multiarch/strcspn.c: Likewise.
* sysdeps/s390/multiarch/wcscspn-c.c: Likewise.
* sysdeps/s390/multiarch/wcscspn-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscspn.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcspn and
wcscspn functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcspn, wcscspn.
* wcsmbs/wcscspn.c: Use WCSCSPN if defined.
* string/test-strcspn.c: Add wcscspn support.
* wcsmbs/test-wcscspn.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcscspn.
* benchtests/bench-strcspn.c: Add wcscspn support.
* benchtests/bench-wcscspn.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscspn.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)]
S390: Optimize strpbrk and wcspbrk.
This patch provides optimized versions of strpbrk and wcspbrk with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strpbrk-c.c: New File.
* sysdeps/s390/multiarch/strpbrk-vx.S: Likewise.
* sysdeps/s390/multiarch/strpbrk.c: Likewise.
* sysdeps/s390/multiarch/wcspbrk-c.c: Likewise.
* sysdeps/s390/multiarch/wcspbrk-vx.S: Likewise.
* sysdeps/s390/multiarch/wcspbrk.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strpbrk and
wcspbrk functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strpbrk, wcspbrk.
* wcsmbs/wcspbrk.c: Use WCSPBRK if defined.
* string/test-strpbrk.c: Add wcspbrk support.
* wcsmbs/test-wcspbrk.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcspbrk.
* benchtests/bench-strpbrk.c: Add wcspbrk support.
* benchtests/bench-wcspbrk.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcspbrk.
Stefan Liebler [Wed, 26 Aug 2015 08:26:24 +0000 (10:26 +0200)]
S390: Optimize strspn and wcsspn.
This patch provides optimized versions of strspn and wcsspn with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strspn-c.c: New File.
* sysdeps/s390/multiarch/strspn-vx.S: Likewise.
* sysdeps/s390/multiarch/strspn.c: Likewise.
* sysdeps/s390/multiarch/wcsspn-c.c: Likewise.
* sysdeps/s390/multiarch/wcsspn-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsspn.c: Likewise.
* wcsmbs/wcsspn.c: Use WCSSPN if defined.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strspn and
wcsspn functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strspn, wcsspn.
* string/test-strspn.c: Add wcsspn support.
* wcsmbs/test-wcsspn.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsspn.
* benchtests/bench-strspn.c: Add wcsspn support.
* benchtests/bench-wcsspn.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsspn.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)]
S390: Optimize strrchr and wcsrchr.
This patch provides optimized versions of strrchr and wcsrchr with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strrchr-c.c: New File.
* sysdeps/s390/multiarch/strrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/strrchr.c: Likewise.
* sysdeps/s390/multiarch/wcsrchr-c.c: Likewise.
* sysdeps/s390/multiarch/wcsrchr-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsrchr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strrchr and
wcsrchr functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strrchr, wcsrchr.
* benchtests/bench-wcsrchr.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsrchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)]
S390: Optimize strchrnul and wcschrnul.
This patch provides optimized versions of strchrnul and wcschrnul with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strchrnul-c.c: New File.
* sysdeps/s390/multiarch/strchrnul-vx.S: Likewise.
* sysdeps/s390/multiarch/strchrnul.c: Likewise.
* sysdeps/s390/multiarch/wcschrnul-c.c: Likewise.
* sysdeps/s390/multiarch/wcschrnul-vx.S: Likewise.
* sysdeps/s390/multiarch/wcschrnul.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchrnul and
wcschrnul functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strchrnul, wcschrnul.
* wcsmbs/wcschrnul.c: Use WCSCHRNUL if defined.
* string/test-strchr.c: Add wcschrnul support.
* wcsmbs/test-wcschrnul.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcschrnul.
* benchtests/bench-strchr.c: Add wcschrnul support.
* benchtests/bench-wcschrnul.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcschrnul.
Stefan Liebler [Wed, 26 Aug 2015 08:26:23 +0000 (10:26 +0200)]
S390: Optimize strchr and wcschr.
This patch provides optimized versions of strchr and wcschr with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strchr-c.c: New File.
* sysdeps/s390/multiarch/strchr-vx.S: Likewise.
* sysdeps/s390/multiarch/strchr.c: Likewise.
* sysdeps/s390/multiarch/wcschr-c.c: Likewise.
* sysdeps/s390/multiarch/wcschr-vx.S: Likewise.
* sysdeps/s390/multiarch/wcschr.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strchr and
wcschr functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strchr, wcschr.
* string/strchr.c (STRCHR): Define and use macro.
* benchtests/bench-wcschr.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcschr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)]
S390: Optimize strncmp and wcsncmp.
This patch provides optimized versions of strncmp and wcsncmp with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strncmp-c.c: New File.
* sysdeps/s390/multiarch/strncmp-vx.S: Likewise.
* sysdeps/s390/multiarch/strncmp.c: Likewise.
* sysdeps/s390/multiarch/wcsncmp-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncmp and
wcsncmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncmp, wcsncmp.
* wcsmbs/wcsncmp.c (WCSNCMP): Define and use macro.
* benchtests/bench-strncmp.c: Add wcsncmp support.
* benchtests/bench-wcsncmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncmp.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)]
S390: Optimize strcmp and wcscmp.
This patch provides optimized versions of strcmp and wcscmp with the z13
vector instructions.
The architecture specific string.h had a typo, which leads to ommiting the
inline version in this file if __USE_STRING_INLINES is defined.
Tested this inline version by tweaking test-strcmp.c.
ChangeLog:
* sysdeps/s390/multiarch/strcmp-vx.S: New File.
* sysdeps/s390/multiarch/strcmp.c: Likewise.
* sysdeps/s390/multiarch/wcscmp-c.c: Likewise.
* sysdeps/s390/multiarch/wcscmp-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscmp.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strcmp.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strcmp.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcmp and
wcscmp functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcmp, wcscmp.
* string/strcmp.c (STRCMP): Define and use macro.
* benchtests/bench-wcscmp.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscmp.
* sysdeps/s390/bits/string.h: Fix typo: _HAVE_STRING_ARCH_strcmp
instead of _HAVE_STRING_ARCH_memchr.
Stefan Liebler [Wed, 26 Aug 2015 08:26:22 +0000 (10:26 +0200)]
S390: Optimize strncat wcsncat.
This patch provides optimized versions of strncat and wcsncat with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strncat-c.c: New File.
* sysdeps/s390/multiarch/strncat-vx.S: Likewise.
* sysdeps/s390/multiarch/strncat.c: Likewise.
* sysdeps/s390/multiarch/wcsncat-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncat-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncat.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncat and
wcsncat functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncat, wcsncat.
* wcsmbs/wcsncat.c (WCSNCAT): Define and use macro.
* string/test-strncat.c: Add wcsncat support.
* wcsmbs/test-wcsncat.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsncat.
* benchtests/bench-strncat.c: Add wcsncat support.
* benchtests/bench-wcsncat.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncat.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)]
S390: Optimize strcat and wcscat.
This patch provides optimized versions of strcat and wcscat with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strcat-c.c: New File.
* sysdeps/s390/multiarch/strcat-vx.S: Likewise.
* sysdeps/s390/multiarch/strcat.c: Likewise.
* sysdeps/s390/multiarch/wcscat-c.c: Likewise.
* sysdeps/s390/multiarch/wcscat-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscat.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcat and
wcscat functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcat, wcscat.
* string/strcat.c (STRCAT): Define and use macro.
* wcsmbs/wcscat.c: Use WCSCAT if defined.
* string/test-strcat.c: Add wcscat support.
* wcsmbs/test-wcscat.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcscat.
* benchtests/bench-strcat.c: Add wcscat support.
* benchtests/bench-wcscat.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscat.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)]
S390: Optimize stpncpy and wcpncpy.
This patch provides optimized versions of stpncpy and wcpncpy with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/stpncpy-c.c: New File.
* sysdeps/s390/multiarch/stpncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/stpncpy.c: Likewise.
* sysdeps/s390/multiarch/wcpncpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcpncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcpncpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpncpy and
wcpncpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for stpncpy, wcpncpy.
* wcsmbs/wcpncpy.c: Use WCPNCPY if defined.
* string/test-stpncpy.c: Add wcpncpy support.
* wcsmbs/test-wcpncpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcpncpy.
* benchtests/bench-stpncpy.c: Add wcpncpy support.
* benchtests/bench-wcpncpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcpncpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)]
S390: Optimize strncpy and wcsncpy.
This patch provides optimized versions of strncpy and wcsncpy with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strncpy-vx.S: New File.
* sysdeps/s390/multiarch/strncpy.c: Likewise.
* sysdeps/s390/multiarch/wcsncpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcsncpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsncpy.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strncpy.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strncpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strncpy and
wcsncpy functions.
* wcsmbs/wcsncpy.c: Use WCSNCPY if defined.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strncpy, wcsncpy.
* string/test-strncpy.c: Add wcsncpy support.
* wcsmbs/test-wcsncpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsncpy.
* benchtests/bench-strncpy.c: Add wcsncpy support.
* benchtests/bench-wcsncpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsncpy
Stefan Liebler [Wed, 26 Aug 2015 08:26:21 +0000 (10:26 +0200)]
S390: Optimize stpcpy and wcpcpy.
This patch provides optimized versions of stpcpy and wcpcpy with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/stpcpy-c.c: New File.
* sysdeps/s390/multiarch/stpcpy-vx.S: Likewise.
* sysdeps/s390/multiarch/stpcpy.c: Likewise.
* sysdeps/s390/multiarch/wcpcpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcpcpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcpcpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add stpcpy and
wcpcpy functions.
* string/stpcpy.c: Use STPCPY if defined.
* wcsmbs/wcpcpy.c: Use WCPCPY if defined.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for stpcpy, wcpcpy.
* string/test-stpcpy.c: Add wcpcpy support.
* wcsmbs/test-wcpcpy.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcpcpy.
* benchtests/bench-stpcpy.c: Add wcpcpy support.
* benchtests/bench-wcpcpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcpcpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)]
S390: Optimize strcpy and wcscpy.
This patch provides optimized versions of strcpy and wcscpy with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strcpy-vx.S: New File.
* sysdeps/s390/multiarch/strcpy.c: Likewise.
* sysdeps/s390/multiarch/wcscpy-c.c: Likewise.
* sysdeps/s390/multiarch/wcscpy-vx.S: Likewise.
* sysdeps/s390/multiarch/wcscpy.c: Likewise.
* sysdeps/s390/s390-32/multiarch/strcpy.c: Likewise.
* sysdeps/s390/s390-64/multiarch/strcpy.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strcpy and
wcscpy functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strcpy, wcscpy.
* benchtests/bench-wcscpy.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcscpy.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)]
S390: Optimize strnlen and wcsnlen.
This patch provides optimized versions of strnlen and wcsnlen with the z13
vector instructions.
ChangeLog:
* sysdeps/s390/multiarch/strnlen-c.c: New File.
* sysdeps/s390/multiarch/strnlen-vx.S: Likewise.
* sysdeps/s390/multiarch/strnlen.c: Likewise.
* sysdeps/s390/multiarch/wcsnlen-c.c: Likewise.
* sysdeps/s390/multiarch/wcsnlen-vx.S: Likewise.
* sysdeps/s390/multiarch/wcsnlen.c: Likewise.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add strnlen and
wcsnlen functions.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc test for strnlen, wcsnlen.
* wcsmbs/wcsnlen.c: Use WCSNLEN if defined.
* string/test-strnlen.c: Add wcsnlen support.
* wcsmbs/test-wcsnlen.c: New File.
* wcsmbs/Makefile (strop-tests): Add wcsnlen.
* benchtests/bench-strnlen.c: Add wcsnlen support.
* benchtests/bench-wcsnlen.c: New File.
* benchtests/Makefile (wcsmbs-bench): Add wcsnlen.
Stefan Liebler [Wed, 26 Aug 2015 08:26:20 +0000 (10:26 +0200)]
S390: Optimize strlen and wcslen.
This patch provides optimized versions of strlen and wcslen with the z13 vector
instructions.
The helper macro IFUNC_VX_IMPL is introduced and is used to register all
__<func>_c() and __<func>_vx() functions within __libc_ifunc_impl_list()
to the ifunc test framework.
ChangeLog:
* sysdeps/s390/multiarch/Makefile: New File.
* sysdeps/s390/multiarch/strlen-c.c: Likewise.
* sysdeps/s390/multiarch/strlen-vx.S: Likewise.
* sysdeps/s390/multiarch/strlen.c: Likewise.
* sysdeps/s390/multiarch/wcslen-c.c: Likewise.
* sysdeps/s390/multiarch/wcslen-vx.S: Likewise.
* sysdeps/s390/multiarch/wcslen.c: Likewise.
* string/strlen.c (STRLEN): Define and use macro.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(IFUNC_VX_IMPL): New macro function.
(__libc_ifunc_impl_list): Add ifunc test for strlen, wcslen.
* benchtests/Makefile (wcsmbs-bench): New variable.
(string-bench-all): Added wcsmbs-bench.
* benchtests/bench-wcslen.c: New File.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)]
S390: Ifunc resolver macro for vector instructions.
This patch introduces a s390 specific ifunc resolver macro for 32/64bit,
which chooses <func>_vx with vector instructions if HWCAP_S390_VX flag
in hwcaps is set or <func>_c if not.
ChangeLog:
* sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc,
s390_vx_libc_ifunc2): New macro function.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)]
S390: configure check for vector instruction support in assembler.
The S390 specific test checks if the assembler has support for the new z13
vector instructions by compiling a vector instruction. The .machine and
.machinemode directives are needed to compile the vector instruction without
-march=z13 option on 31/64 bit.
On success the macro HAVE_S390_VX_ASM_SUPPORT is defined. This macro is used
to determine if the optimized functions can be build without compile errors.
If the used assembler lacks vector support, then a warning is dumped while
configuring and only the common code functions are build.
The z13 instruction support was introduced in
"[Committed] S/390: Add support for IBM z13."
(https://sourceware.org/ml/binutils/2015-01/msg00197.html)
ChangeLog:
* config.h.in (HAVE_S390_VX_ASM_SUPPORT): New macro undefine.
* sysdeps/s390/configure.ac: Add test for S390 vector instruction
assembler support.
* sysdeps/s390/configure: Regenerated.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)]
S390: Add new s390 platform.
The new IBM z13 is added to platform string array.
The macro _DL_PLATFORMS_COUNT is incremented to 8,
because it was not incremented by commit
"S/390: Sync AUXV capabilities and archs with kernel".
ChangeLog:
* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags): Add z13.
* sysdeps/s390/dl-procinfo.h (_DL_PLATFORMS_COUNT): Increased.
Stefan Liebler [Wed, 26 Aug 2015 08:26:19 +0000 (10:26 +0200)]
S390: Add hwcaps value for vector facility.
The HWCAP_S390_VX flag in hwcap field of auxiliary vector indicates
if the vector facility is available and the kernel is aware of it.
This can be tested with LD_SHOW_AUXV=1 <prog>.
Currently it does not show te, because it was not incremented
by commit "S/390: Add hwcap value for transactional execution.".
Thus _DL_HWCAP_COUNT is incremented by two.
ChangeLog:
* sysdeps/s390/dl-procinfo.c (_dl_s390_platforms): Add vector flag.
* sysdeps/s390/dl-procinfo.h: Add vector capability.
* sysdeps/unix/sysv/linux/s390/bits/hwcap.h (HWCAP_S390_VX): Define.
Stefan Liebler [Wed, 26 Aug 2015 08:26:18 +0000 (10:26 +0200)]
S390: Refactor ifunc implementations and enable ifunc-test-framework.
On s390 all ifunc resolvers were implemented in multiarch/ifunc-resolve.c.
The resulting single object files has undefined references to all ifunc-functions.
This patch introduces one multiarch/<func>.c file for each of memcpy, memcmp
and memset with the function specific ifunc resolver. The different function
implementations are now implemented in multiarch/<func>-s390x.S
(moved from multiarch/<func>.S).
The new multiarch/ifunc-resolve.h file contains the ifunc-resolver macro
and other helper-macros. They are merged and are now used in common for
32/64bit. Therefore the __<func>_g5/__<func>_z900 functions were renamed to
__<func>_default.
This patch also enables testing the ifunc implementations by implementing
the function __libc_ifunc_impl_list. It uses the helper-macros of ifunc-resolve.h.
ChangeLog:
* sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines):
Remove ifunc-resolve, add memset-s390, memcpy-s390, memcmp-s390.
* sysdeps/s390/s390-32/multiarch/ifunc-resolve.c: Delete File.
* sysdeps/s390/s390-32/multiarch/memcmp.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memcmp-s390.S: ... here.
(memcmp, bcmp): Use __memcmp_default as alias source.
* sysdeps/s390/s390-32/multiarch/memcmp.c: New File.
* sysdeps/s390/s390-32/memcmp.S (__memcmp_g5):
Rename to __memcmp_default.
* sysdeps/s390/s390-32/multiarch/memcpy.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: ... here.
(memcpy): Use __memcpy_default as alias source.
* sysdeps/s390/s390-32/multiarch/memcpy.c: New File.
* sysdeps/s390/s390-32/memcpy.S (__memcpy_g5):
Rename to __memcpy_default.
* sysdeps/s390/s390-32/multiarch/memset.S: Move to ...
* sysdeps/s390/s390-32/multiarch/memset-s390.S: ... here.
(memset): Use __memset_default as alias source.
* sysdeps/s390/s390-32/multiarch/memset.c: New File.
* sysdeps/s390/s390-32/memset.S (__memset_g5):
Rename to __memset_default.
* sysdeps/s390/s390-64/multiarch/Makefile (sysdep_routines):
Remove ifunc-resolve, add memset-s390x, memcpy-s390x, memcmp-s390x.
* sysdeps/s390/s390-64/multiarch/ifunc-resolve.c: Delete File.
* sysdeps/s390/s390-64/multiarch/memcmp.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: ... here.
(memcmp, bcmp): Use __memcmp_default as alias source.
* sysdeps/s390/s390-64/multiarch/memcmp.c: New File.
* sysdeps/s390/s390-64/memcmp.S (__memcmp_z900):
Rename to __memcmp_default.
* sysdeps/s390/s390-64/multiarch/memcpy.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: ... here.
(memcpy): Use __memcpy_default as alias source.
* sysdeps/s390/s390-64/multiarch/memcpy.c: New File.
* sysdeps/s390/s390-64/memcpy.S (__memcpy_z900):
Rename to __memcpy_default.
* sysdeps/s390/s390-64/multiarch/memset.S: Move to ...
* sysdeps/s390/s390-64/multiarch/memset-s390x.S: ... here.
(memset): Use __memset_default as alias source.
* sysdeps/s390/s390-64/multiarch/memset.c: New File.
* sysdeps/s390/s390-64/memset.S (__memset_z900):
Rename to __memset_default.
* sysdeps/s390/multiarch/ifunc-resolve.h: New File.
* sysdeps/s390/multiarch/ifunc-impl-list.c: New File.
Stefan Liebler [Wed, 26 Aug 2015 08:26:18 +0000 (10:26 +0200)]
S390: Fix handling of DXC-byte in FPC-register.
On s390, the DXC(data-exception-code)-byte in FPC(floating-point-control)-
register contains a code of the last occured exception.
If bits 6 and 7 of DXC-byte are zero, the bits 0-5 correspond to the
ieee-exception flag bits.
The current implementation always uses these bits as ieee-exception flag bits.
fetestexcept() reports any exception after the first usage of a
vector-instruction in a process, because it raises an "vector instruction
exception" with DXC-code 0xFE.
This patch fixes the handling of the DXC-byte. The DXC-Byte is only handled
if bits 6 and 7 are zero.
The #define _FPU_RESERVED is extended by the DXC-Byte.
Otherwise the tests math/test-fpucw-static and math/test-fpucw-ieee-static
fails, because DXC-Byte contains the vector instruction exception when reaching
main(). This exception was triggered by strrchr() call in __init_misc().
__init_misc() is called after __setfpucw () in __libc_init_first().
The field __ieee_instruction_pointer in struct fenv_t is renamed to __unused
because it is a relict from commit "Remove PTRACE_PEEKUSER"
(
87b9b50f0d4b92248905e95a06a13c513dc45e59) and isn´t used anymore.
ChangeLog:
[BZ #18610]
* sysdeps/s390/fpu/bits/fenv.h (fenv_t): Rename
__ieee_instruction_pointer to __unused.
* sysdeps/s390/fpu/fesetenv.c (__fesetenv): Remove usage of
__ieee_instruction_pointer.
* sysdeps/s390/fpu/fclrexcpt.c (feclearexcept): Fix dxc-field handling.
* sysdeps/s390/fpu/fgetexcptflg.c (fegetexceptflag): Likewise.
* sysdeps/s390/fpu/fsetexcptflg.c (fesetexceptflag): Likewise.
* sysdeps/s390/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/s390/fpu/fpu_control.h (_FPU_RESERVED):
Mark dxc-field as reserved.
Roland McGrath [Tue, 25 Aug 2015 20:37:07 +0000 (13:37 -0700)]
NaCl: Call __nacl_main in preference to main.
H.J. Lu [Tue, 25 Aug 2015 19:37:45 +0000 (12:37 -0700)]
Use SSE2 optimized strcmp in x86-64 ld.so
Since ld.so preserves vector registers now, we can use the same SSE2
optimized strcmp in x86-64 libc and ld.so.
* sysdeps/x86_64/strcmp.S: Remove "#if !IS_IN (libc)".
H.J. Lu [Tue, 25 Aug 2015 18:37:31 +0000 (11:37 -0700)]
Don't run tst-getpid2 with LD_BIND_NOW=1
Since _dl_x86_64_save_sse and _dl_x86_64_restore_sse are removed now,
we don't need to run tst-getpid2 with LD_BIND_NOW=1.
[BZ #11214]
* sysdeps/unix/sysv/linux/Makefile (tst-getpid2-ENV): Removed.
Rajalakshmi Srinivasaraghavan [Tue, 25 Aug 2015 13:23:47 +0000 (10:23 -0300)]
Call direct system calls for socket operations
Explicit system calls for the socket operations were added in Linux kernel
in commit
86250b9d12ca for powerpc. This patch make use of those instead of
calling socketcall to save number of cycles on networking syscalls.
2015-08-25 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h: Define new macros.
* sysdeps/unix/sysv/linux/accept.c: Call direct system call.
* sysdeps/unix/sysv/linux/bind.c: Call direct system call.
* sysdeps/unix/sysv/linux/connect.c: Call direct system call.
* sysdeps/unix/sysv/linux/getpeername.c: Call direct system call.
* sysdeps/unix/sysv/linux/getsockname.c: Call direct system call.
* sysdeps/unix/sysv/linux/getsockopt.c: Call direct system call.
* sysdeps/unix/sysv/linux/listen.c: Call direct system call.
* sysdeps/unix/sysv/linux/recv.c: Call direct system call.
* sysdeps/unix/sysv/linux/recvfrom.c: Call direct system call.
* sysdeps/unix/sysv/linux/recvmsg.c: Call direct system call.
* sysdeps/unix/sysv/linux/send.c: Call direct system call.
* sysdeps/unix/sysv/linux/sendmsg.c: Call direct system call.
* sysdeps/unix/sysv/linux/sendto.c: Call direct system call.
* sysdeps/unix/sysv/linux/setsockopt.c: Call direct system call.
* sysdeps/unix/sysv/linux/shutdown.c: Call direct system call.
* sysdeps/unix/sysv/linux/socket.c: Call direct system call.
* sysdeps/unix/sysv/linux/socketpair.c: Call direct system call.
Paul E. Murphy [Fri, 21 Aug 2015 19:39:01 +0000 (14:39 -0500)]
powerpc: Fix tabort usage in syscalls
Fix usage of tabort in generated syscalls. r0 has special meaning
when used with this instruction, thus it will not generate
persistent errors, nor return an error code. This mitigates poor
CPU usage when performing elided critical sections.
Additionally, transactions should be aborted when entering a user
invoked syscall. Otherwise the results of the transaction may be
undefined.
2015-08-25 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use
register other than r0 for tabort, it has special meaning.
* sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise
* sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort
transaction before starting syscall.
Rajalakshmi Srinivasaraghavan [Tue, 18 Aug 2015 17:10:56 +0000 (22:40 +0530)]
powerpc: Handle worstcase behavior in strstr() for POWER7
Instead of checking needle length, constant 'n' number of comparisons
is checked to fall back to default implementation. This patch is tested
on powerpc64 and powerpc64le.
2015-08-25 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/power7/strstr.S: Handle worst case.
H.J. Lu [Tue, 25 Aug 2015 15:51:09 +0000 (08:51 -0700)]
Replace %xmm[8-12] with %xmm[0-4]
Since ld.so preserves vector registers now, we can use %xmm[0-4] to
avoid the REX prefix.
* sysdeps/x86_64/strlen.S: Replace %xmm[8-12] with %xmm[0-4].
H.J. Lu [Tue, 25 Aug 2015 15:49:50 +0000 (08:49 -0700)]
Remove x86-64 rtld-xxx.c and rtld-xxx.S
Since ld.so preserves vector registers now, we can use the regular,
non-ifunc string and memory functions in ld.so.
* sysdeps/x86_64/rtld-memcmp.c: Removed.
* sysdeps/x86_64/rtld-memset.S: Likewise.
* sysdeps/x86_64/rtld-strchr.S: Likewise.
* sysdeps/x86_64/rtld-strlen.S: Likewise.
* sysdeps/x86_64/multiarch/rtld-memcmp.c: Likewise.
* sysdeps/x86_64/multiarch/rtld-memset.S: Likewise.
H.J. Lu [Tue, 25 Aug 2015 15:48:21 +0000 (08:48 -0700)]
Replace %xmm8 with %xmm0
Since ld.so preserves vector registers now, we can use %xmm0 to avoid
the REX prefix.
* sysdeps/x86_64/memset.S: Replace %xmm8 with %xmm0.
Ondřej Bílka [Tue, 25 Aug 2015 14:05:01 +0000 (16:05 +0200)]
add bug 18240 to news.
Ondřej Bílka [Sat, 11 Jul 2015 15:44:10 +0000 (17:44 +0200)]
Handle overflow in __hcreate_r
Hi,
As in bugzilla entry there is overflow in hsearch when looking for prime
number as SIZE_MAX - 1 is divisible by 5. We fix that by rejecting large
inputs before looking for prime.
* misc/hsearch_r.c (__hcreate_r): Handle overflow.
Ondřej Bílka [Tue, 25 Aug 2015 10:23:24 +0000 (12:23 +0200)]
Fix strcpy_chk and stpcpy_chk performance.
Hi, as I wrote in previous patches a performance of checked strcpy and
stpcpy is terrible as these don't use sse2 and are around four times
slower that strcpy and stpcpy now.
As this bug shows that these functions are not performance sensitive I
decided just to improve generic implementation instead for easier
maintainance.
* debug/strcpy_chk.c: Improve performance.
* debug/stpcpy_chk.c: Likewise.
* sysdeps/x86_64/strcpy_chk.S: Remove.
* sysdeps/x86_64/stpcpy_chk.S: Remove.
H.J. Lu [Tue, 25 Aug 2015 11:33:54 +0000 (04:33 -0700)]
Save and restore vector registers in x86-64 ld.so
This patch adds SSE, AVX and AVX512 versions of _dl_runtime_resolve
and _dl_runtime_profile, which save and restore the first 8 vector
registers used for parameter passing. elf_machine_runtime_setup
selects the proper _dl_runtime_resolve or _dl_runtime_profile based
on _dl_x86_cpu_features. It avoids race condition caused by
FOREIGN_CALL macros, which are only used for x86-64.
Performance impact of saving and restoring 8 vector registers are
negligible on Nehalem, Sandy Bridge, Ivy Bridge and Haswell when
ld.so is optimized with SSE2.
[BZ #15128]
* sysdeps/x86_64/Makefile [$(subdir) == elf] (tests): Add
ifuncmain8.
(modules-names): Add ifuncmod8.
($(objpfx)ifuncmain8): New rule.
* sysdeps/x86_64/dl-machine.h: Include <dl-procinfo.h> and
<cpuid.h>.
(elf_machine_runtime_setup): Use _dl_runtime_resolve_sse,
_dl_runtime_resolve_avx, or _dl_runtime_resolve_avx512,
_dl_runtime_profile_sse, _dl_runtime_profile_avx, or
_dl_runtime_profile_avx512, based on HAS_ARCH_FEATURE.
* sysdeps/x86_64/dl-trampoline.S: Rewrite.
* sysdeps/x86_64/dl-trampoline.h: Likewise.
* sysdeps/x86_64/ifuncmain8.c: New file.
* sysdeps/x86_64/ifuncmod8.c: Likewise.
* sysdeps/x86_64/nptl/tcb-offsets.sym (RTLD_SAVESPACE_SSE):
Removed.
* sysdeps/x86_64/nptl/tls.h (__128bits): Removed.
(tcbhead_t): Change rtld_must_xmm_save to __glibc_unused1.
Change rtld_savespace_sse to __glibc_unused2.
(RTLD_CHECK_FOREIGN_CALL): Removed.
(RTLD_ENABLE_FOREIGN_CALL): Likewise.
(RTLD_PREPARE_FOREIGN_CALL): Likewise.
(RTLD_FINALIZE_FOREIGN_CALL): Likewise.
Joseph Myers [Mon, 24 Aug 2015 14:45:32 +0000 (14:45 +0000)]
Note bug 10882 as having been fixed in 2.16.
Wilco Dijkstra [Mon, 24 Aug 2015 13:49:46 +0000 (14:49 +0100)]
2015-08-24 Wilco Dijkstra <wdijkstr@arm.com>
* sysdeps/aarch64/bzero.S (__bzero): Remove.
Wilco Dijkstra [Mon, 24 Aug 2015 13:40:39 +0000 (14:40 +0100)]
2015-08-24 Wilco Dijkstra <wdijkstr@arm.com>
* sysdeps/aarch64/fpu/math_private.h (libc_feholdsetround_aarch64_ctx):
Unconditionally set __fpcr to avoid uninialized warning.
(libc_feholdsetround_noex_aarch64_ctx): Likewise.
Siddhesh Poyarekar [Mon, 24 Aug 2015 09:03:07 +0000 (14:33 +0530)]
Don't use the main arena in retry path if it is corrupt
If allocation on a non-main arena fails, the main arena is used
without checking to see if it is corrupt. Add a check that avoids the
main arena if it is corrupt.
* malloc/arena.c (arena_get_retry): Don't use main_arena if it is
corrupt.
Siddhesh Poyarekar [Mon, 24 Aug 2015 09:02:07 +0000 (14:32 +0530)]
Drop unused first argument from arena_get2
The arena pointer in the first argument to arena_get2 was used in the
old days before per-thread arenas. They're unused now and hence can
be dropped.
ChangeLog:
* malloc/arena.c (arena_get2): Drop unused argument.
(arena_lock): Adjust.
(arena_get_retry): Likewise.
Andreas Schwab [Tue, 18 Aug 2015 08:29:30 +0000 (10:29 +0200)]
Remove __ASSUME_IPC64
PowerPC has always used __IPC_64 like most other architectures, which
means that __ASSUME_IPC64 can be always true. Also, all other
architecture implementations that use the ipc syscall are effectively
identical to the generic version and can be removed.
Mike Frysinger [Thu, 23 Feb 2006 02:12:28 +0000 (21:12 -0500)]
manual: skip build when perl is unavailable
Do not try to generate the manual when perl is unavailable. This
matches the behavior when makeinfo is unavailable. Otherwise the
install step fails when trying to generate the libm section since
it runs a perl script.
Carlos Eduardo Seo [Tue, 11 Aug 2015 21:30:12 +0000 (18:30 -0300)]
powerpc: Fix memchr for powerpc32.
Fix a wrong #undef in memchr.c.
* sysdeps/powerpc/powerpc32/power4/multiarch/memchr.c: Replace
'#undef memcpy' by '#undef memchr'.
Carlos Eduardo Seo [Tue, 11 Aug 2015 22:38:45 +0000 (19:38 -0300)]
powerpc: make memchr use memchr-power7.
In powerpc64, memchr was always pointing to the internal __GI_memchr
implementation. This patch fixes that and makes it use the
optimized POWER7 version when adequate.
* sysdeps/powerpc/powerpc64/multiarch/memchr-ppc64.c: Make
memchr not point to the internal __GI_memchr implementation.
H.J. Lu [Fri, 21 Aug 2015 16:57:15 +0000 (09:57 -0700)]
Revert "Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURN"
This reverts commit
0c5b8b5941e036dcaac69cecee9f01fdf9218e6e.
H.J. Lu [Fri, 21 Aug 2015 16:57:02 +0000 (09:57 -0700)]
Revert "Fix a typo in linux lxstat.c"
This reverts commit
e4ad5e722cec9a274cd84585d9c33f696e36f847.
H.J. Lu [Fri, 21 Aug 2015 15:32:36 +0000 (08:32 -0700)]
Fix a typo in linux lxstat.c
* sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Fix a typo.
H.J. Lu [Fri, 21 Aug 2015 11:46:39 +0000 (04:46 -0700)]
Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURN
For ia32 PIC, the first thing of many syscalls does is to call
__x86.get_pc_thunk.reg to load PC into reg in case there is an error,
which is required for setting errno. In most cases, there are no
errors. But we still call __x86.get_pc_thunk.reg. This patch adds
INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN so that i386
can optimize setting errno by branching to the internal __syscall_error
without PLT.
INLINE_SYSCALL_ERROR_RETURN is designed to take the negative error
number returned from the majority of Linux kernels for which negating
is a no-op with INTERNAL_SYSCALL_ERRNO.
With i386 INLINE_SYSCALL_RETURN, INLINE_SYSCALL_ERROR_RETURN and
i386 syscall inlining optimization for GCC 5, for
sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686
-mtune=generic, GCC 5.2 now generates:
<fchmodat>:
0: push %ebx
1: mov 0x14(%esp),%eax
5: mov 0x8(%esp),%ebx
9: mov 0xc(%esp),%ecx
d: mov 0x10(%esp),%edx
11: test $0xfffffeff,%eax
16: jne 38 <fchmodat+0x38>
18: test $0x1,%ah
1b: jne 48 <fchmodat+0x48>
1d: mov $0x132,%eax
22: call *%gs:0x10
29: cmp $0xfffff000,%eax
2e: ja 58 <fchmodat+0x58>
30: pop %ebx
31: ret
32: lea 0x0(%esi),%esi
38: pop %ebx
39: mov $0xffffffea,%eax
3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error
43: nop
44: lea 0x0(%esi,%eiz,1),%esi
48: pop %ebx
49: mov $0xffffffa1,%eax
4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: pop %ebx
59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error
instead of
<fchmodat>:
0: sub $0x8,%esp
3: mov 0x18(%esp),%eax
7: mov %ebx,(%esp)
a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx
f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
15: mov %edi,0x4(%esp)
19: test $0xfffffeff,%eax
1e: jne 70 <fchmodat+0x70>
20: test $0x1,%ah
23: jne 88 <fchmodat+0x88>
25: mov 0x14(%esp),%edx
29: mov 0x10(%esp),%ecx
2d: mov 0xc(%esp),%edi
31: xchg %ebx,%edi
33: mov $0x132,%eax
38: call *%gs:0x10
3f: xchg %edi,%ebx
41: cmp $0xfffff000,%eax
46: ja 58 <fchmodat+0x58>
48: mov (%esp),%ebx
4b: mov 0x4(%esp),%edi
4f: add $0x8,%esp
52: ret
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno
5e: neg %eax
60: mov %eax,%gs:(%edx)
63: mov $0xffffffff,%eax
68: jmp 48 <fchmodat+0x48>
6a: lea 0x0(%esi),%esi
70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno
76: movl $0x16,%gs:(%eax)
7d: mov $0xffffffff,%eax
82: jmp 48 <fchmodat+0x48>
84: lea 0x0(%esi,%eiz,1),%esi
88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno
8e: movl $0x5f,%gs:(%eax)
95: mov $0xffffffff,%eax
9a: jmp 48 <fchmodat+0x48>
* sysdeps/unix/sysdep.h (INLINE_SYSCALL_RETURN): New.
(INLINE_SYSCALL_ERROR_RETURN): Likewise.
* sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Use
INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN.
* sysdeps/unix/sysv/linux/aio_sigqueue.c (__aio_sigqueue):
Likewise.
* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
* sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise.
* sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise.
* sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise.
* sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise.
* sysdeps/unix/sysv/linux/fstatfs64.c (__fstatfs64): Likewise.
* sysdeps/unix/sysv/linux/ftruncate64.c (__ftruncate64): Likewise.
* sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise.
* sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise.
* sysdeps/unix/sysv/linux/futimesat.c (futimesat): Likewise.
* sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise.
* sysdeps/unix/sysv/linux/fxstat64.c (___fxstat64): Likewise.
* sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise.
* sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise.
* sysdeps/unix/sysv/linux/gai_sigqueue.c (__gai_sigqueue):
Likewise.
* sysdeps/unix/sysv/linux/getpriority.c (__getpriority): Likewise.
* sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Likewise.
* sysdeps/unix/sysv/linux/llseek.c (__llseek): Likewise.
* sysdeps/unix/sysv/linux/lutimes.c (lutimes): Likewise.
* sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise.
* sysdeps/unix/sysv/linux/lxstat64.c (___lxstat64): Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/mq_close.c (mq_close): Likewise.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise.
* sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Likewise.
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise.
* sysdeps/unix/sysv/linux/pt-raise.c (raise): Likewise.
* sysdeps/unix/sysv/linux/raise.c (raise): Likewise.
* sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise.
* sysdeps/unix/sysv/linux/reboot.c (reboot): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Likewise.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/setrlimit64.c (setrlimit64): Likewise.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Likewise.
* sysdeps/unix/sysv/linux/shmdt.c (shmdt): Likewise.
* sysdeps/unix/sysv/linux/shmget.c (shmget): Likewise.
* sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise.
* sysdeps/unix/sysv/linux/sigpending.c (sigpending): Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c ( __sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Likewise.
* sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Likewise.
* sysdeps/unix/sysv/linux/statfs64.c (__statfs64): Likewise.
* sysdeps/unix/sysv/linux/sysctl.c (__sysctl): Likewise.
* sysdeps/unix/sysv/linux/tcsendbrk.c (tcsendbreak): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
* sysdeps/unix/sysv/linux/timer_getoverr.c (timer_getoverrun):
Likewise.
* sysdeps/unix/sysv/linux/timer_gettime.c (timer_gettime):
Likewise.
* sysdeps/unix/sysv/linux/timer_settime.c (timer_settime):
Likewise.
* sysdeps/unix/sysv/linux/truncate64.c (truncate64): Likewise.
* sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise.
* sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise.
* sysdeps/unix/sysv/linux/utimes.c (__utimes): Likewise.
* sysdeps/unix/sysv/linux/xmknod.c (__xmknod): Likewise.
* sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise.
* sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise.
* sysdeps/unix/sysv/linux/xstat64.c (___xstat64): Likewise.
* sysdeps/unix/sysv/linux/xstatconv.c (__xstat_conv): Likewise.
(__xstat64_conv): Likewise.
(__xstat32_conv): Likewise.
* sysdeps/unix/sysv/linux/sched_getaffinity.c
(__sched_getaffinity_new): Add libc_hidden_proto and
libc_hidden_def. Use INLINE_SYSCALL_ERROR_RETURN.
Joseph Myers [Thu, 20 Aug 2015 20:51:22 +0000 (20:51 +0000)]
Don't use -Wno-strict-prototypes in timezone/.
The current timezone/ code from tzcode doesn't need
-Wno-strict-prototypes. This patch removes it from the CFLAGS
settings in timezone/Makefile.
Tested for x86_64 that glibc still builds OK with the patch applied.
* timezone/Makefile (CFLAGS-zdump.c): Remove
-Wno-strict-prototypes.
(CFLAGS-zic.c): Likewise.
(CFLAGS-ialloc.c): Likewise.
(CFLAGS-scheck.c): Likewise.
Joseph Myers [Thu, 20 Aug 2015 20:50:05 +0000 (20:50 +0000)]
Don't use -Wno-error=undef.
This patch removes the use of -Wno-error=undef, so that -Wundef
warnings become errors.
Tested for x86_64, x86, mips64 (all three ABIs) and arm.
* Makeconfig [$(enable-werror) = yes] (+gccwarn): Do not add
-Wno-error=undef.
H.J. Lu [Thu, 20 Aug 2015 19:56:22 +0000 (12:56 -0700)]
Add missing ChangeLog entry for the last commit
H.J. Lu [Thu, 20 Aug 2015 19:47:20 +0000 (12:47 -0700)]
Remove the unused IFUNC files
sysdeps/i386/i686/multiarch/strcasestr-c.c became unused after
commit
1818483b15d22016b0eae41d37ee91cc87b37510
Author: Andreas Schwab <schwab@suse.de>
Date: Wed Dec 18 11:53:27 2013 +1000
Remove use of SSE4.2 functions for strstr on i686
which contains
-sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
+sysdep_routines += strcspn-c strpbrk-c strspn-c
sysdeps/x86_64/multiarch/strcasestr.c became useless after
t
584b18eb4df61ccd447db2dfe8c8a7901f8c8598
Author: Ondřej Bílka <neleai@seznam.cz>
Date: Sat Dec 14 19:33:56 2013 +0100
Add strstr with unaligned loads. Fixes bug 12100.
which changes sysdeps/x86_64/multiarch/strcasestr.c to
libc_ifunc (__strcasestr, __strcasestr_sse2);
This patch removes these file.
* i386/i686/multiarch/strcasestr-c.c: Removed.
* x86_64/multiarch/strcasestr.c: Likewise.
* x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list):
Remove strcasestr.
Joseph Myers [Thu, 20 Aug 2015 18:00:09 +0000 (18:00 +0000)]
Don't use -Wno-uninitialized in math/.
The uninitialized variable warnings in math/ having been fixed for all
the supported floating-point formats, this patch removes the use of
-Wno-uninitialized there, continuing with the goal of avoiding -Wno-
options in makefiles as far as possible..
Tested for x86_64 and x86 (full build and testsuite runs), and for
powerpc and mips64 (verified that glibc builds without errors).
* math/Makefile (CFLAGS): Don't add -Wno-uninitialized.
Joseph Myers [Thu, 20 Aug 2015 17:28:09 +0000 (17:28 +0000)]
Fix uninitialized variable use in ldbl-128ibm nearbyintl.
Removing the use of -Wno-uninitialized for math/ shows errors for
ldbl-128ibm:
../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: In function '__nearbyintl':
../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c:119:34: error: 'low' may be used uninitialized in this function [-Werror=maybe-uninitialized]
u.d[1].d = high - u.d[0].d + low;
^
../sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c:119:23: error: 'high' may be used uninitialized in this function [-Werror=maybe-uninitialized]
u.d[1].d = high - u.d[0].d + low;
^
These errors are correct: if the high part of the argument is a NaN,
and the low part is nonzero but has absolute value less than 2^52,
those variables can be used uninitialized. This patch rearranges the
code so that the variables are always initialized with the natural
values, and then possibly modified later, to avoid this uninitialized
use. (Note that there are still other issues with this code and NaNs
that are not fixed by this patch.) No bug filed in Bugzilla or
testcase added for the uninitialized use since it wasn't user-visible
with the compiler I tried (that is, I still got a NaN result).
Tested for powerpc.
* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Always initialize
variables for high and low parts before possibly modifying them.