Commit Graph

31478 Commits

Author SHA1 Message Date
Stefan Liebler 85286aaf1d S390: Move utf16-utf32-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
The utf16-utf32-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/utf16-utf32-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/utf16-utf32-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|VX] to 1 or 0.
The code below is rearranged and surrounded
by #if HAVE_[FROM|TO]_[C|VX] == 1.  There is no functional change.

ChangeLog:

	* sysdeps/s390/multiarch/utf16-utf32-z9.c: New File.
	* sysdeps/s390/utf16-utf32-z9.c: Move ifunc resolvers to multiarch
	folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|VX].
	(HAVE_FROM_C, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX, FROM_LOOP_DEFAULT,
	FROM_LOOP_C, FROM_LOOP_VX, TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX):
	New Define.
2017-04-21 15:30:00 +02:00
Stefan Liebler df6cc7ee3b 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.
2017-04-21 15:30:00 +02:00
Stefan Liebler 51213e2b8d 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.
2017-04-21 15:30:00 +02:00
Florian Weimer 44e4b889ab manual: Document replacing malloc [BZ #20424] 2017-04-21 10:28:37 +02:00
Joseph Myers 832d8bc00b 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.
2017-04-20 20:35:21 +00:00
Adhemerval Zanella d76d370355 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.
2017-04-20 17:09:17 -03:00
Florian Weimer a0704b1ac7 nss_dns: Correct parentheses for the __glibc_unlikely argument
This fixes commit bee05c9d58.
2017-04-19 22:19:17 +02:00
Florian Weimer b8129a415e rcmd/rexec: Fix typo in comment 2017-04-19 22:19:17 +02:00
Zack Weinberg 25cfd50214 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.
2017-04-19 14:39:04 -04:00
Florian Weimer bee05c9d58 resolv: Replace __builtin_expect with __glibc_unlikely/__glibc_likely 2017-04-19 14:29:24 +02:00
Christopher Chittleborough 3e2cf872a5 Bug 21399: Fix CP1254 comment for U+00EC 2017-04-19 08:10:35 -04:00
Florian Weimer 2f83a7294d Create more sockets with SOCK_CLOEXEC [BZ #15722] 2017-04-19 07:45:04 +02:00
Florian Weimer e92030239a 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.
2017-04-19 07:44:48 +02:00
Joseph Myers 62f71aad7e 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].
2017-04-18 23:51:35 +00:00
Joseph Myers 2288c2674d 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.
2017-04-18 21:22:51 +00:00
H.J. Lu 4cb334c4d6 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.
2017-04-18 14:01:45 -07:00
H.J. Lu 1c53cb49de 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.
2017-04-18 08:27:32 -07:00
Florian Weimer cef9b65376 Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
Florian Weimer b48061e1a5 Assume that dup3 is available 2017-04-18 14:42:19 +02:00
Florian Weimer 46d8874d5b 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.
2017-04-18 14:09:01 +02:00
Florian Weimer 025b33ae84 malloc: Turn cfree into a compatibility symbol 2017-04-18 11:50:58 +02:00
Rajalakshmi Srinivasaraghavan 6c6ab1fc49 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.
2017-04-18 11:28:56 +05:30
Rabin Vincent 2604882cef [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.
2017-04-17 12:03:44 -03:00
Florian Weimer a12ae89f86 Assume that O_NOFOLLOW is always defined 2017-04-13 21:28:18 +02:00
Florian Weimer 44500cbb25 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.
2017-04-13 13:22:51 +02:00
Florian Weimer e14a27723c resolv: Reduce EDNS payload size to 1200 bytes [BZ #21361]
This hardens the stub resolver against fragmentation-based attacks.
2017-04-13 13:09:38 +02:00
Florian Weimer c803cb9b24 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.
2017-04-13 11:56:28 +02:00
Florian Weimer a7ff1da823 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.
2017-04-13 10:52:42 +02:00
Rajalakshmi Srinivasaraghavan 249dcdb71b 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.
2017-04-13 11:29:20 +05:30
Adhemerval Zanella 158d5fa0e1 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.
2017-04-12 11:04:28 -03:00
Adhemerval Zanella 4fee33f8c1 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.
2017-04-12 11:01:35 -03:00
Wainer dos Santos Moschetta b6a6622209 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.
2017-04-11 17:13:56 -03:00
Wainer dos Santos Moschetta 72fd128a08 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.
2017-04-11 17:13:56 -03:00
Wainer dos Santos Moschetta ff06a55aef 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.
2017-04-11 17:13:55 -03:00
Wainer dos Santos Moschetta 18e0054bf7 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.
2017-04-11 17:13:55 -03:00
Wainer dos Santos Moschetta f0748b70a8 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.
2017-04-11 17:13:55 -03:00
Wainer dos Santos Moschetta 6d15a5c2e9 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.
2017-04-11 17:13:54 -03:00
Wainer dos Santos Moschetta 001649fd18 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.
2017-04-11 17:13:54 -03:00
Wainer dos Santos Moschetta 3bc426e156 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.
2017-04-11 17:13:54 -03:00
Wainer dos Santos Moschetta dbcc7d0893 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.
2017-04-11 17:13:31 -03:00
Paul Clarke d031600dd2 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.
2017-04-11 14:05:54 -03:00
Florian Weimer a42478b7bf 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.
2017-04-11 18:04:34 +02:00
Adhemerval Zanella 38efe8c5a5 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.
2017-04-10 17:33:10 -03:00
H.J. Lu fda19e0438 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.
2017-04-10 12:01:45 -07:00
Gabriel F. T. Gomes 6d4adeb700 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.
2017-04-10 12:20:47 -03:00
Dmitry V. Levin 9ace4692b2 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.
2017-04-09 23:34:33 +00:00
H.J. Lu bf7730194f 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.
2017-04-07 07:44:59 -07:00
Paul Eggert 893ba3eac9 getopt: merge from gnulib: use angle-bracket includes consistently
* posix/getopt1.c: Include <config.h>, not "config.h".
2017-04-07 07:56:40 -04:00
Zack Weinberg 06576cbf4e 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.
2017-04-07 07:53:37 -04:00
Zack Weinberg 10a33cf8b4 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.
2017-04-07 07:53:03 -04:00