Stefan Liebler [Fri, 21 Apr 2017 13:30:00 +0000 (15:30 +0200)]
S390: Move utf8-utf16-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
The utf8-utf16-z9.c iconv module is using ifunc and thus the ifunc part should
be in multiarch folder. Otherwise ifunc is used even if you configure
with --disable-multi-arch.
This patch moves the ifunc resolvers to the new file
sysdeps/s390/multiarch/utf8-utf16-z9.c. The resolvers are now implemented
with s390_libc_ifunc_expr macro instead of using gcc attribute ifunc directly.
The ifunc versions are implemented in sysdeps/s390/utf8-utf16-z9.c.
Each version is only implemented if needed or supported. Therefore there is
a block at beginning of the file which selects the versions which should be
defined depending on support for multiarch, vector-support and used minimum
architecture level. This block defines HAVE_[FROM|TO]_[C|CU|VX] to 1 or 0.
The code below is rearranged and surrounded
by #if HAVE_[FROM|TO]_[C|CU|VX] == 1. There is no functional change.
The cu instructions are z9 zarch instructions. As the major distros are
already using the newer z196 as architecture level set, those instructions
can be used as fallback version instead of the c-code. This behaviour is
decided at compile time via HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT.
ChangeLog:
* sysdeps/s390/multiarch/utf8-utf16-z9.c: New File.
* sysdeps/s390/utf8-utf16-z9.c: Move ifunc resolvers to multiarch
folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|CU|VX].
(HAVE_FROM_C, HAVE_FROM_CU, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX,
FROM_LOOP_DEFAULT, FROM_LOOP_C, FROM_LOOP_CU, FROM_LOOP_VX,
TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX): New Define.
Stefan Liebler [Fri, 21 Apr 2017 13:30:00 +0000 (15:30 +0200)]
S390: Use new s390_libc_ifunc_expr macro in s390 8bit-generic.c.
This patch adds s390_libc_ifunc_expr macro which uses the __ifunc base macro
in include/libc-symbols.h and lets the user define a generic expression to
choose the correct ifunc variant. Furthermore as the base macro is used,
the ifunc resolver functions are now also using inhibit_stack_protector.
S390 needs its own version due to the hwcap argument of the ifunc resolver.
This new macro is now used in iconv code in 8bit-generic.c instead of using
gcc attribute ifunc directly.
ChangeLog:
* sysdeps/s390/multiarch/ifunc-resolve.h
(s390_libc_ifunc_expr_init, s390_libc_ifunc_expr): New Define.
* sysdeps/s390/multiarch/8bit-generic.c
(__to_generic, __from_generic): Use s390_libc_ifunc_expr to
define ifunc resolvers.
Florian Weimer [Fri, 21 Apr 2017 08:28:37 +0000 (10:28 +0200)]
manual: Document replacing malloc [BZ #20424]
Joseph Myers [Thu, 20 Apr 2017 20:35:21 +0000 (20:35 +0000)]
Do not use wildcard symbol names for public versions in Versions files.
As noted in
<https://sourceware.org/ml/libc-alpha/2012-12/msg00240.html>,
stdlib/Versions and wcsmbs/Versions list some functions as
__strto*_internal and __wcsto*_internal rather than explicitly listing
the symbols to be exported (so any new internal function matching one
of those patterns would be wrongly added to version GLIBC_2.0), which
seems like a bad idea. This patch changes those files to list the
exported symbols explicitly. There are still entries in
sysdeps/nacl/Versions for __nacl_irt_*, but as GLIBC_PRIVATE symbols
that seems less significant.
Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.
* stdlib/Versions (__strtod_internal): List explicitly, not as
wildcard.
(__strtof_internal): Likewise.
(__strtold_internal): Likewise.
(__strtol_internal): Likewise.
(__strtoll_internal): Likewise.
(__strtoul_internal): Likewise.
(__strtoull_internal): Likewise.
(__strtoq_internal): Likewise.
(__strtouq_internal): Likewise.
* wcsmbs/Versions (__wcstod_internal): Likewise.
(__wcstof_internal): Likewise.
(__wcstold_internal): Likewise.
(__wcstol_internal): Likewise.
(__wcstoll_internal): Likewise.
(__wcstoul_internal): Likewise.
(__wcstoull_internal): Likewise.
Adhemerval Zanella [Mon, 17 Apr 2017 13:38:53 +0000 (10:38 -0300)]
Fix missing timespec definition for sys/stat.h (BZ #21371)
As indicated by the bug report, the 'struct timespec' definition
is not defined for '_XOPEN_SOURCE=700' and '_POSIX_C_SOURCE=200112L'.
It is because current code only includes its definition if __USE_ATFILE
is defined and the define is only set with:
1. _GNU_SOURCE and/or _ATFILE_SOURCE definition.
2. _POSIX_C_SOURCE >= 200809L
However, the 'st_*' fields in 'struct stat' are defined if __USE_XOPEN2K8.
This patch uses the same logic for 'struct timespec' inclusion.
Tested on x86_64-linux-gnu.
* io/sys/stat.h: Use __USE_XOPEN2K8 insteaf of __USE_ATFILE for
struct timespec definition.
Florian Weimer [Wed, 19 Apr 2017 17:34:42 +0000 (19:34 +0200)]
nss_dns: Correct parentheses for the __glibc_unlikely argument
This fixes commit
bee05c9d58a34ec5886faf3b56ecaa56355d94bf.
Florian Weimer [Wed, 19 Apr 2017 17:30:18 +0000 (19:30 +0200)]
rcmd/rexec: Fix typo in comment
Zack Weinberg [Wed, 19 Apr 2017 18:39:04 +0000 (14:39 -0400)]
A third round of inclusion fixes for _ISOMAC testsuite.
* posix/tst-mmap-offset.c: Include stdint.h.
* resolv/tst-ns_name_compress.c: Include string.h.
* resolv/tst-resolv-edns.c: Include resolv.h.
Florian Weimer [Wed, 19 Apr 2017 12:29:11 +0000 (14:29 +0200)]
resolv: Replace __builtin_expect with __glibc_unlikely/__glibc_likely
Christopher Chittleborough [Wed, 19 Apr 2017 12:09:40 +0000 (08:09 -0400)]
Bug 21399: Fix CP1254 comment for U+00EC
Florian Weimer [Wed, 19 Apr 2017 05:45:04 +0000 (07:45 +0200)]
Create more sockets with SOCK_CLOEXEC [BZ #15722]
Florian Weimer [Wed, 19 Apr 2017 05:44:48 +0000 (07:44 +0200)]
Assume that accept4 is always available and works
Simplify the Linux accept4 implementation based on the assumption
that it is available in some way. __ASSUME_ACCEPT4_SOCKETCALL was
previously unused, so remove it.
For ia64, the accept4 system call (and socket call) were backported
in kernel version 3.2.18. Reflect this in the installation
instructions.
Joseph Myers [Tue, 18 Apr 2017 23:51:35 +0000 (23:51 +0000)]
conformtest: Enable tests when cross compiling.
This patch enables the compilation part of the conformtest tests (the
vast bulk of them) when cross compiling, so making it easy to run them
across many configurations with build-many-glibcs.py.
Tested with build-many-glibcs.py.
* conform/Makefile (tests-special): Do not make addition of
$(conformtest-header-tests) conditional on [$(cross-compiling) = no].
(generated): Do not make addition of $(conformtest-header-base)
conditional on [$(cross-compiling) = no].
Joseph Myers [Tue, 18 Apr 2017 21:22:51 +0000 (21:22 +0000)]
Fix bits/socket.h IOC* namespace issues (bug 21267).
sysdeps/unix/sysv/linux/bits/socket.h includes asm/socket.h. That
includes asm/sockios.h, which on MIPS includes asm/ioctl.h, resulting
in namespace violations from IOC* macros.
bits/socket.h already has code to handle asm/socket.h unconditionally
defining macros that are only wanted for __USE_MISC. This patch
extends it to handle the IOC* macros as well (always undefining them
if not defined when bits/socket.h was included, as I don't think they
are part of the intended API even for __USE_MISC).
It's possible there should also be a kernel fix - it's not clear to me
that IOC* belong in the uapi headers, and even if they do they might
best be split out into another header to avoid getting defined by this
particular path. But since glibc needs to deal with existing kernel
headers, it also seems appropriate to extend the existing workaround
to these macros.
Tested (compilation only) with build-many-glibcs.py.
[BZ #21267]
* sysdeps/unix/sysv/linux/bits/socket.h (IOCSIZE_MASK): Undefine
if defined by <asm/socket.h> and not previously defined.
(IOCSIZE_SHIFT): Likewise.
(IOC_IN): Likewise.
(IOC_INOUT): Likewise.
(IOC_OUT): Likewise.
H.J. Lu [Tue, 18 Apr 2017 21:01:45 +0000 (14:01 -0700)]
x86: Use AVX2 memcpy/memset on Skylake server [BZ #21396]
On Skylake server, AVX512 load/store instructions in memcpy/memset may
lead to lower CPU turbo frequency in certain situations. Use of AVX2
in memcpy/memset has been observed to have improved overall performance
in many workloads due to the higher frequency.
Since AVX512ER is unique to Xeon Phi, this patch sets Prefer_No_AVX512
if AVX512ER isn't available so that AVX2 versions of memcpy/memset are
used on Skylake server.
[BZ #21396]
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
Prefer_No_AVX512 if AVX512ER isn't available.
* sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New.
(index_arch_Prefer_No_AVX512): Likewise.
* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use
AVX512 version if Prefer_No_AVX512 is set.
* sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk):
Likewise.
* sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise.
* sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk):
Likewise.
* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise.
* sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk):
Likewise.
* sysdeps/x86_64/multiarch/memset.S (memset): Likewise.
* sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk):
Likewise.
H.J. Lu [Tue, 18 Apr 2017 15:27:22 +0000 (08:27 -0700)]
x86: Set Prefer_No_VZEROUPPER if AVX512ER is available
AVX512ER won't be implemented in any Xeon processors and will be in
all Xeon Phi processors. Don't check CPU model number when setting
Prefer_No_VZEROUPPER for Xeon Phi. Instead, set Prefer_No_VZEROUPPER
if AVX512ER is available. It works with current and future Xeon Phi
and non-Xeon Phi processors.
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
Prefer_No_VZEROUPPER if AVX512ER is available.
* sysdeps/x86/cpu-features.h
(bit_cpu_AVX512PF): New.
(bit_cpu_AVX512ER): Likewise.
(bit_cpu_AVX512CD): Likewise.
(bit_cpu_AVX512BW): Likewise.
(bit_cpu_AVX512VL): Likewise.
(index_cpu_AVX512PF): Likewise.
(index_cpu_AVX512ER): Likewise.
(index_cpu_AVX512CD): Likewise.
(index_cpu_AVX512BW): Likewise.
(index_cpu_AVX512VL): Likewise.
(reg_AVX512PF): Likewise.
(reg_AVX512ER): Likewise.
(reg_AVX512CD): Likewise.
(reg_AVX512BW): Likewise.
(reg_AVX512VL): Likewise.
Florian Weimer [Tue, 18 Apr 2017 12:56:51 +0000 (14:56 +0200)]
Assume that O_CLOEXEC is always defined and works
Florian Weimer [Tue, 18 Apr 2017 12:42:19 +0000 (14:42 +0200)]
Assume that dup3 is available
Florian Weimer [Tue, 18 Apr 2017 12:09:01 +0000 (14:09 +0200)]
Assume that pipe2 is always available
The Debian patches for Hurd (which are already required to build
glibc before this commit) contain an implementation of pipe2.
Florian Weimer [Tue, 18 Apr 2017 09:50:58 +0000 (11:50 +0200)]
malloc: Turn cfree into a compatibility symbol
Rajalakshmi Srinivasaraghavan [Tue, 18 Apr 2017 05:58:56 +0000 (11:28 +0530)]
powerpc64: strrchr optimization for power8
P7 code is used for <=32B strings and for > 32B vectorized loops are used.
This shows as an average 25% improvement depending on the position of search
character. The performance is same for shorter strings.
Tested on ppc64 and ppc64le.
Rabin Vincent [Mon, 17 Apr 2017 15:03:44 +0000 (12:03 -0300)]
[BZ 21357] unwind-dw2-fde: Call free() outside of unwind mutex
__deregister_frame_info_bases() calls free() while holding a mutex which
is also used from _Unwind_Find_FDE(). This leads to a deadlock if
AddressSanitizer uses _Unwind_Backtrace() from its free()
implementation.
Checked on mips-linux-gnu and x86_64-linux-gnu.
[BZ #21357]
* sysdeps/generic/unwind-dw2-fde.c (__deregister_frame_info_bases):
Call free() outside of mutex.
Florian Weimer [Thu, 13 Apr 2017 19:28:18 +0000 (21:28 +0200)]
Assume that O_NOFOLLOW is always defined
Florian Weimer [Thu, 13 Apr 2017 11:22:51 +0000 (13:22 +0200)]
resolv: Remove EDNS fallback [BZ #21369]
EDNS is disabled by default (so there is interoperability issue), and
the fallback code is problematic because it prevents an application
from obtaining DNSSEC data after a FORMERR response.
Florian Weimer [Thu, 13 Apr 2017 11:09:38 +0000 (13:09 +0200)]
resolv: Reduce EDNS payload size to 1200 bytes [BZ #21361]
This hardens the stub resolver against fragmentation-based attacks.
Florian Weimer [Thu, 13 Apr 2017 09:56:28 +0000 (11:56 +0200)]
resolv: Support an exactly sized buffer in ns_name_pack [BZ #21359]
This bug did not affect name resolution because those functions
indirectly call ns_name_pack with a buffer which is always larger
than the generated query packet, even in the case of the
longest-possible domain name.
Florian Weimer [Thu, 13 Apr 2017 08:52:27 +0000 (10:52 +0200)]
resolv: Remove internal and unused definitions from <resolv.h>
The RES_F_* constants are only used with the private _res._flags
member. RES_EXHAUSTIVE is unused. The removed function
declarations refer to functions not actually exported by glibc,
so they are unusable by applications.
Rajalakshmi Srinivasaraghavan [Thu, 13 Apr 2017 05:59:20 +0000 (11:29 +0530)]
powerpc: Optimized strncat for POWER8
With new optimized strnlen for POWER8 [1], this patch adds
strncat for power8 to make use of optimized strlen and strnlen.
This is faster than POWER7 current implementation for larger strings.
Tested on powerpc64 and powerpc64le.
[1] https://sourceware.org/ml/libc-alpha/2017-03/msg00491.html
* sysdeps/powerpc/powerpc64/multiarch/Makefile (sysdep_routines): Add
strncat-power8.
* sysdeps/powerpc/powerpc64/multiarch/strncat.c (strncat): Add
__strncat_power8 to ifunc list.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(strncat): Add __strncat_power8 to list of strncat functions.
* sysdeps/powerpc/powerpc64/multiarch/strncat-power8.c: New file.
Adhemerval Zanella [Thu, 6 Apr 2017 20:01:56 +0000 (17:01 -0300)]
Consolidate Linux mmap implementation (BZ#21270)
This patch consolidates all Linux mmap implementations on default
sysdeps/unix/sysv/linux/mmap{64}.c one. To accomodate all required
architecture specific requeriments a new internal header is created
(mmap_internal.h) where each architecture add its specific code
requirements. Currently only x86_64 (to define MMAP_PREPARE to add
MAP_32BITS), s390 (which have a different kernel ABI for mmap), m68k
(which have variable minimum page sizes), and MIPS n32 (which zero
extend the offset to handle negative one correctly) redefine the new
header.
The patch also fixes BZ#21270 where default mmap64 on architectures
which uses mmap2 silent truncates large offsets value (larger than
1 << (page shift + 8 * sizeof (off_t)) or 1<<44 on architectures with
4096 bytes page size). The new consolidate implementation returns
EINVAL as allowed by POSIX.
It also adds a tests for on current tst-mmap-offset one. I have run
a full make check on x86_64, x86_64-32, i686, aarch64, armhf, powerpc,
powerpc64le, sparc64, and sparcv9 without any regressions. I also ran
some basic tests (tst-mmap-offset) on sh4, m68k, and on qemu simulated
MIPS32 and MIPS64.
[BZ #21270]
* posix/tst-mmap-offset.c (do_prepare): New function.
(do_test): Rename to do_test_bz18877 and use FAIL_RET.
(do_test_bz21270): New function.
* sysdeps/unix/sysv/linux/aarch64/mmap.c: Remove file.
* sysdeps/unix/sysv/linux/arm/mmap.c: Remove file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/i386/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/mmap64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise.
* sysdeps/unix/sysv/linux/mmap_internal.h: New file.
* sysdeps/unix/sysv/linux/m68k/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/s390/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Remove mmap
from auto-generation list.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mmap.c: New file.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Add check for invalid
offsets and support for mmap2 syscall.
Adhemerval Zanella [Tue, 11 Apr 2017 18:08:02 +0000 (15:08 -0300)]
posix: Add cleanup on the trap list for globtest.sh
This patch prevents lingering files for SIGSEGV failures by adding
a cleanup handler on trap handler. Checked on x86_64-linux-gnu.
* posix/globtest.sh: Add cleanup routine on trap 0.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:36 +0000 (14:18 -0300)]
powerpc: refactor memcmp and memmove IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Define the
implementation-specific function name and remove unneeded
macros definition.
* sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcmp.S: Set a default function
name if not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor memcpy and mempcpy IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Define the
implementation-specific function name and remove unneeded
macros definition.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/a2/memcpy.S: Set a default function
name if not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor memchr, memrchr, and rawmemchr IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S: Define the
implementation-specific function name and remove unneeded macros
definition.
* sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memchr.S: Set a default
function name if not defined and pass as parameter to macros
accordingly.
* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor memset IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/memset-power4.S: Define the
implementation-specific function name and remove unneeded macros
definition.
* sysdeps/powerpc/powerpc64/multiarch/memset-power6.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memset-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memset-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/memset.S: Set a default function name if
not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor strcasestr and strstr IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S: Define the
strcasestr implementation name and remove unneeded macros definition.
* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define
strstr implementation name and remove unneeded macros definition.
* sysdeps/powerpc/powerpc64/power7/strstr.S: Set a default function
name if not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor strchr, strchrnul, and strrchr IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S: Define the
implementation-specific function name and remove unneeded macros
definition.
* sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strchr.S: Set a default
function name if not defined and pass as parameter to macros
accordingly.
* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:35 +0000 (14:18 -0300)]
powerpc: refactor strnlen and strlen IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S: Define
the strlen implementation name and remove unneeded macros definition.
* sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S: Define
the strnlen implementation name and remove unneeded macros definition.
* sysdeps/powerpc/powerpc64/power7/strlen.S: Set a default function
name if not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:34 +0000 (14:18 -0300)]
powerpc: refactor strcasecmp, strcmp, and strncmp IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S: Define
the implementation-specific function name and remove unneeded
macros definition.
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Set a default function
name if not defined and pass as parameter to macros accordingly.
* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
Wainer dos Santos Moschetta [Tue, 11 Apr 2017 17:18:34 +0000 (14:18 -0300)]
powerpc: refactor stpcpy, stpncpy, strcpy, and strncpy IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.
Tested on ppc64le with and without --disable-multi-arch flag.
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Define the
implementation-specific function name and remove unneeded macros
definition.
* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strcpy-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/strncpy.S: Set a default
function name if not defined.
* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
Paul Clarke [Tue, 11 Apr 2017 14:19:28 +0000 (11:19 -0300)]
Support auxilliary vector components for cache geometries.
Add support to getauxval() for new types to get L1, L2, L3 cache sizes,
cache line sizes, and cache associativities. The new types for
getauxval() were added in the stream for Linux kernel v4.11 in commit
98a5f361b8625c6f4841d6ba013bbf0e80d08147.
* elf/elf.h (AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY, AT_L1D_CACHESIZE,
AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE, AT_L2_CACHEGEOMETRY,
AT_L3_CACHESIZE, AT_L3_CACHEGEOMETRY): New. Add auxvec
identifiers from kernel arch/powerpc/include/uapi/asm/auxvec.h.
Florian Weimer [Tue, 11 Apr 2017 16:04:34 +0000 (18:04 +0200)]
manual: readdir, readdir64 are thread-safe
They only modify the state in the dirstream argument, and we
generally do not treat this as a reason to mark a function as
not thread-safe. For an example, see random_r, which is marked
as thread-safe even though the random state is not protected
by a lock.
Adhemerval Zanella [Tue, 4 Apr 2017 18:49:43 +0000 (15:49 -0300)]
Consolidate pthreadtype.h placementConsolidate pthreadtype.h placement
This patch moves all arch specific pthreadtypes.h to a similar path
for all architectures (sysdeps/unix/sysv/<arch>/bits). No functional
or build change is expected. The idea is mainly to organize the
header placement for all architectures.
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,
m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).
* sysdeps/unix/sysv/linux/x86/Implies: New file.
* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ...
* sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here.
* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ...
* sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here.
* sysdeps/x86/bits/pthreadtypes.h: Move to ...
* sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
H.J. Lu [Mon, 10 Apr 2017 19:01:30 +0000 (12:01 -0700)]
Add sysdeps/x86/dl-procinfo.c
Add sysdeps/x86/dl-procinfo.c for x86 version of processor capability
information to reduce duplication between i386 and x86_64 dl-procinfo.c.
* sysdeps/i386/dl-procinfo.c: Include
<sysdeps/x86/dl-procinfo.c>.
* sysdeps/x86_64/dl-procinfo.c: Likewise.
* sysdeps/x86/dl-procinfo.c: New file.
Gabriel F. T. Gomes [Mon, 27 Mar 2017 19:23:58 +0000 (16:23 -0300)]
Remove unneeded declarations from math_private.h
The declarations of many functions in math_private.h are not required
since __MATHDECL and __MATHDECLX, in math.h, already provide the
declarations for these functions. This patch removes the declarations
from math_private.h. It also adds the inclusion of math.h to the files
which depended on the declaration of functions in math_private.h.
Tested for powerpc64le and s390x.
* sysdeps/generic/math_private.h: Remove declarations of
many functions that are already declared in math.h.
* sysdeps/ieee754/ldbl-128/e_logl.c: Include math.h to get the
declaration for __frexpl.
* sysdeps/ieee754/ldbl-128ibm/e_logl.c: Include math.h to get
the declarations for __scalbnl and fabsl.
Dmitry V. Levin [Wed, 16 Nov 2016 22:49:25 +0000 (22:49 +0000)]
Check for __mprotect failure in _dl_map_segments [BZ #20831]
* elf/dl-map-segments.h (_dl_map_segments): Check for failure
of __mprotect to change protection on the excess portion
to disallow all access.
H.J. Lu [Fri, 7 Apr 2017 14:44:40 +0000 (07:44 -0700)]
Check if SSE is available with HAS_CPU_FEATURE
Similar to other CPU feature checks, check if SSE is available with
HAS_CPU_FEATURE.
* sysdeps/i386/fpu/fclrexcpt.c (__feclearexcept): Use
HAS_CPU_FEATURE to check for SSE.
* sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Likewise.
* sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Likewise.
* sysdeps/i386/fpu/fegetenv.c (__fegetenv): Likewise.
* sysdeps/i386/fpu/fegetmode.c (fegetmode): Likewise.
* sysdeps/i386/fpu/feholdexcpt.c (__feholdexcept): Likewise.
* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Likewise.
* sysdeps/i386/fpu/fesetmode.c (fesetmode): Likewise.
* sysdeps/i386/fpu/fesetround.c (__fesetround): Likewise.
* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise.
* sysdeps/i386/fpu/fgetexcptflg.c (__fegetexceptflag): Likewise.
* sysdeps/i386/fpu/fsetexcptflg.c (__fesetexceptflag): Likewise.
* sysdeps/i386/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/i386/setfpucw.c (__setfpucw): Likewise.
* sysdeps/x86/cpu-features.h (bit_cpu_SSE): New.
(index_cpu_SSE): Likewise.
(reg_SSE): Likewise.
Paul Eggert [Fri, 7 Apr 2017 11:54:57 +0000 (07:54 -0400)]
getopt: merge from gnulib: use angle-bracket includes consistently
* posix/getopt1.c: Include <config.h>, not "config.h".
Zack Weinberg [Wed, 5 Apr 2017 15:04:35 +0000 (11:04 -0400)]
getopt: annotate files with relationship to gnulib.
As the final act in this patchset, adjust the "This file is part of
the GNU C Library" message at the top of each file to indicate which
files are synced with gnulib.
* posix/bits/getopt_core.h, posix/bits/getopt_ext.h
* posix/getopt.c, posix/getopt1.c, posix/getopt_int.h:
Mention in top-of-file boilerplate that these files are shared
with gnulib.
* posix/getopt.h, posix/bits/getopt_posix.h:
Mention in top-of-file boilerplate that these files are NOT shared
with gnulib, unlike the rest of the getopt implementation.
Zack Weinberg [Sat, 25 Mar 2017 15:24:24 +0000 (11:24 -0400)]
getopt: eliminate __need_getopt by splitting up getopt.h.
__need_getopt is misnamed; what it really means is "we want only the
getopt features specified in POSIX, not the GNU extensions". Because
this code is shared with gnulib, it winds up being cleanest to split
getopt.h into *four* headers. getopt_core.h and getopt_ext.h will
be shared with gnulib, getopt_posix.h will be just for glibc, and
each project will have its own copy of getopt.h.
* posix/bits/getopt_core.h, posix/bits/getopt_ext.h:
New files, intended to be shared with gnulib.
* posix/bits/getopt_posix.h:
New file, not intended to be shared with gnulib.
* posix/getopt.h: Now just includes features.h,
bits/getopt_core.h, and bits/getopt_ext.h. Will
no longer be shared with gnulib.
* include/bits/getopt_core.h, include/bits/getopt_ext.h
* include/bits/getopt_posix.h: New wrappers.
* posix/Makefile: Install new headers.
* posix/unistd.h, libio/stdio.h:
Include bits/getopt_posix.h instead of getopt.h.
Zack Weinberg [Mon, 3 Apr 2017 12:45:41 +0000 (08:45 -0400)]
getopt: merge _GL_UNUSED annotations from gnulib
gnulib now has annotations on at least some functions to cater to
compilation with -Wunused-parameter. In order to follow suit cleanly,
I've added to libc-symbols.h some of the _GL_* macros that
gnulib-common.m4 puts into config.h. (I don't think they belong in
sys/cdefs.h, at least not without further thought.)
At this point all gnulib-side changes to getopt.c have been merged.
* include/libc-symbols.h: For gnulib compatibility, define
_GL_UNUSED, _GL_UNUSED_LABEL, _GL_ATTRIBUTE_PURE, and
_GL_ATTRIBUTE_CONST.
* posix/getopt.c (_getopt_initialize): Mark argc and argv
parameters with _GL_UNUSED.
Zack Weinberg [Sat, 1 Apr 2017 21:13:45 +0000 (17:13 -0400)]
getopt: merge from gnulib: alloca avoidance
In one place, glibc's getopt uses alloca to construct a linked list of
possibilities for an "ambiguous" long option. In gnulib, malloc
should be used instead. Providing for both cases complicates things a
fair bit. Instead of merging straight across, therefore, I have
chosen to rewrite it using a boolean vector instead of a linked list.
There is then only one allocation that might need freeing; in glibc it
can honor __libc_use_alloca as usual, and in gnulib we define
__libc_use_alloca to always be false, so we don't need ifdefs in the
middle of the function. This should also be slightly more efficient
in the normal case of long options being fully spelled out -- I think
most people aren't even aware they _can_ sometimes abbreviate long
options.
One interesting consequence is that the list of possibilities is now
printed in exactly the order they appear in the list of long options,
instead of the first possibility being shuffled to the end. This
shouldn't be a big deal but it did break one test that relied on the
exact text of this error message.
(The reason the previous patch was "in aid of" merging from gnulib is
I didn't want to have to make this change in two places.)
(The patch looks bigger than it really is because there's a fair bit
of reindentation and code rearrangement.)
* posix/getopt.c: When used standalone, define __libc_use_alloca
as always false and alloca to abort if called.
(process_long_option): Rewrite handling of ambiguous long options
to use a single boolean vector, not a linked list; use
__libc_use_alloca to decide whether to allocate this using alloca.
* posix/tst-getopt_long1.c: Adjust text of expected error message.
Zack Weinberg [Sat, 1 Apr 2017 20:19:50 +0000 (16:19 -0400)]
getopt: refactor long-option handling
There were two copies of the bulk of the code to handle long options.
Now there is only one. (Yes, this is in aid of merging from gnulib.)
The change to bug-getopt4.c clarifies the error messages when the test
fails.
* posix/getopt.c (process_long_option): New function split out
from _getopt_internal_r.
(_getopt_internal_r): Replace both copies of the long-option
processing code with calls to process_long_option.
* posix/bug-getopt4.c (one_test): Print argv[0] in error messages.
(do_test): Differentiate argv[0] in the two subtests.
Zack Weinberg [Sat, 1 Apr 2017 16:42:41 +0000 (12:42 -0400)]
getopt: tidy up _getopt_initialize a bit
_getopt_data.__posixly_correct is completely redundant to
_getopt_data.__ordering, and some work that logically belongs in
_getopt_initialize was being done by _getopt_internal_r, making the
code harder to understand.
As a side effect, getenv will no longer be called if the first
character of the options string is '+' or '-', which is probably a
Good Thing. (Perhaps we should have a flag character that
specifically asks for the permutation behavior?)
* posix/getopt_int.h (_getopt_data): Remove __posixly_correct field.
* posix/getopt.c (_getopt_internal_r): Move some initialization code...
(_getopt_initialize): ...here. Don't set d->__posixly_correct.
Zack Weinberg [Sat, 1 Apr 2017 16:11:33 +0000 (12:11 -0400)]
getopt: merge from gnulib: function prototype adjustments
For standards compliance, getopt, getopt_long, and getopt_long_only in
glibc have to take 'char *const *argv' even though they can mutate the
array. gnulib has tried to clean this up as much as possible: all the
internal functions use 'char **argv', and when used standalone, so do
getopt_long and getopt_long_only.
Also brought over are __nonnull annotations, corrections to documentation,
and apparently it is no longer necessary to worry about conflicting
prototypes for getopt. The macroification of the definitions of
getopt and __posix_getopt goes beyond what is currently in gnulib.
At this point getopt1.c and getopt_int.h are identical to their gnulib
versions.
* posix/getopt.h: Add backup definition of __nonnull for
consistency with gnulib. Define __getopt_argv_const to const
if not already defined.
(getopt): Update doc comment from gnulib. Prototype
unconditionally. Add __nonnull annotation.
(__posix_getopt): Add __nonnull annotation.
(getopt_long, getopt_long_only): Use __getopt_argv_const in
prototypes for consistency with gnulib. Add __nonnull
annotations.
* posix/getopt.c (_getopt_initialize, _getopt_internal_r)
(getopt_internal): Change 'argv' argument to type 'char **'.
Remove now-unnecessary casts.
(getopt, __posix_getopt): Eliminate repetition with a macro.
Cast 'argv' to 'char **' when calling _getopt_internal.
* posix/getopt1.c (getopt_long, getopt_long_only):
Use __getopt_argv_const for consistency with gnulib.
Cast 'argv' to 'char **' when calling _getopt_internal.
(_getopt_long_r, _getopt_long_only_r):
Change 'argv' argument to type 'char **'.
(main): Constify 'long_options'.
* posix/getopt_int.h (getopt_internal, _getopt_internal_r)
(_getopt_long_r, _getopt_long_only_r):
Change 'argv' argument to type 'char **'.
Zack Weinberg [Sat, 1 Apr 2017 14:17:44 +0000 (10:17 -0400)]
getopt: clean up error reporting
getopt can print a whole bunch of error messages, and when used
standalone (from gnulib) it uses fprintf to do that. But fprintf is a
cancellation point and getopt isn't, and also applying fprintf to a
stream in wide-character mode is not allowed.
glibc has an internal function called __fxprintf that writes a narrow
format string to a stream regardless of mode, but it only handles
ASCII format strings, and it's still a cancellation point. getopt's
messages are translated, so they might not be ASCII. So getopt has an
error message to an asprintf buffer, monkeys with internal flag bits
on stderr to disable cancellation, and then calls
__fxprintf(stderr, "%s", buffer). There isn't even a helper function,
the code is duplicated every time.
This patch fixes __fxprintf to handle arbitrary multibyte format
strings, and adds a variant __fxprintf_nocancel that does the same
thing but also isn't a cancellation point. (It still _works_ by
monkeying with internal flag bits on the FILE, but that's not really a
layering violation for code in stdio-common.) All of the #ifdef _LIBC
blocks can then be reduced to their standalone versions with a little
help from some macros at the top of the file.
I also wrote a test case to verify that getopt really isn't a
cancellation point, and I'm glad I did, because it found two bugs, one
of which wasn't even to do with cancellation (see previous patch).
* stdio-common/fxprintf.c (__fxprintf_nocancel): New function.
(locked_vfxprintf): New helper function. Handle arbitrary
multibyte strings, not just ASCII.
* include/stdio.h: Declare __fxprintf_nocancel.
* posix/getopt.c: When _LIBC is defined, define fprintf to
__fxprintf_nocancel, flockfile to _IO_flockfile, and
funlockfile to _IO_funlockfile. When neither _LIBC nor
_POSIX_THREAD_SAFE_FUNCTIONS is defined, define flockfile and
funlockfile as no-ops. (_getopt_internal_r): Remove all
internal #ifdef _LIBC blocks; the standalone error-printing
code can now be used for libc as well. Add an
flockfile/funlockfile pair around one case where the error
message is printed in several chunks. Don't use fputc.
* posix/tst-getopt-cancel.c: New test.
* posix/Makefile: Run it.
Zack Weinberg [Sat, 1 Apr 2017 14:01:40 +0000 (10:01 -0400)]
getopt: fix fencepost error in ambiguous-W-option handling
getopt_long contains an undocumented (AFAICT) feature in which, if you
put "W;" in the short-options list, then '-W foo' and '-Wfoo' are
treated as equivalent to '--foo'. This is implemented with a partial
second copy of the code for handling long options, and that code
increments optind one too many times when recovering from an ambiguous
abbreviated option, which can cause the main loop to walk past the end
of argv and crash.
I discovered this while writing a test case that tries to exercise all
of getopt's error reporting paths; I wouldn't be surprised to learn
that this feature is never used by real applications.
* posix/getopt.c (_getopt_internal_r): Don't increment
d->optind a second time when reporting ambiguous -W options.
Zack Weinberg [Fri, 31 Mar 2017 11:58:07 +0000 (07:58 -0400)]
getopt: merge straightforward changes from gnulib
This covers changes with little or no consequences when the code is
used in glibc.
* posix/getopt_int.h: Include getopt.h.
Use impl-namespace names for all arguments to _getopt_internal and
_getopt_internal_r.
Declare __ordering enum outside the struct.
Harmonize comments with gnulib.
* posix/getopt1.c: Simplify #ifdeffage at top of file. Remove
ELIDE_CODE logic entirely. Move inclusion of stdlib.h to
#ifdef TEST block and make unconditional. Do not define NULL.
* posix/getopt.c: Partial merge from gnulib, covering the
initial includes and global declarations, commentary, and
a couple of semantically-neutral code changes.
Zack Weinberg [Fri, 31 Mar 2017 11:39:55 +0000 (07:39 -0400)]
getopt: merge from gnulib: don't use `...' quotes
I'm not sure whether this is official GNU style now, but `...' quotes
haven't looked properly balanced in most people's terminal fonts since
2001ish? and gnulib has chosen to switch over to '...' quotes.
I'm merging this separately from the other changes in gnulib because
it's very mechanical.
* posix/getopt.c, posix/getopt.h, posix/getopt1.c, posix/getopt_int.h:
Use '...' instead of `...' for quotation marks inside
comments and strings.
Zack Weinberg [Wed, 29 Mar 2017 20:58:58 +0000 (16:58 -0400)]
getopt: remove USE_NONOPTION_FLAGS
glibc's implementation of getopt includes code to parse an environment
variable named _XXX_GNU_nonoption_argv_flags_ (where XXX is the
current process's PID in decimal); but all of it has been #ifdefed out
since 2001, with no official way to turn it back on.
According to commentary in our config.h.in, bash version 2.0 set this
environment variable to indicate argv elements that were the result of
glob expansion and therefore should not be treated as options, but the
feature was "disabled later" because "it caused problems". According
to bash's CHANGES file, "later" was release 2.01; it gives no more
detail about what the problems were.
Version 2.0 of bash was released on the last day of 1996, and version
2.01 in June of 1997. Twenty years later, I think it is safe to
assume that this environment variable isn't coming back.
* config.h.in (USE_NONOPTION_FLAGS): Remove.
* csu/init-first.c: Remove all #ifdef USE_NONOPTION_FLAGS blocks.
* sysdeps/mach/hurd/i386/init-first.c: Likewise.
* posix/getopt_int.h: Likewise.
* posix/getopt.c: Likewise. Also remove SWAP_FLAGS and the
__libc_argc and __libc_argv externs, which were only used by
#ifdef USE_NONOPTION_FLAGS blocks.
* posix/getopt_init.c: Remove file.
* posix/Makefile (routines): Remove getopt_init.
* include/getopt.h: Don't declare __getopt_initialize_environment.
* manual/getopt.texi: Remove mention of USE_NONOPTION_FLAGS in
a comment.
Florian Weimer [Fri, 7 Apr 2017 11:01:21 +0000 (13:01 +0200)]
resolv: Remove IQUERY support
Adhemerval Zanella [Thu, 16 Mar 2017 12:15:57 +0000 (09:15 -0300)]
sparc: Fix .udiv plt on libc
With the removal of divdi3 object from sparcv9-linux-gnu build, its
definition came from libgcc and its functions internall calls .udiv.
Since glibc also exports these symbols for compatibility reasons, it
will end up creating PLT calls internally in libc.so.
To avoid it, this patch uses the linker option --wrap to replace all
the internal libc.so .udiv calls to the wrapper __wrap_.udiv. Along
with strong alias in the udiv implementations, it makes linker do
local calls.
Checked on sparcv9-linux-gnu.
* sysdeps/sparc/sparc32/Makefile (libc.so-gnulib): New rule.
* sysdeps/sparc/sparc32/sparcv8/udiv.S (.udiv): Make a strong_alias
to __wrap_.udiv.
* sysdeps/sparc/sparc32/sparcv9/udiv.S (.udiv): Likewise.
* sysdeps/sparc/sparc32/udiv.S (.udiv): Likewise.
Adhemerval Zanella [Wed, 15 Mar 2017 18:44:59 +0000 (15:44 -0300)]
Build divdi3 only for architecture that required it
As noted in [1], divdi3 object is only exported in a handful ABIs
(i386, m68k, powerpc32, s390-32, and ia64), however it is built
for all current architectures regardless.
This patch refact the make rules for this object to so only the
aforementioned architectures that actually require it builds it.
Also, to avoid internal PLT calls to the exported symbol from the
module, glibc uses an internal header (symbol-hacks.h) which is
unrequired (and in fact breaks the build for architectures that
intend to get symbol definitions from libgcc.a). The patch also
changes it to create its own header (divdi3-symbol-hacks.h) and
adjust the architectures that require it accordingly.
I checked the build/check (with run-built-tests=no) on the
following architectures (which I think must cover all supported
ABI/builds) using GCC 6.3:
aarch64-linux-gnu
alpha-linux-gnu
arm-linux-gnueabihf
hppa-linux-gnu
ia64-linux-gnu
m68k-linux-gnu
microblaze-linux-gnu
mips64-n32-linux-gnu
mips-linux-gnu
mips64-linux-gnu
nios2-linux-gnu
powerpc-linux-gnu
powerpc-linux-gnu-power4
powerpc64-linux-gnu
powerpc64le-linux-gnu
s390x-linux-gnu
s390-linux-gnu
sh4-linux-gnu
sh4-linux-gnu-soft
sparc64-linux-gnu
sparcv9-linux-gnu
tilegx-linux-gnu
tilegx-linux-gnu-32
tilepro-linux-gnu
x86_64-linux-gnu
x86_64-linux-gnu-x32
i686-linux-gnu
I only saw one regression on sparcv9-linux-gnu (extra PLT call to
.udiv) which I address in next patch in the set. It also correctly
build SH with GCC 7.0.1 (without any regression from
c89721e25d).
[1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html
* sysdeps/i386/symbol-hacks.h: New file.
* sysdeps/m68k/symbol-hacks.h: New file.
* sysdeps/powerpc/powerpc32/symbol-hacks.h: New file.
* sysdeps/s390/s390-32/symbol-hacks.h: New file.
* sysdeps/unix/sysv/linux/i386/Makefile
[$(subdir) = csu] (sysdep_routines): New rule: divdi3 object.
[$(subdir) = csu] (sysdep-only-routines): Likewise.
[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
* sysdeps/unix/sysv/linux/m68k/Makefile
[$(subdir) = csu] (sysdep_routines): Likewise.
[$(subdir) = csu] (sysdep-only-routines): Likewise.
[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
[$(subdir) = csu] (sysdep_routines): Likewise.
[$(subdir) = csu] (sysdep-only-routines): Likewise.
[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Makefile
[$(subdir) = csu] (sysdep_routines): Likewise.
[$(subdir) = csu] (sysdep-only-routines): Likewise.
[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
* sysdeps/wordsize-32/Makefile: Remove file.
* sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ...
* sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
H.J. Lu [Wed, 5 Apr 2017 21:09:38 +0000 (14:09 -0700)]
Define TEST_FUNCTION_ARGV in elf/tst-dlopen-aout.c
* elf/tst-dlopen-aout.c (TEST_FUNCTION): Removed.
(TEST_FUNCTION_ARGV): New.
Wainer dos Santos Moschetta [Wed, 5 Apr 2017 13:34:39 +0000 (10:34 -0300)]
Update elf tests to use the support test driver.
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.
Checked on x86_64.
* elf/next.c: Import support/test-driver.c instead of
test-skeleton.c and delete TEST_FUNCTION macro definition.
* elf/nodelete.c: Likewise.
* elf/order2.c: Likewise.
* elf/tst-_dl_addr_inside_object.c: Likewise.
* elf/tst-addr1.c: Likewise.
* elf/tst-align.c: Likewise.
* elf/tst-align2.c: Likewise.
* elf/tst-audit11.c: Likewise.
* elf/tst-audit12.c: Likewise.
* elf/tst-audit2.c: Likewise.
* elf/tst-audit9.c: Likewise.
* elf/tst-auxv.c: Likewise and define
TEST_FUNCTION_ARGV macro.
* elf/tst-deep1.c: Likewise.
* elf/tst-dl-iter-static.c: Likewise.
* elf/tst-dlmodcount.c: Likewise.
* elf/tst-dlmopen1.c: Likewise.
* elf/tst-dlmopen2.c: Likewise.
* elf/tst-dlmopen3.c: Likewise.
* elf/tst-dlopen-aout.c: Likewise.
* elf/tst-dlopenrpath.c: Likewise.
* elf/tst-dlsym-error.c: Likewise.
* elf/tst-execstack-needed.c: Likewise.
* elf/tst-execstack-prog.c: Likewise.
* elf/tst-execstack.c: Likewise.
* elf/tst-global1.c: Likewise.
* elf/tst-gnu2-tls1.c: Likewise.
* elf/tst-latepthread.c: Likewise.
* elf/tst-leaks1.c: Likewise.
* elf/tst-linkall-static.c: Likewise.
(do_test): New function.
* elf/tst-nodelete-opened.c: Likewise.
* elf/tst-nodelete.cc: Likewise.
* elf/tst-nodelete2.c: Likewise.
* elf/tst-noload.c: Likewise.
* elf/tst-null-argv.c: Likewise and define
TEST_FUNCTION_ARGV marcro.
* elf/tst-order-main.c: Likewise.
* elf/tst-pathopt.c: Likewise.
* elf/tst-pie2.c: Likewise.
* elf/tst-piemod1.c: Likewise.
* elf/tst-prelink.c: Likewise.
* elf/tst-protected1a.c: Likewise.
* elf/tst-protected1b.c: Likewise.
* elf/tst-ptrguard1.c: Likewise, import getopt.h,
and define _GNU_SOURCE macro.
(cmdline_process_function): New function.
* elf/tst-relsort1.c: Likewise.
* elf/tst-stackguard1.c: Likewise, import getopt.h,
and define _GNU_SOURCE macro.
(cmdline_process_function): New function.
* elf/tst-thrlock.c: Likewise.
* elf/tst-tls-dlinfo.c: Likewise.
* elf/tst-tls-manydynamic.c: Likewise and import
support/xthread.h.
* elf/tst-tls1.c: Likewise.
* elf/tst-tls10.c: Likewise.
* elf/tst-tls11.c: Likewise.
* elf/tst-tls12.c: Likewise.
* elf/tst-tls13.c: Likewise.
* elf/tst-tls14.c: Likewise.
* elf/tst-tls15.c: Likewise.
* elf/tst-tls16.c: Likewise.
* elf/tst-tls17.c: Likewise.
* elf/tst-tls18.c: Likewise.
* elf/tst-tls19.c: Likewise.
* elf/tst-tls2.c: Likewise.
* elf/tst-tls3.c: Likewise.
* elf/tst-tls4.c: Likewise.
* elf/tst-tls5.c: Likewise.
* elf/tst-tls6.c: Likewise.
* elf/tst-tls7.c: Likewise.
* elf/tst-tls8.c: Likewise.
* elf/tst-tls9.c: Likewise.
* elf/tst-tlsalign-extern.c: Likewise.
* elf/tst-tlsalign.c: Likewise.
* elf/tst-unique1.c: Likewise.
* elf/tst-unique2.c: Likewise.
* elf/vismain.c: Likewise.
Wainer dos Santos Moschetta [Wed, 5 Apr 2017 13:28:21 +0000 (10:28 -0300)]
Add page tests to string/test-strnlen.
May be tricky for otimized implementations to handle strings around
page boundary once, for instance, it is performed unaligned loads or
when maxlen is used as a hint for vectorized loops. The test cases
should unveil regression bugs on these cases.
To some extend do_random_tests in string/test-strnlen tests strings
placed at page end but it does not cover all cases. So this change
adds tests which consists of placing strings of varying sizes ending
at the page boundary. It also combines with different values of maxlen.
Tested on ppc64le and x86_64.
* string/test-strnlen.c (do_page_tests): New function
to check length of strings ending at the page boundary.
(test_main): Added call to the do_page_tests function.
Wainer dos Santos Moschetta [Wed, 5 Apr 2017 13:24:24 +0000 (10:24 -0300)]
powerpc64: Add POWER8 strnlen
Added strnlen POWER8 otimized for long strings. It delivers
same performance as POWER7 implementation for short strings.
This takes advantage of reasonably performing unaligned loads
and bit permutes to check the first 1-16 bytes until
quadword aligned, then checks in 64 bytes strides until unsafe,
then 16 bytes, truncating the count if need be.
Likewise, the POWER7 code is recycled for less than 32 bytes strings.
Tested on ppc64 and ppc64le.
* sysdeps/powerpc/powerpc64/multiarch/Makefile
(sysdep_routines): Add strnlen-power8.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(strnlen): Add __strnlen_power8 to list of strnlen functions.
* sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S:
New file.
* sysdeps/powerpc/powerpc64/multiarch/strnlen.c
(__strnlen): Add __strnlen_power8 to ifunc list.
* sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.
Wainer dos Santos Moschetta [Tue, 4 Apr 2017 21:05:20 +0000 (18:05 -0300)]
Update wcsmbs tests to use the support test driver
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.
Checked on x86_64-linux-gnu.
* wcsmbs/tst-btowc.c: Import support/test-driver.c and remove
the TEST_FUNCTION macro definition.
* wcsmbs/tst-mbrtowc2.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.
Adhemerval Zanella [Tue, 4 Apr 2017 19:00:27 +0000 (16:00 -0300)]
Remove CALL_THREAD_FCT macro
This patch removes CALL_THREAD_FCT macro usage and its defition for
x86. For 32 bits it usage is only for force 16 stack alignment,
however stack is already explicit aligned in clone syscall. For
64 bits and x32 it just a function call and there is no need to
code it with inline assembly.
Checked on i686-linux-gnu, x86_64-linux-gnu, and x86_64-linux-gnu-x32.
* nptl/pthread_create.c (START_THREAD_DEFN): Remove
CALL_THREAD_FCT macro usage.
* sysdeps/i386/nptl/tls.h (CALL_THREAD_FCT): Remove definition.
* sysdeps/x86_64/nptl/tls.h (CALL_THREAD_FCT): Likewise.
* sysdeps/x86_64/32/nptl/tls.h: Remove file.
Adhemerval Zanella [Tue, 4 Apr 2017 20:23:33 +0000 (17:23 -0300)]
Remove __ASSUME_REQUEUE_PI
The new cond var implementation (
ed19993b5b0d) removed all the
__ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no
need to keep defining it. This patch removes all USE_REQUEUE_PI
and __ASSUME_REQUEUE_PI. It is as follow up from BZ#18463.
Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf,
m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
* nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_REQUEUE_PI): Likewise.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_REQUEUE_PI): Likewise.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_REQUEUE_PI): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
(__ASSUME_REQUEUE_PI): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_REQUEUE_PI): Likewise.
Florian Weimer [Tue, 4 Apr 2017 15:31:52 +0000 (17:31 +0200)]
resolv: Add tst-resolv-canonname
Florian Weimer [Tue, 4 Apr 2017 12:36:02 +0000 (14:36 +0200)]
nss_dns: Replace local declarations with declarations from a header file
Florian Weimer [Tue, 4 Apr 2017 12:13:03 +0000 (14:13 +0200)]
nss_dns: Remove superfluous dn_expand call from network handling
Florian Weimer [Tue, 4 Apr 2017 12:09:56 +0000 (14:09 +0200)]
resolv: Add test coverage for ns_name_unpack, ns_name_ntop
Stefan Liebler [Tue, 4 Apr 2017 11:16:28 +0000 (13:16 +0200)]
S390: Clobber also r14 in TLS_LD, TLS_GD macros on 31bit.
This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit.
This ensures that r14 isn't used to save and restore r12 while
r14 is clobbered by the bas-instruction.
As note:
r12 can't be added to clobber list as gcc would fail with:
error: PIC register clobbered by ‘12’ in ‘asm’
For 64bit this fix was already done in 2004 in the
commit
b80af23ac6973e69df6cd23d221fa44fffb21e17.
ChangeLog:
* sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD):
Clobber also r14.
Mike Frysinger [Mon, 3 Apr 2017 19:18:07 +0000 (15:18 -0400)]
ChangeLog: fix BZ style to be consistent and match majority of existing code
Mike Frysinger [Thu, 16 Mar 2017 06:59:31 +0000 (23:59 -0700)]
posix_spawn: use a larger min stack for -fstack-check [BZ #21253]
When glibc is built with -fstack-check, trying to use posix_spawn can
lead to segfaults due to gcc internally probing stack memory too far.
The new spawn API will allocate a minimum of 1 page, but the stack
checking logic might probe a couple of pages. When it tries to walk
them, everything falls apart.
The gcc internal docs [1] state the default interval checking is one
page. Which means we need two pages (the current one, and the next
probed). No target currently defines it larger.
Further, it mentions that the default minimum stack size needed to
recover from an overflow is 4/8KiB for sjlj or 8/12KiB for others.
But some Linux targets (like mips and ppc) go up to 16KiB (and some
non-Linux targets go up to 24KiB).
Let's create each child with a minimum of 32KiB slack space to support
them all, and give us future breathing room.
No test is added as existing ones crash. Even a simple call is
enough to trigger the problem:
char *argv[] = { "/bin/ls", NULL };
posix_spawn(NULL, "/bin/ls", NULL, NULL, argv, NULL);
[1] https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Stack-Checking.html
Wladimir J. van der Laan [Sat, 1 Apr 2017 07:09:09 +0000 (12:39 +0530)]
Call the right helper function when setting mallopt M_ARENA_MAX (BZ #21338)
Fixes a typo introduced in commit
be7991c0705e35b4d70a419d117addcd6c627319. This caused
mallopt(M_ARENA_MAX) as well as the environment variable
MALLOC_ARENA_MAX to not work as intended because it set the
wrong internal parameter.
[BZ #21338]
* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
instead of incorrect do_set_arena_test
Gabriel F. T. Gomes [Fri, 31 Mar 2017 12:31:10 +0000 (09:31 -0300)]
Fix condition for inclusion of math-finite.h for long double
The condition for declaration of long double functions in
math-finite.h was #ifdef __MATH_DECLARE_LDOUBLE before the
macroization of this file. After the macroization, it was incorreclty
changed to #if __MATH_DECLARE_LDOUBLE, which broke the build for arm.
* math/math.h: Fix check for __MATH_DECLARE_LDOUBLE.
* math/bits/math-finite.h: Likewise.
Slava Barinov [Fri, 31 Mar 2017 06:49:25 +0000 (08:49 +0200)]
fts: Fix symbol redirect for fts_set [BZ #21289]
In a 32-bit environment with _FILE_OFFSET_BITS=64, the __REDIRECT macro
combined with __THROW generates an invalid C++ declaration.
Adhemerval Zanella [Tue, 28 Mar 2017 19:44:19 +0000 (16:44 -0300)]
Fix more test-errno issues
This patch fixes some test-errno-linux unexpected returns for the
tested syscalls on some older kernels (I saw it on a Linux 3.8 on
armv7l). Basically:
- inotify_add_watch: Linux v3.8 (
676a0675c) removed the test to
check at least one valid bit in flags (to return EINVAL). It
was later added back in v3.9 (
04df32fa1).
- quotactl: returns ENOSYS for kernels not configured with
CONFIG_QUOTA.
Checked on x86_64-linux-gnu and armv7l-linux-gnueabihf.
* sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Handle
non expected inotify_add_watch and quotactl return.
Gabriel F. T. Gomes [Tue, 28 Mar 2017 17:48:57 +0000 (14:48 -0300)]
Change return type in the declaration of __ieee754_rem_pio2l
The implementation of __ieee754_rem_pio2l in ldbl-128, ldbl-128ibm,
and ldbl-96 return the type int32_t, whereas math_private.h declares
it as returning int. This patch changes the declaration to match the
declaration in thoses directories, as well as it changes the stub
implementation in math/e_rem_pio2l.c, similarly.
* math/e_rem_pio2l.c (__ieee754_rem_pio2l): Change return type
to int32_t.
* sysdeps/generic/math_private.h: Declare __ieee754_rem_pio2l
as returning int32_t.
Gabriel F. T. Gomes [Fri, 10 Mar 2017 12:47:18 +0000 (09:47 -0300)]
Macroize inclusion of math-finite.h
This patch macroizes the declarations in math/bits/math-finite.h
similarly to what math/bits/mathcalls.h does. For each floating-point
type, the file is included once in math/math.h. This will reduce the
amount of repetitive boilerplate required when adding float128
versions of these declarations.
Tested for powerpc64le and s390x.
* math/math.h: Include bits/math-finite.h once per
floating-point type.
* math/bits/math-finite.h: Macroize all declarations by
floating-point type.
Adhemerval Zanella [Tue, 14 Mar 2017 17:16:13 +0000 (14:16 -0300)]
Fix i686 memchr overflow calculation (BZ#21182)
This patch fixes the regression added by 23d2770 for final address
overflow calculation. The subtraction of the considered size (16)
at line 120 is at wrong place, for sizes less than 16 subsequent
overflow check will not take in consideration an invalid size (since
the subtraction will be negative). Also, the lea instruction also
does not raise the carry flag (CF) that is used in subsequent jbe
to check for overflow.
The fix is to follow x86_64 logic from 3daef2c where the overflow
is first check and a sub instruction is issued. In case of resulting
negative size, CF will be set by the sub instruction and a NULL
result will be returned. The patch also add similar tests reported
in bug report.
Checked on i686-linux-gnu and x86_64-linux-gnu.
* string/test-memchr.c (do_test): Add BZ#21182 checks for address
near end of a page.
* sysdeps/i386/i686/multiarch/memchr-sse2.S (__memchr): Fix
overflow calculation.
Steve Ellcey [Tue, 28 Mar 2017 16:07:03 +0000 (09:07 -0700)]
Change TEST_NAME to memcpy to fix IFUNC testing of multiple versions.
* benchtests/bench-memcpy-random.c (TEST_NAME): Change to memcpy.
(IMPL) Call with 1 instead of 0 as argument.
Adhemerval Zanella [Fri, 20 Jan 2017 21:01:59 +0000 (19:01 -0200)]
Consolidate set* Linux implementation
This patch consolidates the Linux setegid, seteuid, setgid, setgroups,
setregid, setresgid, setresuid, setreuid, and setuid implementation on
default sysdeps/unix/sysv/linux/set*.c implementation. It basically
removes all the architecture define implementations and add support for
__NR_set*32 syscall on Linux default implementation.
Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.
* sysdeps/unix/sysv/linux/arm/setegid.c: Remove file.
* sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/arm/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/i386/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise.
* sysdeps/unix/sysv/linux/setegid.c (setegid): Use
INLINE_SYSCALL_ERROR_RETURN_VALUE.
* sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise.
* sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if
defined.
* sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use
__NR_setgroups32 if defined.
* sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32
if defined.
* sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use
__NR_setresgid32 is defined.
* sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use
__NR_setresuid32 if defined.
* sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use
__NR_setreuid32 if defined.
* sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if
defined.
Egmont Koblinger [Thu, 23 Mar 2017 01:27:30 +0000 (21:27 -0400)]
localedata: hu_HU: fix multiple sorting bugs (bug 18934)
Fix the incorrect sorting order of a digraph and its geminated variant,
regression introduced by a faulty fix to bug 13547 in commit
b008d4c85619a753e441d7f473ba8af0db400bd6.
Fix two inconsistencies in sorting unusual capitalization of digraphs
(bug #18587).
Enable DIACRIT_FORWARD to work around bug #17750.
Sort foreign accents after the Hungarian ones.
Add extensive unittests containing all the examples from The Rules of
Hungarian Orthography and many more, including explanatory comments.
Joseph Myers [Mon, 27 Mar 2017 15:07:38 +0000 (15:07 +0000)]
Define more termios.h macros unconditionally for alpha (bug 21277).
termios.h should define IUCLC for UNIX98 and older XSI standards. The
sysdeps/unix/sysv/linux/alpha version defines it only if __USE_MISC,
so causing some conform/ tests to fail.
Other versions define it unconditionally (I* being a reserved
namespace for this header); the API should be consistent between
architectures in the absence of a clear reason for it to differ (and
given that a symbol is part of the API on two architectures, I don't
see any reason for the feature test macros required ever to differ
between those architectures), so this patch makes the alpha version
define it unconditionally as well. Two non-POSIX macros alongside it,
IMAXBEL and IUTF8, are also defined unconditionally on other
architectures, so this patch makes them consistent by defining them
unconditionally on alpha as well.
Tested (compilation only) with build-many-glibcs.py.
[BZ #21277]
* sysdeps/unix/sysv/linux/alpha/bits/termios.h (IUCLC): Define
unconditionally.
(IMAXBEL): Likewise.
(IUTF8): Likewise.
Szabolcs Nagy [Mon, 27 Mar 2017 11:01:34 +0000 (12:01 +0100)]
[AArch64] Update libm-test-ulps
* sysdeps/aarch64/libm-test-ulps: Update.
Siddhesh Poyarekar [Sun, 26 Mar 2017 13:31:50 +0000 (19:01 +0530)]
Actually add bench-memcpy-random
git-add and commit the benchmark that Wilco posted on the list.
Sunyeop Lee [Fri, 24 Mar 2017 05:38:28 +0000 (11:08 +0530)]
Update old tunables framework document/script.
Since commit
8b9e9c3c0bae497ad5e2d0ae2f333f62feddcc12, security_level replaces
is_secure. There were some old files need to be updated.
2017-03-23 Sunyeop Lee <sunyeop97@gmail.com>
* README.tunables: Updated descriptions.
* elf/dl-tunables.list: Fixed typo: SXID_NONE -> NONE.
* scripts/gen-tunables.awk: Updated the code related to the commit.
Wilco Dijkstra [Thu, 23 Mar 2017 19:00:02 +0000 (19:00 +0000)]
Add a new randomized memcpy test for copies up to 256 bytes. The distribution
of the size and alignment is based on a trace of SPEC2006. Instead of
repeating the same copy over and over again like the existing tests, it times
several thousand different copies to more accurately estimate the overhead of
branch prediction.
* benchtests/Makefile (string-benchset): Add memcpy-random.
* benchtests/bench-memcpy-random.c: New file.
Tulio Magno Quites Machado Filho [Thu, 23 Mar 2017 18:45:00 +0000 (15:45 -0300)]
Change the order of function attributes in printf.h
ISO C++ section 8.3.5 [dcl.fct] requires exception specifications
to appear before attribute specifiers in function declarations.
This patch fixes issues reported by stdio-common/check-installed-headers-cxx.
* stdio-common/printf.h (register_printf_modifier): Change the
order of __wur and __THROW.
(register_printf_type): Likewise.
Wainer dos Santos Moschetta [Thu, 23 Mar 2017 14:32:17 +0000 (11:32 -0300)]
Update string tests to use the support test driver.
Replaced all imports of test-skeleton.c with support/test-driver.c.
In some cases it was needed to adjust do_test to return int
instead of static int since that is the method's signature expected by
test-driver.c.
Checked on x86_64.
* string/test-string.h (TEST_FUNCTION): Use test_main instead of
test_main ().
(CMDLINE_PROCESS): Use function instead of defined macro.
* debug/test-strcpy_chk.c: Import support/test-driver.c and also
<suppport/support.h> to use set_fortify_handler().
* string/bug-envz1.c: Import support/test-driver.c instead of
test-skeleton.c.
* string/bug-strcoll2.c: Likewise.
* string/bug-strtok1.c: Likewise.
* string/stratcliff.c: Likewise.
* string/test-ffs.c: Likewise.
* string/test-memccpy.c: Likewise.
* string/test-memchr.c: Likewise.
* string/test-memcmp.c: Likewise.
* string/test-memcpy.c: Likewise.
* string/test-memmem.c: Likewise.
* string/test-memmove.c: Likewise.
* string/test-memrchr.c: Likewise.
* string/test-memset.c: Likewise.
* string/test-rawmemchr.c: Likewise.
* string/test-strcasecmp.c: Likewise.
* string/test-strcasestr.c: Likewise.
* string/test-strcat.c: Likewise.
* string/test-strchr.c: Likewise.
* string/test-strcmp.c: Likewise.
* string/test-strcpy.c: Likewise.
* string/test-string.h: Likewise.
* string/test-strlen.c: Likewise.
* string/test-strncasecmp.c: Likewise.
* string/test-strncat.c: Likewise.
* string/test-strncmp.c: Likewise.
* string/test-strncpy.c: Likewise.
* string/test-strnlen.c: Likewise.
* string/test-strpbrk.c: Likewise.
* string/test-strrchr.c: Likewise.
* string/test-strspn.c: Likewise.
* string/test-strstr.c: Likewise.
* string/tst-bswap.c: Likewise.
* string/tst-cmp.c: Likewise.
* string/tst-endian.c: Likewise.
* string/tst-inlcall.c: Likewise.
* string/tst-strcoll-overflow.c: Likewise.
* string/tst-strfry.c: Likewise.
* string/tst-strlen.c: Likewise.
* string/tst-strtok.c: Likewise.
* string/tst-strtok_r.c: Likewise.
* string/tst-strxfrm.c: Likewise.
* string/tst-strxfrm2.c: Likewise.
* string/tst-svc.c: Likewise.
* string/tst-svc2.c: Likewise.
Zack Weinberg [Wed, 22 Mar 2017 12:39:36 +0000 (08:39 -0400)]
Another round of inclusion fixes for _ISOMAC testsuite.
* stdio-common/bug25.c: Include stdlib.h.
* support/tst-support_format_dns_packet.c: Include stdio.h,
stdlib.h, and string.h.
* support/tst-support_record_failure.c: Include string.h.
* support/tst-support_record_failure-2.sh: Adjust line number
expectations and correct a typo in an error message.
H.J. Lu [Tue, 21 Mar 2017 17:59:31 +0000 (10:59 -0700)]
x86-64: Improve branch predication in _dl_runtime_resolve_avx512_opt [BZ #21258]
On Skylake server, _dl_runtime_resolve_avx512_opt is used to preserve
the first 8 vector registers. The code layout is
if only %xmm0 - %xmm7 registers are used
preserve %xmm0 - %xmm7 registers
if only %ymm0 - %ymm7 registers are used
preserve %ymm0 - %ymm7 registers
preserve %zmm0 - %zmm7 registers
Branch predication always executes the fallthrough code path to preserve
%zmm0 - %zmm7 registers speculatively, even though only %xmm0 - %xmm7
registers are used. This leads to lower CPU frequency on Skylake
server. This patch changes the fallthrough code path to preserve
%xmm0 - %xmm7 registers instead:
if whole %zmm0 - %zmm7 registers are used
preserve %zmm0 - %zmm7 registers
if only %ymm0 - %ymm7 registers are used
preserve %ymm0 - %ymm7 registers
preserve %xmm0 - %xmm7 registers
Tested on Skylake server.
[BZ #21258]
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt):
Define only if _dl_runtime_resolve is defined to
_dl_runtime_resolve_sse_vex.
* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt):
Fallthrough to _dl_runtime_resolve_sse_vex.
Joseph Myers [Tue, 21 Mar 2017 16:40:16 +0000 (16:40 +0000)]
Regenerate INSTALL.
Thorsten Kukuk [Tue, 21 Mar 2017 15:47:00 +0000 (16:47 +0100)]
Merge branch 'master' of ssh://sourceware.org/git/glibc
Conflicts:
ChangeLog
Stefan Liebler [Tue, 21 Mar 2017 15:41:56 +0000 (16:41 +0100)]
Fix failing test malloc/tst-interpose-nothread with GCC 7.
The test malloc/tst-interpose-nothread fails on s390x if built
with GCC 7 and glibc commit "Remove the str(n)dup inlines
from string/bits/string2.h. Although inlining"
(
ae65d4f3c3995279ca458c460ebf8bab1885fa03) with output:
error: free: 0x3fffdffa010: invalid allocation index: 0 (not less than 0)
The destructor check_for_allocations in malloc/tst-interpose-aux.c is
called twice. One time after the test-child-process has finished successfully
and once after the test-parent-process finishes.
During the latter invocation, allocation_index == 0. GCC 7 is now inlining the
free function and calls unconditionally fail in get_header as
header->allocation_index (type == size_t) is always >= allocation_index (= 0).
Before the mentioned commit above, strdup was replaced by strlen, malloc and
memcpy. The malloc call was also inlined and allocation_index was set to one.
This patch moves the already existing compiler barrier before the invocation
of free.
ChangeLog:
* malloc/tst-interpose-aux.c (check_for_allocations):
Move compiler barrier before free.
Thorsten Kukuk [Tue, 21 Mar 2017 14:14:27 +0000 (15:14 +0100)]
Deprecate libnsl by default (only shared library will be
build for backward compatibility, no linking possible) and disable building
of libnss_compat, libnss_nis and libnss_nisplus, except --enable-obsolete-nsl
option is given to configure.
* config.h.in: Add LINK_OBSOLETE_NSL.
* config.make.in: Add build-obsolete-nsl.
* configure.ac: Add obsolete-nsl option.
* include/libc-symbols.h: Define libnsl_hidden_nolink_def.
* include/rpcsvc/yp.h: Add missing functions as libnsl_hidden_proto.
* include/rpcsvc/nislib.h: Likewise.
* include/rpcsvc/ypclnt.h: Likewise.
* manual/install.texi: Document --enable-obsolete-nsl.
* nis/Makefile: Build only libnsl by default (add build-obsolete-nsl).
* nis/nis_add.c: Replace libnsl_hidden_def with
libnsl_hidden_nolink_def.
* nis/nis_addmember.c: Likewise.
* nis/nis_call.c: Likewise.
* nis/nis_clone_obj.c: Likewise.
* nis/nis_defaults.c: Likeise.
* nis/nis_domain_of_r.c: Likewise.
* nis/nis_error.c: Likewise.
* nis/nis_file.c: Likewise.
* nis/nis_free.c: Likewise.
* nis_local_names.c: Likewise.
* nis/nis_lookup.c: Likewise.
* nis/nis_modify.c: Likewise.
* nis/nis_print.c: Likewise.
* nis/nis_remove.c: Likewise.
* nis/nis_table.c: Likewise.
* nis/nis_util.c: Likewise.
* nis/nis_xdr.c: Likewise.
* nis/yp_xdr.c: Likewise.
* nis/ypclnt.c: Likewise.
* nis/ypupdate_xdr.c: Likewise.
* nis/nis_checkpoint.c: Add libnsl_hidden_nolink_def to all functions.
* nis/nis_clone_dir.c: Likewise.
* nis/nis_clone_res.c: Likewise.
* nis/nis_creategroup.c: Likewise.
* nis/nis_destroygroup.c: Likewise.
* nis/nis_domain_of.c: Likewise.
* nis/nis_getservlist.c: Likewise.
* nis/nis_ismember.c: Likewise.
* nis/nis_mkdir.c: Likewise.
* nis/nis_ping.c: Likewise.
* nis/nis_print_group_entry.c: Likewise.
* nis/nis_removemember.c: Likewise.
* nis/nis_rmdir.c: Likewise.
* nis/nis_server.c: Likewise.
* nis/nis_subr.c: Likewise.
* nis/nis_verifygroup.c: Likewise.
Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
Joseph Myers [Mon, 20 Mar 2017 21:30:28 +0000 (21:30 +0000)]
conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).
POSIX specifies long as the type of elements of struct mq_attr. For
x32, they are __syscall_slong_t (i.e. long long). This patch XFAILs
the corresponding tests for x32 in the conformtest expectations (the
bug should not be closed without an actual fix).
Tested with build-many-glibcs.py.
[BZ #21279]
* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
* conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for
x86_64-x32-linux.
(mq_attr.mq_maxmsg): Likewise.
(mq_attr.mq_msgsize): Likewise.
(mq_attr.mq_curmsgs): Likewise.