Commit graph

30040 commits

Author SHA1 Message Date
H.J. Lu 893e371b2f Use JUMPTARGET in x86-64 pthread
When PLT may be used, JUMPTARGET should be used instead calling the
function directly.

	* sysdeps/unix/sysv/linux/x86_64/cancellation.S
	(__pthread_enable_asynccancel): Use JUMPTARGET to call
	__pthread_unwind.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
	(__condvar_cleanup2): Use JUMPTARGET to call _Unwind_Resume.
	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
	(__condvar_cleanup1): Likewise.
2016-03-21 06:51:05 -07:00
Mike Frysinger a4cea54b12 localedata: standardize copyright/license information [BZ #11213]
Use the language from the FSF in all locale files to disclaim any
license/copyright on locale data.

See https://sourceware.org/ml/libc-locales/2013-q1/msg00048.html
2016-03-21 02:29:56 -04:00
Dylan Alex Simon f9378ac377 math: don't clobber old libm.so on install [BZ #19822]
When installing glibc (w/mathvec enabled) in-place on a system with
a glibc w/out mathvec enabled, the install will clobber the existing
libm.so (e.g., /lib64/libm-2.21.so) with a linker script.  This is
because libm.so is a symlink to libm.so.6 which is a symlink to the
final libm-2.21.so file.  When the makefile writes the linker script
directly to libm.so, it gets clobbered.

The simple patch below to math/Makefile fixes this.  It is based on
the nptl Makefile, which does exactly the same thing in a safer way.
2016-03-21 02:07:51 -04:00
Mike Frysinger 6bc81cf205 localedata: standardize first few lines
Purely a style touchup to make sure the headers all look the same.
2016-03-21 02:00:09 -04:00
Adhemerval Zanella 2a69f853c0 posix: Fix posix_spawn invalid memory access
Current Linux posix_spawn spawn do not test if the pid argument is
valid before trying to update it for success case.  This patch fixes
it.

Tested on x86_64 and i686.

	* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Fix invalid memory
	access where posix_spawn success and pid argument is null.
	* posix/tst-spawn.c (do_test): Add posix_spawn null pid argument for
	success case.
2016-03-20 18:17:52 -03:00
Samuel Thibault 0e8e593d73 hurd: Add c++-types expected result
* sysdeps/mach/hurd/i386/c++-types.data: New file.
2016-03-20 22:16:34 +01:00
Samuel Thibault 4d10ceb2b2 hurd: Allow inlining IO locks
* sysdeps/mach/hurd/libc-lock.h (_IO_lock_inexpensive): Define to 1.
2016-03-20 22:12:06 +01:00
Samuel Thibault d2129ad457 hurd: Do not hide rtld symbols which need to be preempted
* sysdeps/generic/dl-fcntl.h: New file, adds attribute_hidden to __open
	and __fcntl.
	* sysdeps/mach/hurd/dl-fcntl.h: New file, adds attribute_hidden to
	__fcntl only.
	* include/fcntl.h [IS_IN (rtld)]: Include <dl-fcntl.h> instead of
	adding attribute_hidden to __open and __fcntl.
2016-03-20 19:51:42 +01:00
Samuel Thibault c775104ac6 Fix mach-syscalls.mk build
* mach/Makefile ($(objpfx)mach-syscalls.mk): Depend on libc-modules.h.
2016-03-20 19:50:58 +01:00
Samuel Thibault fe43d0f464 hurd: Break errnos.d / libc-modules.h dependency loop
Generating errnos.d does not actually need libc-modules.h.

* sysdeps/mach/hurd/Makefile ($(common-objpfx)errnos.d): Strip
"-include $(common-objpfx)libc-modules.h" from CPPFLAGS, and do not
depend on libc-modules.h,
2016-03-20 16:44:44 +01:00
Joseph Myers a64e3aadbf Remove __ASSUME_EVENTFD2, move eventfd to syscalls.list.
Given current Linux kernel version requirements, we can assume the
presence of the eventfd2 syscall.  This means that __ASSUME_EVENTFD2
can be removed, and a syscalls.list entry suffices for eventfd instead
of needing a .c file.  This patch implements those changes.

Tested for x86_64 and x86 (not that that means much, given the lack of
testsuite coverage for eventfd).

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_EVENTFD2):
	Remove macro.
	* sysdeps/unix/sysv/linux/eventfd.c: Remove file.
	* sysdeps/unix/sysv/linux/syscalls.list (eventfd): New syscall
	entry.
2016-03-17 19:07:39 +00:00
Joseph Myers 4674df40bb Remove __ASSUME_FALLOCATE.
Given current Linux kernel version requirements, we can always assume
the fallocate syscall to be available.  This patch removes
__ASSUME_FALLOCATE and a test for whether __NR_fallocate is defined.

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

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_FALLOCATE):
	Remove macro.
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c: Do not
	include <kernel-features.h>.
	[!__ASSUME_FALLOCATE]: Remove conditional code.
	(posix_fallocate) [__NR_fallocate]: Make code unconditional.
2016-03-17 12:15:51 +00:00
H.J. Lu 86ed888255 Use JUMPTARGET in x86-64 mathvec
When PLT may be used, JUMPTARGET should be used instead calling the
function directly.

	* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core_sse4.S
	(_ZGVbN2v_cos_sse4): Use JUMPTARGET to call cos.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core_avx2.S
	(_ZGVdN4v_cos_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S
	(_ZGVdN4v_cos): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core_sse4.S
	(_ZGVbN2v_exp_sse4): Use JUMPTARGET to call exp.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core_avx2.S
	(_ZGVdN4v_exp_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core_avx512.S
	(_ZGVdN4v_exp): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core_sse4.S
	(_ZGVbN2v_log_sse4): Use JUMPTARGET to call log.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core_avx2.S
	(_ZGVdN4v_log_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S
	(_ZGVdN4v_log): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core_sse4.S
	(_ZGVbN2vv_pow_sse4): Use JUMPTARGET to call pow.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core_avx2.S
	(_ZGVdN4vv_pow_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core_avx512.S
	(_ZGVdN4vv_pow): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core_sse4.S
	(_ZGVbN2v_sin_sse4): Use JUMPTARGET to call sin.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core_avx2.S
	(_ZGVdN4v_sin_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S
	(_ZGVdN4v_sin): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core_sse4.S
	(_ZGVbN2vvv_sincos_sse4): Use JUMPTARGET to call sin and cos.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core_avx2.S
	(_ZGVdN4vvv_sincos_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S
	(_ZGVdN4vvv_sincos): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S
	(_ZGVdN8v_cosf): Use JUMPTARGET to call cosf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf4_core_sse4.S
	(_ZGVbN4v_cosf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_cosf8_core_avx2.S
	(_ZGVdN8v_cosf_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S
	(_ZGVdN8v_expf): Use JUMPTARGET to call expf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf4_core_sse4.S
	(_ZGVbN4v_expf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_expf8_core_avx2.S
	(_ZGVdN8v_expf_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S
	(_ZGVdN8v_logf): Use JUMPTARGET to call logf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf4_core_sse4.S
	(_ZGVbN4v_logf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_logf8_core_avx2.S
	(_ZGVdN8v_logf_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S
	(_ZGVdN8vv_powf): Use JUMPTARGET to call powf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf4_core_sse4.S
	(_ZGVbN4vv_powf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_powf8_core_avx2.S
	(_ZGVdN8vv_powf_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
	(_ZGVdN8vv_powf): Use JUMPTARGET to call sinf and cosf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf4_core_sse4.S
	(_ZGVbN4vvv_sincosf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf8_core_avx2.S
	(_ZGVdN8vvv_sincosf_avx2): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S
	(_ZGVdN8v_sinf): Use JUMPTARGET to call sinf.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf4_core_sse4.S
	(_ZGVbN4v_sinf_sse4): Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_s_sinf8_core_avx2.S
	(_ZGVdN8v_sinf_avx2): Likewise.
	* sysdeps/x86_64/fpu/svml_d_wrapper_impl.h (WRAPPER_IMPL_SSE2):
	Use JUMPTARGET to call callee.
	(WRAPPER_IMPL_SSE2_ff): Likewise.
	(WRAPPER_IMPL_SSE2_fFF): Likewise.
	(WRAPPER_IMPL_AVX): Likewise.
	(WRAPPER_IMPL_AVX_ff): Likewise.
	(WRAPPER_IMPL_AVX_fFF): Likewise.
	(WRAPPER_IMPL_AVX512): Likewise.
	(WRAPPER_IMPL_AVX512_ff): Likewise.
	* sysdeps/x86_64/fpu/svml_s_wrapper_impl.h (WRAPPER_IMPL_SSE2):
	Likewise.
	(WRAPPER_IMPL_SSE2_ff): Likewise.
	(WRAPPER_IMPL_SSE2_fFF): Likewise.
	(WRAPPER_IMPL_AVX): Likewise.
	(WRAPPER_IMPL_AVX_ff): Likewise.
	(WRAPPER_IMPL_AVX_fFF): Likewise.
	(WRAPPER_IMPL_AVX512): Likewise.
	(WRAPPER_IMPL_AVX512_ff): Likewise.
	(WRAPPER_IMPL_AVX512_fFF): Likewise.
2016-03-16 14:24:19 -07:00
Mike Frysinger 0863cf2ada add ChangeLog entry 2016-03-16 15:06:33 -04:00
Mike Frysinger b07aa58944 localedata: use same comment_char/escape_char in these files
These files are small and easy to convert to what most others use.
2016-03-16 14:59:05 -04:00
Carlos O'Donell 6f915e9dc8 localedata: an_ES: fix case of lang_ab
This needs to be lowercase to match the local ISO 639 database.
2016-03-16 00:54:56 -04:00
Samuel Thibault 35fbb341f8 Fix hurd build
* sysdeps/mach/hurd/openat.c (__openat): Add missing ellipsis.
	* resolv/gai_sigqueue.c (__gai_sigqueue): Add missing internal_function
	qualifier.
	* /rt/aio_sigqueue.c (__aio_sigqueue): Add missing attribute_hidden
	internal_function qualifiers.
2016-03-16 13:57:57 +01:00
Carlos O'Donell b4f518ecfa Fix building glibc master with NDEBUG and --with-cpu.
When building on i686, x86_64, and arm, and with NDEBUG, or --with-cpu
there are various variables and functions which are unused based on
these settings.

This patch marks all such variables with __attribute__((unused)) to
avoid the compiler warnings when building with the aformentioned
options.
2016-03-15 23:23:24 -04:00
Joseph Myers 089b772f98 Remove __ASSUME_PPOLL.
With current kernel version requirements, the ppoll Linux syscall can
be assumed to be present on all architectures; this patch removes the
__ASSUME_PPOLL macro and conditionals on it and on whether __NR_ppoll
is defined.  (Note that the same can't yet be done for pselect,
because MicroBlaze only wired that up in the syscall table in 3.15.)

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

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PPOLL):
	Remove macro.
	* sysdeps/unix/sysv/linux/ppoll.c: Do not include
	<kernel-features.h>.
	[__NR_ppoll]: Make code unconditional.
	[!__ASSUME_PPOLL]: Remove conditional code.
2016-03-15 21:11:07 +00:00
Joseph Myers 35ade9f11b Adjust kernel-features.h defaults for socket syscalls.
This patch adjusts the defaults for kernel-features.h macros relating
to availability of accept4, recvmmsg and sendmmsg.  It is not intended
to affect which macros end up getting defined in any configuration.

At present, all architectures with syscalls for those functions need
to define __ASSUME_*_SYSCALL macros; in particular, any new
architecture needs its own kernel-features.h file for that purpose,
though it may not otherwise need such a header.  Those macros are then
used together with __ASSUME_SOCKETCALL to define macros for whether
the functions in question are available.

This patch changes the defaults so that the syscalls are assumed to be
available by default with recent-enough kernels, and it is the
responsibility of architecture headers to undefine the macros if they
are unavailable in supported kernels at least as recent as the version
where the architecture-independent functionality was introduced.  The
__ASSUME_<function> macros are defaulted similarly instead of being
defined based on other macros (defining based on other macros would no
longer work because the #undefs appear after the generic header is
included), so where the syscall being unavailable means the function
is unavailable this means the architecture header has to undefine the
__ASSUME_<function> macro; this only affects __ASSUME_ACCEPT4 for
ia64, as other cases where the syscalls were added late enough to be
relevant with current kernel version requirements are all on
socketcall architectures.

As a consequence, the AArch64 and Nios II kernel-features.h header
files are removed, and others simplified.  When the minimum kernel
version becomes 4.3 or later on all architectures, the syscalls in
question can just be assumed unconditionally, permitting further
simplification.

Tested for x86_64, x86 and powerpc (that installed shared libraries
are unchanged by the patch, and testsuite for x86_64 and x86).

	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Define unconditionally.
	(__ASSUME_ACCEPT4): Likewise.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Define.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h: Remove file.
	* sysdeps/unix/sysv/linux/nios2/kernel-features.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Do not define.
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Do not define.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x030300].
	[__LINUX_KERNEL_VERSION < 0x030300] (__ASSUME_ACCEPT4): Undefine.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x030300].
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
2016-03-15 21:09:33 +00:00
Andreas Schwab 5e7fdabd7d Fix resource leak in resolver (bug 19257)
The number of currently defined nameservers is stored in ->nscount,
whereas ->_u._ext.nscount is set by __libc_res_nsend only after local
initializations.
2016-03-15 13:15:54 +01:00
Andreas Schwab 2beb1010e4 Fix compilation of test-signgam-* tests 2016-03-15 00:03:03 +01:00
Joseph Myers 981569c74c Update glibc headers for Linux 4.5.
This patch updates the glibc headers with the defines MADV_FREE,
IPV6_HDRINCL and EPOLLEXCLUSIVE that are added in Linux 4.5.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* bits/mman-linux.h [__USE_MISC] (MADV_FREE): New macro.
	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]
	(MADV_FREE): Likewise.
	* sysdeps/unix/sysv/linux/bits/in.h (IPV6_HDRINCL): Likewise.
	* sysdeps/unix/sysv/linux/sys/epoll.h (enum EPOLL_EVENTS): Add
	EPOLLEXCLUSIVE.
2016-03-14 19:04:53 +00:00
Carlos O'Donell 3205a39364 Remove mention of checktab.awk in timezone/README. 2016-03-14 14:11:51 -04:00
Samuel Thibault 15b9738da3 Fix flag test in waitid compatibility layer
* sysdeps/posix/waitid.c (OUR_WAITID): Test against WSTOPPED instead of
	WUNTRACED.
2016-03-13 21:44:09 +01:00
Tulio Magno Quites Machado Filho b43f552a8a Fix type of parameter passed by malloc_consolidate
atomic_exchange_acq() expected a pointer, but was receiving an integer.
2016-03-11 18:09:40 -03:00
Rajalakshmi Srinivasaraghavan 869d7180dd powerpc: Rearrange cfi_offset calls
This patch rearranges cfi_offset() calls after the last store
so as to avoid extra DW_CFA_advance opcodes in unwind information.
2016-03-11 11:31:58 -03:00
Carlos O'Donell f60ee13f5d Removed unused timezone/checktab.awk. 2016-03-10 23:22:49 -05:00
Joseph Myers b55b28e657 Allow spurious underflow / inexact for ldbl-128ibm.
A large number of the test-ldouble failures seen for ldbl-128ibm are
spurious "underflow" and "inexact" exceptions.  These arise from such
exceptions in the underlying arithmetic; unlike other spurious
exceptions from that arithmetic, they do not in general relate to
cases where the returned result is also substantially inaccurate, are
not so readily avoidable by appropriately conditional libgcc patches,
and are widespread enough to be hard to handle through individual
XFAILing of the affected tests.

Thus, this patch documents relaxed accuracy goals for libm functions
for IBM long double and makes libm-test.inc reflect these spurious
exceptions in ldbl-128ibm arithmetic and always allow them in
ldbl-128ibm testing (while still not allowing these exceptions to be
missing where required to be present).  Tested for powerpc.

	* manual/math.texi (Errors in Math Functions): Document relaxed
	accuracy goals for IBM long double.
	* math/libm-test.inc (test_exceptions): Always allow spurious
	"underflow" and "inexact" exceptions for IBM long double.
2016-03-10 23:48:46 +00:00
H.J. Lu 6aa3e97e25 Add _arch_/_cpu_ to index_*/bit_* in x86 cpu-features.h
index_* and bit_* macros are used to access cpuid and feature arrays o
struct cpu_features.  It is very easy to use bits and indices of cpuid
array on feature array, especially in assembly codes.  For example,
sysdeps/i386/i686/multiarch/bcopy.S has

	HAS_CPU_FEATURE (Fast_Rep_String)

which should be

	HAS_ARCH_FEATURE (Fast_Rep_String)

We change index_* and bit_* to index_cpu_*/index_arch_* and
bit_cpu_*/bit_arch_* so that we can catch such error at build time.

	[BZ #19762]
	* sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
	(EXTRA_LD_ENVVARS): Add _arch_ to index_*/bit_*.
	* sysdeps/x86/cpu-features.c (init_cpu_features): Likewise.
	* sysdeps/x86/cpu-features.h (bit_*): Renamed to ...
	(bit_arch_*): This for feature array.
	(bit_*): Renamed to ...
	(bit_cpu_*): This for cpu array.
	(index_*): Renamed to ...
	(index_arch_*): This for feature array.
	(index_*): Renamed to ...
	(index_cpu_*): This for cpu array.
	[__ASSEMBLER__] (HAS_FEATURE): Add and use field.
	[__ASSEMBLER__] (HAS_CPU_FEATURE)): Pass cpu to HAS_FEATURE.
	[__ASSEMBLER__] (HAS_ARCH_FEATURE)): Pass arch to HAS_FEATURE.
	[!__ASSEMBLER__] (HAS_CPU_FEATURE): Replace index_##name and
	bit_##name with index_cpu_##name and bit_cpu_##name.
	[!__ASSEMBLER__] (HAS_ARCH_FEATURE): Replace index_##name and
	bit_##name with index_arch_##name and bit_arch_##name.
2016-03-10 05:27:07 -08:00
Aurelien Jarno f8e9c4d30c mips: terminate the FDE before the return trampoline in makecontext
In makecontext the FDE needs to be terminated before the return
trampoline otherwise backtrace called within a context created by
makecontext yields infinite backtrace.

This bug has been present for a long time, stdlib/tst-makecontext did
not fail until recent commit e535ce25. Tested on mips-linux-gnu and
mips64el-linux-gnuabi64 and mips-linux-gnu, no regression.

This fixes stdlib/tst-makecontext on MIPS.

Changelog:
	[BZ #19792]
	* sysdeps/unix/sysv/linux/mips/makecontext.S (__makecontext):
	Terminate FDE before return label.
2016-03-09 18:48:18 +01:00
Joseph Myers 613c92b3b5 Fix ldbl-128ibm nearbyintl in non-default rounding modes (bug 19790).
The ldbl-128ibm implementation of nearbyintl uses logic that only
works in round-to-nearest mode.  This contrasts with rintl, which
works in all rounding modes.

Now, arguably nearbyintl could simply be aliased to rintl, given that
spurious "inexact" is generally allowed for ldbl-128ibm, even for the
underlying arithmetic operations.  But given that the only point of
nearbyintl is to avoid "inexact", this patch follows the more
conservative approach of adding conditionals to the rintl
implementation to make it suitable for use to implement nearbyintl,
then builds it for nearbyintl with USE_AS_NEARBYINTL defined.  The
test test-nearbyint-except-2 shows up issues when traps on "inexact"
are enabled, which turn out to be problems with the powerpc
fenv_private.h implementation (two functions that should disable
exception traps potentially failing to do so in some cases); this
patch duly fixes that as well (I don't see any other existing cases
where this would be user-visible; there isn't much use of *_NOEX,
*hold* etc. in libm that requires exceptions to be discarded and not
trapped on).

Tested for powerpc.

	[BZ #19790]
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c [USE_AS_NEARBYINTL]
	(rintl): Define as macro.
	[USE_AS_NEARBYINTL] (__rintl): Likewise.
	(__rintl) [USE_AS_NEARBYINTL]: Use SET_RESTORE_ROUND_NOEX instead
	of fesetround.  Ensure results are evaluated before end of scope.
	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Define
	USE_AS_NEARBYINTL and include s_rintl.c.
	* sysdeps/powerpc/fpu/fenv_private.h (libc_feholdsetround_ppc):
	Disable exception traps in new environment.
	(libc_feholdsetround_ppc_ctx): Likewise.
2016-03-09 00:30:59 +00:00
Roland McGrath 3bd80c0de2 Fix tst-audit10 build when -mavx512f is not supported. 2016-03-08 12:32:59 -08:00
Aurelien Jarno 0b8dedd38f Add sys/auxv.h wrapper to include/sys/
The GNU libc testsuite fails to build on powerpc/ppc64/ppc64le with the
following error:

    ../sysdeps/powerpc/test-get_hwcap.c:26:22: fatal error: sys/auxv.h: No such file or director

This is because test-get_hwcap.c includes <sys/auxv.h>, but we don't
provide a wrapper in include/sys. This patch adds one.

Changelog:
	* include/sys/auxv.h: New file.
2016-03-08 21:20:43 +01:00
H.J. Lu 2b35e48c0c Define _HAVE_STRING_ARCH_mempcpy to 1 for x86
Since x86 has an optimized mempcpy and GCC can inline mempcpy on x86,
define _HAVE_STRING_ARCH_mempcpy to 1 for x86.

	[BZ #19759]
	* sysdeps/x86/bits/string.h (_HAVE_STRING_ARCH_mempcpy): New.
2016-03-08 10:57:41 -08:00
Gabriel F. T. Gomes 183a34dc4a powerpc: Remove uses of operand modifier (%s) in inline asm
The operand modifier %s on powerpc is an undocumented internal implementation
detail of GCC.  Besides that, the GCC community wants to remove it.  This patch
rewrites the expressions that use this modifier with logically equivalent
expressions that don't require it.

Explanation for the substitution:

The %s modifier takes an immediate operand and prints 32 less such immediate.
Thus, in the previous code, the expression resulted in:

  32 - __builtin_ffs(e)

where e was guaranteed to have exactly a single bit set, by the following
expressions:

  (e & (e-1) == 0) : e has at most one bit set.
  (e != 0)         : e is not zero, thus it has at least one bit set.

Since we guarantee that there is exactly only one bit set, the following
statement is true:

  32 - __builtin_ffs(e) == __builtin_clz(e)

Thus, we can replace __builtin_ffs with __builtin_clz and remove the %s operand
modifier.
2016-03-08 15:30:28 -03:00
Carlos Eduardo Seo 911569d02d powerpc: Fix dl-procinfo HWCAP
HWCAP-related code should had been updated when the 32 bits of HWCAP were
used.  This patch updates the code in dl-procinfo.h to loop through all
the 32 bits in HWCAP and updates _dl_powerpc_cap_flags accordingly.
2016-03-08 15:30:06 -03:00
H.J. Lu 87da630b22 Support --enable-hardcoded-path-in-tests in benchtests
benchtests should use $(test-via-rtld-prefix) and $(+link-tests) like
other glibc tests.

	[BZ #19783]
	* benchtests/Makefile (run-bench): Replace $(rtld-prefix) with
	$(test-via-rtld-prefix).
	($(binaries-bench)): Replace $(+link) with $(+link-tests).
2016-03-08 04:53:38 -08:00
Florian Weimer 30bcdc1860 sunrpc: In key_call_keyenvoy, use int status instead of union wait 2016-03-08 10:04:24 +01:00
Adhemerval Zanella e49b221aea posix: Fix tst-execvpe5 for --enable-hardcoded-path-in-tests
This patch fixes the posix/tst-execvpe5 invocation when GLIBC is
configured with --enable-hardcoded-path-in-tests which fails with:

$ cat  posix/tst-execvpe5.out
Wrong number of arguments (4)

Checked on x86-64 and powerpc64le.

	* posix/tst-execvpe5.c (do_test): Fix fix test invocation when
	configured with --enable-hardcoded-path-in-tests.
2016-03-08 09:30:38 +07:00
Joseph Myers cc4084017e Fix ldbl-128ibm remainderl equality test for zero low part (bug 19677).
The ldbl-128ibm implementation of remainderl has logic resulting in
incorrect tests for equality of the absolute values of the arguments
in the case of zero low parts.  If the low parts are both zero but
with different signs, this can wrongly cause equal arguments to be
treated as different, resulting in turn in incorrect signs of zero
result in nondefault rounding modes arising from the subtractions done
when the arguments are not equal.

This patch fixes the logic to convert -0 low parts into +0 before the
comparison (remquo already has separate logic to deal with signs of
zero results, so doesn't need such a change).  Tests are added for
remainderl and remquol similar to that for fmodl, and based on a
refactoring of it, since the bug depends on low parts which should not
be relied upon in tests not setting the representation explicitly
(although in fact the bug shows up in test-ldouble with current GCC).
Tested for powerpc.

	[BZ #19677]
	* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
	(__ieee754_remainderl): Put zero low parts in canonical form.
	* sysdeps/ieee754/ldbl-128ibm/test-fmodrem-ldbl-128ibm.c: New
	file.  Based on
	sysdeps/ieee754/ldbl-128ibm/test-fmodl-ldbl-128ibm.c.
	* sysdeps/ieee754/ldbl-128ibm/test-fmodl-ldbl-128ibm.c: Replace
	with wrapper round test-fmodrem-ldbl-128ibm.c.
	* sysdeps/ieee754/ldbl-128ibm/test-remainderl-ldbl-128ibm.c: New
	file.
	* sysdeps/ieee754/ldbl-128ibm/test-remquol-ldbl-128ibm.c:
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Add
	test-remainderl-ldbl-128ibm and test-remquol-ldbl-128ibm.
2016-03-08 00:27:21 +00:00
Florian Weimer 920b35c92e ldconfig: Do not remove stale symbolic links with -X [BZ #19610] 2016-03-07 22:06:18 +01:00
Mike Frysinger 515b0760fa link sln fix to bugzilla [BZ #15333] 2016-03-07 13:23:24 -05:00
Andreas Schwab 8de3f8b2be Fix min/max needed for ascii to INTERNAL conversion 2016-03-07 17:47:50 +01:00
Hongjiu Zhang f5e753c8c3 sln: use stat64
When using sln on some filesystems which return 64-bit inodes,
the stat call might fail during install like so:
	.../elf/sln .../elf/symlink.list
	/lib32/libc.so.6: invalid destination: Value too large for defined data type
	/lib32/ld-linux.so.2: invalid destination: Value too large for defined data type
	Makefile:104: recipe for target 'install-symbolic-link' failed

Switch to using stat64 all the time to avoid this.

URL: https://bugs.gentoo.org/576396
2016-03-07 11:37:12 -05:00
Florian Weimer abc40bb2a7 libio: Clean up _IO_file_doallocate and _IO_wfile_doallocate
No functional changes.
2016-03-07 17:05:06 +01:00
Florian Weimer 3c0f7407ee tst-audit4, tst-audit10: Compile AVX/AVX-512 code separately [BZ #19269]
This ensures that GCC will not use unsupported instructions before
the run-time check to ensure support.
2016-03-07 16:00:25 +01:00
Florian Weimer 900056024b test-skeleton.c: Do not set RLIMIT_DATA [BZ #19648]
With older kernels, it is mostly ineffective because it causes malloc
to switch from sbrk to mmap (potentially invalidating malloc testing
compared to what real appliations do).  With newer kernels which
have switched to enforcing RLIMIT_DATA for mmap as well, some test
cases will fail in an unintended fashion because the limit which was
set previously does not include room for all mmap mappings.
2016-03-07 13:48:47 +01:00
Adhemerval Zanella 9ff72da471 posix: New Linux posix_spawn{p} implementation
This patch implements a new posix_spawn{p} implementation for Linux.  The main
difference is it uses the clone syscall directly with CLONE_VM and CLONE_VFORK
flags and a direct allocated stack.  The new stack and start function solves
most the vfork limitation (possible parent clobber due stack spilling).  The
remaning issue are related to signal handling:

  1. That no signal handlers must run in child context, to avoid corrupt
     parent's state.
  2. Child must synchronize with parent to enforce stack deallocation and
     to possible return execv issues.

The first one is solved by blocking all signals in child, even NPTL-internal
ones (SIGCANCEL and SIGSETXID).  The second issue is done by a stack allocation
in parent and a synchronization with using a pipe or waitpid (in case or error).
The pipe has the advantage of allowing the child signal an exec error (checked
with new tst-spawn2 test).

There is an inherent race condition in pipe2 usage for architectures that do not
support the syscall directly.  In such cases the a pipe plus fctnl is used
instead and it may lead to file descriptor leak in parent (as decribed by fcntl
documentation).

The child process stack is allocate with a mmap with MAP_STACK flag using
default architecture stack size.  Although it is slower than use a stack buffer
from parent, it allows some slack for the compatibility code to run scripts
with no shebang (which may use a buffer with size depending of argument list
count).

Performance should be similar to the vfork default posix implementation and
way faster than fork path (vfork on mostly linux ports are basically
clone with CLONE_VM plus CLONE_VFORK).  The only difference is the syscalls
required for the stack allocation/deallocation.

It fixes BZ#10354, BZ#14750, and BZ#18433.

Tested on i386, x86_64, powerpc64le, and aarch64.

	[BZ #14750]
	[BZ #10354]
	[BZ #18433]
	* include/sched.h (__clone): Add hidden prototype.
	(__clone2): Likewise.
	* include/unistd.h (__dup): Likewise.
	* posix/Makefile (tests): Add tst-spawn2.
	* posix/tst-spawn2.c: New file.
	* sysdeps/posix/dup.c (__dup): Add hidden definition.
	* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/i386/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/ia64/clone2.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/m68k/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/mips/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/nios2/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/sh/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/tile/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/nptl-signals.h
	(____nptl_is_internal_signal): New function.
	* sysdeps/unix/sysv/linux/spawni.c: New file.
2016-03-07 11:53:47 +07:00
Adhemerval Zanella 1eb8930608 posix: execvpe cleanup
This patch removes all the dynamic allocation on execvpe code and
instead use direct stack allocation.  This is QoI approach to make
it possible use in scenarios where memory is shared with parent
(vfork or clone with CLONE_VM).

For default process spawn (script file without a shebang), stack
allocation is bounded by NAME_MAX plus PATH_MAX plus 1.  Large
file arguments returns an error (ENAMETOOLONG).  This differs than
current GLIBC pratice in general, but it used to limit stack
allocation for large inputs.  Also, path in PATH environment variable
larger than PATH_MAX are ignored.

The shell direct execution exeception, where execve returns ENOEXEC,
might requires a large stack allocation due large input argument list.

Tested on i686, x86_64, powerpc64le, and aarch64.

	* posix/execvpe.c (__execvpe): Remove dynamic allocation.
	* posix/Makefile (tests): Add tst-execvpe{1,2,3,4,5,6}.
	* posix/tst-execvp1.c (do_test): Use a macro to call execvp.
	* posix/tst-execvp2.c (do_test): Likewise.
	* posix/tst-execvp3.c (do_test): Likewise.
	* posix/tst-execvp4.c (do_test): Likewise.
	* posix/tst-execvpe1.c: New file.
	* posix/tst-execvpe2.c: Likewise.
	* posix/tst-execvpe3.c: Likewise.
	* posix/tst-execvpe4.c: Likewise.
	* posix/tst-execvpe5.c: Likewise.
	* posix/tst-execvpe6.c: Likewise.
2016-03-07 00:21:37 -03:00