Commit Graph

11262 Commits

Author SHA1 Message Date
Joseph Myers 3d452dabd1 Fix uc_* namespace (bug 21457).
The standard members of ucontext_t, in all standard versions with that
type, are uc_link, uc_sigmask, uc_stack and uc_mcontext.

The uc_* namespace is mostly reserved for additions to the structure.
However, in XPG4.2, it's only reserved when <ucontext.h> is included,
not when <signal.h> is included, while <signal.h> is required to
define ucontext_t (but not allowed to make visible other symbols from
<ucontext.h>).  Thus, nonstandard members should avoid uc_* names.
Some already do use __uc_*, but others don't; most architectures (all
except ia64, I think) have a member uc_flags and some have additional
members beyond that.

This patch makes nonstandard members have an __ prefix unless
__USE_MISC is defined.  Members whose names indicate they are solely
padding / reserved for future use are renamed unconditionally to use
the __glibc_reserved1 naming convention.

This is part of the preparation for a revised version of the
mcontext_t / sigcontext patch to be able to eliminate all 13 of the
miscellaneous XFAILs in conform/Makefile, rather than only 11 of them
as at present (at least one further fix on top of this one will be
needed for that as well).

Tested for x86_64, and with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/generic/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/i386/sys/ucontext.h (__ctx): Move undefine further down.
	(__ctxt): Likewise.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/m68k/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/mips/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (__ctx): New
	macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags and uc_regspace.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags, uc_regs_ptr, uc_regs and uc_reg_space.
	Rename uc_pad to __glibc_reserved1.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (__ctx): Move undefine
	further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags.
2017-08-09 17:51:26 +00:00
Andreas Schwab 5797b410a8 Fix s390 version of pt-longjmp.c 2017-08-09 10:47:36 +02:00
Siddhesh Poyarekar 0e02b5107e memcpy_falkor: Fix code style in comments 2017-08-09 12:57:59 +05:30
Siddhesh Poyarekar 36ada5f681 aarch64: Optimized memcpy for Qualcomm Falkor processor
This is an optimized implementation of the memcpy routine that gives a
significant gain in performance for all sizes of copies on the
Qualcomm Falkor processor.  A detailed rationale of the implementation
is written in a comment in the patch.

This implementation improves time for copies up to 128 bytes by up to
15% and for larger copies by up to 35% in the glibc
microbenchmark. The memcpy-random benchmark sees improvements in all
sizes in the range of 13%-18%.

Here are the full numbers extracted from the glibc microbenchmark
using the commands:

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic length align1 align2

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy-large.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic length align1 align2

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy-random.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic max-size

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: default
================================================================================
length=1,align1=0,align2=0:     33.59 (-115.00%)        15.62 (0.00%)   15.62
length=1,align1=0,align2=0:     16.41 (-10.53%) 14.06 (5.26%)   14.84
length=1,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=1,align1=0,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=0,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=1,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=0,align2=1:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=1,align2=1:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=4,align1=0,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=4,align1=2,align2=0:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=4,align1=0,align2=2:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=4,align1=2,align2=2:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=8,align1=0,align2=0:     14.84 (-5.56%)  13.28 (5.56%)   14.06
length=8,align1=3,align2=0:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=8,align1=0,align2=3:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=8,align1=3,align2=3:     13.28 (-6.25%)  13.28 (-6.25%)  12.50
length=16,align1=0,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=16,align1=4,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=16,align1=0,align2=4:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=16,align1=4,align2=4:    13.28 (-6.25%)  12.50 (0.00%)   12.50
length=32,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=32,align1=5,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=32,align1=0,align2=5:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=32,align1=5,align2=5:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=64,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=64,align1=6,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=64,align1=0,align2=6:    14.06 (5.26%)   14.06 (5.26%)   14.84
length=64,align1=6,align2=6:    14.84 (-11.77%) 14.06 (-5.88%)  13.28
length=128,align1=0,align2=0:   17.19 (-4.76%)  14.84 (9.52%)   16.41
length=128,align1=7,align2=0:   16.41 (4.55%)   15.62 (9.09%)   17.19
length=128,align1=0,align2=7:   16.41 (0.00%)   14.06 (14.29%)  16.41
length=128,align1=7,align2=7:   16.41 (4.55%)   15.62 (9.09%)   17.19
length=256,align1=0,align2=0:   21.88 (-3.70%)  21.09 (0.00%)   21.09
length=256,align1=8,align2=0:   21.09 (-3.85%)  21.09 (-3.85%)  20.31
length=256,align1=0,align2=8:   20.31 (-4.00%)  20.31 (-4.00%)  19.53
length=256,align1=8,align2=8:   21.88 (-7.69%)  20.31 (0.00%)   20.31
length=512,align1=0,align2=0:   28.91 (-2.78%)  28.91 (-2.78%)  28.12
length=512,align1=9,align2=0:   30.47 (-2.63%)  30.47 (-2.63%)  29.69
length=512,align1=0,align2=9:   29.69 (0.00%)   29.69 (0.00%)   29.69
length=512,align1=9,align2=9:   28.12 (-2.86%)  28.12 (-2.86%)  27.34
length=1024,align1=0,align2=0:  44.53 (0.00%)   44.53 (0.00%)   44.53
length=1024,align1=10,align2=0:         50.00 (0.00%)   50.00 (0.00%)   50.00
length=1024,align1=0,align2=10:         49.22 (1.56%)   50.78 (-1.56%)  50.00
length=1024,align1=10,align2=10:        44.53 (-1.79%)  43.75 (0.00%)   43.75
length=2048,align1=0,align2=0:  77.34 (-1.02%)  76.56 (0.00%)   76.56
length=2048,align1=11,align2=0:         89.84 (0.00%)   89.84 (0.00%)   89.84
length=2048,align1=0,align2=11:         89.84 (0.00%)   89.84 (0.00%)   89.84
length=2048,align1=11,align2=11:        75.78 (0.00%)   75.78 (0.00%)   75.78
length=4096,align1=0,align2=0:  141.41 (-0.56%) 140.62 (0.00%)  140.62
length=4096,align1=12,align2=0:         171.09 (-0.46%) 170.31 (0.00%)  170.31
length=4096,align1=0,align2=12:         170.31 (0.00%)  170.31 (0.00%)  170.31
length=4096,align1=12,align2=12:        140.62 (0.00%)  140.62 (0.00%)  140.62
length=8192,align1=0,align2=0:  278.91 (-0.28%) 275.78 (0.84%)  278.12
length=8192,align1=13,align2=0:         338.28 (0.23%)  335.94 (0.92%)  339.06
length=8192,align1=0,align2=13:         338.28 (0.00%)  455.47 (-34.64%)        338.28
length=8192,align1=13,align2=13:        278.12 (-0.28%) 275.78 (0.56%)  277.34
length=16384,align1=0,align2=0:         535.94 (-0.15%) 531.25 (0.73%)  535.16
length=16384,align1=14,align2=0:        659.38 (0.12%)  659.38 (0.12%)  660.16
length=16384,align1=0,align2=14:        659.38 (0.00%)  657.03 (0.36%)  659.38
length=16384,align1=14,align2=14:       535.16 (0.44%)  532.81 (0.87%)  537.50
length=32768,align1=0,align2=0:         1260.94 (10.68%)        1121.88 (20.53%)        1411.72
length=32768,align1=15,align2=0:        1368.75 (10.02%)        1376.56 (9.50%) 1521.09
length=32768,align1=0,align2=15:        1333.59 (10.91%)        1373.44 (8.25%) 1496.88
length=32768,align1=15,align2=15:       1256.25 (13.96%)        1125.78 (22.90%)        1460.16
length=65536,align1=0,align2=0:         2853.91 (30.11%)        2589.06 (36.60%)        4083.59
length=65536,align1=16,align2=0:        2850.00 (30.14%)        2589.84 (36.52%)        4079.69
length=65536,align1=0,align2=16:        2853.12 (30.60%)        2589.84 (37.00%)        4110.94
length=65536,align1=16,align2=16:       2850.78 (30.07%)        2589.06 (36.49%)        4076.56
length=0,align1=0,align2=0:     15.62 (-5.26%)  16.41 (-10.53%) 14.84
length=0,align1=0,align2=0:     14.84 (-5.56%)  14.84 (-5.56%)  14.06
length=0,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=0,align1=0,align2=0:     16.41 (-16.67%) 14.84 (-5.56%)  14.06
length=1,align1=0,align2=0:     15.62 (4.76%)   15.62 (4.76%)   16.41
length=1,align1=1,align2=0:     15.62 (0.00%)   14.84 (5.00%)   15.62
length=1,align1=0,align2=1:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=1,align1=1,align2=1:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=0,align2=0:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=2,align2=0:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=0,align2=2:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=2,align1=2,align2=2:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=3,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=3,align1=3,align2=0:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=3,align1=0,align2=3:     15.62 (-11.11%) 14.06 (0.00%)   14.06
length=3,align1=3,align2=3:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=4,align1=0,align2=0:     17.97 (-27.78%) 14.06 (0.00%)   14.06
length=4,align1=4,align2=0:     13.28 (5.56%)   14.06 (0.00%)   14.06
length=4,align1=0,align2=4:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=4,align1=4,align2=4:     13.28 (5.56%)   13.28 (5.56%)   14.06
length=5,align1=0,align2=0:     13.28 (5.56%)   13.28 (5.56%)   14.06
length=5,align1=5,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=5,align1=0,align2=5:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=5,align1=5,align2=5:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=6,align1=0,align2=0:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=6,align1=6,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=6,align1=0,align2=6:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=6,align1=6,align2=6:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=7,align1=0,align2=0:     14.84 (-11.77%) 14.06 (-5.88%)  13.28
length=7,align1=7,align2=0:     13.28 (0.00%)   14.06 (-5.88%)  13.28
length=7,align1=0,align2=7:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=7,align1=7,align2=7:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=8,align1=0,align2=0:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=8,align1=8,align2=0:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=8,align1=0,align2=8:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=8,align1=8,align2=8:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=9,align1=0,align2=0:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=9,align1=9,align2=0:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=9,align1=0,align2=9:     13.28 (0.00%)   14.06 (-5.88%)  13.28
length=9,align1=9,align2=9:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=10,align1=0,align2=0:    14.06 (0.00%)   13.28 (5.56%)   14.06
length=10,align1=10,align2=0:   14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=10,align1=0,align2=10:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=10,align1=10,align2=10:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=11,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=11,align1=11,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=11,align1=0,align2=11:   13.28 (0.00%)   13.28 (0.00%)   13.28
length=11,align1=11,align2=11:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=12,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=12,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=0,align2=12:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=12,align2=12:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=13,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=13,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=0,align2=13:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=13,align2=13:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=14,align1=0,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=14,align1=14,align2=0:   13.28 (5.56%)   13.28 (5.56%)   14.06
length=14,align1=0,align2=14:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=14,align1=14,align2=14:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=15,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=15,align1=15,align2=0:   14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=15,align1=0,align2=15:   13.28 (0.00%)   13.28 (0.00%)   13.28
length=15,align1=15,align2=15:  13.28 (0.00%)   14.06 (-5.88%)  13.28
length=16,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=16,align1=16,align2=0:   13.28 (5.56%)   14.06 (0.00%)   14.06
length=16,align1=0,align2=16:   14.84 (-11.77%) 13.28 (0.00%)   13.28
length=16,align1=16,align2=16:  13.28 (-6.25%)  12.50 (0.00%)   12.50
length=17,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=17,align1=17,align2=0:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=17,align1=0,align2=17:   14.84 (-5.56%)  12.50 (11.11%)  14.06
length=17,align1=17,align2=17:  14.84 (-11.77%) 12.50 (5.88%)   13.28
length=18,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=18,align1=18,align2=0:   13.28 (5.56%)   12.50 (11.11%)  14.06
length=18,align1=0,align2=18:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=18,align1=18,align2=18:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=19,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=19,align1=19,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=19,align1=0,align2=19:   14.84 (-5.56%)  12.50 (11.11%)  14.06
length=19,align1=19,align2=19:  14.06 (-5.88%)  12.50 (5.88%)   13.28
length=20,align1=0,align2=0:    14.84 (-11.77%) 12.50 (5.88%)   13.28
length=20,align1=20,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=20,align1=0,align2=20:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=20,align1=20,align2=20:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=21,align1=0,align2=0:    14.84 (-5.56%)  12.50 (11.11%)  14.06
length=21,align1=21,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=21,align1=0,align2=21:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=21,align1=21,align2=21:  13.28 (5.56%)   13.28 (5.56%)   14.06
length=22,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=22,align1=22,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=22,align1=0,align2=22:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=22,align1=22,align2=22:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=23,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=23,align1=23,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=23,align1=0,align2=23:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=23,align1=23,align2=23:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=24,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=24,align1=24,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=24,align1=0,align2=24:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=24,align1=24,align2=24:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=25,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=25,align1=25,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=25,align1=0,align2=25:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=25,align1=25,align2=25:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=26,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=26,align1=26,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=26,align1=0,align2=26:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=26,align1=26,align2=26:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=27,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=27,align2=0:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=0,align2=27:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=27,align2=27:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=28,align1=28,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=0,align2=28:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=28,align2=28:  14.84 (-11.77%) 13.28 (0.00%)   13.28
length=29,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=29,align1=29,align2=0:   13.28 (0.00%)   12.50 (5.88%)   13.28
length=29,align1=0,align2=29:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=29,align1=29,align2=29:  13.28 (5.56%)   12.50 (11.11%)  14.06
length=30,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=30,align1=30,align2=0:   13.28 (5.56%)   12.50 (11.11%)  14.06
length=30,align1=0,align2=30:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=30,align1=30,align2=30:  13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=0,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=31,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=31,align1=0,align2=31:   13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=31,align2=31:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=48,align1=0,align2=0:    14.06 (0.00%)   14.06 (0.00%)   14.06
length=48,align1=3,align2=0:    14.06 (0.00%)   14.06 (0.00%)   14.06
length=48,align1=0,align2=3:    14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=48,align1=3,align2=3:    13.28 (5.56%)   14.06 (0.00%)   14.06
length=80,align1=0,align2=0:    15.62 (-11.11%) 14.84 (-5.56%)  14.06
length=80,align1=5,align2=0:    15.62 (-11.11%) 16.41 (-16.67%) 14.06
length=80,align1=0,align2=5:    14.06 (0.00%)   15.62 (-11.11%) 14.06
length=80,align1=5,align2=5:    15.62 (-5.26%)  17.19 (-15.79%) 14.84
length=96,align1=0,align2=0:    14.06 (0.00%)   14.84 (-5.56%)  14.06
length=96,align1=6,align2=0:    14.84 (-5.56%)  16.41 (-16.67%) 14.06
length=96,align1=0,align2=6:    14.06 (0.00%)   14.84 (-5.56%)  14.06
length=96,align1=6,align2=6:    14.84 (-5.56%)  17.19 (-22.22%) 14.06
length=112,align1=0,align2=0:   17.19 (-4.76%)  14.06 (14.29%)  16.41
length=112,align1=7,align2=0:   17.19 (0.00%)   16.41 (4.55%)   17.19
length=112,align1=0,align2=7:   16.41 (0.00%)   14.84 (9.52%)   16.41
length=112,align1=7,align2=7:   17.19 (0.00%)   17.19 (0.00%)   17.19
length=144,align1=0,align2=0:   17.19 (-10.00%) 17.97 (-15.00%) 15.62
length=144,align1=9,align2=0:   17.19 (-4.76%)  18.75 (-14.29%) 16.41
length=144,align1=0,align2=9:   20.31 (-8.33%)  18.75 (0.00%)   18.75
length=144,align1=9,align2=9:   18.75 (-4.35%)  18.75 (-4.35%)  17.97
length=160,align1=0,align2=0:   18.75 (-4.35%)  17.97 (0.00%)   17.97
length=160,align1=10,align2=0:  18.75 (4.00%)   18.75 (4.00%)   19.53
length=160,align1=0,align2=10:  19.53 (-4.17%)  17.97 (4.17%)   18.75
length=160,align1=10,align2=10:         18.75 (-4.35%)  18.75 (-4.35%)  17.97
length=176,align1=0,align2=0:   18.75 (-4.35%)  17.19 (4.35%)   17.97
length=176,align1=11,align2=0:  19.53 (0.00%)   19.53 (0.00%)   19.53
length=176,align1=0,align2=11:  19.53 (-4.17%)  18.75 (0.00%)   18.75
length=176,align1=11,align2=11:         18.75 (0.00%)   17.97 (4.17%)   18.75
length=192,align1=0,align2=0:   18.75 (0.00%)   17.97 (4.17%)   18.75
length=192,align1=12,align2=0:  21.09 (-8.00%)  18.75 (4.00%)   19.53
length=192,align1=0,align2=12:  18.75 (0.00%)   18.75 (0.00%)   18.75
length=192,align1=12,align2=12:         18.75 (0.00%)   17.97 (4.17%)   18.75
length=208,align1=0,align2=0:   17.97 (0.00%)   20.31 (-13.04%) 17.97
length=208,align1=13,align2=0:  19.53 (7.41%)   21.09 (0.00%)   21.09
length=208,align1=0,align2=13:  23.44 (-11.11%) 21.09 (0.00%)   21.09
length=208,align1=13,align2=13:         21.09 (-3.85%)  21.09 (-3.85%)  20.31
length=224,align1=0,align2=0:   21.09 (-8.00%)  20.31 (-4.00%)  19.53
length=224,align1=14,align2=0:  23.44 (-11.11%) 20.31 (3.70%)   21.09
length=224,align1=0,align2=14:  21.09 (3.57%)   20.31 (7.14%)   21.88
length=224,align1=14,align2=14:         20.31 (0.00%)   19.53 (3.85%)   20.31
length=240,align1=0,align2=0:   20.31 (-4.00%)  19.53 (0.00%)   19.53
length=240,align1=15,align2=0:  22.66 (0.00%)   20.31 (10.34%)  22.66
length=240,align1=0,align2=15:  20.31 (-4.00%)  20.31 (-4.00%)  19.53
length=240,align1=15,align2=15:         21.88 (0.00%)   21.09 (3.57%)   21.88
length=272,align1=0,align2=0:   20.31 (0.00%)   28.12 (-38.46%) 20.31
length=272,align1=17,align2=0:  22.66 (0.00%)   27.34 (-20.69%) 22.66
length=272,align1=0,align2=17:  25.78 (-10.00%) 28.12 (-20.00%) 23.44
length=272,align1=17,align2=17:         22.66 (-3.57%)  27.34 (-25.00%) 21.88
length=288,align1=0,align2=0:   23.44 (-7.14%)  27.34 (-25.00%) 21.88
length=288,align1=18,align2=0:  22.66 (0.00%)   27.34 (-20.69%) 22.66
length=288,align1=0,align2=18:  23.44 (-3.45%)  25.00 (-10.35%) 22.66
length=288,align1=18,align2=18:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=304,align1=0,align2=0:   21.88 (0.00%)   21.88 (0.00%)   21.88
length=304,align1=19,align2=0:  23.44 (-3.45%)  22.66 (0.00%)   22.66
length=304,align1=0,align2=19:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=304,align1=19,align2=19:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=320,align1=0,align2=0:   22.66 (-3.57%)  21.88 (0.00%)   21.88
length=320,align1=20,align2=0:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=320,align1=0,align2=20:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=320,align1=20,align2=20:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=336,align1=0,align2=0:   21.88 (0.00%)   24.22 (-10.71%) 21.88
length=336,align1=21,align2=0:  22.66 (0.00%)   25.00 (-10.35%) 22.66
length=336,align1=0,align2=21:  25.78 (0.00%)   25.00 (3.03%)   25.78
length=336,align1=21,align2=21:         25.00 (0.00%)   23.44 (6.25%)   25.00
length=352,align1=0,align2=0:   24.22 (0.00%)   24.22 (0.00%)   24.22
length=352,align1=22,align2=0:  25.00 (0.00%)   25.00 (0.00%)   25.00
length=352,align1=0,align2=22:  25.00 (-3.23%)  25.00 (-3.23%)  24.22
length=352,align1=22,align2=22:         25.00 (-3.23%)  24.22 (0.00%)   24.22
length=368,align1=0,align2=0:   25.00 (-3.23%)  23.44 (3.23%)   24.22
length=368,align1=23,align2=0:  25.00 (0.00%)   24.22 (3.12%)   25.00
length=368,align1=0,align2=23:  25.00 (-3.23%)  25.00 (-3.23%)  24.22
length=368,align1=23,align2=23:         25.00 (-6.67%)  23.44 (0.00%)   23.44
length=384,align1=0,align2=0:   24.22 (0.00%)   24.22 (0.00%)   24.22
length=384,align1=24,align2=0:  25.00 (0.00%)   24.22 (3.12%)   25.00
length=384,align1=0,align2=24:  25.00 (0.00%)   25.78 (-3.12%)  25.00
length=384,align1=24,align2=24:         24.22 (-3.33%)  23.44 (0.00%)   23.44
length=400,align1=0,align2=0:   25.00 (-3.23%)  26.56 (-9.68%)  24.22
length=400,align1=25,align2=0:  25.78 (-3.12%)  27.34 (-9.38%)  25.00
length=400,align1=0,align2=25:  27.34 (0.00%)   27.34 (0.00%)   27.34
length=400,align1=25,align2=25:         26.56 (0.00%)   25.78 (2.94%)   26.56
length=416,align1=0,align2=0:   26.56 (-3.03%)  25.78 (0.00%)   25.78
length=416,align1=26,align2=0:  28.12 (-2.86%)  27.34 (0.00%)   27.34
length=416,align1=0,align2=26:  27.34 (-2.94%)  28.12 (-5.88%)  26.56
length=416,align1=26,align2=26:         25.78 (0.00%)   26.56 (-3.03%)  25.78
length=432,align1=0,align2=0:   27.34 (-2.94%)  25.78 (2.94%)   26.56
length=432,align1=27,align2=0:  28.12 (-2.86%)  27.34 (0.00%)   27.34
length=432,align1=0,align2=27:  27.34 (0.00%)   28.12 (-2.86%)  27.34
length=432,align1=27,align2=27:         25.78 (0.00%)   25.78 (0.00%)   25.78
length=448,align1=0,align2=0:   26.56 (-3.03%)  25.78 (0.00%)   25.78
length=448,align1=28,align2=0:  27.34 (0.00%)   27.34 (0.00%)   27.34
length=448,align1=0,align2=28:  27.34 (0.00%)   28.12 (-2.86%)  27.34
length=448,align1=28,align2=28:         25.78 (0.00%)   25.78 (0.00%)   25.78
length=464,align1=0,align2=0:   25.78 (0.00%)   28.12 (-9.09%)  25.78
length=464,align1=29,align2=0:  28.12 (-2.86%)  29.69 (-8.57%)  27.34
length=464,align1=0,align2=29:  30.47 (0.00%)   30.47 (0.00%)   30.47
length=464,align1=29,align2=29:         28.12 (0.00%)   27.34 (2.78%)   28.12
length=480,align1=0,align2=0:   29.69 (-5.56%)  28.12 (0.00%)   28.12
length=480,align1=30,align2=0:  31.25 (-2.56%)  29.69 (2.56%)   30.47
length=480,align1=0,align2=30:  29.69 (0.00%)   30.47 (-2.63%)  29.69
length=480,align1=30,align2=30:         28.12 (0.00%)   28.12 (0.00%)   28.12
length=496,align1=0,align2=0:   28.12 (0.00%)   27.34 (2.78%)   28.12
length=496,align1=31,align2=0:  30.47 (-2.63%)  29.69 (0.00%)   29.69
length=496,align1=0,align2=31:  29.69 (0.00%)   30.47 (-2.63%)  29.69
length=496,align1=31,align2=31:         28.12 (-2.86%)  28.12 (-2.86%)  27.34
length=1024,align1=0,align2=0:  44.53 (0.00%)   44.53 (0.00%)   44.53
length=1024,align1=32,align2=0:         44.53 (-1.79%)  44.53 (-1.79%)  43.75
length=1024,align1=0,align2=32:         44.53 (-1.79%)  43.75 (0.00%)   43.75
length=1024,align1=32,align2=32:        43.75 (1.75%)   43.75 (1.75%)   44.53
length=1056,align1=0,align2=0:  46.88 (-1.69%)  46.88 (-1.69%)  46.09
length=1056,align1=33,align2=0:         53.12 (0.00%)   52.34 (1.47%)   53.12
length=1056,align1=0,align2=33:         52.34 (0.00%)   53.12 (-1.49%)  52.34
length=1056,align1=33,align2=33:        46.09 (0.00%)   46.88 (-1.69%)  46.09
length=1088,align1=0,align2=0:  46.88 (-1.69%)  46.09 (0.00%)   46.09
length=1088,align1=34,align2=0:         52.34 (0.00%)   52.34 (0.00%)   52.34
length=1088,align1=0,align2=34:         53.12 (-3.03%)  53.12 (-3.03%)  51.56
length=1088,align1=34,align2=34:        46.09 (0.00%)   46.88 (-1.69%)  46.09
length=1120,align1=0,align2=0:  49.22 (-1.61%)  48.44 (0.00%)   48.44
length=1120,align1=35,align2=0:         54.69 (1.41%)   55.47 (0.00%)   55.47
length=1120,align1=0,align2=35:         57.03 (0.00%)   55.47 (2.74%)   57.03
length=1120,align1=35,align2=35:        48.44 (0.00%)   49.22 (-1.61%)  48.44
length=1152,align1=0,align2=0:  47.66 (1.61%)   48.44 (0.00%)   48.44
length=1152,align1=36,align2=0:         55.47 (-1.43%)  55.47 (-1.43%)  54.69
length=1152,align1=0,align2=36:         58.59 (-1.35%)  55.47 (4.05%)   57.81
length=1152,align1=36,align2=36:        48.44 (0.00%)   49.22 (-1.61%)  48.44
length=1184,align1=0,align2=0:  53.12 (-3.03%)  50.78 (1.52%)   51.56
length=1184,align1=37,align2=0:         61.72 (-2.60%)  57.03 (5.19%)   60.16
length=1184,align1=0,align2=37:         62.50 (-1.27%)  57.03 (7.60%)   61.72
length=1184,align1=37,align2=37:        53.12 (-1.49%)  50.78 (2.99%)   52.34
length=1216,align1=0,align2=0:  53.91 (-4.55%)  50.78 (1.52%)   51.56
length=1216,align1=38,align2=0:         60.94 (0.00%)   57.03 (6.41%)   60.94
length=1216,align1=0,align2=38:         60.16 (0.00%)   57.81 (3.90%)   60.16
length=1216,align1=38,align2=38:        52.34 (-1.52%)  50.00 (3.03%)   51.56
length=1248,align1=0,align2=0:  54.69 (-2.94%)  53.12 (0.00%)   53.12
length=1248,align1=39,align2=0:         64.06 (-1.23%)  60.16 (4.94%)   63.28
length=1248,align1=0,align2=39:         60.94 (-2.63%)  60.16 (-1.32%)  59.38
length=1248,align1=39,align2=39:        53.12 (0.00%)   52.34 (1.47%)   53.12
length=1280,align1=0,align2=0:  52.34 (-1.52%)  52.34 (-1.52%)  51.56
length=1280,align1=40,align2=0:         61.72 (3.66%)   59.38 (7.32%)   64.06
length=1280,align1=0,align2=40:         60.94 (-2.63%)  60.16 (-1.32%)  59.38
length=1280,align1=40,align2=40:        52.34 (-1.52%)  52.34 (-1.52%)  51.56
length=1312,align1=0,align2=0:  54.69 (-1.45%)  55.47 (-2.90%)  53.91
length=1312,align1=41,align2=0:         63.28 (0.00%)   62.50 (1.23%)   63.28
length=1312,align1=0,align2=41:         62.50 (0.00%)   62.50 (0.00%)   62.50
length=1312,align1=41,align2=41:        53.91 (0.00%)   54.69 (-1.45%)  53.91
length=1344,align1=0,align2=0:  54.69 (0.00%)   54.69 (0.00%)   54.69
length=1344,align1=42,align2=0:         62.50 (0.00%)   62.50 (0.00%)   62.50
length=1344,align1=0,align2=42:         62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1344,align1=42,align2=42:        53.91 (0.00%)   53.91 (0.00%)   53.91
length=1376,align1=0,align2=0:  65.62 (-16.67%) 68.75 (-22.22%) 56.25
length=1376,align1=43,align2=0:         71.88 (-9.52%)  73.44 (-11.90%) 65.62
length=1376,align1=0,align2=43:         72.66 (-12.05%) 74.22 (-14.46%) 64.84
length=1376,align1=43,align2=43:        64.06 (-13.89%) 67.97 (-20.83%) 56.25
length=1408,align1=0,align2=0:  57.03 (-1.39%)  68.75 (-22.22%) 56.25
length=1408,align1=44,align2=0:         65.62 (-1.20%)  73.44 (-13.25%) 64.84
length=1408,align1=0,align2=44:         64.84 (0.00%)   74.22 (-14.46%) 64.84
length=1408,align1=44,align2=44:        56.25 (-1.41%)  68.75 (-23.94%) 55.47
length=1440,align1=0,align2=0:  67.97 (-14.47%) 64.84 (-9.21%)  59.38
length=1440,align1=45,align2=0:         74.22 (-10.47%) 68.75 (-2.33%)  67.19
length=1440,align1=0,align2=45:         72.66 (-6.90%)  69.53 (-2.30%)  67.97
length=1440,align1=45,align2=45:        65.62 (-13.51%) 58.59 (-1.35%)  57.81
length=1472,align1=0,align2=0:  66.41 (-14.86%) 58.59 (-1.35%)  57.81
length=1472,align1=46,align2=0:         73.44 (-9.30%)  67.19 (0.00%)   67.19
length=1472,align1=0,align2=46:         70.31 (-4.65%)  67.97 (-1.16%)  67.19
length=1472,align1=46,align2=46:        57.81 (0.00%)   58.59 (-1.35%)  57.81
length=1504,align1=0,align2=0:  60.94 (0.00%)   60.94 (0.00%)   60.94
length=1504,align1=47,align2=0:         71.09 (-1.11%)  70.31 (0.00%)   70.31
length=1504,align1=0,align2=47:         70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1504,align1=47,align2=47:        60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1536,align1=0,align2=0:  62.50 (-3.90%)  60.16 (0.00%)   60.16
length=1536,align1=48,align2=0:         60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1536,align1=0,align2=48:         61.72 (-3.95%)  60.16 (-1.32%)  59.38
length=1536,align1=48,align2=48:        60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1568,align1=0,align2=0:  80.47 (-27.16%) 63.28 (0.00%)   63.28
length=1568,align1=49,align2=0:         86.72 (-18.09%) 72.66 (1.06%)   73.44
length=1568,align1=0,align2=49:         74.22 (-3.26%)  74.22 (-3.26%)  71.88
length=1568,align1=49,align2=49:        62.50 (0.00%)   61.72 (1.25%)   62.50
length=1600,align1=0,align2=0:  62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1600,align1=50,align2=0:         73.44 (0.00%)   71.88 (2.13%)   73.44
length=1600,align1=0,align2=50:         72.66 (0.00%)   73.44 (-1.08%)  72.66
length=1600,align1=50,align2=50:        62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1632,align1=0,align2=0:  64.84 (0.00%)   64.84 (0.00%)   64.84
length=1632,align1=51,align2=0:         75.78 (0.00%)   75.00 (1.03%)   75.78
length=1632,align1=0,align2=51:         78.91 (0.00%)   75.78 (3.96%)   78.91
length=1632,align1=51,align2=51:        64.84 (-2.47%)  64.84 (-2.47%)  63.28
length=1664,align1=0,align2=0:  64.84 (-1.22%)  64.84 (-1.22%)  64.06
length=1664,align1=52,align2=0:         75.78 (0.00%)   75.00 (1.03%)   75.78
length=1664,align1=0,align2=52:         80.47 (-0.98%)  75.78 (4.90%)   79.69
length=1664,align1=52,align2=52:        64.06 (-1.23%)  65.62 (-3.70%)  63.28
length=1696,align1=0,align2=0:  69.53 (-3.49%)  72.66 (-8.14%)  67.19
length=1696,align1=53,align2=0:         80.47 (-0.98%)  82.03 (-2.94%)  79.69
length=1696,align1=0,align2=53:         80.47 (0.96%)   82.03 (-0.96%)  81.25
length=1696,align1=53,align2=53:        68.75 (-2.33%)  72.66 (-8.14%)  67.19
length=1728,align1=0,align2=0:  67.97 (0.00%)   72.66 (-6.90%)  67.97
length=1728,align1=54,align2=0:         80.47 (-0.98%)  82.81 (-3.92%)  79.69
length=1728,align1=0,align2=54:         78.91 (-1.00%)  82.03 (-5.00%)  78.12
length=1728,align1=54,align2=54:        68.75 (0.00%)   72.66 (-5.68%)  68.75
length=1760,align1=0,align2=0:  77.34 (-12.50%) 68.75 (0.00%)   68.75
length=1760,align1=55,align2=0:         91.41 (-8.33%)  79.69 (5.56%)   84.38
length=1760,align1=0,align2=55:         88.28 (-10.78%) 80.47 (-0.98%)  79.69
length=1760,align1=55,align2=55:        77.34 (-11.24%) 68.75 (1.12%)   69.53
length=1792,align1=0,align2=0:  78.12 (-14.94%) 68.75 (-1.15%)  67.97
length=1792,align1=56,align2=0:         88.28 (-4.63%)  79.69 (5.56%)   84.38
length=1792,align1=0,align2=56:         88.28 (-9.71%)  80.47 (0.00%)   80.47
length=1792,align1=56,align2=56:        77.34 (-11.24%) 68.75 (1.12%)   69.53
length=1824,align1=0,align2=0:  72.66 (7.92%)   70.31 (10.89%)  78.91
length=1824,align1=57,align2=0:         85.94 (5.17%)   82.03 (9.48%)   90.62
length=1824,align1=0,align2=57:         82.03 (3.67%)   82.81 (2.75%)   85.16
length=1824,align1=57,align2=57:        70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1856,align1=0,align2=0:  70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1856,align1=58,align2=0:         83.59 (-0.94%)  82.03 (0.94%)   82.81
length=1856,align1=0,align2=58:         178.12 (-115.09%)       82.81 (0.00%)   82.81
length=1856,align1=58,align2=58:        70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1888,align1=0,align2=0:  73.44 (-1.08%)  78.91 (-8.60%)  72.66
length=1888,align1=59,align2=0:         85.94 (0.00%)   89.84 (-4.55%)  85.94
length=1888,align1=0,align2=59:         84.38 (0.00%)   89.06 (-5.56%)  84.38
length=1888,align1=59,align2=59:        72.66 (-1.09%)  78.12 (-8.70%)  71.88
length=1920,align1=0,align2=0:  72.66 (-1.09%)  78.12 (-8.70%)  71.88
length=1920,align1=60,align2=0:         85.94 (0.00%)   89.84 (-4.55%)  85.94
length=1920,align1=0,align2=60:         85.16 (0.00%)   89.06 (-4.59%)  85.16
length=1920,align1=60,align2=60:        72.66 (-1.09%)  78.91 (-9.78%)  71.88
length=1952,align1=0,align2=0:  75.00 (-1.05%)  75.00 (-1.05%)  74.22
length=1952,align1=61,align2=0:         88.28 (0.00%)   87.50 (0.88%)   88.28
length=1952,align1=0,align2=61:         87.50 (0.00%)   88.28 (-0.89%)  87.50
length=1952,align1=61,align2=61:        74.22 (0.00%)   74.22 (0.00%)   74.22
length=1984,align1=0,align2=0:  75.00 (-1.05%)  73.44 (1.05%)   74.22
length=1984,align1=62,align2=0:         89.06 (-0.89%)  87.50 (0.88%)   88.28
length=1984,align1=0,align2=62:         87.50 (0.00%)   88.28 (-0.89%)  87.50
length=1984,align1=62,align2=62:        74.22 (0.00%)   74.22 (0.00%)   74.22
length=2016,align1=0,align2=0:  77.34 (-1.02%)  76.56 (0.00%)   76.56
length=2016,align1=63,align2=0:         91.41 (-0.86%)  90.62 (0.00%)   90.62
length=2016,align1=0,align2=63:         89.84 (0.00%)   90.62 (-0.87%)  89.84
length=2016,align1=63,align2=63:        77.34 (-1.02%)  76.56 (0.00%)   76.56
length=4096,align1=0,align2=0:  141.41 (-0.56%) 146.88 (-4.44%) 140.62

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: large
================================================================================
length=65543,align1=0,align2=0:         4018.75 (3.09%) 2634.38 (36.47%)        4146.88
length=65551,align1=0,align2=3:         4425.00 (-6.47%)        3134.38 (24.59%)        4156.25
length=65567,align1=3,align2=0:         2909.38 (29.95%)        3134.38 (24.53%)        4153.12
length=65599,align1=3,align2=5:         4415.62 (-6.16%)        3134.38 (24.64%)        4159.38
length=131079,align1=0,align2=0:        5765.62 (30.38%)        5240.62 (36.72%)        8281.25
length=131087,align1=0,align2=3:        8831.25 (-6.56%)        6271.88 (24.32%)        8287.50
length=131103,align1=3,align2=0:        5793.75 (29.05%)        6268.75 (23.23%)        8165.62
length=131135,align1=3,align2=5:        5806.25 (29.97%)        6259.38 (24.50%)        8290.62
length=262151,align1=0,align2=0:        11850.00 (28.91%)       10762.50 (35.43%)       16668.80
length=262159,align1=0,align2=3:        12043.80 (27.72%)       12700.00 (23.78%)       16662.50
length=262175,align1=3,align2=0:        12046.90 (27.90%)       12687.50 (24.07%)       16709.40
length=262207,align1=3,align2=5:        11984.40 (28.08%)       12678.10 (23.91%)       16662.50
length=524295,align1=0,align2=0:        24825.00 (25.00%)       24268.80 (27.34%)       33400.00
length=524303,align1=0,align2=3:        35731.20 (-6.53%)       25678.10 (23.44%)       33540.60
length=524319,align1=3,align2=0:        25893.80 (22.71%)       25725.00 (23.22%)       33503.10
length=524351,align1=3,align2=5:        25887.50 (22.86%)       25690.60 (23.45%)       33559.40
length=1048583,align1=0,align2=0:       50621.90 (0.30%)        50600.00 (0.34%)        50771.90
length=1048591,align1=0,align2=3:       53206.20 (0.54%)        51081.20 (4.51%)        53493.80
length=1048607,align1=3,align2=0:       53221.90 (0.32%)        51975.00 (2.66%)        53393.80
length=1048639,align1=3,align2=5:       53240.60 (0.36%)        51953.10 (2.77%)        53431.20
length=2097159,align1=0,align2=0:       103744.00 (-2.00%)      102447.00 (-1.00%)      102425.00
length=2097167,align1=0,align2=3:       108588.00 (-1.00%)      105159.00 (2.00%)       107606.00
length=2097183,align1=3,align2=0:       107678.00 (0.00%)       105250.00 (2.00%)       108125.00
length=2097215,align1=3,align2=5:       107906.00 (1.00%)       105841.00 (3.00%)       109475.00
length=4194311,align1=0,align2=0:       202994.00 (0.00%)       202500.00 (1.00%)       204809.00
length=4194319,align1=0,align2=3:       213350.00 (0.00%)       205997.00 (3.00%)       213384.00
length=4194335,align1=3,align2=0:       212653.00 (0.00%)       206444.00 (3.00%)       212900.00
length=4194367,align1=3,align2=5:       213044.00 (0.00%)       206084.00 (3.00%)       213847.00
length=8388615,align1=0,align2=0:       401294.00 (0.00%)       401231.00 (0.00%)       401944.00
length=8388623,align1=0,align2=3:       480872.00 (-14.00%)     406444.00 (3.00%)       422900.00
length=8388639,align1=3,align2=0:       422147.00 (0.00%)       407750.00 (3.00%)       422803.00
length=8388671,align1=3,align2=5:       442003.00 (-5.00%)      407125.00 (3.00%)       423509.00
length=16777223,align1=0,align2=0:      799809.00 (0.00%)       800000.00 (0.00%)       801756.00
length=16777231,align1=0,align2=3:      841184.00 (0.00%)       808525.00 (4.00%)       843775.00
length=16777247,align1=3,align2=0:      841166.00 (0.00%)       810147.00 (3.00%)       843147.00
length=16777279,align1=3,align2=5:      972569.00 (-16.00%)     808588.00 (4.00%)       843731.00
length=33554439,align1=0,align2=0:      1842240.00 (-0.01%)     1863590.00 (-1.17%)     1841990.00
length=33554447,align1=0,align2=3:      2103470.00 (-2.74%)     1919460.00 (6.25%)      2047440.00
length=33554463,align1=3,align2=0:      2075690.00 (-1.07%)     1930040.00 (6.02%)      2053720.00
length=33554495,align1=3,align2=5:      2110590.00 (-2.82%)     1924440.00 (6.25%)      2052650.00

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: random
================================================================================
max-size=4096:  44061.90 (5.85%)        38568.20 (17.59%)       46799.90
max-size=8192:  42790.90 (5.27%)        38158.90 (15.52%)       45171.50
max-size=16384:         44912.10 (2.25%)        38710.40 (15.75%)       45945.00
max-size=32768:         43577.90 (1.23%)        37975.10 (13.93%)       44120.00
max-size=65536:         44375.50 (1.04%)        38474.20 (14.20%)       44840.60

	* manual/tunables.texi (Tunable glibc.tune.cpu): Add falkor.
	* sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add
	memcpy_falkor.
	* sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC):
	Bump.
	(__libc_ifunc_impl_list): Add __memcpy_falkor.
	* sysdeps/aarch64/multiarch/memcpy.c: Likewise.
	* sysdeps/aarch64/multiarch/memcpy_falkor.S: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
	Add falkor.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_FALKOR):
	New macro.
2017-08-09 06:32:17 +05:30
Joseph Myers f17a42333f Do not use __ptr_t.
sys/cdefs.h has a macro __ptr_t, which a few places in glibc use
instead of void *.  void * is a well-understood standard type for that
purpose and in a post-C89 context there is no need for a macro for it;
this patch changes those places to use void * directly instead.

Unlike __long_double_t, __ptr_t is widely used outside glibc (or at
least has many hits on codesearch.debian.net).  I don't know how many
of those uses would break if sys/cdefs.h ceased to define the macro,
but there's enough risk that this patch leaves the definition and just
removes the uses within glibc; removal of the definition can be
considered separately if desired.

Tested for x86_64, and with build-many-glibcs.py.

	* malloc/mcheck.c (old_free_hook): Use void * instead of __ptr_t.
	(old_malloc_hook): Likewise.
	(old_memalign_hook): Likewise.
	(old_realloc_hook): Likewise.
	(struct hdr): Likewise.
	(flood): Likewise.
	(freehook): Likewise.
	(mallochook): Likewise.
	(memalignhook): Likewise.
	(reallochook): Likewise.
	(mprobe): Likewise.
	* malloc/mtrace.c (mallwatch): Likewise.
	(tr_old_free_hook): Likewise.
	(tr_old_malloc_hook): Likewise.
	(tr_old_realloc_hook): Likewise.
	(tr_old_memalign_hook): Likewise.
	(tr_where): Likewise.
	(lock_and_info): Likewise.
	(tr_freehook): Likewise.
	(tr_mallochook): Likewise.
	(tr_reallochook): Likewise.
	(tr_memalignhook): Likewise.
	* misc/err.h [!__GNUC_VA_LIST] (__gnuc_va_list): Likewise.
	* misc/mmap.c (__mmap): Likewise.
	* misc/mmap64.c (__mmap64): Likewise.
	* misc/mprotect.c (__mprotect): Likewise.
	* misc/msync.c (msync): Likewise.
	* misc/munmap.c (__munmap): Likewise.
	* posix/posix_madvise.c (posix_madvise): Likewise.
	* socket/send.c (__send): Likewise.
	* socket/sendto.c (__sendto): Likewise.
	* socket/setsockopt.c (__setsockopt): Likewise.
	* string/memcmp.c (__ptr_t): Remove macro.
	(MEMCMP): Use void * instead of ptr_t.
	* string/memrchr.c (__ptr_t): Remove macro.
	(__memrchr): Use void * instead of ptr_t.
	* sysdeps/mach/hurd/dl-sysdep.c (__mmap): Likewise.
	* sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
	* sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise.
	* sysdeps/mach/mprotect.c (__mprotect): Likewise.
	* sysdeps/mach/msync.c (msync): Likewise.
	* sysdeps/mach/munmap.c (__munmap): Likewise.
	* sysdeps/mips/bits/setjmp.h (struct __jmp_buf_internal_tag):
	Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/powerpc/powerpc32/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power4/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power4/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power7/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power7/mempcpy.S (__mempcpy):
	Likewise.
	* sysdeps/powerpc/powerpc32/power7/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power4/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S (__mempcpy):
	Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S (memset): Likewise.
	* sysdeps/tile/memcmp.c (__ptr_t): Remove macro.
	(MEMCMP): Use void * instead of ptr_t.
	* sysdeps/unix/sysv/linux/alpha/oldglob.c (old_glob_t): Likewise.
	* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
2017-08-08 17:14:49 +00:00
Florian Weimer 0df595b23a getaddrinfo: Remove unreachable return statement from gaih_inet 2017-08-08 18:48:05 +02:00
H.J. Lu 086df229ee i386: Add <startup.h> [BZ #21913]
On Linux/i386, there are 3 ways to make a system call:

1. call *%gs:SYSINFO_OFFSET.  This requires TLS initialization.
2. call *_dl_sysinfo.  This requires relocation of _dl_sysinfo.
3. int $0x80.  This is slower than #2 and #3, but works everywhere.

When an object file is compiled with PIC, #1 is prefered since it is
faster than #3 and doesn't require relocation of _dl_sysinfo.  For
dynamic executables, ld.so initializes TLS.  However, for static
executables, before TLS is initialized by __libc_setup_tls, #3 should
be used for system calls.

This patch adds <startup.h> which defines _startup_fatal and defaults
it to __libc_fatal.  It replaces __libc_fatal with _startup_fatal in
static executables where it is called before __libc_setup_tls is called.
This header file is included in all files containing functions which are
called before __libc_setup_tls is called.  On Linux/i386, when PIE is
enabled by default, _startup_fatal is turned into ABORT_INSTRUCTION and
I386_USE_SYSENTER is defined to 0 so that "int $0x80" is used for system
calls before __libc_setup_tls is called.

Tested on i686 and x86-64.  Without this patch, all statically-linked
tests will fail on i686 when the compiler defaults to -fPIE.

	[BZ #21913]
	* csu/libc-tls.c: Include <startup.h> first.
	(__libc_setup_tls): Call _startup_fatal instead of __libc_fatal.
	* elf/dl-tunables.c: Include <startup.h> first.
	* include/libc-symbols.h (BUILD_PIE_DEFAULT): New.
	* sysdeps/generic/startup.h: New file.
	* sysdeps/unix/sysv/linux/i386/startup.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/brk.c [BUILD_PIE_DEFAULT != 0]
	(I386_USE_SYSENTER): New.  Defined to 0.
2017-08-08 08:43:15 -07:00
Adhemerval Zanella 852d631207 posix: Set p{read,write}v2 to return ENOTSUP (BZ#21780)
Different than other architectures hppa-linux-gnu define different values
for ENOTSUP and EOPNOTSUPP, where the later is a Linux specific one.
This leads to tst-preadwritev{64}v2 tests failures:

$ ./testrun.sh misc/tst-preadvwritev2
error: tst-preadvwritev2-common.c:35: preadv2 failure did not set errno to ENOTSUP (223)
error: 1 test failures

The straightforward fix is to return the POSIX defined ENOTSUP on all
p{read,write}v{64}v2 implementations instead of Linux specific one.

Checked on x86_64-linux-gnu and the tst-preadwritev{64}v2 on
hppa-linux-gnu (although due the installed kernel on my testing system
the pwritev{64}v2 with an invalid flag still fails due a known kernel
issue [1]).

	[BZ #21780]
	* sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
	EOPNOTSUPP.
	* sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
	* sysdeps/posix/pwritev2.c (pwritev2): Likewise.
	* sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
	* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
	* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg00726.html
2017-08-08 09:59:46 -03:00
Joseph Myers cd65836b5f Fix XPG4.2 bits/sigaction.h namespace (bug 21899).
For XPG4.2, sa_sigaction, SA_ONSTACK, SA_RESETHAND, SA_RESTART and
SA_NODEFER should be defined in signal.h, but they are only defined
for other standards at present.

This patch fixes the various bits/sigaction.h headers accordingly.
All the fixes are essentially the same, except those for SPARC and
Tile.

For SPARC, the header (a) spuriously defined various nonstandard
macros for __USE_UNIX98 || defined __USE_XOPEN2K8 and (b) defined some
standard macros as aliases of nonstandard ones instead of the other
way round.  This patch fixes the SPARC header to handle these macros
the same way and with the same conditions as those for other
architectures, so the standard macros are the primary ones and the
other ones are defined only for __USE_MISC and are aliases of the
standard ones where applicable.

For Tile, the header spuriously defined the nonstandard macro
SA_NOPTRACE for __USE_UNIX98 || defined __USE_XOPEN2K8; this is moved
to __USE_MISC.

(Those nonstandard macros are in a reserved namespace, but it seems
desirable to be consistent between architectures as far as possible,
and so not define them in standard modes anywhere.)

Tested for x86_64, and with build-many-glibcs.py.

	[BZ #21899]
	* bits/sigaction.h (struct sigaction): Define sa_handler and
	sa_sigaction using union also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.  Define directly rather than as alias.
	(SA_RESETHAND): Likewise.
	(SA_INTERRUPT): Define only for [__USE_MISC].
	(SA_NOMASK): Define as alias of SA_NODEFER, only for [__USE_MISC].
	(SA_ONESHOT): Define as alias of SA_RESETHAND, only for
	[__USE_MISC].
	(SA_STACK): Define only for [__USE_MISC].
	* sysdeps/unix/sysv/linux/tile/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	(SA_NOPTRACE): Define only for [__USE_MISC].
2017-08-07 23:41:32 +00:00
Joseph Myers d9fee042e2 Consistently use uintN_t not u_intN_t everywhere.
This patch changes the remaining uses of the old nonstandard u_intN_t
types in glibc to use the C99 uintN_t instead, except for the
definitions of those typedefs and the tests of them in the c++-types
test.  This follows the previous such fix for libm, and being
consistent in using uintN_t makes sense as a global cleanup.

Tested for x86_64, and with build-many-glibcs.py.

	* catgets/catgets.c (catgets): Use uintN_t instead of u_intN_t.
	* catgets/catgetsinfo.h (struct catalog_obj): Likewise.
	(struct catalog_info): Likewise.
	* inet/htontest.c (lo): Likewise.
	(foo): Likewise.
	* inet/inet_lnaof.c (inet_lnaof): Likewise.
	* inet/inet_net.c (inet_network): Likewise.
	* inet/inet_netof.c (inet_netof): Likewise.
	* inet/rcmd.c (__ivaliduser): Likewise.
	(iruserok): Likewise.
	* locale/loadlocale.c (_nl_intern_locale_data): Likewise.
	* locale/programs/locale-spec.c (locale_special): Likewise.
	* nis/nis_findserv.c (struct findserv_req): Likewise.
	(__nis_findfastest_with_timeout): Likewise.
	* nss/test-netdb.c (test_network): Likewise.
	* resolv/inet_neta.c (inet_neta): Likewise.
	* resolv/ns_date.c (ns_datetosecs): Likewise.
	(SECS_PER_DAY): Likewise.
	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r):
	Likewise.
	* resolv/res_comp.c (__putlong): Likewise.
	(__putshort): Likewise.
	(_getlong): Likewise.
	(_getshort): Likewise.
	* resolv/res_debug.c (p_time): Likewise.
	(precsize_ntoa): Likewise.
	(precsize_aton): Likewise.
	(latlon2ul): Likewise.
	(loc_aton): Likewise.
	(loc_ntoa): Likewise.
	* resolv/res_hconf.c (struct netaddr): Likewise.
	(_res_hconf_reorder_addrs): Likewise.
	* sunrpc/clnt_tcp.c (clnttcp_call): Likewise.
	(clnttcp_control): Likewise.
	* sunrpc/clnt_udp.c (clntudp_call): Likewise.
	(clntudp_control): Likewise.
	* sunrpc/clnt_unix.c (clntunix_call): Likewise.
	(clntunix_control): Likewise.
	* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
	* sunrpc/rpc/auth.h (union des_block): Likewise.
	* sunrpc/tst-udp-nonblocking.c (do_test): Likewise.
	* sunrpc/xdr_rec.c (struct rec_strm): Likewise.
	(xdrrec_create): Likewise.
	(xdrrec_endofrecord): Likewise.
	(flush_out): Likewise.
	* sunrpc/xdr_stdio.c (xdrstdio_getlong): Likewise.
	(xdrstdio_putlong): Likewise.
	* sysdeps/unix/sysv/linux/errqueue.h (struct sock_extended_err):
	Likewise.
2017-08-07 19:55:34 +00:00
H.J. Lu 57a72fa350 x86-64: Add FMA multiarch functions to libm
This patch adds multiarch functions optimized with -mfma -mavx2 to libm.
e_pow-fma.c is compiled with $(config-cflags-nofma) due to PR 19003.

	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add e_exp-fma, e_log-fma, e_pow-fma, s_atan-fma, e_asin-fma,
	e_atan2-fma, s_sin-fma, s_tan-fma, mplog-fma, mpa-fma,
	slowexp-fma, slowpow-fma, sincos32-fma, doasin-fma, dosincos-fma,
	halfulp-fma, mpexp-fma, mpatan2-fma, mpatan-fma, mpsqrt-fma,
	and mptan-fma.
	(CFLAGS-doasin-fma.c): New.
	(CFLAGS-dosincos-fma.c): Likewise.
	(CFLAGS-e_asin-fma.c): Likewise.
	(CFLAGS-e_atan2-fma.c): Likewise.
	(CFLAGS-e_exp-fma.c): Likewise.
	(CFLAGS-e_log-fma.c): Likewise.
	(CFLAGS-e_pow-fma.c): Likewise.
	(CFLAGS-halfulp-fma.c): Likewise.
	(CFLAGS-mpa-fma.c): Likewise.
	(CFLAGS-mpatan-fma.c): Likewise.
	(CFLAGS-mpatan2-fma.c): Likewise.
	(CFLAGS-mpexp-fma.c): Likewise.
	(CFLAGS-mplog-fma.c): Likewise.
	(CFLAGS-mpsqrt-fma.c): Likewise.
	(CFLAGS-mptan-fma.c): Likewise.
	(CFLAGS-s_atan-fma.c): Likewise.
	(CFLAGS-sincos32-fma.c): Likewise.
	(CFLAGS-slowexp-fma.c): Likewise.
	(CFLAGS-slowpow-fma.c): Likewise.
	(CFLAGS-s_sin-fma.c): Likewise.
	(CFLAGS-s_tan-fma.c): Likewise.
	* sysdeps/x86_64/fpu/multiarch/doasin-fma.c: New file.
	* sysdeps/x86_64/fpu/multiarch/dosincos-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_asin-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_atan2-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_log-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_pow-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/halfulp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/ifunc-avx-fma4.h: Likewise.
	* sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mpa-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mpatan-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mpatan2-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mpexp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mplog-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mpsqrt-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/mptan-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_atan-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_sin-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/sincos32-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowpow-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_asin.c: Rewrite.
	* sysdeps/x86_64/fpu/multiarch/e_atan2.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_log.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_pow.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_atan.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_sin.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan.c: Likewise.
2017-08-07 08:20:56 -07:00
Joseph Myers 219dd320d6 Reimplement min_of_type using __MATH_TG.
This patch reimplements the libm-internal min_of_type macro to use
__MATH_TG instead of its own local type-generic implementation, so
simplifying the code and reducing the number of different type-generic
implementation variants in use in glibc.

Tested for x86_64.

	* sysdeps/generic/math_private.h (__EXPR_FLT128): Remove macro.
	(min_of_type_f): New macro.
	(min_of_type_): Likewise.
	(min_of_type_l): Likewise.
	(min_of_type_f128): Likewise.
	(min_of_type): Define using __MATH_TG and taking an expression
	argument.
	(math_check_force_underflow): Pass expression instead of type to
	min_of_type.
	(math_check_force_underflow_nonneg): Likewise.
2017-08-04 21:32:57 +00:00
H.J. Lu 64d4dea6cd x86: Remove assembly versions of HAS_CPU_FEATURE/HAS_ARCH_FEATURE
Since all x86 IFUNC selectors are implemented in C, assembly versions of
HAS_CPU_FEATURE and HAS_ARCH_FEATURE can be removed.

	* sysdeps/x86/cpu-features.h [__ASSEMBLER__]
	(LOAD_RTLD_GLOBAL_RO_RDX, HAS_FEATURE, LOAD_FUNC_GOT_EAX,
	HAS_CPU_FEATURE, HAS_ARCH_FEATURE): Removed.
2017-08-04 13:38:20 -07:00
H.J. Lu 973da22a35 i686: Implement IFUNC selectors in C
* sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add
	bcopy-ia32, bzero-ia32, rawmemchr-ia32 memchr-ia32,
	memcmp-ia32, memcpy-ia32, memmove-ia32, mempcpy-ia32,
	memset-ia32, strcat-ia32, strchr-ia32, strrchr-ia32,
	strcpy-ia32, strcmp-ia32, strcspn-ia32, strpbrk-ia32,
	strspn-ia32, strlen-ia32, stpcpy-ia32, stpncpy-ia32,
	memcpy_chk-nonshared, mempcpy_chk-nonshared,
	memmove_chk-nonshared and memset_chk-nonshared
	* sysdeps/i386/i686/multiarch/bcopy-ia32.S: New file.
	* sysdeps/i386/i686/multiarch/bcopy.c: Likewise.
	* sysdeps/i386/i686/multiarch/bzero-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/bzero.c: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-memmove.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-memset.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-sse2-bsf.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-sse2-ssse3.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-sse2.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-sse4_2.h: Likewise.
	* sysdeps/i386/i686/multiarch/ifunc-ssse3-sse4_2.h: Likewise.
	* sysdeps/i386/i686/multiarch/memchr-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk-nonshared.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk.c: Likewise.
	* sysdeps/i386/i686/multiarch/memmove-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove.c: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk-nonshared.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk.c: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk-nonshared.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk.c: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/memset-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset.c: Likewise.
	* sysdeps/i386/i686/multiarch/memset_chk-nonshared.S: Likewise.
	* sysdeps/i386/i686/multiarch/rawmemchr-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/rawmemchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/stpcpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/stpcpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/stpcpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/stpncpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/stpncpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcasecmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcasecmp_l.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcat-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat.c: Likewise.
	* sysdeps/i386/i686/multiarch/strchr-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/strcspn-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcspn.c: Likewise.
	* sysdeps/i386/i686/multiarch/strlen-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen.c: Likewise.
	* sysdeps/i386/i686/multiarch/strncase.c: Likewise.
	* sysdeps/i386/i686/multiarch/strncase_l.c: Likewise.
	* sysdeps/i386/i686/multiarch/strncat.c: Likewise.
	* sysdeps/i386/i686/multiarch/strncmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/strncpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/strnlen.c: Likewise.
	* sysdeps/i386/i686/multiarch/strpbrk-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strpbrk.c: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/strspn-ia32.S: Likewise.
	* sysdeps/i386/i686/multiarch/strspn.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcscmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen.c: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr.c: Likewise.
	* sysdeps/i386/i686/multiarch/wmemcmp.c: Likewise.
	* sysdeps/i386/i686/multiarch/bcopy.S: Removed.
	* sysdeps/i386/i686/multiarch/bzero.S: Likewise.
	* sysdeps/i386/i686/multiarch/memchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/rawmemchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/stpcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/stpncpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcasecmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcasecmp_l.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/strlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncase.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncase_l.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncat.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/strncpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/strnlen.S: Likewise.
	* sysdeps/i386/i686/multiarch/strpbrk.S: Likewise.
	* sysdeps/i386/i686/multiarch/strrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/strspn.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcschr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscmp.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcscpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcslen.S: Likewise.
	* sysdeps/i386/i686/multiarch/wcsrchr.S: Likewise.
	* sysdeps/i386/i686/multiarch/wmemcmp.S: Likewise.
2017-08-04 13:29:38 -07:00
H.J. Lu 8537e0f6cf x86-64: Implement libmathvec IFUNC selectors in C
* sysdeps/x86_64/fpu/multiarch/Makefile (libmvec-sysdep_routines)
	Add svml_d_cos2_core-sse2, svml_d_cos4_core-sse,
	svml_d_cos8_core-avx2, svml_d_exp2_core-sse2,
	svml_d_exp4_core-sse, svml_d_exp8_core-avx2,
	svml_d_log2_core-sse2, svml_d_log4_core-sse,
	svml_d_log8_core-avx2, svml_d_pow2_core-sse2,
	svml_d_pow4_core-sse, svml_d_pow8_core-avx2
	svml_d_sin2_core-sse2, svml_d_sin4_core-sse,
	svml_d_sin8_core-avx2, svml_d_sincos2_core-sse2,
	svml_d_sincos4_core-sse, svml_d_sincos8_core-avx2,
	svml_s_cosf16_core-avx2, svml_s_cosf4_core-sse2,
	svml_s_cosf8_core-sse, svml_s_expf16_core-avx2,
	svml_s_expf4_core-sse2, svml_s_expf8_core-sse,
	svml_s_logf16_core-avx2, svml_s_logf4_core-sse2,
	svml_s_logf8_core-sse, svml_s_powf16_core-avx2,
	svml_s_powf4_core-sse2, svml_s_powf8_core-sse,
	svml_s_sincosf16_core-avx2, svml_s_sincosf4_core-sse2,
	svml_s_sincosf8_core-sse, svml_s_sinf16_core-avx2,
	svml_s_sinf4_core-sse2 and svml_s_sinf8_core-sse.
	* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx2.h: New file.
	* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-avx512.h: Likewise.
	* sysdeps/x86_64/fpu/multiarch/ifunc-mathvec-sse4_1.h: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf16_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf4_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf8_core.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2v_cos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN4v_cos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN8v_cos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2v_exp): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN4v_exp): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_exp8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN8v_exp): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_log2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2v_log): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_log4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN4v_log): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_log8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN8v_log): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2vv_pow): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN4vv_pow): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_pow8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN8vv_pow): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2v_sin): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4v_sin): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN8v_sin): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos2_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN2vvv_sincos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos4_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN4vvv_sincos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN8vvv_sincos): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16v_cosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4v_cosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_cosf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8v_cosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16v_expf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4v_expf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_expf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8v_expf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16v_logf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4v_logf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_logf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8v_logf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16vv_powf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4vv_powf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_powf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8vv_powf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16vvv_sincosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4vvv_sincosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sincosf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8vvv_sincosf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf16_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf16_core-avx2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVeN16v_sinf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf4_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf4_core-sse2.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVbN4v_sinf): Removed.
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf8_core.S:  Renamed to
	...
	* sysdeps/x86_64/fpu/multiarch/svml_d_sinf8_core-sse.S: This.
	Don't include <sysdep.h> nor <init-arch.h>.
	(_ZGVdN8v_sinf): Removed.
2017-08-04 13:03:58 -07:00
H.J. Lu 10a87ca476 x86-64: Implement libm IFUNC selectors in C
* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add s_ceil-sse4_1, s_ceilf-sse4_1, s_floor-sse4_1,
	s_floorf-sse4_1, s_nearbyint-sse4_1, s_nearbyintf-sse4_1,
	s_rint-sse4_1 and s_rintf-sse4_1.
	* sysdeps/x86_64/fpu/multiarch/ifunc-sse4_1.h: New file.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_rint.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_ceil-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__ceil): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_ceilf-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__ceilf): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_floor.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_floor-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__floor): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_floorf-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__floorf): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__nearbyint): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__nearbyintf): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_rint.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_rint-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__rint): Removed.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.S: Renamed to ...
	* sysdeps/x86_64/fpu/multiarch/s_rintf-sse4_1.S: This.  Don't
	include <machine/asm.h> nor <init-arch.h>.  Include <sysdep.h>.
	(__rintf): Removed.
2017-08-04 13:02:13 -07:00
H.J. Lu 1e8e527dd9 i386: Support static PIE in start.S
Since start.o may be compiled as PIC, we should check PIC instead of
SHARED.  Also avoid dynamic relocation against main in static PIE since
_start is the entry point before the executable is relocated.

	* sysdeps/i386/start.S (_start): Check Check PIC instead of
	SHARED.  Avoid dynamic relocation against main in static PIE.
2017-08-04 12:59:51 -07:00
H.J. Lu 627c69c838 i386: Update I386_USE_SYSENTER for early PIC syscall
Define I386_USE_SYSENTER to 0 or 1 so that special versions of syscalls
with "int $0x80" can be provided for static PIE during self relocation.
Also check PIC instead SHARED for PIC version of syscall macros.

	* sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER):
	Define to I386_USE_SYSENTER to 0 or 1 if not defined.
	(ENTER_KERNEL): Check if I386_USE_SYSENTER is 1 and check PIC.
	(INTERNAL_SYSCALL_MAIN_INLINE): Likewise.
	(INTERNAL_SYSCALL_NCS): Likewise.
	(LOADARGS_1): Likewise.
	(LOADARGS_5): Likewise.
	(RESTOREARGS_1): Likewise.
	(RESTOREARGS_5): Likewise.
2017-08-04 12:30:38 -07:00
H.J. Lu fc11ff8d0a x86-64: Use IFUNC memcpy and mempcpy in libc.a
Since apply_irel is called before memcpy and mempcpy are called, we
can use IFUNC memcpy and mempcpy in libc.a.

	* sysdeps/x86_64/memmove.S (MEMCPY_SYMBOL): Don't check SHARED.
	(MEMPCPY_SYMBOL): Likewise.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test memcpy and mempcpy in libc.a.
	* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: Also include
	in libc.a.
	* sysdeps/x86_64/multiarch/memcpy-ssse3.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S:
	Likewise.
	* sysdeps/x86_64/multiarch/memcpy.c: Also include in libc.a.
	(__hidden_ver1): Don't use in libc.a.
	* sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
	(__mempcpy): Don't create a weak alias in libc.a.
	* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: Support
	libc.a.
	* sysdeps/x86_64/multiarch/mempcpy.c: Also include in libc.a.
	(__hidden_ver1): Don't use in libc.a.
2017-08-04 12:27:18 -07:00
H.J. Lu 19f1a11e7e Check linker support for INSERT in linker script
Since gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=21676

tst-split-dynreloc fails to link with gold.  Check if linker supports
INSERT in linker script before using it.

	* config.make.in (have-insert): New.
	* configure.ac (libc_cv_insert): New.  Set to yes if linker
	supports INSERT in linker script.
	(AC_SUBST(libc_cv_insert): New.
	* configure: Regenerated.
	* sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc only
	if $(have-insert) == yes.
2017-08-04 12:17:30 -07:00
H.J. Lu d2cf37c0a2 x86-64: Use _dl_runtime_resolve_opt only with AVX512F [BZ #21871]
On AVX machines with XGETBV (ECX == 1) like Skylake processors,

(gdb) disass _dl_runtime_resolve_avx_opt
Dump of assembler code for function _dl_runtime_resolve_avx_opt:
   0x0000000000015890 <+0>:	push   %rax
   0x0000000000015891 <+1>:	push   %rcx
   0x0000000000015892 <+2>:	push   %rdx
   0x0000000000015893 <+3>:	mov    $0x1,%ecx
   0x0000000000015898 <+8>:	xgetbv
   0x000000000001589b <+11>:	mov    %eax,%r11d
   0x000000000001589e <+14>:	pop    %rdx
   0x000000000001589f <+15>:	pop    %rcx
   0x00000000000158a0 <+16>:	pop    %rax
   0x00000000000158a1 <+17>:	and    $0x4,%r11d
   0x00000000000158a5 <+21>:	bnd je 0x16200 <_dl_runtime_resolve_sse_vex>
End of assembler dump.

is slower than:

(gdb) disass _dl_runtime_resolve_avx_slow
Dump of assembler code for function _dl_runtime_resolve_avx_slow:
   0x0000000000015850 <+0>:	vorpd  %ymm0,%ymm1,%ymm8
   0x0000000000015854 <+4>:	vorpd  %ymm2,%ymm3,%ymm9
   0x0000000000015858 <+8>:	vorpd  %ymm4,%ymm5,%ymm10
   0x000000000001585c <+12>:	vorpd  %ymm6,%ymm7,%ymm11
   0x0000000000015860 <+16>:	vorpd  %ymm8,%ymm9,%ymm9
   0x0000000000015865 <+21>:	vorpd  %ymm10,%ymm11,%ymm10
   0x000000000001586a <+26>:	vpcmpeqd %xmm8,%xmm8,%xmm8
   0x000000000001586f <+31>:	vorpd  %ymm9,%ymm10,%ymm10
   0x0000000000015874 <+36>:	vptest %ymm10,%ymm8
   0x0000000000015879 <+41>:	bnd jae 0x158b0 <_dl_runtime_resolve_avx>
   0x000000000001587c <+44>:	vzeroupper
   0x000000000001587f <+47>:	bnd jmpq 0x16200 <_dl_runtime_resolve_sse_vex>
End of assembler dump.
(gdb)

since xgetbv takes much more cycles than single cycle operations like
vpord/vvpcmpeq/ptest.  _dl_runtime_resolve_opt should be used only with
AVX512 where AVX512 instructions lead to lower CPU frequency on Skylake
server.

	[BZ #21871]
	* sysdeps/x86/cpu-features.c (init_cpu_features): Set
	bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
2017-08-04 11:14:33 -07:00
H.J. Lu c8a0e6ec03 x86: Remove __memset_zero_constant_len_parameter [BZ #21790]
__memset_zero_constant_len_parameter should be removed by

commit 61062f5630
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Tue Mar 1 00:35:23 2005 +0000

    2005-02-24  Roland McGrath  <roland@redhat.com>

            * debug/Versions (libc: GLIBC_2.4): Remove
            __memset_zero_constant_len_parameter.
            * sysdeps/generic/memset_chk.c: Remove alias and warning.
            * misc/sys/cdefs.h (__warndecl): New macro.
            * debug/warning-nop.c: New file.
            * string/bits/string3.h (memset): Call __warn_memset_zero_len with no
            arguments, instead of calling __memset_zero_constant_len_parameter.
            Use __warndecl for __warn_memset_zero_len.
            * debug/Makefile (routines): Add $(static-only-routines).
            (static-only-routines): New variable.

This patch removes the last emaining pieces of it.  Tested it on i586,
i686 and x86-64.

	[BZ #21790]
	* sysdeps/i386/i586/memset.S
	(__memset_zero_constant_len_parameter): Removed.
	* sysdeps/i386/i686/memset.S
	(__memset_zero_constant_len_parameter): Likewise.
	* sysdeps/i386/i686/multiarch/memset_chk.S
	(__memset_zero_constant_len_parameter): Likewise.
	* sysdeps/x86_64/memset.S (__memset_zero_constant_len_parameter):
	Likewise.
2017-08-04 10:56:51 -07:00
Aurelien Jarno 144bdab050 i686/multiarch: Regenerate ulps
This comes from running “make regen-ulps” on an AMD Opteron 2378 CPU.

Changelog:
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
2017-08-03 22:33:19 +00:00
Joseph Myers 24ab7723b8 Consistently use uintN_t not u_intN_t in libm.
This patch changes libm code to make consistent use of C99 uintN_t
types instead of sometimes using those and sometimes using the older
nonstandard u_intN_t names.  This makes sense as a cleanup in its own
right, and also facilitates merges to GCC's libquadmath (which gets
the types from stdint.h and so may not have u_intN_t available at
all).

Tested for x86_64, and with build-many-glibcs.py.

	* math/s_nextafter.c (__nextafter): Use uintN_t instead of
	u_intN_t.
	* math/s_nexttowardf.c (__nexttowardf): Likewise.
	* sysdeps/generic/math_private.h (ieee_double_shape_type):
	Likewise.
	(ieee_float_shape_type): Likewise.
	* sysdeps/i386/fpu/s_fpclassifyl.c (__fpclassifyl): Likewise.
	* sysdeps/i386/fpu/s_isnanl.c (__isnanl): Likewise.
	* sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Likewise.
	* sysdeps/i386/fpu/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/i386/fpu/s_nexttowardf.c (__nexttowardf): Likewise.
	* sysdeps/ieee754/dbl-64/e_acosh.c (__ieee754_acosh): Likewise.
	* sysdeps/ieee754/dbl-64/e_cosh.c (__ieee754_cosh): Likewise.
	* sysdeps/ieee754/dbl-64/e_fmod.c (__ieee754_fmod): Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r):
	Likewise.
	* sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
	(__ieee754_yn): Likewise.
	* sysdeps/ieee754/dbl-64/e_log10.c (__ieee754_log10): Likewise.
	* sysdeps/ieee754/dbl-64/e_log2.c (__ieee754_log2): Likewise.
	* sysdeps/ieee754/dbl-64/e_rem_pio2.c (__ieee754_rem_pio2):
	Likewise.
	* sysdeps/ieee754/dbl-64/e_sinh.c (__ieee754_sinh): Likewise.
	* sysdeps/ieee754/dbl-64/s_ceil.c (__ceil): Likewise.
	* sysdeps/ieee754/dbl-64/s_copysign.c (__copysign): Likewise.
	* sysdeps/ieee754/dbl-64/s_erf.c (__erf): Likewise.
	(__erfc): Likewise.
	* sysdeps/ieee754/dbl-64/s_expm1.c (__expm1): Likewise.
	* sysdeps/ieee754/dbl-64/s_finite.c (FINITE): Likewise.
	* sysdeps/ieee754/dbl-64/s_floor.c (__floor): Likewise.
	* sysdeps/ieee754/dbl-64/s_fpclassify.c (__fpclassify): Likewise.
	* sysdeps/ieee754/dbl-64/s_isnan.c (__isnan): Likewise.
	* sysdeps/ieee754/dbl-64/s_issignaling.c (__issignaling):
	Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c (__llrint): Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c (__llround): Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c (__lrint): Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c (__lround): Likewise.
	* sysdeps/ieee754/dbl-64/s_modf.c (__modf): Likewise.
	* sysdeps/ieee754/dbl-64/s_nextup.c (__nextup): Likewise.
	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Likewise.
	* sysdeps/ieee754/dbl-64/s_round.c (__round): Likewise.
	* sysdeps/ieee754/dbl-64/s_trunc.c (__trunc): Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_issignaling.c
	(__issignaling): Likewise.
	* sysdeps/ieee754/flt-32/e_atan2f.c (__ieee754_atan2f): Likewise.
	* sysdeps/ieee754/flt-32/e_fmodf.c (__ieee754_fmodf): Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
	Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c (__ieee754_ynf): Likewise.
	* sysdeps/ieee754/flt-32/e_log10f.c (__ieee754_log10f): Likewise.
	* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Likewise.
	* sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f):
	Likewise.
	* sysdeps/ieee754/flt-32/e_remainderf.c (__ieee754_remainderf):
	Likewise.
	* sysdeps/ieee754/flt-32/e_sqrtf.c (__ieee754_sqrtf): Likewise.
	* sysdeps/ieee754/flt-32/s_ceilf.c (__ceilf): Likewise.
	* sysdeps/ieee754/flt-32/s_copysignf.c (__copysignf): Likewise.
	* sysdeps/ieee754/flt-32/s_erff.c (__erff): Likewise.
	(__erfcf): Likewise.
	* sysdeps/ieee754/flt-32/s_expm1f.c (__expm1f): Likewise.
	* sysdeps/ieee754/flt-32/s_finitef.c (FINITEF): Likewise.
	* sysdeps/ieee754/flt-32/s_floorf.c (__floorf): Likewise.
	* sysdeps/ieee754/flt-32/s_fpclassifyf.c (__fpclassifyf):
	Likewise.
	* sysdeps/ieee754/flt-32/s_isnanf.c (__isnanf): Likewise.
	* sysdeps/ieee754/flt-32/s_issignalingf.c (__issignalingf):
	Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c (__llrintf): Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c (__llroundf): Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c (__lrintf): Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c (__lroundf): Likewise.
	* sysdeps/ieee754/flt-32/s_modff.c (__modff): Likewise.
	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
	* sysdeps/ieee754/flt-32/s_roundf.c (__roundf): Likewise.
	* sysdeps/ieee754/ldbl-128/e_acoshl.c (__ieee754_acoshl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_atan2l.c (__ieee754_atan2l):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_atanhl.c (__ieee754_atanhl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_fmodl.c (__ieee754_fmodl): Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
	(__ieee754_ynl): Likewise.
	* sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise.
	* sysdeps/ieee754/ldbl-128/e_rem_pio2l.c (__ieee754_rem_pio2l):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_remainderl.c (__ieee754_remainderl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/e_sinhl.c (__ieee754_sinhl): Likewise.
	* sysdeps/ieee754/ldbl-128/k_cosl.c (__kernel_cosl): Likewise.
	* sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_ceill.c (__ceill): Likewise.
	* sysdeps/ieee754/ldbl-128/s_copysignl.c (__copysignl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_erfl.c (__erfcl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_fabsl.c (__fabsl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_finitel.c (__finitel): Likewise.
	* sysdeps/ieee754/ldbl-128/s_floorl.c (__floorl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_fpclassifyl.c (__fpclassifyl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_frexpl.c (__frexpl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_isnanl.c (__isnanl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_issignalingl.c (__issignalingl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c (__llrintl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c (__llroundl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c (__lrintl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c (__lroundl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_modfl.c (__modfl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-128/s_nextupl.c (__nextupl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128/s_rintl.c (__rintl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_roundl.c (__roundl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_tanhl.c (__tanhl): Likewise.
	* sysdeps/ieee754/ldbl-128/s_truncl.c (__truncl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
	(__ieee754_remainderl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/e_acoshl.c (__ieee754_acoshl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_asinl.c (__ieee754_asinl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_coshl.c (__ieee754_coshl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j0l.c (__ieee754_j0l): Likewise.
	(__ieee754_y0l): Likewise.
	(pzero): Likewise.
	(qzero): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Likewise.
	(__ieee754_y1l): Likewise.
	(pone): Likewise.
	(qone): Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
	(__ieee754_ynl): Likewise.
	* sysdeps/ieee754/ldbl-96/e_lgammal_r.c (sin_pi): Likewise.
	(__ieee754_lgammal_r): Likewise.
	* sysdeps/ieee754/ldbl-96/e_rem_pio2l.c (__ieee754_rem_pio2l):
	Likewise.
	* sysdeps/ieee754/ldbl-96/e_sinhl.c (__ieee754_sinhl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_copysignl.c (__copysignl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_erfl.c (__erfl): Likewise.
	(__erfcl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_frexpl.c (__frexpl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_issignalingl.c (__issignalingl):
	Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c (__llrintl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c (__llroundl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c (__lrintl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c (__lroundl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_modfl.c (__modfl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-96/s_nextupl.c (__nextupl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/s_roundl.c (__roundl): Likewise.
	* sysdeps/ieee754/ldbl-96/s_tanhl.c (__tanhl): Likewise.
	* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c (__nldbl_nexttowardf):
	Likewise.
	* sysdeps/m68k/m680x0/fpu/e_pow.c (s(__ieee754_pow)): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fpclassifyl.c (__fpclassifyl):
	Likewise.
	* sysdeps/m68k/m680x0/fpu/s_llrint.c (__llrint): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_llrintf.c (__llrintf): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_llrintl.c (__llrintl): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nextafterl.c (__nextafterl): Likewise.
	* sysdeps/x86/fpu/powl_helper.c (__powl_helper): Likewise.
2017-08-03 19:55:04 +00:00
Florian Weimer 964263bb8d getaddrinfo: Release resolver context on error in gethosts [BZ #21885] 2017-08-03 12:33:00 +02:00
Alan Modra e98c925fa4 tst-tlsopt-powerpc as a shared lib
This makes the __tls_get_addr_opt test run as a shared library, and so
actually test that DTPMOD64/DTPREL64 pairs are processed by ld.so to
support the __tls_get_adfr_opt call stub fast return.  After a
2017-01-24 patch (binutils f0158f4416) ld.bfd no longer emitted
unnecessary dynamic relocations against local thread variables,
instead setting up the __tls_index GOT entries for the call stub fast
return.  This meant tst-tlsopt-powerpc passed but did not check ld.so
relocation support.  After a 2017-07-16 patch (binutils 676ee2b5fa)
ld.bfd no longer set up the __tls_index GOT entries for the call stub
fast return, and tst-tlsopt-powerpc failed.

Compiling mod-tlsopt-powerpc.c with -DSHARED exposed a bug in
powerpc64/tls-macros.h, which defines a __TLS_GET_ADDR macro that
clashes with one defined in dl-tls.h.  The tls-macros.h version is
only used in that file, so delete it and expand.

	* sysdeps/powerpc/mod-tlsopt-powerpc.c: Extract from
	tst-tlsopt-powerpc.c with function name change and no test harness.
	* sysdeps/powerpc/tst-tlsopt-powerpc.c: Remove body of test.
	Call tls_get_addr_opt_test.
	* sysdeps/powerpc/Makefile (LDFLAGS-tst-tlsopt-powerpc): Don't define.
	(modules-names): Add mod-tlsopt-powerpc.
	(mod-tlsopt-powerpc.so-no-z-defs): Define.
	(tst-tlsopt-powerpc): Depend on .so.
	* sysdeps/powerpc/powerpc64/tls-macros.h (__TLS_GET_ADDR): Don't
	define.  Expand use in TLS_GD and TLS_LD.
2017-08-03 15:39:21 +09:30
Samuel Thibault 3da5756ee8 Add missing include for pthread_setcancelstate
* sysdeps/posix/shm_open.c: Include <pthread.h>.
2017-08-03 00:30:22 +02:00
Samuel Thibault 8ee1abdb4b [hurd]: Add __libc_init_secure stub
csu/libc-start.c now insists on calling __libc_init_secure, while the Hurd
port already implements it "very early" in dl-sysdep.c and init-first.c

	* sysdeps/mach/hurd/enbl-secure.c (__libc_init_secure): Define
	function.
2017-08-02 23:29:57 +02:00
H.J. Lu 5b736bc9b5 x86-64: Check PIC instead of SHARED in start.S
Since start.o may be compiled as PIC, we should check PIC instead of
SHARED.

	* sysdeps/x86_64/start.S (_start): Check PIC instead of SHARED.
2017-08-02 10:27:34 -07:00
H.J. Lu dfc93c41ee i386: Check PIC to enable PIC setups in multiarch functions
Check PIC, instead of SHARED, to enable PIC setups.

	* sysdeps/i386/i686/multiarch/memcmp-sse4.S: Check PIC instead
	of SHARED.
	* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset-sse2-rep.S: Likewise.
	* sysdeps/i386/i686/multiarch/memset-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcat-sse2.S: Likewise.
	* sysdeps/i386/i686/multiarch/strcpy-sse2.S: Likewise.
2017-08-02 10:25:25 -07:00
H.J. Lu b358255f95 i386: Don't define multiarch __memmove_chk in libc.a [BZ #21791]
There is no need to define multiarch __memmove_chk in libc.a since they
aren't used at all.

	[BZ #21791]
	* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
	(MEMCPY_CHK): Define only if SHARED is defined.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S (MEMCPY_CHK):
	Likewise.
	* sysdeps/i386/i686/multiarch/memcpy-ssse3.S (MEMCPY_CHK):
	Likewise.
2017-08-02 08:34:34 -07:00
Nathan Rossi d95fcb2df4 microblaze: Resolve non-relocatable branch in pt-vfork.S (BZ#21779)
The relative branch directly to __libc_vfork results in an relocation
that cannot be resolved. Specifically a R_MICROBLAZE_64_PCREL relocation
is created for this branch, however for MicroBlaze R_MICROBLAZE_64_PCREL
type relocations symbols are not resolved. Additionally due to the
branch being located in the .text section the instruction cannot be
rewritten as the section is not writable, and causes a segfault at
runtime when loading libpthread.

To resolve this issue, ensure the branch is done using PLT. This removes
the need to modify the instruction and trades the R_MICROBLAZE_64_PCREL
for a more common R_MICROBLAZE_JUMP via the PLT.

	[BZ #21779]
	* sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Branch using PLT.
2017-07-28 09:21:14 -03:00
Nathan Rossi 0aab054a92 Update Microblaze libm-test-ulps
* sysdeps/microblaze/libm-test-ulps: Update.
2017-07-28 09:19:40 -03:00
Chung-Lin Tang d4550bd002 Update Nios II ULPs file. 2017-07-28 03:54:35 -07:00
Adhemerval Zanella 2557ae38f3 Update Alpha libm-test-ulps
* sysdeps/alpha/fpu/libm-test-ulps: Update.
2017-07-27 14:21:28 -03:00
Adhemerval Zanella 95a7339258 tunables: Use direct syscall for access (BZ#21744)
The function maybe_enable_malloc_check, which is called by
__tunables_init, calls __access_noerrno.  It isn't problem when
symbol is is in ld.so, which has a special version of __access_noerrno
without stack protector.  But when glibc is built with stack protector,
maybe_enable_malloc_check in libc.a can't call the regular version of
__access_noerrno with stack protector.

This patch changes how Linux defines the __access_noerrno to be an
inline call instead and thus preventing defining different build
rules for ld/static and shared.

	H.J. Lu  <hongjiu.lu@intel.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	[BZ #21744]
	* elf/dl-tunables.c: Include not-errno.h header.
	* include/unistd.h (__access_noerrno): Remove definition.
	* sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise.
	* sysdeps/generic/not-errno.h: New file.
	* sysdeps/unix/sysv/linux/not-errno.h: Likewise.
2017-07-24 11:21:07 -03:00
H.J. Lu 422ff87c24 Avoid accessing corrupted stack from __stack_chk_fail [BZ #21752]
__libc_argv[0] points to address on stack and __libc_secure_getenv
accesses environment variables which are on stack.  We should avoid
accessing stack when stack is corrupted.

This patch also renames function argument in __fortify_fail_abort
from do_backtrace to need_backtrace to avoid confusion with do_backtrace
from enum __libc_message_action.

	[BZ #21752]
	* debug/fortify_fail.c (__fortify_fail_abort): Don't pass down
	__libc_argv[0] if we aren't doing backtrace.  Rename do_backtrace
	to need_backtrace.
	* sysdeps/posix/libc_fatal.c (__libc_message): Don't call
	__libc_secure_getenv if we aren't doing backtrace.
2017-07-24 06:06:24 -07:00
Andreas Schwab 55703fcace Remove extra semicolons in struct pthread_mutex (bug 21804) 2017-07-24 12:22:05 +02:00
Dmitry V. Levin cab91f947a S390: fix sys/ptrace.h to make it includible again after asm/ptrace.h
sys/ptrace.h on S390 used to be includible both before and after
asm/ptrace.h, until commit b08a6a0dea
among other changes introduced PTRACE_SINGLEBLOCK enum constant which
is also defined in asm/ptrace.h as a macro, making sys/ptrace.h fail
to compile when included after asm/ptrace.h.

* sysdeps/unix/sysv/linux/s390/sys/ptrace.h [_LINUX_PTRACE_H ||
_S390_PTRACE_H]: Undefine all PTRACE_* macro constants defined
later as enum constants, except PTRACE_PEEKUSER, PTRACE_POKEUSER,
and PTRACE_SEIZE_DEVEL that are not defined by Linux headers.
2017-07-23 23:22:53 +00:00
John David Anglin 64a1daed18 [BZ 19170]
Revise comment in sysdeps/hppa/dl-trampoline.S
2017-07-23 12:50:44 -04:00
Steve Ellcey a4c9be1b8b Fix cexpl when compiled with latest GCC
* sysdeps/ieee754/ldbl-128/e_expl.c (__ieee754_expl): Call
	math_force_eval.
2017-07-21 09:47:57 -07:00
Adhemerval Zanella ee8c6cc5f9 Update sparc ulps
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2017-07-19 15:56:02 -03:00
Adhemerval Zanella d500130f31 alpha: Fix clone exit syscall argument passing (BZ#21512)
This patch fixes the argument passing for exit syscall after
the clone function returns on hppa.  This fixes misc/tst-clone2
on alpha-linux-gnu.

Checked misc/tst-clone2 on alpha-linux-gnu.

	[BZ #21512]
	* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Fix argument
	passing to syscall exit.
2017-07-19 14:24:43 -03:00
H.J. Lu 47f2739659 i386: Test memmove_chk and memset_chk only in libc.so [BZ #21741]
Since there are no multiarch versions of memmove_chk and memset_chk,
test multiarch versions of memmove_chk and memset_chk only in libc.so.

	[BZ #21741]
	* sysdeps/i386/i686/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test memmove_chk and memset_chk only
	in libc.so.
2017-07-19 08:39:18 -07:00
Szabolcs Nagy 82e0660050 [AArch64] Update dl-procinfo for new HWCAP flags in Linux 4.12
Follow up to commit 512d245bc3.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c:
	(_dl_aarch64_cap_flags): Update.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_DL_HWCAP_COUNT, _DL_HWCAP_LAST): Update.
2017-07-19 13:50:23 +01:00
Szabolcs Nagy 00d7a37773 [AArch64] Fix out of bound array access regression
Partially revert ea01a4da21
"aarch64: Add hwcap string routines" because _dl_procinfo cannot
be future proof and avoid oob access in _dl_hwcap_string.
2017-07-18 10:34:20 +01:00
Tulio Magno Quites Machado Filho 91ac3a7d84 powerpc: Fix float128 IFUNC relocations [BZ #21707]
The patch proposed by Peter Bergner [1] to libgcc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

It also requires to read the thread pointer during IRELA relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

	[BZ #21707]
	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
	relocations before or after initializing the TCB on statically
	linked executables.  That's a per-architecture definition.
	* elf/rtld.c (dl_main): Add a comment about thread-local
	variables initialization.
	* sysdeps/generic/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
	* sysdeps/powerpc/Makefile:
	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
	(tests-internal): Add tst-tlsifunc.
	* sysdeps/powerpc/tst-tlsifunc.c: New file.
	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
2017-07-17 17:49:26 -03:00
Adhemerval Zanella 48145e1c7d hppa: Fix clone exit syscall argument passing (BZ#21512)
This patch fixes the argument passing for exit syscall after
the clone function returns on hppa.  This fixes misc/tst-clone2
on hppa-linux-gnu.

Checked misc/tst-clone2 on hppa-linux-gnu.

	[BZ #21512]
	* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Fix argument
	passing to syscall exit.
2017-07-17 14:25:40 -03:00
Szabolcs Nagy 512d245bc3 Add HWCAP_ macros from Linux 4.12 to AArch64 bits/hwcap.h.
This patch adds the HWCAP_JSCVT, HWCAP_FCMA and HWCAP_LRCPC macros
from Linux 4.12 to the AArch64 bits/hwcap.h.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_FCMA): New macro.
	(HWCAP_JSCVT, HWCAP_LRCPC): Likewise.
2017-07-17 09:24:08 +01:00
John David Anglin 1903b38c65 Return to caller if dl_fixup fails to resolve callee on hppa. 2017-07-16 12:59:00 -04:00
John David Anglin ce1917d0bf Add CFI annotation. 2017-07-16 12:46:50 -04:00
John David Anglin cc407f4e81 Fix stack offset for r19 load in __getcontext. 2017-07-16 12:24:30 -04:00
John David Anglin 07f94b7a96 Fix __setcontext return value on hppa. 2017-07-16 12:13:14 -04:00
John David Anglin d71400dca6 Fix syscall cancellation on hppa. 2017-07-16 11:58:01 -04:00
John David Anglin a363f70336 Remove _exit entry from sysdeps/unix/sysv/linux/hppa/localplt.data. 2017-07-16 11:28:02 -04:00
John David Anglin 4d42d18029 Remove extra braces from sysdeps/hppa/__longjmp.c. 2017-07-16 11:11:31 -04:00
John David Anglin df3d455b23 Fix [BZ 20098]. 2017-07-16 10:51:13 -04:00
John David Anglin 32d9b0e7a6 Fix [BZ locale/19838]. 2017-07-15 12:54:14 -04:00
John David Anglin 2759a2c1d8 Fix failing sNaN tests on hppa. 2017-07-15 12:18:03 -04:00
Jiong Wang 5ba6405338 [ARM] Fix ld.so crash when built using Binutils 2.29
There is bug report that ld.so in GLIBC 2.24 built by Binutils 2.29 will crash
on arm-linux-gnueabihf.  This is confirmed, and the details is at:

   https://sourceware.org/bugzilla/show_bug.cgi?id=21725.

As analyzed in the PR, the old code was with the assumption that assembler
won't set bit0 of thumb function address if it comes from PC-relative
instructions and the calculation can be finished during assembling.  This
assumption however does not hold after PR gas/21458.

	* sysdeps/arm/dl-machine.h (elf_machine_load_address):  Also strip bit 0
	of pcrel_address under Thumb mode.
2017-07-13 15:48:41 +01:00
John David Anglin 27f29b2dad Fix type in sysdeps/hppa/dl-machine.h. 2017-07-12 20:02:45 -04:00
Gabriel F. T. Gomes 4de0cb2e9a powerpc64le: Iterate over all object suffixes when appending -mfloat128
On powerpc64le, the compilation of the files related to float128 support
requires the option -mfloat128 to be passed to gcc.  However, not all
possible object suffixes were covered in the Makefile.  This patch uses
$(all-object-suffixes) in all remaining rules.

Tested for powerpc64le.

	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
	to iterate over all possible object suffixes.  Add a comment
	explaining the use of sysdep-CFLAGS instead of CFLAGS.
2017-07-11 14:02:10 -03:00
H.J. Lu ed421fca42 Avoid backtrace from __stack_chk_fail [BZ #12189]
__stack_chk_fail is called on corrupted stack.  Stack backtrace is very
unreliable against corrupted stack.  __libc_message is changed to accept
enum __libc_message_action and call BEFORE_ABORT only if action includes
do_backtrace.  __fortify_fail_abort is added to avoid backtrace from
__stack_chk_fail.

	[BZ #12189]
	* debug/Makefile (CFLAGS-tst-ssp-1.c): New.
	(tests): Add tst-ssp-1 if -fstack-protector works.
	* debug/fortify_fail.c: Include <stdbool.h>.
	(_fortify_fail_abort): New function.
	(__fortify_fail): Call _fortify_fail_abort.
	(__fortify_fail_abort): Add a hidden definition.
	* debug/stack_chk_fail.c: Include <stdbool.h>.
	(__stack_chk_fail): Call __fortify_fail_abort, instead of
	__fortify_fail.
	* debug/tst-ssp-1.c: New file.
	* include/stdio.h (__libc_message_action): New enum.
	(__libc_message): Replace int with enum __libc_message_action.
	(__fortify_fail_abort): New hidden prototype.
	* malloc/malloc.c (malloc_printerr): Update __libc_message calls.
	* sysdeps/posix/libc_fatal.c (__libc_message): Replace int
	with enum __libc_message_action.  Call BEFORE_ABORT only if
	action includes do_backtrace.
	(__libc_fatal): Update __libc_message call.
2017-07-11 07:44:14 -07:00
Adhemerval Zanella 94070f86c0 posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)
Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new
p{read,write}v2 flag RWF_NOWAIT.  This patch adds it for linux
uio-ext.h header.

Checked on x86_64-linux-gnu (on a 4.10 kernel).

	[BZ #21738]
	* manual/llio.texi (RWF_NOWAIT): New item.
	* misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags):
	Add RWF_NOWAIT check.
	* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag.
2017-07-11 11:06:44 -03:00
Stefan Liebler 2c80445787 S390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.
The request PTRACE_SINGLEBLOCK was introduced in Linux 3.15.  Thus the ptrace call
will fail on older kernels.
Thus the test is now testing PTRACE_SINGLEBLOCK with data argument pointing to a
buffer on stack which is assumed to fail.  If the request would be interpreted as
PTRACE_GETREGS, then the ptrace call will not fail and the regs are written to buf.

If we run with a kernel with support for PTRACE_SINGLEBLOCK a ptrace call with
data=NULL, returns zero with no error.  If we run with a kernel without support for
PTRACE_SINGLEBLOCK a ptrace call with data=NULL reports an error.
In the latter case, the test is just continuing with PTRACE_CONT.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
	Support running on kernels without PTRACE_SINGLEBLOCK.
2017-07-11 10:38:44 +02:00
H.J. Lu 7a499756ab x86-64: Test memmove_chk and memset_chk only in libc.so [BZ #21741]
Since there are no multiarch versions of memmove_chk and memset_chk,
test multiarch versions of memmove_chk and memset_chk only in libc.so.

	[BZ #21741]
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test memmove_chk and memset_chk only
	in libc.so.
2017-07-10 04:44:38 -07:00
John David Anglin 2e783eb905 Update hppa ulps. 2017-07-09 15:22:41 -04:00
John David Anglin c5f70682a5 Use generic pthread support on hppa. 2017-07-09 15:01:11 -04:00
H.J. Lu 58d021c836 x86-64: Update comments in IFUNC selectors
* sysdeps/x86_64/multiarch/memcmp.c: Update comments.
	* sysdeps/x86_64/multiarch/memmove.c: Likewise.
	* sysdeps/x86_64/multiarch/memrchr.c: Likewise.
	* sysdeps/x86_64/multiarch/memset.c: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/strchrnul.c: Likewise.
	* sysdeps/x86_64/multiarch/strlen.c: Likewise.
	* sysdeps/x86_64/multiarch/strnlen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcschr.c: Likewise.
	* sysdeps/x86_64/multiarch/wcscpy.c: Likewise.
	* sysdeps/x86_64/multiarch/wcslen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemset.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.
2017-07-09 11:43:20 -07:00
H.J. Lu 4df54c89bb x86-64: Update comments in ifunc-impl-list.c
All x86-64 IFUNC selectors are written in C now.  Update comments to
reflect it.

	* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Update comments.
2017-07-09 11:38:37 -07:00
John David Anglin 7023e6db99 Fix BZ #21049. 2017-07-09 13:48:04 -04:00
Matthew Krupcale 3adfef7eaa nptl: Fix typo on __have_pthread_attr_t (BZ#21715)
This patch fixes some build issues when including types/sigevent_t.h
along with bits/pthreadtypes.h.

Checked on x86_64-linux-gnu and on a build on supported major ABIs.

	[BZ #21715]
	* sysdeps/nptl/bits/pthreadtypes.h (__have_pthread_attr_t): Fix typo
	on definition.
2017-07-06 10:27:24 -03:00
H.J. Lu 031e519c95 x86-64: Align the stack in __tls_get_addr [BZ #21609]
This change forces realignment of the stack pointer in __tls_get_addr, so
that binaries compiled by GCCs older than GCC 4.9:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

continue to work even if vector instructions are used in glibc which
require the ABI stack realignment.

__tls_get_addr_slow is added to handle the slow paths in the default
implementation of__tls_get_addr in elf/dl-tls.c.  The new __tls_get_addr
calls __tls_get_addr_slow after realigning the stack.  Internal calls
within ld.so go directly to the default implementation of __tls_get_addr
because they do not need stack realignment.

	[BZ #21609]
	* sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr.
	(gen-as-const-headers): Add rtld-offsets.sym.
	* sysdeps/x86_64/dl-tls.c: New file.
	* sysdeps/x86_64/rtld-offsets.sym: Likwise.
	* sysdeps/x86_64/tls_get_addr.S: Likewise.
	* sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards.
	* sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New.
	(TI_OFFSET_OFFSET): Likwise.
2017-07-06 04:43:20 -07:00
Adhemerval Zanella db6b2f2522 posix: Fix default posix_spawn return value
This patch fix the return value for error conditions for default
posix_spawn (where the errno is expected).  It also avoid clobber
errno on fork call.

Checked on x86_64 (with Linux implementation removed).

	[BZ# 21697]
	* sysdeps/posix/spawni.c (__spawni_child): Fix return value.
	(__spawnix): Do not clober errno.
2017-07-05 15:58:31 -03:00
Szabolcs Nagy d2e0491883 Single threaded stdio optimization
Locking overhead can be significant in some stdio operations
that are common in single threaded applications.

This patch adds the _IO_FLAGS2_NEED_LOCK flag to indicate if
an _IO_FILE object needs to be locked and some of the stdio
functions just jump to their _unlocked variant when not.  The
flag is set on all _IO_FILE objects when the first thread is
created.  A new GLIBC_PRIVATE libc symbol, _IO_enable_locks,
was added to do this from libpthread.

The optimization can be applied to more stdio functions,
currently it is only applied to single flag check or single
non-wide-char standard operations.  The flag should probably
be never set for files with _IO_USER_LOCK, but that's just a
further optimization, not a correctness requirement.

The optimization is valid in a single thread because stdio
operations are non-as-safe (so lock state is not observable
from a signal handler) and stdio locks are recursive (so lock
state is not observable via deadlock).  The optimization is not
valid if a thread may be created while an stdio lock is taken
and thus it should be disabled if any user code may run during
an stdio operation (interposed malloc, printf hooks, etc).
This makes the optimization more complicated for some stdio
operations (e.g. printf), but those are bigger and thus less
important to optimize so this patch does not try to do that.

	* libio/libio.h (_IO_FLAGS2_NEED_LOCK, _IO_need_lock): Define.
	* libio/libioP.h (_IO_enable_locks): Declare.
	* libio/Versions (_IO_enable_locks): New symbol.
	* libio/genops.c (_IO_enable_locks): Define.
	(_IO_old_init): Initialize flags2.
	* libio/feof.c.c (_IO_feof): Avoid locking when not needed.
	* libio/ferror.c (_IO_ferror): Likewise.
	* libio/fputc.c (fputc): Likewise.
	* libio/putc.c (_IO_putc): Likewise.
	* libio/getc.c (_IO_getc): Likewise.
	* libio/getchar.c (getchar): Likewise.
	* libio/ioungetc.c (_IO_ungetc): Likewise.
	* nptl/pthread_create.c (__pthread_create_2_1): Enable stdio locks.
	* libio/iofopncook.c (_IO_fopencookie): Enable locking for the file.
	* sysdeps/pthread/flockfile.c (__flockfile): Likewise.
2017-07-04 16:05:12 +01:00
Florian Weimer 1ff6c67a25 sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542] 2017-07-04 16:12:46 +02:00
Florian Weimer 352f4ff9a2 resolv: Introduce struct resolv_context [BZ #21668]
struct resolv_context objects provide a temporary resolver context
which does not change during a name lookup operation.  Only when the
outmost context is created, the stub resolver configuration is
verified to be current (at present, only against previous res_init
calls).  Subsequent attempts to obtain the context will reuse the
result of the initial verification operation.

struct resolv_context can also be extended in the future to store
data which needs to be deallocated during thread cancellation.
2017-07-03 20:52:59 +02:00
Rajalakshmi Srinivasaraghavan 2572f356b1 powerpc: Clean up strlen and strnlen for power8
To align a quadword aligned address to 64 bytes, maximum of three
16 bytes load is needed for worst case instead of loading four times.
2017-07-03 10:46:13 +05:30
Siddhesh Poyarekar 47ea614b9a Fix typo in glibc.tune.cpu name 2017-07-01 19:51:44 +05:30
Gabriel F. T. Gomes 8466ee1cb7 float128: Add signbit alternative for old compilers
In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
e.g.: __builtin_signbitf128, before GCC 6.  However, there has never
been a __builtin_signbitf128 in GCC and the type-generic builtin is
only available since GCC 6.  For older GCC, this patch defines
__builtin_signbitf128 to __signbitf128, so that the internal function
is used instead of the non-existent builtin.

This patch also changes the implementation of __signbitf128, because
it was reusing the implementation of __signbitl from ldbl-128, which
calls __builtin_signbitl.  Using the long double version of the
builtin is not correct on machines where _Float128 is ABI-distinct
from long double (i.e.: ia64, powerpc64le, x86, x86_84).  The new
implementation does not rely on builtins when being built with GCC
versions older than 6.0.

The new code does not currently affect powerpc64le builds, because
only GCC 6.2 fulfills the requirements from configure.  It might
affect powerpc64le builds if those requirements are backported to
older versions of the compiler.  The new code affects x86_64 builds,
since glibc is supposed to build correctly with older versions of GCC.

Tested for powerpc64le and x86_64.

	* include/math.h (__signbitf128): Define as hidden.
	* sysdeps/ieee754/float128/s_signbitf128.c (__signbitf128):
	Reimplement without builtins.
	* sysdeps/ia64/bits/floatn.h [!__GNUC_PREREQ (6, 0)]
	(__builtin_signbitf128): Define to __signbitf128.
	* sysdeps/powerpc/bits/floatn.h: Likewise.
	* sysdeps/x86/bits/floatn.h: Likewise.
2017-06-30 18:34:29 -03:00
Adhemerval Zanella 9b8f8593e5 Consolidate Linux fcntl implementation
This patch consolidates the fcntl Linux syscall generation on
sysdeps/unix/sysv/linux/fcntl.c.  It basically removes all the
architecture specific implementations.

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/fcntl.c: Remove file.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/fcntl.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to
	use default implementation.
2017-06-30 15:17:26 -03:00
Siddhesh Poyarekar 28cfa3a48e tunables, aarch64: New tunable to override cpu
Add a new tunable (glibc.tune.cpu) to override CPU identification on
aarch64.  This is useful in two cases: one where it is desirable to
pretend to be another CPU for purposes of testing or because routines
written for that CPU are beneficial for specific workloads and second
where the underlying kernel does not support emulation of MRS to get
the MIDR of the CPU.

	* elf/dl-tunables.h (tunable_is_name): Move from...
	* elf/dl-tunables.c (is_name): ... here.
	(parse_tunables, __tunables_init): Adjust.
	* manual/tunables.texi: Document glibc.tune.cpu.
	* sysdeps/aarch64/dl-tunables.list: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct
	cpu_list): New type.
	(cpu_list): New list of CPU names and their MIDR.
	(get_midr_from_mcpu): New function.
	(init_cpu_features): Override MIDR if necessary.
2017-06-30 22:58:39 +05:30
Siddhesh Poyarekar ab85da1530 aarch64: Call all string function implementations in tests
The string function implementations implemented so far do not use any
instructions that may deviate from standard aarch64, so it is possible
for all routines to run on all armv8 hardware.  Select all
implementations in the benchmarks and tests.

	* sysdeps/aarch64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Unconditionally select thunderx
	routine for testing.
2017-06-30 22:57:12 +05:30
H.J. Lu 4e61a6be44 i386: Increase MALLOC_ALIGNMENT to 16 [BZ #21120]
GCC 7 changed the definition of max_align_t on i386:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9b5c49ef97e63cc63f1ffa13baf771368105ebe2

As a result, glibc malloc no longer returns memory blocks which are as
aligned as max_align_t requires.

This causes malloc/tst-malloc-thread-fail to fail with an error like this
one:

error: allocation function 0, size 144 not aligned to 16

This patch moves the MALLOC_ALIGNMENT definition to <malloc-alignment.h>
and increases the malloc alignment to 16 for i386.

	[BZ #21120]
	* malloc/malloc-internal.h (MALLOC_ALIGNMENT): Moved to ...
	* sysdeps/generic/malloc-alignment.h: Here.  New file.
	* sysdeps/i386/malloc-alignment.h: Likewise.
	* sysdeps/generic/malloc-machine.h: Include <malloc-alignment.h>.
2017-06-30 09:11:24 -07:00
Joseph Myers e78dc67889 SPARC sys/ucontext.h namespace fixes (bug 21457).
This patch fixes various miscellaneous namespace issues in the SPARC
sys/ucontext.h header.  These are similar to changes made previous to
other sys/ucontext.h headers, where the SPARC header was excluded from
those previous patches because of its complexity.

Tested for SPARC with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (__ctx): New macro.
	[__WORDSIZE == 64] (MC_TSTATE): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (MC_PC): Likewise.
	[__WORDSIZE == 64] (MC_NPC): Likewise.
	[__WORDSIZE == 64] (MC_Y): Likewise.
	[__WORDSIZE == 64] (MC_G1): Likewise.
	[__WORDSIZE == 64] (MC_G2): Likewise.
	[__WORDSIZE == 64] (MC_G3): Likewise.
	[__WORDSIZE == 64] (MC_G4): Likewise.
	[__WORDSIZE == 64] (MC_G5): Likewise.
	[__WORDSIZE == 64] (MC_G6): Likewise.
	[__WORDSIZE == 64] (MC_G7): Likewise.
	[__WORDSIZE == 64] (MC_O0): Likewise.
	[__WORDSIZE == 64] (MC_O1): Likewise.
	[__WORDSIZE == 64] (MC_O2): Likewise.
	[__WORDSIZE == 64] (MC_O3): Likewise.
	[__WORDSIZE == 64] (MC_O4): Likewise.
	[__WORDSIZE == 64] (MC_O5): Likewise.
	[__WORDSIZE == 64] (MC_O6): Likewise.
	[__WORDSIZE == 64] (MC_O7): Likewise.
	[__WORDSIZE == 64] (MC_NGREG): Rename to __MC_NGREG and define to
	__MC_NGREG if [__USE_MISC].
	[__WORDSIZE == 64] (MC_MAXFPQ): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (mc_gregset_t): Define using __MC_NGREG.
	[__WORDSIZE == 64] (struct mc_fq): Rename to struct __mc_fq.
	Define fields using __ctx.
	[__WORDSIZE == 64] (mc_fpu_t): Remove struct tag.  Define fields
	using __ctx.
	[__WORDSIZE == 64] (mcontext_t): Define fields using __ctx.
	(REG_PSR): Define only for [__USE_MISC].
	(REG_PC): Likewise.
	(REG_nPC): Likewise.
	(REG_Y): Likewise.
	(REG_G1): Likewise.
	(REG_G2): Likewise.
	(REG_G3): Likewise.
	(REG_G4): Likewise.
	(REG_G5): Likewise.
	(REG_G6): Likewise.
	(REG_G7): Likewise.
	(REG_O0): Likewise.
	(REG_O1): Likewise.
	(REG_O2): Likewise.
	(REG_O3): Likewise.
	(REG_O4): Likewise.
	(REG_O5): Likewise.
	(REG_O6): Likewise.
	(REG_O7): Likewise.
	[__WORDSIZE == 64] (REG_ASI): Define only for [__USE_MISC].
	[__WORDSIZE == 64] (REG_FPRS): Likewise.
	(NGREG): Rename to __NGREG and define to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(SPARC_MAXREGWINDOW): Rename to __SPARC_MAXREGWINDOW and define to
	__SPARC_MAXREGWINDOW if [__USE_MISC].
	(struct rwindow): Rename to struct __rwindow.  Define fields using
	__ctx.
	(rw_fp): Define only for [__USE_MISC].
	(rw_rtn): Likewise.
	(gwindows_t): Remove struct tag.  Define fields using __ctx and
	__SPARC_MAXREGWINDOW.
	(MAXFPQ): Define only for [__USE_MISC].
	(struct fpq): Rename to struct __fpq.  Define fields using __ctx.
	(struct fq): Rename to struct __fq.  Define fields using __ctx.
	(FPU_REGS_TYPE): Define only for [__USE_MISC].
	(FPU_DREGS_TYPE): Likewise.
	(V7_FPU_FSR_TYPE): Likewise.
	(V9_FPU_FSR_TYPE): Likewise.
	(V9_FPU_FPRS_TYPE): Likewise.
	[__WORDSIZE == 64] (fpregset_t): Remove struct tag.  Define fields
	using __ctx.
	[__WORDSIZE != 64] (fpregset_t): Likewise.
	[__WORDSIZE != 64] (xrs_t): Define fields using __ctx.
	[__WORDSIZE != 64] (XRS_ID): Define only for [__USE_MISC].
	[__WORDSIZE != 64] (mcontext_t): Define fields using __ctx.
	Rename field filler to __glibc_reserved1.
	* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
	(MC_FILLER): Remove.
2017-06-29 19:44:43 +00:00
Adhemerval Zanella ccfb296472 posix: Improve default posix_spawn implementation
This patch improves the default posix implementation of posix_spawn{p}
and align with Linux one.  The main idea is to fix some issues already
fixed in Linux code, and deprecated vfork internal usage (source of
various bug reports).  In a short:

   - It moves POSIX_SPAWN_USEVFORK usage and sets it a no-op.  Since
     the process that actually spawn the new process do not share
     memory with parent (with vfork), it fixes BZ#14750 for this
     implementation.

   - It uses a pipe to correctly obtain the return upon failure
     of execution (BZ#18433).

   - It correctly enable/disable asynchronous cancellation (checked
     on ptl/tst-exec5.c).

   - It correctly disable/enable signal handling.

Using this version instead of Linux shows only one regression,
posix/tst-spawn3, because of pipe2 usage which increase total
number of file descriptor.

	* sysdeps/posix/spawni.c (__spawni_child): New function.
	(__spawni): Rename to __spawnix.
2017-06-29 10:59:07 -03:00
Joseph Myers 073e8fa773 Require binutils 2.25 or later to build glibc.
This patch implements a requirement of binutils >= 2.25 (up from 2.22)
to build glibc.  Tests for 2.24 or later on x86_64 and s390 are
removed.  It was already the case, as indicated by buildbot results,
that 2.24 was too old for building tests for 32-bit x86 (produced
internal linker errors linking elf/tst-gnu2-tls1mod.so).  I don't know
if any configure tests for binutils features are obsolete given the
increased version requirement.

Tested for x86_64.

	* configure.ac (AS): Require binutils 2.25 or later.
	(LD): Likewise.
	* configure: Regenerated.
	* sysdeps/s390/configure.ac (AS): Remove version check.
	* sysdeps/s390/configure: Regenerated.
	* sysdeps/x86_64/configure.ac (AS): Remove version check.
	* sysdeps/x86_64/configure: Regenerated.
	* manual/install.texi (Tools for Compilation): Document
	requirement for binutils 2.25 or later.
	* INSTALL: Regenerated.
2017-06-28 11:31:50 +00:00
Joseph Myers d57cb31910 Miscellaneous sys/ucontext.h namespace fixes (bug 21457).
This patch fixes various miscellaneous namespace issues in
sys/ucontext.h headers.

Some struct tags are removed where the structs also have *_t typedef
names, while other struct tags without such names are renamed to start
__; the changes are noted in NEWS as they can affect C++ name mangling
(although there seems to be little if any external use of these types,
at least based on checking codesearch.debian.net).  For powerpc,
pointers to struct pt_regs (not defined in this header) are changed to
point to struct __ctx(pt_regs), so in the __USE_MISC case those struct
fields continue to point to the existing struct pt_regs type for
maximum compatibility, while when that's a namespace issue they point
to a struct __pt_regs type which is always an incomplete struct.

Tested for affected architectures with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset_t): Remove
	struct tag.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (fpregset_t):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (mcontext_t):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (pt_regs):
	Declare struct type with __ctx.
	[__WORDSIZE != 32] (mcontext_t): Use __ctx with pt_regs struct
	tag.
	(ucontext_t) [__WORDSIZE == 32]: Use __ctx with pt_regs struct tag
	and regs field name.
2017-06-28 10:33:23 +00:00
Prakhar Bahuguna f8f72bc0c3 [ARM] Optimise memchr for NEON-enabled processors
This patch provides an optimised implementation of memchr using NEON
instructions to improve its performance, especially with longer search regions.
This gave an improvement in performance against the Thumb2+DSP optimised code,
with more significant gains for larger inputs. The NEON code also wins in cases
where the input is small (less than 8 bytes) by defaulting to a simple
byte-by-byte search. This avoids the overhead imposed by filling two quadword
registers from memory.

	* sysdeps/arm/armv7/multiarch/Makefile: Add memchr_neon to
	sysdep_routines.
	* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c: Add define for
	__memchr_neon.
	Add ifunc definitions for __memchr_neon and __memchr_noneon.
	* sysdeps/arm/armv7/multiarch/memchr.S: New file.
	* sysdeps/arm/armv7/multiarch/memchr_impl.S: Likewise.
	* sysdeps/arm/armv7/multiarch/memchr_neon.S: Likewise.

Testing done: Ran regression tests for arm-none-linux-gnueabihf as well as a
full toolchain bootstrap. Benchmark tests were ran on ARMv7-A and ARMv8-A
hardware targets.
2017-06-27 15:43:50 +00:00
Stefan Liebler a37b5daa6b S390: Use cu21 instruction for converting from utf16 to utf8.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu21 instruction.

ChangeLog:

	* sysdeps/s390/utf8-utf16-z9.c (__to_utf8_loop_vx_cu):
	Use vector and cu21 instruction.
	* sysdeps/s390/multiarch/utf8-utf16-z9.c:
	Add __to_utf8_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler f0137ff31d S390: Use cu24 instruction for converting from utf16 to utf32.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu24 instruction.

ChangeLog:

	* sysdeps/s390/utf16-utf32-z9.c (__from_utf16_loop_vx_cu):
	Use vector and cu24 instruction.
    	* sysdeps/s390/multiarch/utf16-utf32-z9.c:
    	Add __from_utf16_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler 593e4da186 S390: Use cu42 instruction for converting from utf32 to utf16.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu42 instruction.

ChangeLog:

	* sysdeps/s390/utf16-utf32-z9.c (__to_utf16_loop_vx_cu):
	Use vector and cu42 instruction.
	* sysdeps/s390/multiarch/utf16-utf32-z9.c:
	Add __to_utf16_loop_vx_cu in ifunc resolver.
2017-06-27 17:09:43 +02:00
Stefan Liebler 23ea69a9d6 S390: Use cu41 instruction for converting from utf32 to utf8.
This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu41 instruction.

ChangeLog:

	* sysdeps/s390/utf8-utf32-z9.c (__to_utf8_loop_vx_cu):
	Use vector and cu41 instruction.
	* sysdeps/s390/multiarch/utf8-utf32-z9.c: Add __to_utf8_loop_vx_cu
	in ifunc resolver.
2017-06-27 17:09:42 +02:00
Stefan Liebler f21f59124d S390: Add new hwcap values for new cpu architecture - arch12.
The new hwcap values indicate support for:
- Vector packed decimal facility
- Vector enhancements facility 1
- Guarded storage facility

Note: arch12 is NOT the official name of the new CPU.
It refers to the edition number of the Principle of Operations manual.

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
	Add vxd, vxe, gs flag.
	* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXD, HWCAP_S390_VXE,
	HWCAP_S390_GS capability.
	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
	(HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS): Define.
2017-06-27 17:09:42 +02:00
H.J. Lu e94c310357 x86-64: Optimize memcmp-avx2-movbe.S for short difference
Check the first 32 bytes before checking size when size >= 32 bytes
to avoid unnecessary branch if the difference is in the first 32 bytes.
Replace vpmovmskb/subl/jnz with vptest/jnc.

On Haswell, the new version is as fast as the previous one.  On Skylake,
the new version is a little bit faster.

	* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S (MEMCMP): Check
	the first 32 bytes before checking size when size >= 32 bytes.
	Replace vpmovmskb/subl/jnz with vptest/jnc.
2017-06-27 07:55:00 -07:00
Stefan Liebler 83653f804d S390: Save and restore r12 in TLS_IE macro.
The testcases elf/tst-tls1-static and elf/tst-tls2-static
are failing on s390 if gcc is configured with --enable-default-pie.

According to binutils, there are only four valid cases for IE -> LE transition:
lg %rx,(0,%ry)    -> sllg %rx,%ry,0
lg %rx,(%ry,0)    -> sllg %rx,%ry,0
lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
lg %rx,(%r12,%ry) -> sllg %rx,%ry,0

Thus I've adjusted the TLS_IE macro in s390 tls-macros.h files in PIC case
in order to use r12 for the address of global offset table.
The adjusted macro definition is not used if gcc is not configured with
--enable-default-pie.

ChangeLog:

	* sysdeps/s390/s390-32/tls-macros.h (TLS_IE): Use r12 for GOT address.
	* sysdeps/s390/s390-64/tls-macros.h (TLS_IE): Likewise.
2017-06-27 15:23:43 +02:00
Florian Weimer e6b4e2de6d resolv: Call _res_hconf_init from __res_vinit
Many callers of __res_maybe_init also call _res_hconf_init.
Additional calls to the latter do not hurt because the function
does its work only once.  (/etc/hosts.conf is not reloaded or
even checked for changes.)  This means that we can simplify the
code by calling _res_hconf_init directly from __res_vinit.
2017-06-27 09:26:46 +02:00
Joseph Myers 034e738021 Add float128 support for ia64.
This patch enables float128 support for ia64, so that all the
configurations where GCC supports _Float128 / __float128 as an
ABI-distinct type now have glibc support as well.  bits/floatn.h
declares the support to be available for GCC 4.4 and later, which is
when the libgcc support was added.  The removal of
sysdeps/ia64/fpu/k_rem_pio2.c is because the generic k_rem_pio2.c
defines a function required by the float128 code.

Tested (compilation only) with build-many-glibcs.py for ia64 (GCC 6
and GCC 7).

Given how long it is since libm-test-ulps has been updated for ia64, I
think truncating the file and regenerating it from scratch would be a
good idea when doing a regeneration to add float128 ulps.  I expect
various ia64 libm issues (at least some already filed in Bugzilla) to
result in test failures even after ulps regeneration, but hopefully
the float128 code will pass tests as it's the same as used on other
architectures.

	* sysdeps/ia64/Implies: Add ieee754/float128.
	* sysdeps/ia64/bits/floatn.h: New file.
	* sysdeps/ia64/float128-abi.h: Likewise.
	* manual/math.texi (Mathematics): Document support for _Float128
	on ia64.
	* sysdeps/ia64/Makefile [$(subdir) = math] (CPPFLAGS): Append to
	Makefile variable.
	* sysdeps/ia64/fpu/e_sqrtf128.c: New file.
	* sysdeps/ia64/fpu/k_rem_pio2.c: Remove file.
	* sysdeps/ia64/fpu/sfp-machine.h: New file.  Based on libgcc.
	* sysdeps/ia64/math-tests.h: New file.
	* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): Also define
	based on TEST_COND_binary128 for [__ia64__].
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise,
2017-06-26 22:50:45 +00:00
Joseph Myers 251287734e Rename struct ucontext tag (bug 21457).
The ucontext_t type has a tag struct ucontext.  As with previous such
issues for siginfo_t and stack_t, this tag is not permitted by POSIX
(is not in a reserved namespace), and so namespace conformance means
breaking C++ name mangling for this type.

In this case, the type does need to have some tag rather than just a
typedef name, because it includes a pointer to itself.  This patch
uses struct ucontext_t as the new tag, so the type is mangled as
ucontext_t (the POSIX *_t reservation applies in all namespaces, not
just the namespace of ordinary identifiers).  Another reserved name
such as struct __ucontext could of course be used.

Because of other namespace issues, this patch does not by itself fix
bug 21457 or allow any XFAILs to be removed.

Tested for x86_64, and with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (struct ucontext): Rename to struct
	ucontext_t.
	* sysdeps/generic/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/i386/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/m68k/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/mips/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct
	ucontext): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (struct
	ucontext): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/powerpc/powerpc32/backtrace.c (struct
	rt_signal_frame_32): Likewise.
	* sysdeps/powerpc/powerpc64/backtrace.c (struct signal_frame_64):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/profil-counter.h
	(__profil_counter): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h
	(SIGCONTEXT): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/nios2/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c
	(__start_context): Likewise.
	* sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/register-dump.h (register_dump):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
2017-06-26 22:03:58 +00:00
Joseph Myers c86ed71d63 Add float128 support for x86_64, x86.
This patch enables float128 support for x86_64 and x86.  All GCC
versions that can build glibc provide the required support, but since
GCC 6 and before don't provide __builtin_nanq / __builtin_nansq, sNaN
tests and some tests of NaN payloads need to be disabled with such
compilers (this does not affect the generated glibc binaries at all,
just the tests).  bits/floatn.h declares float128 support to be
available for GCC versions that provide the required libgcc support
(4.3 for x86_64, 4.4 for i386 GNU/Linux, 4.5 for i386 GNU/Hurd);
compilation-only support was present some time before then, but not
really useful without the libgcc functions.

fenv_private.h needed updating to avoid trying to put _Float128 values
in registers.  I make no assertion of optimality of the
math_opt_barrier / math_force_eval definitions for this case; they are
simply intended to be sufficient to work correctly.

Tested for x86_64 and x86, with GCC 7 and GCC 6.  (Testing for x32 was
compilation tests only with build-many-glibcs.py to verify the ABI
baseline updates.  I have not done any testing for Hurd, although the
float128 support is enabled there as for GNU/Linux.)

	* sysdeps/i386/Implies: Add ieee754/float128.
	* sysdeps/x86_64/Implies: Likewise.
	* sysdeps/x86/bits/floatn.h: New file.
	* sysdeps/x86/float128-abi.h: Likewise.
	* manual/math.texi (Mathematics): Document support for _Float128
	on x86_64 and x86.
	* sysdeps/i386/fpu/fenv_private.h: Include <bits/floatn.h>.
	(math_opt_barrier): Do not put _Float128 values in floating-point
	registers.
	(math_force_eval): Likewise.
	[__x86_64__] (SET_RESTORE_ROUNDF128): New macro.
	* sysdeps/x86/fpu/Makefile [$(subdir) = math] (CPPFLAGS): Append
	to Makefile variable.
	* sysdeps/x86/fpu/e_sqrtf128.c: New file.
	* sysdeps/x86/fpu/sfp-machine.h: Likewise.  Based on libgcc.
	* sysdeps/x86/math-tests.h: New file.
	* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): New macro.
	* math/libm-test-getpayload.inc (getpayload_test_data): Use
	XFAIL_FLOAT128_PAYLOAD.
	* math/libm-test-setpayload.inc (setpayload_test_data): Likewise.
	* math/libm-test-totalorder.inc (totalorder_test_data): Likewise.
	* math/libm-test-totalordermag.inc (totalordermag_test_data):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-06-26 22:02:24 +00:00
Adhemerval Zanella 3f823e87cc Call exit directly in clone (BZ #21512)
On aarch64, alpha, arm, hppa, mips, nios2, powerpc, sh, sparc, tile,
and x86_64 the clone syscall jumps to _exit after the child execution
and the function ends the process execution by calling exit_group.
This behavior have a small issue where threads created with
CLONE_THREAD using clone syscall directly will eventually exit the
whole group altogether instead of just the thread created.  Also,
s390, microblaze, ia64, i386, and m68k differs by calling exit
syscall directly.

This patch changes all architectures to call the exit syscall
directly, as for s390, microblaze, ia64, i386, and m68k.  This do not
have change glibc internal behavior in any sort, since the only
usage of clone implementation in posix_spawn calls _exit directly
in the created child (fork uses a direct call to clone).

Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
powerpc-linux-gnu, powerpc64le-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu.

	[BZ #21512]
	* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Call exit
	syscall instead of jump to _exit.
	(CLONE_VM_BIT): Remove unused define.
	(CLONE_VM): Likewise.
	(CLONE_THREAD_BIT): Likewise.
	(CLONE_THREAD): Likewise.
	* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	(CLONE_THREAD): Likewise.
	* sysdeps/unix/sysv/linux/i386/clone.S (CLONE_VM): Likewise.
	* sysdeps/unix/sysv/linux/ia64/clone2.S (__clone2): Call exit
	syscall instead of jump to _exit.
	* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/mips/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	(CLONE_THREAD): Likewise.
	* sysdeps/unix/sysv/linux/nios2/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone):
	Likewise.
	(CLONE_VM): Remove unused define.
	(CLONE_THREAD): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
	Likewise.
	(CLONE_VM): Remove unused define.
	(CLONE_THREAD): Likewise.
	* sysdeps/unix/sysv/linux/sh/clone.S  (__clone): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	* sysdeps/unix/sysv/linux/tile/clone.S (__clone): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/clone.S (__clone): Likewise.
	(CLONE_VM): Remove unused define.
	* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-clone3.
	* sysdeps/unix/sysv/linux/tst-clone3.c: New file.

Fix
2017-06-26 17:52:20 -03:00
Paul E. Murphy f819dbea0a powerpc64le: Enable float128
This patch adds ULPs for the float128 type, updates the abilist for libc
and libm, and adds the files bits/floatn.h and float128-abi.h, in order to
enable the new type for powerpc64le.

This patch also adds the implementation of sqrtf128 for powerpc64le, since
it is not implemented in libgcc.  The sfp-machine.h header is taken from
libgcc.

Tested for powerpc64le (GCC 6.2 and GCC 7.1), powerpc64 and s390x.

	* manual/math.texi (Mathematics): Mention the enabling of float128
	for powerpc64le.
	* sysdeps/powerpc/bits/floatn.h: New file.
	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
	* sysdeps/powerpc/fpu/math_private.h:
	(__ieee754_sqrtf128): New inline override.
	* sysdeps/powerpc/powerpc64le/Implies-before: New file.
	* sysdeps/powerpc/powerpc64le/Makefile: New file.
	* sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file.
	* sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file.
	* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Updated.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h:
	New file.
2017-06-26 15:04:47 -03:00
Gabriel F. T. Gomes a27d2c1935 powerpc64le: Require at least POWER8 for powerpc64le
Support for powerpc64le requires POWER8 or newer processors.  Builds for
older processors are not tested.  Require at least POWER8 to avoid
unintentional builds.

	* sysdeps/powerpc/powerpc64le/configure.ac: Check for POWER8.
	* sysdeps/powerpc/powerpc64le/configure: Update.
2017-06-26 15:00:34 -03:00
Gabriel F. T. Gomes 4efe3ce400 powerpc64le: Check for compiler features for float128
On powerpc64le, support for float128 will be enabled, which requires some
compiler features to be present.  This patch adds a configure test to check
for such features, which are provided for powerpc64le since GCC 6.2.

Tested for powerpc64 and powerpc64le.

	* INSTALL: Regenerate.
	* manual/install.texi (Recommended Tools for Compilation): Mention
	the powerpc64le-specific requirement in the manual.
	* sysdeps/powerpc/powerpc64le/configure.ac: New file with checks
	for the compiler features required for building float128.
	* sysdeps/powerpc/powerpc64le/configure: New, auto-generated file.
2017-06-26 14:58:47 -03:00
Dmitry Bilunov 5cf88a83f2 getaddrinfo: Merge IPv6 addresses and IPv4 addresses [BZ #21295] 2017-06-24 16:50:42 +02:00
Adhemerval Zanella fa872e1b62 Clean pthread functions namespaces for C11 threads
This patch adds internal definition (through {libc_}hidden_{proto,def}) and
also change some strong to weak alias for symbols that might be used by C11
threads implementations.

The patchset should not change libc/libpthread functional, although object
changes are expected (since now internal symbols are used instead) and final
exported symbols through GLIBC_PRIVATE is also expanded (to cover libpthread
usage of __mmap{64}, __munmap, __mprotect).

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).

	* include/sched.h (__sched_get_priority_max): Add libc hidden proto.
	(__sched_get_prioriry_min): Likewise.
	* include/sys/mman.h (__mmap): Likewise.
	(__mmap64): Likewise.
	(__munmap): Likewise.
	(__mprotect): Likewise.
	* include/termios.h (__tcsetattr): Likewise.
	* include/time.h (__nanosleep): Use hidden_proto instead of
	libc_hidden_proto.
	* posix/nanosleep.c (__nanosleep): Likewise.
	* misc/Versions (libc): Export __mmap, __munmap, __mprotect,
	__sched_get_priority_min, and __sched_get_priority_max under
	GLIBC_PRIVATE.
	* nptl/allocatestack.c (__free_stacks): Use internal definition for
	libc symbols.
	(change_stack_perm): Likewise.
	(allocate_stack): Likewise.
	* sysdeps/posix/gethostname.c: Likewise.
	* nptl/tpp.c (__init_sched_fifo_prio): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
	* nptl/pthreadP.h (__pthread_mutex_timedlock): Add definition.
	(__pthread_key_delete): Likewise.
	(__pthread_detach): Likewise.
	(__pthread_cancel): Likewise.
	(__pthread_mutex_trylock): Likewise.
	(__pthread_mutexattr_init): Likewise.
	(__pthread_mutexattr_settype): Likewise.
	* nptl/pthread_cancel.c (pthread_cancel): Change to internal name and
	create alias for exported one.
	* nptl/pthread_join.c (pthread_join): Likewise.
	* nptl/pthread_detach.c (pthread_detach): Likewise.
	* nptl/pthread_key_delete.c (pthread_key_delete): Likewise.
	* nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
	* nptl/pthread_create.c: Change static requirements for pthread
	symbols.
	* nptl/pthread_equal.c (__pthread_equal): Change strong alias to weak
	for internal definition.
	* nptl/pthread_exit.c (__pthread_exit): Likewise.
	* nptl/pthread_getspecific.c (__pthread_getspecific): Likewise.
	* nptl/pthread_key_create.c (__pthread_key_create): Likewise.
	* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Likewise.
	* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise.
	* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock): Likewise.
	* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likwise.
	* nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
	Likewise.
	* nptl/pthread_self.c (__pthread_self): Likewise.
	* nptl/pthread_setspecific.c (__pthread_setspecific): Likewise.
	* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
	* misc/mmap.c (__mmap): Add internal symbol definition.
	* misc/mmap.c (__mmap64): Likewise.
	* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
	* sysdeps/unix/sysv/linux/mmap64.c (__mmap): Likewise.
	(__mmap64): Likewise.
	* sysdeps/unix/sysv/linux/i386/Versions (libc) [GLIBC_PRIVATE):
	Add __uname.
2017-06-23 17:38:17 -03:00
Joseph Myers 06a5b8f799 Update x86 ulps for GCC 7.
Testing with GCC 7 for 32-bit x86 showed some ulps differences,
presumably from variation in when values with excess precision get
spilled to the stack and so lose that precision.  This patch updates
the libm-test-ulps files accordingly.

	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
2017-06-23 20:23:26 +00:00
Joseph Myers 16000c8d04 Avoid localplt issues from x86 fereaiseexcept inline.
Building for x86_64 with float128 support, I get a localplt test
failure from lrintf128 calling feraiseexcept.

The problem is that an inline optimized version of feraiseexcept calls
__feraiseexcept_renamed in cases where it doesn't completely expand
inline, and that in turn is redirected to feraiseexcept for a library
call, so meaning the redirection of feraiseexcept to
__GI_feraiseexcept inside libm is lost for that call.

This patch fixes the problem by moving the redirect to an internal
header in the _LIBC case, with the internal header using
__GI_feraiseexcept where appropriate.

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/x86/fpu/bits/fenv.h [_LIBC] (__feraiseexcept_renamed):
	Do not declare.
	* sysdeps/x86/fpu/include/bits/fenv.h [_LIBC &&
	__USE_EXTERN_INLINES] (__feraiseexcept_renamed): Declare here,
	redirected to __GI_feraiseexcept if [SHARED && IS_IN (libm)].
2017-06-23 20:04:23 +00:00
H.J. Lu 049816c3be x86-64: Optimize L(between_2_3) in memcmp-avx2-movbe.S
Turn

	movzbl	-1(%rdi, %rdx), %edi
	movzbl	-1(%rsi, %rdx), %esi
	orl	%edi, %eax
	orl	%esi, %ecx

into

	movb	-1(%rdi, %rdx), %al
	movb	-1(%rsi, %rdx), %cl

	* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S (between_2_3):
	Replace movzbl and orl with movb.
2017-06-23 12:46:12 -07:00
Florian Weimer bc0382ae90 x86-64: Fix comment typo in memcmp-avx2-movbe.S 2017-06-23 19:00:58 +02:00
Florian Weimer 3ec7c02cc3 x86-64: memcmp-avx2-movbe.S needs saturating subtraction [BZ #21662]
This code:

L(between_2_3):
	/* Load as big endian with overlapping loads and bswap to avoid
	   branches.  */
	movzwl	-2(%rdi, %rdx), %eax
	movzwl	-2(%rsi, %rdx), %ecx
	shll	$16, %eax
	shll	$16, %ecx
	movzwl	(%rdi), %edi
	movzwl	(%rsi), %esi
	orl	%edi, %eax
	orl	%esi, %ecx
	bswap	%eax
	bswap	%ecx
	subl	%ecx, %eax
	ret

needs a saturating subtract because the full register is used.
With this commit, only the lower 24 bits of the register are used,
so a regular subtraction suffices.

The test case change adds coverage for these kinds of bugs.
2017-06-23 17:24:40 +02:00
Gabriel F. T. Gomes 7fa1d9462b Add libio-mtsafe flags to the build of strfromf128
Similar to the other functions in the strfrom class, strfromf128 calls
__printf_fp in order to convert the floating-point value to characters.
This requires the value of IO_MTSAFE_IO.

Tested for powerpc64le and s390x.

	* sysdeps/ieee754/float128/Makefile (CFLAGS-strfromf128.c): Add
	$(libio-mtsafe) to get the value of IO_MTSAFE_IO.
2017-06-23 10:31:49 -03:00
Paul Clarke c340290de8 Optimized version of powf()
Most significant changes are code simplification and use of doubles for
intermediate values.  Also, some rearrangement to move early
non-dependent code later, out of the faster paths.

	* sysdeps/ieee754/flt-32/e_powf.c: Optimized implementation utilizing
	rearranged code and doubles float types.
2017-06-23 09:19:17 -03:00
Rogerio A. Cardoso 76c4c838e7 powerpc: Fix sinf() IFUNC fallback.
sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c should fall back to
sysdeps/powerpc/fpu/s_sinf.c not to sysdeps/ieee754/flt-32/s_sinf.c.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c: Change
	s_sinf.c from sysdeps/ieee754/flt-32/ to sysdeps/powerpc/fpu/.
2017-06-23 09:19:00 -03:00
Paul Clarke 1301c20f6c powerpc: fix sysconf support for cache geometries
Commit cdfbe5037f added sysconf support
for cache geometries on powerpc, but mishandled errno.  For valid input
parameters, sysconf() should not set errno.

	* sysdeps/unix/sysv/linux/powerpc/sysconf.c: Remove references
	to errno, and simplify remaining related code.
2017-06-23 09:10:32 -03:00
Tulio Magno Quites Machado Filho 7dcdfbcf67 powerpc: Update AT_HWCAP[2] bits
Linux commit ID a4700a26107241cc7b9ac8528b2c6714ff99983d reserved 2 more
bits for the instructions darn (Deliver a Random Number) and scv (System
Call Vectored).

Linux commit ID 6997e57d693b07289694239e52a10d2f02c3a46f reserved
another bit for internal usage.

	* sysdeps/powerpc/bits/hwcap.h: Add PPC_FEATURE2_DARN and
	PPC_FEATURE2_SCV.
	* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add scv
	and darn.
2017-06-23 09:10:32 -03:00
Rajalakshmi Srinivasaraghavan 12f50337ae powerpc: refactor strrchr IFUNC
As done in commit 6d15a5c2e9
clean up IFUNC implementation for power8 in order to remove
unneeded macro definitions.
2017-06-23 11:24:30 +05:30
Rajalakshmi Srinivasaraghavan 001b09a6a2 powerpc: Add optimized version of [l]lroundf
This patch makes use of optimized double version of llround for single
precision as both the versions return [long] long type.
2017-06-23 10:43:31 +05:30
Joseph Myers c271ff9469 Support _Float128 in ldbl-96 bits/iscanonical.h.
This patch adds _Float128 support to the ldbl-96 bits/iscanonical.h,
as needed for x86_64 / x86 / ia64 support of _Float128.

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/ieee754/ldbl-96/bits/iscanonical.h
	[__HAVE_DISTINCT_FLOAT128] (__iscanonicalf128): New macro.
2017-06-22 23:06:41 +00:00
Joseph Myers 8d375dafe2 Support _Float128 in math-tests.h.
This patch makes math-tests.h, as used to describe support of given
floating-point types for sNaNs, rounding modes and exceptions, handle
distinguishing _Float128 from long double.  This is needed for x86_64,
where if building with GCC 6 or earlier there is no __builtin_nansq,
so no way to get a signaling NaN of _Float128 type, so associated
tests cannot be run (although glibc itself works fine, as there is
never any need to create such an sNaN with a built-in function inside
glibc).

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/generic/math-tests.h: Include <bits/floatn.h>.
	(MATH_TESTS_TG): New macro.
	(SNAN_TESTS_float128): Likewise.
	(ROUNDING_TESTS_float128): Likewise.
	(EXCEPTION_TESTS_float128): Likewise.
	(SNAN_TESTS): Define using MATH_TESTS_TG.
	(ROUNDING_TESTS): Likewise.
	(EXCEPTION_TESTS): Likewise.
2017-06-22 23:03:38 +00:00
Joseph Myers f20079d219 Fix float128_private.h redefinition of SET_RESTORE_ROUNDL.
As with other long double identifiers, float128_private.h has a
redefinition of SET_RESTORE_ROUNDL.  However, that redefinition is
broken, since this is a macro with one argument being defined to take
no arguments.  This patch fixes the redefinition.  (x86_64 needs the
redefinition because SET_RESTORE_ROUNDL only changes the x87 rounding
mode, whereas _Float128 arithmetic uses the SSE rounding mode instead
on x86_64.)

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/ieee754/float128/float128_private.h
	[SET_RESTORE_ROUNDF128] (SET_RESTORE_ROUNDL): Take an argument and
	pass it to SET_RESTORE_ROUNDF128.
2017-06-22 22:57:28 +00:00
Joseph Myers db7a548d02 Make float128_private.h work with generic ieee754.h.
float128_private.h redefines ieee754.h identifiers ieee854_long_double
and IEEE854_LONG_DOUBLE_BIAS to map them to identifiers from
ieee754_float128.h.

This causes problems when ieee754.h is included after
float128_private.h and it's a version of ieee754.h that also defines
those identifiers; specifically, sysdeps/ieee754/ieee754.h, which
defines those identifiers for the x86 extended format.  This patch
fixes this by ensuring an include of ieee754.h from float128_private.h
before the redefinitions.

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/ieee754/float128/float128_private.h: Include
	<ieee754.h>.
2017-06-22 22:53:01 +00:00
Joseph Myers d08cdabdd0 Correct min_of_type handling of _Float128.
The math_private.h macro min_of_type has broken _Float128 handling:
instead of passing its type argument to the key __EXPR_FLT128 macro,
it passes x, which is not a macro argument but whatever variable
called x happens to be visible in the calling function.  If that
variable has the wrong type, the wrong one of long double and
_Float128 can get chosen.  In particular, this applies to some
_Complex long double functions (where x happens to have type _Complex
long double, resulting in min_of_type returning a _Float128 value when
it should return a long double value).  For some reason, this only
caused test failures for me on x86_64 with GCC 6 but not GCC 7 (I
suspect it triggers known bugs in conversions from x86 long double to
_Float128 that are present in GCC 6's soft-fp).

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/generic/math_private.h (__EXPR_FLT128): Do not apply
	typeof to argument passed to __builtin_types_compatible_p.
	(min_of_type): Pass type argument, not x, to __EXPR_FLT128.
2017-06-22 22:46:27 +00:00
Joseph Myers 33711da4e9 Fix float128 uses of xlocale.h.
Three float128 files still include xlocale.h after it was removed.  I
don't know why this didn't cause problems for powerpc64le float128
testing; it did cause problems for my x86_64 float128 testing.  This
patch changes the includes to use bits/types/locale_t.h.

Tested for x86_64 (in conjunction with float128 patches).

	* sysdeps/ieee754/float128/strtof128_l.c: Include
	<bits/types/locale_t.h> instead of <xlocale.h>.
	* sysdeps/ieee754/float128/wcstof128.c: Likewise.
	* sysdeps/ieee754/float128/wcstof128_l.c: Likewise.
2017-06-22 22:34:49 +00:00
H.J. Lu 11ffcacb64 x86-64: Implement strcmp family IFUNC selectors in C
Implement strcmp family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcmp family functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcmp-sse2, strcmp-sse4_2, strncmp-sse2, strncmp-sse4_2,
	strcasecmp_l-sse2, strcasecmp_l-sse4_2, strcasecmp_l-avx,
	strncase_l-sse2, strncase_l-sse4_2 and strncase_l-avx.
	* sysdeps/x86_64/multiarch/ifunc-strcasecmp.h: New file.
	* sysdeps/x86_64/multiarch/strcasecmp.c: Likewise.
	* sysdeps/x86_64/multiarch/strcasecmp_l-avx.S: Likewise.
	* sysdeps/x86_64/multiarch/strcasecmp_l-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcasecmp_l-sse4_2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcasecmp_l.c: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-sse4_2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp.c: Likewise.
	* sysdeps/x86_64/multiarch/strncase.c: Likewise.
	* sysdeps/x86_64/multiarch/strncase_l-avx.S : Likewise.
	* sysdeps/x86_64/multiarch/strncase_l-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strncase_l-sse4_2.S: Likewise.
	* sysdeps/x86_64/multiarch/strncase_l.c: Likewise.
	* sysdeps/x86_64/multiarch/strncmp-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strncmp-sse4_2.S: Likewise.
	* sysdeps/x86_64/multiarch/strncmp.c: Likewise.
	* sysdeps/x86_64/multiarch/strcasecmp_l.S: Removed.
	* sysdeps/x86_64/multiarch/strcmp.S: Likewise.
	* sysdeps/x86_64/multiarch/strncase_l.S: Likewise.
	* sysdeps/x86_64/multiarch/strncmp.S: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-sse42.S: Include <sysdep.h>.
	(STRCMP_SSE42): New.  Defined to __strcmp_sse42 if not defined.
	[USE_AS_STRCASECMP_L || USE_AS_STRNCASECMP_L]: Include
	"locale-defines.h".
	(UPDATE_STRNCMP_COUNTER): New.
	(SECTION): Likewise.
	(GLABEL): Likewise.
	(LABEL): Likewise.
	* sysdeps/x86_64/multiarch/strncmp-ssse3.S: Rewrite and enable
	for libc.a.
2017-06-21 12:11:06 -07:00
Joseph Myers 9649350d2e Fix tile SA_* conditions for POSIX.1:2008 (bug 21622).
As shown by conform/ tests once the remaining namespace issues are
fixed, the tile bits/sigaction.h fails to declare SA_RESETHAND,
SA_RESTART and SA_NODEFER for non-XSI POSIX.1:2008 as other versions
do.  Those constants were moved from XSI to Base in the 2008 edition
of POSIX.  This patch fixes the conditions to match other versions of
this header.

Tested (compilation only) for tilegx-linux-gnu with
build-many-glibcs.py.

	[BZ #21622]
	* sysdeps/unix/sysv/linux/tile/bits/sigaction.h (SA_RESTART):
	Define for [__USE_UNIX98 || __USE_XOPEN2K8], not [__USE_UNIX98 ||
	__USE_MISC].
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
2017-06-21 17:35:24 +00:00
H.J. Lu 03feacb562 x86: Rename glibc.tune.ifunc to glibc.tune.hwcaps
Rename glibc.tune.ifunc to glibc.tune.hwcaps and move it to
sysdeps/x86/dl-tunables.list since it is x86 specicifc.  Also
change type of data_cache_size, data_cache_size and
non_temporal_threshold to unsigned long int to match size_t.
Remove usage DEFAULT_STRLEN from cpu-tunables.c.

	* elf/dl-tunables.list (glibc.tune.ifunc): Removed.
	* sysdeps/x86/dl-tunables.list (glibc.tune.hwcaps): New.
	Remove security_level on all fields.
	* manual/tunables.texi: Replace ifunc with hwcaps.
	* sysdeps/x86/cpu-features.c (TUNABLE_CALLBACK (set_ifunc)):
	Renamed to ..
	(TUNABLE_CALLBACK (set_hwcaps)): This.
	(init_cpu_features): Updated.
	* sysdeps/x86/cpu-features.h (cpu_features): Change type of
	data_cache_size, data_cache_size and non_temporal_threshold to
	unsigned long int.
	* sysdeps/x86/cpu-tunables.c (DEFAULT_STRLEN): Removed.
	(TUNABLE_CALLBACK (set_ifunc)): Renamed to ...
	(TUNABLE_CALLBACK (set_hwcaps)): This.  Update comments.  Don't
	use DEFAULT_STRLEN.
2017-06-21 10:21:37 -07:00
Szabolcs Nagy e535139e82 [AArch64] Add more cfi annotations to tlsdesc entry points
Backtrace through _dl_tlsdesc_resolve_rela was broken because the offset
of x30 from cfa was not in the debug info.

Add enough annotation so backtracing from the dynamic linker through
tlsdesc entry points works and the debugger shows registers correctly.
2017-06-21 15:04:37 +01:00
Szabolcs Nagy e9177fba13 [AArch64] Use hidden __GI__dl_argv in rtld startup code
We rely on the symbol being locally defined so using extern symbol
is not correct and the linker may complain about the relocations.
2017-06-21 14:54:11 +01:00
Florian Weimer 76b8266f99 getaddrinfo: Avoid stack copy of IPv6 address 2017-06-21 13:35:37 +02:00
Rajalakshmi Srinivasaraghavan 43e0ac24c8 powerpc: Optimize memchr for power8
Vectorized loops are used for sizes greater than 32B to improve
performance over power7 optimiztion.
2017-06-21 10:55:12 +05:30
Rajalakshmi Srinivasaraghavan 99c3eb0f73 powerpc: Add optimized version of [l]lrintf
This patch makes use of optimized double version of llrint for single
precision as both the versions return [long] long type.
2017-06-21 10:44:18 +05:30
Zack Weinberg 8082d91e1c Factor out shared definitions from bits/signum.h.
Many of the things defined by bits/signum.h are invariant across all
supported operating systems.  This patch factors out all of them to a
new header bits/signum-generic.h, which each bits/signum.h will include
and then override whichever things need adjustment.  Normally that will
mean, at most, adding or changing a few signal numbers.

A user-visible side effect is that the obsolete signal constant SIGUNUSED
(which is an alias for SIGSYS on all platforms that define it) is no
longer exposed by any version of bits/signum.h.

A side effect only relevant to glibc hackers is that _NSIG is now defined
in terms of __SIGRTMAX, instead of the other way around.  This is because
__SIGRTMAX varies from platform to platform, but _NSIG==__SIGRTMAX+1 is
true universally.  If your platform doesn't support realtime signals,
leave __SIGRTMAX equal to __SIGRTMIN.

I also added a Linux-specific test to make sure that our signal constants
match the ones in <asm/signal.h>, since we can't use that header (it's
not even vaguely namespace-clean).

	* bits/signum-generic.h: Renamed from bits/signum.h.
	Add proper multiple include guard and misuse check.
	Define __SIGRTMIN = __SIGRTMAX = 32, and define _NSIG = __SIGRTMAX+1.
	Move definition of SIGIO to "archaic names for compatibility" section.
	* bits/signum.h: New file which just includes bits/signum-generic.h.
	* sysdeps/unix/bsd/bits/signum.h
	* sysdeps/unix/sysv/linux/bits/signum.h
	* sysdeps/unix/sysv/linux/alpha/bits/signum.h
	* sysdeps/unix/sysv/linux/hppa/bits/signum.h
	* sysdeps/unix/sysv/linux/mips/bits/signum.h
	* sysdeps/unix/sysv/linux/sparc/bits/signum.h
	Just include <bits/signum-generic.h> and then add or adjust
	signal constants.  Do not define SIGUNUSED, SIGRTMIN, or SIGRTMAX.

	* signal/Makefile: Install bits/signum-generic.h.
	* signal/signal.h: Define SIGRTMIN and SIGRTMAX here.

	* sysdeps/generic/siglist.h: SIGSYS and SIGWINCH are
	universal.  Prefer SIGPOLL to SIGIO. Simplify #ifdeffage.

	* sysdeps/unix/sysv/linux/tst-signal-numbers.sh: New test.
	* sysdeps/unix/sysv/linux/Makefile: Run it.
2017-06-20 20:32:50 -04:00
Zack Weinberg af85385f31 Use locale_t, not __locale_t, throughout glibc
<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t.  Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.

	* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
	* include/monetary.h, include/stdlib.h, include/time.h
	* include/wchar.h, locale/duplocale.c, locale/freelocale.c
	* locale/global-locale.c, locale/langinfo.h, locale/locale.h
	* locale/localeinfo.h, locale/newlocale.c
	* locale/nl_langinfo_l.c, locale/uselocale.c
	* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
	* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
	* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
	* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
	* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
	* string/strcasecmp.c, string/strcoll_l.c, string/string.h
	* string/strings.h, string/strncase.c, string/strxfrm_l.c
	* sysdeps/ieee754/float128/strtof128_l.c
	* sysdeps/ieee754/float128/wcstof128.c
	* sysdeps/ieee754/float128/wcstof128_l.c
	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
	* sysdeps/ieee754/ldbl-64-128/strtold_l.c
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
	* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
	* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
	* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
	* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
	* sysdeps/x86_64/strcasecmp_l-nonascii.c
	* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
	* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
	* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
	* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
	* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
	* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
	* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
	* wctype/towctrans_l.c, wctype/wcfuncs_l.c
	* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
	Change all uses of __locale_t to locale_t.
2017-06-20 20:30:06 -04:00
Zack Weinberg f0be25b633 Rename xlocale.h to bits/types/__locale_t.h.
xlocale.h is already a single-type micro-header, defining struct
__locale_struct and the typedefs __locale_t and locale_t.  This patch
brings it into the bits/types/ scheme: there are now
bits/types/__locale_t.h which defines only __locale_struct and
__locale_t, and bits/types/locale_t.h which defines locale_t as well
as the other two.  None of *our* headers need __locale_t.h, but it
appears to me that libstdc++ could make use of it.

There are a lot of external uses of xlocale.h, but all the uses I
checked had an autoconf test or equivalent for its existence.  It has
never been available from other C libraries, and it has always
contained a comment reading "This file is not standardized, don't rely
on it, it can go away without warning" so I think dropping it is
pretty safe.

I also took the opportunity to clean up comments in various public
header files that still talk about the *_l interfaces as though they
were completely nonstandard.  There are a few of them, notably the
strtoX_l and wcstoX_l families, that haven't been standardized, but
the bulk are in POSIX.1-2008.

        * locale/xlocale.h: Rename to...
	* locale/bits/types/__locale_t.h: ...here.  Adjust commentary.
	Only define struct __locale_struct and __locale_t, not locale_t.
        * locale/bits/types/locale_t.h: New file; define locale_t here.
        * locale/Makefile (headers): Update to match.

        * include/xlocale.h: Delete wrapper.
        * include/bits/types/__locale_t.h: New wrapper.
        * include/bits/types/locale_t.h: New wrapper.

        * ctype/ctype.h, include/printf.h, include/time.h
        * locale/langinfo.h, locale/locale.h, stdlib/monetary.h
        * stdlib/stdlib.h, string/string.h, string/strings.h, time/time.h
        * wcsmbs/wchar.h, wctype/wctype.h: Use bits/types/locale_t.h.
        Correct outdated comments regarding the standardization status of
        the functions that take locale_t arguments.

        * stdlib/strtod_l.c, stdlib/strtof_l.c, stdlib/strtol_l.c
        * stdlib/strtold_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
        * sysdeps/ieee754/ldbl-128ibm/strtold_l.c
        * sysdeps/ieee754/ldbl-64-128/strtold_l.c
        * wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
        * wcsmbs/wcstof_l.c, wcsmbs/wcstold.c, wcsmbs/wcstold_l.c:
        Don't include xlocale.h. If necessary, include locale.h instead.

        * stdlib/strtold_l.c: Unconditionally include wchar.h.
2017-06-20 20:28:11 -04:00
Adhemerval Zanella bafcba22ac Consolidate Linux openat implementation
This patch consolidates the open Linux syscall implementation on
sysdeps/unix/sysv/linux/open{64}.c.  The changes are:

  1. Remove wordsize-64 openat{64}.
  2. For architetures that define __OFF_T_MATCHES_OFF64_T openat64
     will be default one with alias to required symbols.  Otherwise
     openat64 will pass the required O_LARGEFILE flag on syscall.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/openat.c (__libc_openat): Build only
	for !__OFF_T_MATCHES_OFF64_T.
	* sysdeps/unix/sysv/linux/openat64.c (__libc_openat64): New
	implementation based on open64.
	* sysdeps/unix/sysv/linux/wordsize-64/openat.c: Remove file.
	* sysdeps/unix/sysv/linux/wordsize-64/openat64.c: Likewise.
2017-06-20 18:20:06 -03:00
H.J. Lu da69a35566 Move x86 specific tunables to x86/dl-tunables.list
* elf/dl-tunables.list: Move x86 specific tunables to ...
	* sysdeps/x86/dl-tunables.list: Here.  New file.
2017-06-20 14:03:31 -07:00
Joseph Myers 46ad8909ce conformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635).
This patch XFAILs one test where the powerpc32 ucontext_t has the
wrong type of a field, to allow the conform/ tests as a whole to pass
once the namespace issues are fixed.

Tested with build-many-glibcs.py.

	[BZ #21635]
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (uc_mcontext): XFAIL for
	powerpc32-linux.
	* conform/data/ucontext.h-data (uc_mcontext): Likewise.
2017-06-20 17:51:36 +00:00
Joseph Myers e0b5a3b654 conformtest: XFAIL uc_sigmask test for ia64 (bug 21634).
This patch XFAILs one test where the ia64 ucontext_t has the wrong
type of a field, to allow the conform/ tests as a whole to pass once
the namespace issues are fixed.

Tested with build-many-glibcs.py.

	[BZ #21634]
	* sysdeps/unix/sysv/linux/ia64/Makefile [$(subdir) = conform]
	(conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (uc_sigmask): XFAIL for ia64-linux.
	* conform/data/ucontext.h-data (uc_sigmask): Likewise.
2017-06-20 17:47:32 +00:00
H.J. Lu 905947c304 tunables: Add IFUNC selection and cache sizes
The current IFUNC selection is based on microbenchmarks in glibc.  It
should give the best performance for most workloads.  But other choices
may have better performance for a particular workload or on the hardware
which wasn't available at the selection was made.  The environment
variable, GLIBC_TUNABLES=glibc.tune.ifunc=-xxx,yyy,-zzz...., can be used
to enable CPU/ARCH feature yyy, disable CPU/ARCH feature yyy and zzz,
where the feature name is case-sensitive and has to match the ones in
cpu-features.h.  It can be used by glibc developers to override the
IFUNC selection to tune for a new processor or improve performance for
a particular workload.  It isn't intended for normal end users.

NOTE: the IFUNC selection may change over time.  Please check all
multiarch implementations when experimenting.

Also, GLIBC_TUNABLES=glibc.tune.x86_non_temporal_threshold=NUMBER is
provided to set threshold to use non temporal store to NUMBER,
GLIBC_TUNABLES=glibc.tune.x86_data_cache_size=NUMBER to set data cache
size, GLIBC_TUNABLES=glibc.tune.x86_shared_cache_size=NUMBER to set
shared cache size.

	* elf/dl-tunables.list (tune): Add ifunc,
	x86_non_temporal_threshold,
	x86_data_cache_size and x86_shared_cache_size.
	* manual/tunables.texi: Document glibc.tune.ifunc,
	glibc.tune.x86_data_cache_size, glibc.tune.x86_shared_cache_size
	and glibc.tune.x86_non_temporal_threshold.
	* sysdeps/unix/sysv/linux/x86/dl-sysdep.c: New file.
	* sysdeps/x86/cpu-tunables.c: Likewise.
	* sysdeps/x86/cacheinfo.c
	(init_cacheinfo): Check and get data cache size, shared cache
	size and non temporal threshold from cpu_features.
	* sysdeps/x86/cpu-features.c [HAVE_TUNABLES] (TUNABLE_NAMESPACE):
	New.
	[HAVE_TUNABLES] Include <unistd.h>.
	[HAVE_TUNABLES] Include <elf/dl-tunables.h>.
	[HAVE_TUNABLES] (TUNABLE_CALLBACK (set_ifunc)): Likewise.
	[HAVE_TUNABLES] (init_cpu_features): Use TUNABLE_GET to set
	IFUNC selection, data cache size, shared cache size and non
	temporal threshold.
	* sysdeps/x86/cpu-features.h (cpu_features): Add data_cache_size,
	shared_cache_size and non_temporal_threshold.
2017-06-20 08:37:28 -07:00
Zack Weinberg c0b23001a8 Fix fallout from bits/string.h removal.
Remove one more string inline that was defined directly in string.h;
in the absence of the rest of the inlines, it broke the build.

Like other ifunc shims for these functions,
x86_64/multiarch/{mem,st}pcpy.c need to define __NO_STRING_INLINES and
NO_MEMPCPY_STPCPY_REDIRECT.

	* string/string.h (__mempcpy_inline): Delete.
	* sysdeps/x86_64/multiarch/mempcpy.c
	* sysdeps/x86_64/multiarch/stpcpy.c:
	Define NO_MEMPCPY_STPCPY_REDIRECT and __NO_STRING_INLINES
	before including string.h.
2017-06-20 09:39:08 -04:00
Zack Weinberg 09a596cc2c Remove bits/string.h.
These machine-dependent inline string functions have never been on by
default, and even if they were a good idea at the time they were
introduced, they haven't really been touched in ten to fifteen years
and probably aren't a good idea on current-gen processors.  Current
thinking is that this class of optimization is best left to the
compiler.

	* bits/string.h, string/bits/string.h
	* sysdeps/aarch64/bits/string.h
	* sysdeps/m68k/m680x0/m68020/bits/string.h
	* sysdeps/s390/bits/string.h, sysdeps/sparc/bits/string.h
	* sysdeps/x86/bits/string.h: Delete file.

	* string/string.h: Don't include bits/string.h.
	* string/bits/string3.h: Rename to bits/string_fortified.h.
	No need to undef various symbols that the removed headers
	might have defined as macros.
	* string/Makefile (headers): Remove bits/string.h, change
	bits/string3.h to bits/string_fortified.h.
	* string/string-inlines.c: Update commentary.  Remove definitions
	of various macros that nothing looks at anymore.  Don't directly
	include bits/string.h. Set _STRING_INLINE_unaligned here, based on
	compiler-predefined macros.
	* string/strncat.c: If STRNCAT is not defined, or STRNCAT_PRIMARY
	_is_ defined, provide internal hidden alias __strncat.
	* include/string.h: Declare internal hidden alias __strncat.
	Only forward __stpcpy to __builtin_stpcpy if __NO_STRING_INLINES is
	not defined.
	* include/bits/string3.h: Rename to bits/string_fortified.h,
	update to match above.

	* sysdeps/i386/string-inlines.c: Define compat symbols for
	everything formerly defined by sysdeps/x86/bits/string.h.
	Make existing definitions into compat symbols as well.
	Remove some no-longer-necessary messing around with macros.

	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	* sysdeps/s390/multiarch/mempcpy.c
	No need to define _HAVE_STRING_ARCH_mempcpy.
	Do define __NO_STRING_INLINES and NO_MEMPCPY_STPCPY_REDIRECT.

	* sysdeps/i386/i686/multiarch/strncat-c.c
	* sysdeps/s390/multiarch/strncat-c.c
	* sysdeps/x86_64/multiarch/strncat-c.c
	Define STRNCAT_PRIMARY.  Don't change definition of libc_hidden_def.
2017-06-20 08:21:24 -04:00
Joseph Myers 6c2ec6677b Remove pre-GCC-4.9 MIPS code.
This patch removes some MIPS code in glibc that was conditional on old
GCC versions no longer supported for building glibc.

Tested with build-many-glibcs.py.

	* sysdeps/mips/atomic-machine.h (R10K_BEQZ_INSN): Remove.
	[__GNUC_PREREQ (4, 8) || __mips16]: Make code unconditional.
	[!__GNUC_PREREQ (4, 8) && !__mips16]: Remove conditional code.
	* sysdeps/mips/math-tests.h
	[_MIPS_SIM != _ABIO32 && !__GNUC_PREREQ (4, 9)]: Remove
	conditional code.
2017-06-19 23:24:36 +00:00
Stefan Liebler b08a6a0dea S390: Sync ptrace.h with kernel. [BZ #21539]
This patch removes PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS
and PTRACE_SETFPREGS as these requests does not exist on s390 kernel.

But the kernel has support for PTRACE_SINGLEBLOCK,
PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE and
PTRACE_TE_ABORT_RAND.  Thus those are defined now.

The current kernel s390 specific ptrace.h file also defines
PTRACE_PEEKTEXT_AREA, PTRACE_PEEKDATA_AREA, PTRACE_POKETEXT_AREA,
PTRACE_POKEDATA_AREA, PTRACE_PEEK_SYSTEM_CALL, PTRACE_POKE_SYSTEM_CALL
and PTRACE_PROT, but those requests are not supported.
Thus those defines are skipped in glibc ptrace.h.

There were old includes of ptrace.h in sysdeps/s390/fpu/fesetenv.c.
The ptrace feature isn't used there anymore, thus I removed the includes.

Before this patch, <glibc>/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
uses ptrace-request 12 for PTRACE_GETREGS,
but <kernel>/include/uapi/linux/ptrace.h uses 12 for PTRACE_SINGLEBLOCK.

The s390 kernel has never had support for PTRACE_GETREGS!
Thus glibc ptrace.h is adjusted to match kernel ptrace.h.

The new s390 specific test ensures, that PTRACE_SINGLEBLOCK defined
in glibc works as expected.  If the kernel would interpret it as
PTRACE_GETREGS, then the testcase will not make any progress
and will time out.

ChangeLog:

	[BZ #21539]
	* NEWS: Mention s390 ptrace request changes.
	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
	(PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS,
	PTRACE_SETFPREGS): Remove enum constant.
	(PT_GETREGS, PT_SETREGS, PT_GETFPREGS, T_SETFPREGS):
	Remove defines.
	(PTRACE_SINGLEBLOCK): New enum constant.
	(PT_STEPBLOCK): New define.
	(PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
	PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE,
	PTRACE_TE_ABORT_RAND): New enum constant and define.
	* sysdeps/s390/fpu/fesetenv.c: Remove ptrace.h includes.
	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
	New file.
	* sysdeps/unix/sysv/linux/s390/Makefile: Add test.
2017-06-19 16:27:25 +02:00
Joseph Myers 487549c466 Fix another x86 sys/ucontext.h namespace issue (bug 21457).
This patch fixes a namespace issue for one more field in the x86
sys/ucontext.h that I missed in my previous changes.

Tested for x86_64.

	[BZ #21457]
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h [__x86_64__] (struct
	_libc_xmmreg): Use __ctx in defining field.
2017-06-19 12:21:35 +00:00
Joseph Myers a66bc30d6b Define struct rusage in sys/wait.h when required (bug 21575).
Some older standards (XPG4.2 through POSIX.1:2001, XSI only) require
sys/wait.h to include the definition of struct rusage.  This is
missing in glibc.

This patch adds the required definition.  struct rusage is moved to a
new header bits/types/struct_rusage.h to avoid bringing in the whole
of sys/resource.h (although the standards in question do allow the
whole of sys/resource.h to be brought in).  In the five
bits/resource.h headers, the only variation between the definitions of
struct rusage is that the sysdeps/unix/sysv/linux version is prepared
for x32 (by having anonymous unions with __syscall_slong_t fields) and
the others are not.  Thus, this version is suitable for use
generically (everything other than x32 simply has __syscall_slong_t
the same as long int, so there are no API or ABI changes involved, and
anonymous unions are already a required language feature for glibc
headers elsewhere), and this patch uses it as a base for the single
implementation of bits/types/struct_rusage.h.

Tested for x86_64, and with build-many-glibcs.py.

	[BZ #21575]
	* resource/bits/types/struct_rusage.h: New file.
	* include/bits/types/struct_rusage.h: Likewise.
	* bits/resource.h (struct rusage): Include
	<bits/types/struct_rusage.h> instead of defining here.
	* sysdeps/unix/sysv/linux/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/resource.h (struct rusage):
	Likewise.
	* resource/Makefile (headers): Add bits/types/struct_rusage.h.
	* posix/sys/wait.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8]:
	Include <bits/types/struct_rusage.h>
2017-06-19 11:59:19 +00:00
Siddhesh Poyarekar 629ebc873a Fix typo when undefining weak_alias
The macro directive #undef was miswritten as #undefine.

	* sysdeps/x86_64/multiarch/rawmemchr-sse2.S: Fix typo.
2017-06-19 14:56:40 +05:30
Stefan Liebler 5e5b3b8866 S390: Fix build with gcc configured with --enable-default-pie. [BZ #21537]
Building glibc with gcc configured with --enable-default-pie failed on s390
due to assembler messages:
../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44:
Error: junk at end of line, first unrecognized character is `@'

HIDDEN_JUMPTARGET was expanded to exit@PLT@GOTOFF.
If SHARED is not defined, HIDDEN_JUMPTARGET is defined to JUMPTARGET
in sysdeps/s390/s390-32/sysdep.h.  There it expanded to exit@PLT
in non SHARED case as PIC is defined if gcc is configured with
--enable-default-pie. Thus I've changed the "ifdef PIC" to "ifdef SHARED"
as we do not want PLTs in the static obj files.  I've also changed this
in sysdeps/s390/s390-64/sysdep.h.

I've also adjusted sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S.
If glibc is configured with --disable-hidden-plt, then NO_HIDDEN is defined.
In SHARED case HIDDEN_JUMPTARGET would be expanded to exit@PLT@GOTOFF
instead of __GI_exit@GOTOFF.
Now we jump to:
- __GI_exit if SHARED is defined
- exit@PLT if SHARED and NO_HIDDEN is defined
- exit if both are not defined.
On s390 31bit we have to setup GOT pointer in r12 if we use a PLT stub.
Therefore I use SYSCALL_PIC_SETUP from sysdep.h and added the missing semicolons.

ChangeLog:

	[BZ #21537]
	* sysdeps/s390/s390-32/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP):
	Check SHARED instead of PIC.
	(SYSCALL_PIC_SETUP): Add missing semicolons.
	* sysdeps/s390/s390-64/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP):
	Check SHARED instead of PIC.
	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
	(__makecontext_ret): Adjust code to jump to exit.
2017-06-19 11:08:58 +02:00
Christian Borntraeger 35810f5ccf s390: optimize syscall function
Since kernel 2.6.0 all Linux version accept the system call number
in register 1 for svc 0. There is no need to have special handling
that uses EX for system calls < 256. This will simplify and speed
up that code.

A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster
by ~12%.

        * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Simplify
        code by always using SVC 0 instead of EX.
        * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
2017-06-19 10:59:40 +02:00
Adhemerval Zanella 48d966eb35 linux: Consolidate sync_file_range implementation
This patch consolidates Linux sync_file_range at default
sysdeps/unix/sysv/linux/sync_file_range.c implementation.  It also
moves the rules flags from generic io/Makefile to Linux one due the
fact it is a Linux-only symbol.

Checked on i686-linux-gnu and x86_64-linux-gnu.

	* io/Makefile (CFLAGS-sync_file_range.c): Remove rule.
	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-sync_file_range.c): New
	rule.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove
	sync_file_range.
2017-06-15 16:03:37 -03:00
H.J. Lu 70fe2eb794 x86-64: Implement strcspn/strpbrk/strspn IFUNC selectors in C
Implement strcspn/strpbrk/strspn IFUNC selectors in C

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcspn/strpbrk/strspn functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcspn-sse2, strpbrk-sse2 and strspn-sse2.
	* sysdeps/x86_64/strcspn.S (STRPBRK_P): Removed.
	Check USE_AS_STRPBRK instead of STRPBRK_P.
	* sysdeps/x86_64/strpbrk.S (USE_AS_STRPBRK): New.
	* sysdeps/x86_64/multiarch/ifunc-sse4_2.h: New file.
	* sysdeps/x86_64/multiarch/strcspn-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcspn.c: Likewise.
	* sysdeps/x86_64/multiarch/strpbrk-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strpbrk.c: Likewise.
	* sysdeps/x86_64/multiarch/strspn-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strspn.c: Likewise.
	* sysdeps/x86_64/multiarch/strcspn.S: Removed.
	* sysdeps/x86_64/multiarch/strpbrk.S: Likewise.
	* sysdeps/x86_64/multiarch/strspn.S: Likewise.
	* sysdeps/x86_64/multiarch/strpbrk-c.c: Remove "#ifdef SHARED"
	and "#endif".
2017-06-15 08:59:05 -07:00
H.J. Lu 9f4254b8bd x86-64: Implement wcscpy IFUNC selector in C
* sysdeps/x86_64/multiarch/wcscpy.S: Removed.
	* sysdeps/x86_64/multiarch/wcscpy.c: New file.
2017-06-15 08:57:52 -07:00
H.J. Lu 9ed0aa15d3 x86-64: Implement strcat family IFUNC selectors in C
Implement strcat family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcat family functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcat-sse2.
	* sysdeps/x86_64/multiarch/strcat-sse2.S: New file.
	* sysdeps/x86_64/multiarch/strcat.c: Likewise.
	* sysdeps/x86_64/multiarch/strncat.c: Likewise.
	* sysdeps/x86_64/multiarch/strcat.S: Removed.
	* sysdeps/x86_64/multiarch/strncat.S: Likewise.
2017-06-15 08:56:59 -07:00
H.J. Lu b91a52d0d7 x86-64: Implement memcmp family IFUNC selectors in C
Implement memcmp family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for memcmp family functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memcmp-sse2.
	* sysdeps/x86_64/multiarch/ifunc-memcmp.h: New file.
	* sysdeps/x86_64/multiarch/memcmp-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/memcmp.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemcmp.c: Likewise.
	* sysdeps/x86_64/multiarch/memcmp.S: Removed.
	* sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.
2017-06-15 08:49:57 -07:00
H.J. Lu 93e46f8773 x86-64: Implement memset family IFUNC selectors in C
Implement memset family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for memset functions within libc.

2017-06-07  H.J. Lu  <hongjiu.lu@intel.com>
	    Erich Elsen  <eriche@google.com>

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memset-sse2-unaligned-erms, and memset_chk-nonshared.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add test for __memset_chk_erms.
	Update comments.
	* sysdeps/x86_64/multiarch/ifunc-memset.h: New file.
	* sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S: Likewise.
	* sysdeps/x86_64/multiarch/memset.c: Likewise.
	* sysdeps/x86_64/multiarch/memset_chk-nonshared.S: Likewise.
	* sysdeps/x86_64/multiarch/memset_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/memset.S: Removed.
	* sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
	(__memset_chk_erms): New function.
2017-06-15 08:33:35 -07:00
H.J. Lu 5c3e322d3b x86-64: Implement memmove family IFUNC selectors in C
Implement memmove family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for memmove family functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memmove-sse2-unaligned-erms, memcpy_chk-nonshared,
	mempcpy_chk-nonshared and memmove_chk-nonshared.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __memmove_chk_erms,
	__memcpy_chk_erms and __mempcpy_chk_erms.  Update comments.
	* sysdeps/x86_64/multiarch/ifunc-memmove.h: New file.
	* sysdeps/x86_64/multiarch/memcpy.c: Likewise.
	* sysdeps/x86_64/multiarch/memcpy_chk-nonshared.S: Likewise.
	* sysdeps/x86_64/multiarch/memcpy_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove.c: Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk-nonshared.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.c: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk-nonshared.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S: Removed.
	* sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
	(__mempcpy_chk_erms): New function.
	(__memmove_chk_erms): Likewise.
	(__memcpy_chk_erms): New alias.
2017-06-14 12:11:10 -07:00
Florian Weimer 69052a3a95 i686: Add missing IS_IN (libc) guards to vectorized strcspn
Since commit d957c4d3fa (i386: Compile
rtld-*.os with -mno-sse -mno-mmx -mfpmath=387), vector intrinsics can
no longer be used in ld.so, even if the compiled code never makes it
into the final ld.so link.  This commit adds the missing IS_IN (libc)
guard to the SSE 4.2 strcspn implementation, so that it can be used from
ld.so in the future.
2017-06-14 14:50:11 +02:00
Zack Weinberg fd860eaaa8 Remove __need macros from errno.h (__need_Emath, __need_error_t).
This is fairly complicated, not because the users of __need_Emath and
__need_error_t have complicated requirements, but because the core
changes had a lot of fallout.

__need_error_t exists for gnulib compatibility in argz.h and argp.h.
error_t itself is a Hurdism, an enum containing all the E-constants,
so you can do 'p (error_t) errno' in gdb and get a symbolic value.
argz.h and argp.h use it for function return values, and they want to
fall back to 'int' when that's not available.  There is no reason why
these nonstandard headers cannot just go ahead and include all of
errno.h; so we do that.

__need_Emath is defined only by .S files; what they _really_ need is
for errno.h to avoid declaring anything other than the E-constants
(e.g. 'extern int __errno_location(void);' is a syntax error in
assembly language). This is replaced with a check for __ASSEMBLER__ in
errno.h, plus a carefully documented requirement for bits/errno.h not
to define anything other than macros.  That in turn has the
consequence that bits/errno.h must not define errno - fortunately, all
live ports use the same definition of errno, so I've moved it to
errno.h.  The Hurd bits/errno.h must also take care not to define
error_t when __ASSEMBLER__ is defined, which involves repeating all of
the definitions twice, but it's a generated file so that's okay.

	* stdlib/errno.h: Remove __need_Emath and __need_error_t logic.
	Reorganize file.  Declare errno here.  When __ASSEMBLER__ is
	defined, don't declare anything other than the E-constants.

	* include/errno.h: Change conditional for exposing internal
	declarations to (not _ISOMAC and not __ASSEMBLER__).
	* bits/errno.h: Remove logic for __need_Emath.  Document
	requirements for a port-specific bits/errno.h.

	* sysdeps/unix/sysv/linux/bits/errno.h
	* sysdeps/unix/sysv/linux/alpha/bits/errno.h
	* sysdeps/unix/sysv/linux/hppa/bits/errno.h
	* sysdeps/unix/sysv/linux/mips/bits/errno.h
	* sysdeps/unix/sysv/linux/sparc/bits/errno.h:
	Add multiple-include guard and check against improper inclusion.
	Remove __need_Emath logic.  Don't declare errno here.  Ensure all
	constants are defined as simple integer literals.  Consistent
	formatting.
	* sysdeps/mach/hurd/errnos.awk: Likewise.  Only define error_t and
	enum __error_t_codes if __ASSEMBLER__ is not defined.
	* sysdeps/mach/hurd/bits/errno.h: Regenerate.

	* argp/argp.h, string/argz.h: Don't define __need_error_t before
	including errno.h.
	* sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
	* sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S
	* sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
	* sysdeps/x86_64/fpu/s_cosf.S
	* sysdeps/x86_64/fpu/s_sincosf.S
	* sysdeps/x86_64/fpu/s_sinf.S:
	Just include errno.h; don't define __need_Emath or include
	bits/errno.h directly.
2017-06-14 08:14:34 -04:00
Zack Weinberg 37f802f864 Remove __need_IOV_MAX and __need_FOPEN_MAX.
__need_FOPEN_MAX wasn't being used anywhere.  __need_IOV_MAX was more
complicated; the basic deal is that sys/uio.h wants to define a
constant named UIO_MAXIOV and bits/xopen_lim.h wants to define a
constant named IOV_MAX, with the same meaning.  For no apparent reason
this was being handled via bits/stdio_lim.h -- stdio.h is NOT supposed
to define IOV_MAX -- and some mess in Makerules.  Also, bits/uio.h on
Linux was being used as a dumping ground for extension functions.

So now we have bits/uio_lim.h, which defines __IOV_MAX.
bits/xopen_lim.h and sys/uio.h use that to define their respective
constants.  We also now have bits/uio-ext.h, which is the official
Proper Home for extensions to sys/uio.h.  bits/uio.h is removed, and
stdio_lim.h doesn't define IOV_MAX at all.

	* bits/uio_lim.h, sysdeps/unix/sysv/linux/bits/uio_lim.h
	* bits/uio-ext.h, sysdeps/unix/sysv/linux/bits/uio-ext.h: New file.
	* bits/uio.h, sysdeps/unix/sysv/linux/bits/uio.h: Delete file.

	* include/bits/xopen_lim.h: Use bits/uio_lim.h to get the value
	for IOV_MAX.
	* misc/Makefile: Install bits/uio-ext.h and bits/uio_lim.h.
	Don't install bits/uio.h.
	* misc/sys/uio.h: Don't include bits/uio.h.  Do include
	bits/types/struct_iovec.h and bits/uio_lim.h.  Set UIO_MAXIOV
	based on __IOV_MAX. Under __USE_GNU, also include bits/uio-ext.h.

	* stdio-common/stdio_lim.h.in: Remove logic for __need_FOPEN_MAX
	and __need_IOV_MAX.  Don't define IOV_MAX at all.
	* Makerules (stdio_lim.h): Remove logic for setting IOV_MAX.

	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h:
	Include bits/types/struct_iovec.h, not bits/uio.h.
	Use __ssize_t, not ssize_t, in function prototypes.
	Don't use hard TAB for double space after period in comments.
2017-06-14 07:51:30 -04:00
Alan Modra 0572433b5b PowerPC64 ELFv2 PPC64_OPT_LOCALENTRY
ELFv2 functions with localentry:0 are those with a single entry point,
ie. global entry == local entry, that have no requirement on r2 or
r12 and guarantee r2 is unchanged on return.  Such an external
function can be called via the PLT without saving r2 or restoring it
on return, avoiding a common load-hit-store for small functions.

This patch implements the ld.so changes necessary for this
optimization.  ld.so needs to check that an optimized plt call
sequence is in fact calling a function implemented with localentry:0,
end emit a fatal error otherwise.

The elf/testobj6.c change is to stop "error while loading shared
libraries: expected localentry:0 `preload'" when running
elf/preloadtest, which we'd get otherwise.

	* elf/elf.h (PPC64_OPT_LOCALENTRY): Define.
	* sysdeps/alpha/dl-machine.h (elf_machine_fixup_plt): Add
	refsym and sym parameters.  Adjust callers.
	* sysdeps/aarch64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/arm/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/generic/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/mips/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_fixup_plt):
	Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_fixup_plt): Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.c (_dl_error_localentry): New.
	(_dl_reloc_overflow): Increase buffser size.  Formatting.
	* sysdeps/powerpc/powerpc64/dl-machine.h (ppc64_local_entry_offset):
	Delete reloc param, add refsym and sym.  Check optimized plt
	call stubs for localentry:0 functions.  Adjust callers.
	(elf_machine_fixup_plt, elf_machine_plt_conflict): Add refsym
	and sym parameters.  Adjust callers.
	(_dl_reloc_overflow): Move attribute.
	(_dl_error_localentry): Declare.
	* elf/dl-runtime.c (_dl_fixup): Save original sym.  Pass
	refsym and sym to elf_machine_fixup_plt.
	* elf/testobj6.c (preload): Call printf.
2017-06-14 10:47:25 +09:30
Alan Modra d5b411854f PowerPC64 ENTRY_TOCLESS
A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use
or change r2, yet declare a global entry that sets up r2.  This patch
fixes that problem, and consolidates the ENTRY and EALIGN macros.

	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
	(NOPS, ENTRY_3): New macros.
	(ENTRY): Rewrite.
	(ENTRY_TOCLESS): Define.
	(EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5,
	EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete.
	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY.
	* sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
	* sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS.
	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/lshift.S: Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/mul_1.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l):
	Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
	* sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier.  Don't
	add nop when SHARED.
	* sysdeps/powerpc/powerpc64/start.S: Fix comment.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't
	define.
	(ENTRY_TOCLESS): Define.
	* sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define.
	* sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS.
	* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
2017-06-14 10:45:50 +09:30
Alan Modra de7ee73d6f PowerPC64 strncpy, stpncpy and strstr fixes
Makes __stpncpy_power8 call __memset_power8 directly rather than via an
IFUNC.  Fixes a missing _mcount, and removes some redundant NOPS.  The
*_is_local defines are also used in a followup patch.

	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Define
	MEMSET_is_local.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise.
	Define MEMSET.
	* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define
	STRLEN_is_local, STRNLEN_is_local, and STRCHR_is_local.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise.  Don't add
	nop after local calls.
	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Define MEMSET_is_local.
	Don't add nop after local call.
	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.  Add missing
	CALL_MCOUNT.
2017-06-14 10:44:59 +09:30
Alan Modra 4b6e7667db PowerPC64 sysdep.h tidy
.align on some targets takes a byte alignment, on others like powerpc,
log2 of the byte alignment.  It's a good idea to avoid .align,
particularly since x86 and powerpc are different.  This patch fixes
the occurrences of .align in powerpc64/sysdep.h, renames DOT_LABEL
since the macro doesn't have anything to do with adding dots, removes
extraneous semicolons, and fixes some formatting.

	* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
	(FUNC_LABEL): Rename from DOT_LABEL.
	(ENTRY_1): Use FUNC_LABEL and remove leading space from label.
	Use .p2align rather than .align.
	(TRACEBACK, TRACEBACK_MASK): Use .p2align rather than .align.
	(ABORT_TRANSACTION): Likewise.
	(ENTRY_1, ENTRY_2, END_2, LOCALENTRY): Remove unnecessary semicolons,
	particularly at end.  Add semicolon at invocation as necessary.
	(TRACEBACK, TRACEBACK_MASK, PSEUDO, PSEUDO_NOERRNO): Likewise.
	(PSEUDO_ERRVAL, PPC64_LOAD_FUNCPTR, OPD_ENT): Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY,
	END): Adjust to suit.
2017-06-14 10:44:03 +09:30
Alan Modra fb499eb04e PowerPC64 FRAME_PARM_SAVE
I think FRAME_PARM[1-9]_SAVE confuse the code, particularly
FRAME_PARM9_SAVE.  There are only 8 parameter save slots!

	* sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN,
	FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional.
	(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
	FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
	FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace
	uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
2017-06-14 10:43:33 +09:30
Alan Modra dd8854361b PowerPC64, fix calls to _mcount
The macros used in assembly were broken on powerpc64 ELFv1.

	* sysdeps/powerpc/powerpc64/sysdep.h: (call_mcount_parm_offset): Delete.
	(SAVE_ARG, REST_ARG, CFI_SAVE_ARG): Correct.
2017-06-14 10:42:42 +09:30
Gordana Cmiljanovic b309f058cf mips: Fix store/load gp registers to/from ucontext_t
General purpose registers in mcontext_t structure
are 8 bytes long for both MIPS32/MIPS64.

get/set/make/swap context implementations for MIPS O32
incorrectly assume that general purpose registers
in this structure are 4 bytes long.

This patch is fixing that.

Tested for MIPS O32 LE and BE.
Compared objdump of modified functions for mips n32 and mips n64.

	[BZ #21548]
	* sysdeps/unix/sysv/linux/mips/getcontext.S: Define MCONTEXT_SZGREG as
	8 and use it when copying general purpose registers.
	* sysdeps/unix/sysv/linux/mips/makecontext.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile: Include new test for
	mips o32.
	* sysdeps/unix/sysv/linux/mips/mips32/bug-getcontext-mips-gp.c: Added
	new test for mips o32.
	* sysdeps/unix/sysv/linux/mips/setcontext.S: Define MCONTEXT_SZGREG as
	8 and use it when copying general purpose registers.
	* sysdeps/unix/sysv/linux/mips/swapcontext.S: Likewise.
2017-06-13 21:34:45 +00:00
Zack Weinberg 46ee3da55e Remove __need_schedparam and __cpu_set_t_defined.
bits/sched.h has logic to expose only an impl-namespace variant of
struct sched_param (i.e. struct __sched_param), but nothing uses it,
and the only header that includes bits/sched.h is sched.h.  The
__need_schedparam logic can therefore be removed.

bits/sched.h also has a great deal of code relating to cpu_set_t
objects that was *almost* the same between the two versions of
bits/sched.h in the tree; a little spelunking indicated that this is
because some bug fixes got applied to the Linux-specific bits/sched.h
but not the generic one.  Introduce a new header, bits/cpu-set.h,
containing the version of that code with the bugfixes, have sched.h
include it directly, and delete all of the code from both versions of
bits/sched.h.

Also remove the unnecessary name mangling in the definition of struct
sched_param -- POSIX specifies a field 'sched_priority', so there is
no reason to define it as '__sched_priority' and then paper over that
with a macro.  (Just in case someone was using the internal name,
'sched_priority' remains a macro defined to expand to itself, and
'__sched_priority' now expands to 'sched_priority'.)

Finally, as long as I'm touching these files anyway, merge new
constants from linux/sched.h into the Linux bits/sched.h.

	* bits/sched.h: Remove __need_schedparam logic and replace with a
	normal multiple-include guard.  Change field name in struct
	sched_param from __sched_priority to sched_priority.  Delete
	everything under #ifndef __cpu_set_t_defined.
	* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.  Also sync with
	kernel sched.h, adding SCHED_ISO and SCHED_DEADLINE constants.

	* posix/sched.h: Include bits/cpu-set.h as well as bits/sched.h.
	For compatibility, #define sched_priority to itself, and #define
	__sched_priority as sched_priority.
	* posix/bits/cpu-set.h: New file containing, verbatim, the code
	that was under #ifndef __cpu_set_t_defined in
	sysdeps/unix/sysv/linux/bits/sched.h.
	* include/bits/cpu-set.h: New wrapper.
	* posix/Makefile: Install bits/cpu-set.h.
2017-06-12 17:11:36 -04:00
Paul E. Murphy 45f39d4588 float128: Add strtof128, wcstof128, and related functions.
The implementations are contained with sysdeps/ieee754/float128 as
they are only built when _Float128 is enabled within libc/m.

	* include/gmp.h (__mpn_construct_float128): New declaration.
	* include/stdlib.h: Include bits/floatn.h for _Float128 tests.
	(__strtof128_l): New declaration.
	(__strtof128_nan): Likewise.
	(__wcstof128_nan): Likewise.
	(__strtof128_internal): Likewise.
	(____strtof128_l_internal): Likewise.
	* include/wchar.h: Include bits/floatn.h for _Float128 tests.
	(__wcstof128_l): New declaration.
	(__wcstof128_internal): Likewise.

	* stdlib/Makefile (bug-strtod2): Link libm too.

	* stdlib/stdlib.h (strtof128): New declaration.
	(strtof128_l): Likewise.

	* stdlib/tst-strtod-nan-locale-main.c: Updated to use
	tst-strtod.h macros to ensure float128 gets tested too.

	* stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro.

	* stdlib/tst-strtod.h: Include bits/floatn.h for _Float128
	tests.
	(IF_FLOAT128): New macro.
	(GEN_TEST_STRTOD): Update to optionally include _Float128 in
	the tests.
	(STRTOD_TEST_FOREACH): Likewise.

	* sysdeps/ieee754/float128/Makefile: Insert new strtof128 and
	wcstof128 functions into libc.

	* sysdeps/ieee754/float128/Versions: Add exports for the above
	new functions.

	* sysdeps/ieee754/float128/mpn2float128.c: New file.
	* sysdeps/ieee754/float128/strtod_nan_float128.h: New file.
	* sysdeps/ieee754/float128/strtof128.c: New file.
	* sysdeps/ieee754/float128/strtof128_l.c: New file.
	* sysdeps/ieee754/float128/strtof128_nan.c: New file.
	* sysdeps/ieee754/float128/wcstof128.c: New file.
	* sysdeps/ieee754/float128/wcstof128_l.c: New file.
	* sysdeps/ieee754/float128/wcstof128_nan.c: New fike.
	* wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS.
	(CFLAGS-wcstof128_l): Likewise.

	* wcsmbs/wchar.h: Include bits/floatn.h for _Float128 tests.
	(wcstof128): New declaration.
	(wcstof128_l): Likewise.
2017-06-12 14:48:53 -03:00
H.J. Lu 5a103908c0 x86-64: Implement strcpy family IFUNC selectors in C
Implement strcpy family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcpy family functions within libc.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcpy-sse2 and stpcpy-sse2.
	* sysdeps/x86_64/multiarch/ifunc-unaligned-ssse3.h: New file.
	* sysdeps/x86_64/multiarch/stpcpy-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/stpcpy.c: Likewise.
	* sysdeps/x86_64/multiarch/stpncpy.c: Likewise.
	* sysdeps/x86_64/multiarch/strcpy-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy.c: Likewise.
	* sysdeps/x86_64/multiarch/strncpy.c: Likewise.
	* sysdeps/x86_64/multiarch/stpcpy.S: Removed.
	* sysdeps/x86_64/multiarch/stpncpy.S: Likewise.
	* sysdeps/x86_64/multiarch/strcpy.S: Likewise.
	* sysdeps/x86_64/multiarch/strncpy.S: Likewise.
	* sysdeps/x86_64/multiarch/stpncpy-c.c (weak_alias): New.
	(libc_hidden_def): Always defined as empty.
	* sysdeps/x86_64/multiarch/strncpy-c.c (libc_hidden_builtin_def):
	Always Defined as empty.
2017-06-12 09:06:09 -07:00
Wilco Dijkstra d99431e519 Replace all internal uses of __bzero with memset. This removes the need
to redirect it to a builtin and means memset is inlined whenever possible,
including with -Os.

	* sunrpc/bindrsvprt.c (bindresvport): Change __bzero to memset.
	* sunrpc/clnt_gen.c (clnt_create): Likewise.
	* sunrpc/des_impl.c (_des_crypt): Likewise.
	* sunrpc/key_call.c (key_gendes): Likewise.
	* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
	* sunrpc/svc_simple.c (universal): Likewise.
	* sunrpc/svc_tcp.c (svctcp_create): Likewise.
	* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
	* sysdeps/arm/aeabi_memclr.c (__aeabi_memclr): Likewise.
2017-06-12 14:56:53 +01:00
Paul Clarke cdfbe5037f powerpc: add sysconf support for cache geometries
There is currently no "cross-platform" (x86 and POWER) support for
determining the cacheline size.

This patch adds support to sysconf() to correctly report cacheline sizes
based on the information in the auxilliary vector.

Thus, using sysconf() is a cross-platform (x86 and POWER) solution for
determining cacheline sizes.

Support is added (on powerpc) for:
_SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE
_SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE
_SC_LEVEL2_CACHE_SIZE  _SC_LEVEL2_CACHE_ASSOC  _SC_LEVEL2_CACHE_LINESIZE
_SC_LEVEL3_CACHE_SIZE  _SC_LEVEL3_CACHE_ASSOC  _SC_LEVEL3_CACHE_LINESIZE

	* sysdeps/unix/sysv/linux/powerpc/sysconf.c: New file.
	Add powerpc-specific overrides for L1, L2, L3 CACHE_SIZEs,
	CACHE_ASSOCs, and CACHE_LINESIZEs, retrieving from auxv.
	* sysdeps/unix/sysv/linux/powerpc/test-powerpc-linux-sysconf.c:
	New file.  Invoke newly supported sysconf values for powerpc,
	and report results.  If none are supported, report so.
	* sysdeps/unix/sysv/linux/powerpc/Makefile (tests):  Add new test,
	tst-sysconf.
2017-06-09 14:36:22 -03:00
Joseph Myers a17973efc6 Fix waitid namespace (bug 21561).
In sys/wait.h, waitid and associated constants and types are UX-shaded
in XPG4.2 (so not in XPG4), and XSI-shaded in POSIX before 2008, so
should be appropriately conditional in the headers.  This patch fixes
the conditionals accordingly.  (WCONTINUED is actually still
XSI-shaded in POSIX.1:2008, but W* is also reserved there without
XSI-shading, so nothing special needs to be done about the
conditionals on WCONTINUED to conform to POSIX.1:2008 namespace
rules.)

Tested for x86_64.

	[BZ #21561]
	* posix/sys/wait.h (idtype_t): Change [__USE_XOPEN] condition to
	[__USE_XOPEN_EXTENDED].
	(id_t): Likewise.
	(include of <bits/types/siginfo_t.h): Likewise.
	(waitid): Likewise.
	* sysdeps/unix/sysv/linux/bits/waitflags.h (WSTOPPED): Condition
	on [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8].
	(WEXITED): Likewise.
	(WCONTINUED): Likewise.
	(WNOWAIT): Likewise.
	* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove.
	(test-xfail-XPG4/sys/wait.h/conform): Likewise.
	(test-xfail-POSIX/sys/wait.h/conform): Likewise.
2017-06-09 16:28:07 +00:00
Joseph Myers 10d33c5a86 Update nios2, sparc32 localplt.data files for recent GCC change.
A recent GCC change to expand floating-point classification built-in
functions inline using integer rather than floating-point arithmetic
in some cases resulted in localplt test failures for nios2 and sparc32
<https://sourceware.org/ml/libc-testresults/2017-q2/msg00320.html>.
This patch updates the localplt.data files in question to mark the
relevant symbols as optional / add a new optional symbol.  (The GCC
patch has been reverted because of other problems it caused, but one
can assume it will be applied again, without changes that would affect
the PLT entries generated, once those issues have been resolved.)

Tested with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/nios2/localplt.data (__gtdf2): Mark
	libc.so PLT entry optional.
	(__gtsf2): Likewise.
	(__unorddf2): Likewise.
	(__unordsf2): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data (_Q_fgt):
	New optional libc.so PLT entry.
2017-06-09 16:26:06 +00:00
H.J. Lu 6b6710e55b x86-64: Correct comments in ifunc-impl-list.c
* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Correct comments.
2017-06-09 05:53:45 -07:00
H.J. Lu d2538b9156 x86-64: Optimize strrchr/wcsrchr with AVX2
Optimize strrchr/wcsrchr with AVX2 to check 32 bytes with vector
instructions.  It is as fast as SSE2 version for small data sizes
and up to 1X faster for large data sizes on Haswell.  Select AVX2
version on AVX2 machines where vzeroupper is preferred and AVX
unaligned load is fast.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strrchr-sse2, strrchr-avx2, wcsrchr-sse2 and wcsrchr-avx2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __strrchr_avx2,
	__strrchr_sse2, __wcsrchr_avx2 and __wcsrchr_sse2.
	* sysdeps/x86_64/multiarch/strrchr-avx2.S: New file.
	* sysdeps/x86_64/multiarch/strrchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strrchr.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsrchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsrchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsrchr.c: Likewise.
2017-06-09 05:45:52 -07:00
H.J. Lu 5ac7aa1d7c x86-64: Optimize memrchr with AVX2
Optimize memrchr with AVX2 to search 32 bytes with a single vector
compare instruction.  It is as fast as SSE2 memrchr for small data
sizes and up to 1X faster for large data sizes on Haswell.  Select
AVX2 memrchr on AVX2 machines where vzeroupper is preferred and AVX
unaligned load is fast.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memrchr-sse2 and memrchr-avx2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __memrchr_avx2 and
	__memrchr_sse2.
	* sysdeps/x86_64/multiarch/memrchr-avx2.S: New file.
	* sysdeps/x86_64/multiarch/memrchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/memrchr.c: Likewise.
2017-06-09 05:44:41 -07:00
H.J. Lu 8fe57365bf x86-64: Optimize strchr/strchrnul/wcschr with AVX2
Optimize strchr/strchrnul/wcschr with AVX2 to search 32 bytes with vector
instructions.  It is as fast as SSE2 versions for size <= 16 bytes and up
to 1X faster for or size > 16 bytes on Haswell.  Select AVX2 version on
AVX2 machines where vzeroupper is preferred and AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strchr-sse2, strchrnul-sse2, strchr-avx2, strchrnul-avx2,
	wcschr-sse2 and wcschr-avx2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __strchr_avx2,
	__strchrnul_avx2, __strchrnul_sse2, __wcschr_avx2 and
	__wcschr_sse2.
	* sysdeps/x86_64/multiarch/strchr-avx2.S: New file.
	* sysdeps/x86_64/multiarch/strchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strchr.c: Likewise.
	* sysdeps/x86_64/multiarch/strchrnul-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/strchrnul-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strchrnul.c: Likewise.
	* sysdeps/x86_64/multiarch/wcschr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcschr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcschr.c: Likewise.
	* sysdeps/x86_64/multiarch/strchr.S: Removed.
2017-06-09 05:42:29 -07:00
H.J. Lu dc485ceb2a x86-64: Optimize strlen/strnlen/wcslen/wcsnlen with AVX2
Optimize strlen/strnlen/wcslen/wcsnlen with AVX2 to check 32 bytes with
a single vector compare instruction.  It is as fast as SSE2 versions for
size <= 16 bytes and up to 1X faster for or size > 16 bytes on Haswell.
Select AVX2 version on AVX2 machines where vzeroupper is preferred and
AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strlen-sse2, strnlen-sse2, strlen-avx2, strnlen-avx2,
	wcslen-sse2, wcslen-avx2 and wcsnlen-avx2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __strlen_avx2,
	__strlen_sse2, __strnlen_avx2, __strnlen_sse2, __wcslen_avx2,
	__wcslen_sse2 and __wcsnlen_avx2.
	* sysdeps/x86_64/multiarch/strlen-avx2.S: New file.
	* sysdeps/x86_64/multiarch/strlen-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strlen.c: Likewise.
	* sysdeps/x86_64/multiarch/strnlen-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/strnlen-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/strnlen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcslen-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcslen-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcslen.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen.c (OPTIMIZE (avx2)): New.
	(IFUNC_SELECTOR): Return OPTIMIZE (avx2) on AVX2 machines where
	vzeroupper is preferred and AVX unaligned load is fast.
2017-06-09 05:18:18 -07:00
H.J. Lu 2f5d20ac99 x86-64: Optimize memchr/rawmemchr/wmemchr with SSE2/AVX2
SSE2 memchr is extended to support wmemchr.  AVX2 memchr/rawmemchr/wmemchr
are added to search 32 bytes with a single vector compare instruction.
AVX2 memchr/rawmemchr/wmemchr are as fast as SSE2 memchr/rawmemchr/wmemchr
for small sizes and up to 1.5X faster for larger sizes on Haswell and
Skylake.  Select AVX2 memchr/rawmemchr/wmemchr on AVX2 machines where
vzeroupper is preferred and AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

	* sysdeps/x86_64/memchr.S (MEMCHR): New.  Depending on if
	USE_AS_WMEMCHR is defined.
	(PCMPEQ): Likewise.
	(memchr): Renamed to ...
	(MEMCHR): This.  Support wmemchr if USE_AS_WMEMCHR is defined.
	Replace pcmpeqb with PCMPEQ.
	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memchr-sse2, rawmemchr-sse2, memchr-avx2, rawmemchr-avx2,
	wmemchr-sse4_1, wmemchr-avx2 and wmemchr-c.
	* sysdeps/x86_64/multiarch/ifunc-avx2.h: New file.
	* sysdeps/x86_64/multiarch/memchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/memchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/memchr.c: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemchr.c: Likewise.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test __memchr_avx2, __memchr_sse2,
	__rawmemchr_avx2, __rawmemchr_sse2, __wmemchr_avx2 and
	__wmemchr_sse2.
2017-06-09 05:13:31 -07:00
Siddhesh Poyarekar 6c85cc2852 aarch64: Fix undefined behavior in _dl_procinfo
1 << 31 is undefined, so replace it with a cleaner check.  Also remove
magic numbers in comments.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: Remove
	mention of magic numbers in comments.
	(_dl_procinfo): Fix undefined behavior
2017-06-09 14:18:12 +05:30
H.J. Lu 37b66c0b1a ld.so: Consolidate 2 strtouls into _dl_strtoul [BZ #21528]
There are 2 minimal strtoul implementations in ld.so:

1. __strtoul_internal in elf/dl-minimal.c.
2. tunables_strtoul in elf/dl-tunables.c.

This patch adds _dl_strtoul to replace them.  Tested builds with and
without --enable-tunables.

	[BZ #21528]
	* elf/dl-minimal.c (__strtoul_internal): Removed.
	(strtoul): Likewise.
	* elf/dl-misc.c (_dl_strtoul): New function.
	* elf/dl-tunables.c (tunables_strtoul): Removed.
	(tunable_initialize): Replace tunables_strtoul with _dl_strtoul.
	* elf/rtld.c (process_envvars): Likewise.
	* sysdeps/unix/sysv/linux/dl-librecon.h (_dl_osversion_init):
	Likewise.
	* sysdeps/generic/ldsodefs.h (_dl_strtoul): New prototype.
2017-06-08 12:52:42 -07:00
Zack Weinberg 199fc19d3a Remove __need macros from stdio.h and wchar.h.
wint_t is a little finicky because it might be defined by stddef.h, which
belongs to the compiler.

In addition to the _types_, a bunch of other declarations shared between
wctype.h and wchar.h are factored out to their own header.

	* libio/bits/types/FILE.h, libio/bits/types/__FILE.h
	* wcsmbs/bits/types/mbstate_t.h, wcsmbs/bits/types/__mbstate_t.h
	* wcsmbs/bits/types/wint_t.h: New single-type definition files.
	* wctype/bits/wctype-wchar.h: New file holding declarations shared
	between wctype.h and wchar.h.

	* libio/Makefile, wcsmbs/Makefile, wctype/Makefile:
	Install them.

	* include/bits/types/FILE.h, include/bits/types/__FILE.h
	* include/bits/types/mbstate_t.h, include/bits/types/__mbstate_t.h
	* include/bits/types/wint_t.h, include/bits/wcsmbs-wchar.h:
	New wrappers.
	* include/stdio.h, include/wchar.h, include/wctype.h:
	No need to handle __need macros.

	* grp/grp.h, gshadow/gshadow.h, hurd/hurd.h, iconv/gconv.h
	* libio/stdio.h, mach/mach.h, misc/mntent.h, pwd/pwd.h
	* shadow/shadow.h, stdio-common/printf.h, wcsmbs/uchar.h
	* wcsmbs/wchar.h, wctype/wctype.h
	* sysdeps/generic/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h
	Use the new files instead of __need macros.
2017-06-08 13:58:17 -04:00
H.J. Lu 5e1122827a x86-64: Rename wmemset.h to ifunc-wmemset.h
No code changes.

	* sysdeps/x86_64/multiarch/wmemset.c: Include ifunc-wmemset.h
	instead of wmemset.h.
	* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.
	* sysdeps/x86_64/multiarch/wmemset.h: Renamed to ...
	* sysdeps/x86_64/multiarch/ifunc-wmemset.h: This.
2017-06-07 14:48:34 -07:00
Gabriel F. T. Gomes cf2046ec7d float128: Add strfromf128
Add strfromf128 to stdlib when _Float128 support is enabled.

	* stdio-common/printf-parsemb.c (__parse_one_specmb): Initialize
	spec->info.is_binary128 to zero.
	* stdio-common/printf.h (printf_info): Add new member is_binary128
	to indicate that the number being converted to string is compatible
	with the IEC 60559 binary128 format.
	* stdio-common/printf_fp.c (__printf_fp_l): Add code to deal with
	_Float128 numbers.
	* stdio-common/printf_fphex.c: Include ieee754_float128.h and
	ldbl-128/printf_fphex_macros.h
	(__printf_fphex): Add code to deal with _Float128 numbers.
	* stdio-common/printf_size.c (__printf_size): Likewise.
	* stdio-common/vfprintf.c (process_arg): Initialize member
	info.is_binary128 to zero.
	* stdlib/fpioconst.h (FLT128_MAX_10_EXP_LOG): New macro.
	* stdlib/stdlib.h: Include bits/floatn.h for _Float128 support.
	(strfromf128): New declaration.
	* stdlib/strfrom-skeleton.c (STRFROM): Set member info.is_binary128
	to one.
	* sysdeps/ieee754/float128/Makefile: Add strfromf128.
	* sysdeps/ieee754/float128/Versions: Likewise.
	* sysdeps/ieee754/float128/strfromf128.c: New file.
2017-06-07 17:08:21 -03:00
Gabriel F. T. Gomes 2bc646c9e9 Refactor PRINT_FPHEX_LONG_DOUBLE into a reusable macro
This patch refactors the macro PRINT_FPHEX_LONG_DOUBLE from the file
sysdeps/ieee754/ldbl-128/printf_fphex.c into a function-like macro to
enable its use for both long double and _Float128, when they are
ABI-distinct.

	* sysdeps/ieee754/ldbl-128/printf_fphex.c: Include
	ldbl-128/printf_fphex_macros.h for the definition of PRINT_FPHEX.
	(PRINT_FPHEX_LONG_DOUBLE): Define based on PRINT_FPHEX.
	* sysdeps/ieee754/ldbl-128/printf_fphex_macros.h
	(PRINT_FPHEX): New function-like macro that can be used for long
	double, as well as for _Float128
2017-06-07 17:06:31 -03:00
Gabriel F. T. Gomes 32bf1d09da float128: Add conversion from float128 to mpn
Reuse the code for __mpn_extract_long_double to implement
__mpn_extract_float128.

	* include/gmp.h: Include bits/floatn.h
	(__mpn_extract_float128): Declare when __HAVE_DISTINCT_FLOAT128 is 1.
	* stdlib/gmp-impl.h: Also check if alloca is not defined before
	including stack-alloc.h.  It could have been defined by other header
	which not necessarily defines HAVE_ALLOCA.
	* sysdeps/ieee754/float128/Makefile: New file.
	* sysdeps/ieee754/float128/float1282mpn.c: New file.
	* sysdeps/ieee754/float128/float128_private.h: Include gmp.h before
	redefining __mpn_extract_long_double to __mpn_extract_float128, then
	redefine __mpn_extract_long_double to __mpn_extract_float128.
	* sysdeps/ieee754/ldbl-128/ldbl2mpn.c: Replace long double with
	_Float128 to allow float128_private.h overrides.
2017-06-07 17:03:43 -03:00
H.J. Lu 2e87c7d158 x86-64: Fold ifunc-sse4_1.h into wcsnlen.c
Since ifunc-sse4_1.h is included only by wcsnlen.c, we can fold it
into wcsnlen.c.  No code changes in wcsnlen.o.

2017-06-07  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/x86_64/multiarch/ifunc-sse4_1.h: Removed and folded
	into ...
	* sysdeps/x86_64/multiarch/wcsnlen.c: Here.  Don't include
	ifunc-sse4_1.h.
2017-06-07 09:04:40 -07:00
Arjun Shankar 8f0a947cf5 Remove check for NULL buffer passed to `ptsname_r'
`ptsname_r' is declared in stdlib.h to only accept a `nonnull'
second argument and therefore GCC may choose to make optimizations
based on the assumption that this argument is NULL. This means
that potentially, GCC can optimize away the NULL check at some
point in the future. Since this is a programming interface, we
might as well remove the NULL check ourselves.

This also warrants a change to the `ptsname_r' manual page that
must be submitted to the corresponding mailing list.

In addition, remove the NULL buffer test in login/tst-ptsname.c.
2017-06-07 17:37:59 +02:00
Arjun Shankar fdc543919a Use test-driver in sysdeps/unix/sysv/linux/tst-clone2.c 2017-06-07 14:05:42 +02:00
Siddhesh Poyarekar ea01a4da21 aarch64: Add hwcap string routines
Add support for routines in dl-procinfo.h to show string versions of
HWCAP entries when a program is invoked with the LD_SHOW_AUXV
environment variable set and also to aid in path resolution for
ldconfig.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_dl_aarch64_cap_flags): New array.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_dl_hwcap_string, _dl_string_hwcap, _dl_procinfo): Implement
	functions.
2017-06-07 11:11:40 +05:30
Siddhesh Poyarekar 511c5a1087 Make LD_HWCAP_MASK usable for static binaries
The LD_HWCAP_MASK environment variable was ignored in static binaries,
which is inconsistent with the behaviour of dynamically linked
binaries.  This seems to have been because of the inability of
ld_hwcap_mask being read early enough to influence anything but now
that it is in tunables, the mask is usable in static binaries as well.

This feature is important for aarch64, which relies on HWCAP_CPUID
being masked out to disable multiarch.  A sanity test on x86_64 shows
that there are no failures.  Likewise for aarch64.

	* elf/dl-hwcaps.h [HAVE_TUNABLES]: Always read hwcap_mask.
	* sysdeps/sparc/sparc32/dl-machine.h [HAVE_TUNABLES]:
	Likewise.
	* sysdeps/x86/cpu-features.c (init_cpu_features): Always set
	up hwcap and hwcap_mask.
2017-06-07 11:11:40 +05:30
Siddhesh Poyarekar f82e9672ad aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
Now that LD_HWCAP_MASK (or glibc.tune.hwcap_mask) is read early enough
to influence cpu feature check in aarch64, use it to influence
multiarch selection.  Setting LD_HWCAP_MASK such that it clears
HWCAP_CPUID will now disable multiarch for the binary.

HWCAP_CPUID is also now set in HWCAP_IMPORTANT so that it is set by
default.  With this patch, this feature is only usable with
dyanmically linked binaries because LD_HWCAP_MASK is not read for
static binaries.  A future patch fixes that.

	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c
	(init_cpu_features): Use glibc.tune.hwcap_mask.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: New file.
2017-06-07 11:11:39 +05:30
Siddhesh Poyarekar ff08fc59e3 tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
Drop _dl_hwcap_mask when building with tunables.  This completes the
transition of hwcap_mask reading from _dl_hwcap_mask to tunables.

	* elf/dl-hwcaps.h: New file.
	* elf/dl-hwcaps.c: Include it.
	(_dl_important_hwcaps)[HAVE_TUNABLES]: Read and update
	glibc.tune.hwcap_mask.
	* elf/dl-cache.c: Include dl-hwcaps.h.
	(_dl_load_cache_lookup)[HAVE_TUNABLES]: Read
	glibc.tune.hwcap_mask.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* elf/dl-support.c (_dl_hwcap2)[HAVE_TUNABLES]: Drop
	_dl_hwcap_mask.
	* elf/rtld.c (rtld_global_ro)[HAVE_TUNABLES]: Drop
	_dl_hwcap_mask.
	(process_envvars)[HAVE_TUNABLES]: Likewise.
	* sysdeps/generic/ldsodefs.h (rtld_global_ro)[HAVE_TUNABLES]:
	Likewise.
	* sysdeps/x86/cpu-features.c (init_cpu_features): Don't
	initialize dl_hwcap_mask when tunables are enabled.
2017-06-07 11:11:38 +05:30
Siddhesh Poyarekar 6482e63403 Add include guards to dl-procinfo.h
The dl-procinfo.h for linux/s390 and linux/i386 don't have include
guards, which causes them to fail since addition of LD_HWCAP_MASK to
tunables.  Add _DL_I386_PROCINFO_H guard to avoid redefining
_dl_procinfo on multiple includes and also allow the subsequent
include of another dl-procinfo.h to work.

Verified with a build test on i686.

	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Add include
	guard.
	* sysdeps/unix/sysv/linux/s390/dl-procinfo.h: Likewise.
2017-06-07 11:11:38 +05:30
H.J. Lu d4cc385c6e x86-64: Move wcsnlen.S to multiarch/wcsnlen-sse4_1.S
Since wcsnlen.S uses pminud which is the part of SSE4.1, move wcsnlen.S
to multiarch/wcsnlen-sse4_1.S.

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	wcsnlen-sse4_1 and wcsnlen-c.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test __wcsnlen_sse4_1 and
	__wcsnlen_sse2.
	* sysdeps/x86_64/multiarch/ifunc-sse4_1.h: New file.
	* sysdeps/x86_64/multiarch/wcsnlen-c.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen-sse4_1.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
	* sysdeps/x86_64/wcsnlen.S: Removed.
2017-06-06 06:12:32 -07:00
Stefan Liebler 4bf7abaeb3 S390: Use generic spinlock code.
This patch removes the s390 specific implementation of spinlock code
and is now using the generic one.

ChangeLog:

	* sysdeps/s390/nptl/pthread_spin_init.c: Delete File.
	* sysdeps/s390/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise.
	* sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise.
2017-06-06 09:41:56 +02:00
Stefan Liebler 12d2dd7060 Optimize generic spinlock code and use C11 like atomic macros.
This patch optimizes the generic spinlock code.

The type pthread_spinlock_t is a typedef to volatile int on all archs.
Passing a volatile pointer to the atomic macros which are not mapped to the
C11 atomic builtins can lead to extra stores and loads to stack if such
a macro creates a temporary variable by using "__typeof (*(mem)) tmp;".
Thus, those macros which are used by spinlock code - atomic_exchange_acquire,
atomic_load_relaxed, atomic_compare_exchange_weak - have to be adjusted.
According to the comment from  Szabolcs Nagy, the type of a cast expression is
unqualified (see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_423.htm):
__typeof ((__typeof (*(mem)) *(mem)) tmp;
Thus from spinlock perspective the variable tmp is of type int instead of
type volatile int.  This patch adjusts those macros in include/atomic.h.
With this construct GCC >= 5 omits the extra stores and loads.

The atomic macros are replaced by the C11 like atomic macros and thus
the code is aligned to it.  The pthread_spin_unlock implementation is now
using release memory order instead of sequentially consistent memory order.
The issue with passed volatile int pointers applies to the C11 like atomic
macros as well as the ones used before.

I've added a glibc_likely hint to the first atomic exchange in
pthread_spin_lock in order to return immediately to the caller if the lock is
free.  Without the hint, there is an additional jump if the lock is free.

I've added the atomic_spin_nop macro within the loop of plain reads.
The plain reads are also realized by C11 like atomic_load_relaxed macro.

The new define ATOMIC_EXCHANGE_USES_CAS determines if the first try to acquire
the spinlock in pthread_spin_lock or pthread_spin_trylock is an exchange
or a CAS.  This is defined in atomic-machine.h for all architectures.

The define SPIN_LOCK_READS_BETWEEN_CMPXCHG is now removed.
There is no technical reason for throwing in a CAS every now and then,
and so far we have no evidence that it can improve performance.
If that would be the case, we have to adjust other spin-waiting loops
elsewhere, too!  Using a CAS loop without plain reads is not a good idea
on many targets and wasn't used by one.  Thus there is now no option to
do so.

Architectures are now using the generic spinlock automatically if they
do not provide an own implementation.  Thus the pthread_spin_lock.c files
in sysdeps folder are deleted.

ChangeLog:

	* NEWS: Mention new spinlock implementation.
	* include/atomic.h:
	(__atomic_val_bysize): Cast type to omit volatile qualifier.
	(atomic_exchange_acq): Likewise.
	(atomic_load_relaxed): Likewise.
	(ATOMIC_EXCHANGE_USES_CAS): Check definition.
	* nptl/pthread_spin_init.c (pthread_spin_init):
	Use atomic_store_relaxed.
	* nptl/pthread_spin_lock.c (pthread_spin_lock):
	Use C11-like atomic macros.
	* nptl/pthread_spin_trylock.c (pthread_spin_trylock):
	Likewise.
	* nptl/pthread_spin_unlock.c (pthread_spin_unlock):
	Use atomic_store_release.
	* sysdeps/aarch64/nptl/pthread_spin_lock.c: Delete File.
	* sysdeps/arm/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/hppa/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/m68k/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/microblaze/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/mips/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/nios2/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/aarch64/atomic-machine.h (ATOMIC_EXCHANGE_USES_CAS): Define.
	* sysdeps/alpha/atomic-machine.h: Likewise.
	* sysdeps/arm/atomic-machine.h: Likewise.
	* sysdeps/i386/atomic-machine.h: Likewise.
	* sysdeps/ia64/atomic-machine.h: Likewise.
	* sysdeps/m68k/coldfire/atomic-machine.h: Likewise.
	* sysdeps/m68k/m680x0/m68020/atomic-machine.h: Likewise.
	* sysdeps/microblaze/atomic-machine.h: Likewise.
	* sysdeps/mips/atomic-machine.h: Likewise.
	* sysdeps/powerpc/powerpc32/atomic-machine.h: Likewise.
	* sysdeps/powerpc/powerpc64/atomic-machine.h: Likewise.
	* sysdeps/s390/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc32/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc64/atomic-machine.h: Likewise.
	* sysdeps/tile/tilegx/atomic-machine.h: Likewise.
	* sysdeps/tile/tilepro/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/atomic-machine.h: Likewise.
	* sysdeps/x86_64/atomic-machine.h: Likewise.
2017-06-06 09:41:56 +02:00
H.J. Lu 48e7bc7a55 x86: Don't use dl_x86_cpu_features in cacheinfo.c
Since cpu_features is available, use it instead of dl_x86_cpu_features.

	* sysdeps/x86/cacheinfo.c (intel_check_word): Accept cpu_features
	and use it instead of dl_x86_cpu_features.
	(handle_intel): Replace maxidx with cpu_features.  Pass
	cpu_features to intel_check_word.
	(__cache_sysconf): Pass cpu_features to handle_intel.
	(init_cacheinfo): Likewise.  Use cpu_features instead of
	dl_x86_cpu_features.
2017-06-05 16:20:11 -07:00
H.J. Lu 935971ba6b x86-64: Optimize memcmp/wmemcmp with AVX2 and MOVBE
Optimize x86-64 memcmp/wmemcmp with AVX2.  It uses vector compare as
much as possible.  It is as fast as SSE4 memcmp for size <= 16 bytes
and up to 2X faster for size > 16 bytes on Haswell and Skylake.  Select
AVX2 memcmp/wmemcmp on AVX2 machines where vzeroupper is preferred and
AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

Key features:

1. For size from 2 to 7 bytes, load as big endian with movbe and bswap
   to avoid branches.
2. Use overlapping compare to avoid branch.
3. Use vector compare when size >= 4 bytes for memcmp or size >= 8
   bytes for wmemcmp.
4. If size is 8 * VEC_SIZE or less, unroll the loop.
5. Compare 4 * VEC_SIZE at a time with the aligned first memory area.
6. Use 2 vector compares when size is 2 * VEC_SIZE or less.
7. Use 4 vector compares when size is 4 * VEC_SIZE or less.
8. Use 8 vector compares when size is 8 * VEC_SIZE or less.

	* sysdeps/x86/cpu-features.h (index_cpu_MOVBE): New.
	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	memcmp-avx2 and wmemcmp-avx2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Test __memcmp_avx2 and __wmemcmp_avx2.
	* sysdeps/x86_64/multiarch/memcmp-avx2.S: New file.
	* sysdeps/x86_64/multiarch/wmemcmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/memcmp.S: Use __memcmp_avx2 on AVX
	2 machines if AVX unaligned load is fast and vzeroupper is
	preferred.
	* sysdeps/x86_64/multiarch/wmemcmp.S: Use __wmemcmp_avx2 on AVX
	2 machines if AVX unaligned load is fast and vzeroupper is
	preferred.
2017-06-05 12:52:55 -07:00
H.J. Lu ef9c4cb6c7 x86-64: Optimize wmemset with SSE2/AVX2/AVX512
The difference between memset and wmemset is byte vs int.  Add stubs
to SSE2/AVX2/AVX512 memset for wmemset with updated constant and size:

SSE2 wmemset:
	shl    $0x2,%rdx
	movd   %esi,%xmm0
	mov    %rdi,%rax
	pshufd $0x0,%xmm0,%xmm0
	jmp	entry_from_wmemset

SSE2 memset:
	movd   %esi,%xmm0
	mov    %rdi,%rax
	punpcklbw %xmm0,%xmm0
	punpcklwd %xmm0,%xmm0
	pshufd $0x0,%xmm0,%xmm0
entry_from_wmemset:

Since the ERMS versions of wmemset requires "rep stosl" instead of
"rep stosb", only the vector store stubs of SSE2/AVX2/AVX512 wmemset
are added.  The SSE2 wmemset is about 3X faster and the AVX2 wmemset
is about 6X faster on Haswell.

	* include/wchar.h (__wmemset_chk): New.
	* sysdeps/x86_64/memset.S (VDUP_TO_VEC0_AND_SET_RETURN): Renamed
	to MEMSET_VDUP_TO_VEC0_AND_SET_RETURN.
	(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
	(WMEMSET_CHK_SYMBOL): Likewise.
	(WMEMSET_SYMBOL): Likewise.
	(__wmemset): Add hidden definition.
	(wmemset): Add weak hidden definition.
	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	wmemset_chk-nonshared.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add __wmemset_sse2_unaligned,
	__wmemset_avx2_unaligned, __wmemset_avx512_unaligned,
	__wmemset_chk_sse2_unaligned, __wmemset_chk_avx2_unaligned
	and __wmemset_chk_avx512_unaligned.
	* sysdeps/x86_64/multiarch/memset-avx2-unaligned-erms.S
	(VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ...
	(MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This.
	(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
	(WMEMSET_SYMBOL): Likewise.
	* sysdeps/x86_64/multiarch/memset-avx512-unaligned-erms.S
	(VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ...
	(MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This.
	(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
	(WMEMSET_SYMBOL): Likewise.
	* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: Updated.
	(WMEMSET_CHK_SYMBOL): New.
	(WMEMSET_CHK_SYMBOL (__wmemset_chk, unaligned)): Likewise.
	(WMEMSET_SYMBOL (__wmemset, unaligned)): Likewise.
	* sysdeps/x86_64/multiarch/memset.S (WMEMSET_SYMBOL): New.
	(libc_hidden_builtin_def): Also define __GI_wmemset and
	__GI___wmemset.
	(weak_alias): New.
	* sysdeps/x86_64/multiarch/wmemset.c: New file.
	* sysdeps/x86_64/multiarch/wmemset.h: Likewise.
	* sysdeps/x86_64/multiarch/wmemset_chk-nonshared.S: Likewise.
	* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.
	* sysdeps/x86_64/wmemset.c: Likewise.
	* sysdeps/x86_64/wmemset_chk.c: Likewise.
2017-06-05 11:09:59 -07:00
H.J. Lu 9cd30491dd x86: Add macros to implement ifunce selection in C
These macros are used to implement ifunc selection in C.  To implement
an ifunc function, foo, which returns the address of __foo_sse2 or
__foo_avx2:

   __foo_avx2:

   #define foo __redirect_foo
   #define __foo __redirect___foo
   #include <foo.h>
   #undef foo
   #undef __foo
   #define SYMBOL_NAME foo
   #include <init-arch.h>

   extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
   extern __typeof (REDIRECT_NAME) OPTIMIZE (avx2) attribute_hidden;

   static inline void *
   foo_selector (void)
   {
     if (use AVX2)
      return OPTIMIZE (avx2);

     return OPTIMIZE (sse2);
   }

   libc_ifunc_redirected (__redirect_foo, foo, foo_selector ());

	* sysdeps/x86/init-arch.h (PASTER1): New.
	(EVALUATOR1): Likewise.
	(PASTER2): Likewise.
	(EVALUATOR2): Likewise.
	(REDIRECT_NAME): Likewise.
	(OPTIMIZE): Likewise.
	(IFUNC_SELECTOR): Likewise.
2017-06-05 08:28:13 -07:00
H.J. Lu 30cb625a21 x86-64: Update strlen.S to support wcslen/wcsnlen
The difference between strlen and wcslen is byte vs int.  We can
replace pminub and pcmpeqb with pminud and pcmpeqd to turn strlen
into wcslen.

	* sysdeps/x86_64/strlen.S (PMINU): New.
	(PCMPEQ): Likewise.
	(SHIFT_RETURN): Likewise.
	(FIND_ZERO): Replace pcmpeqb with PCMPEQ.
	(strlen): Add SHIFT_RETURN before ret.  Replace pcmpeqb and
	pminub with PCMPEQ and PMINU.
	* sysdeps/x86_64/wcsnlen.S: New file.
2017-06-05 07:58:23 -07:00
H.J. Lu 7395928b95 x86_64: Remove redundant REX bytes from memrchr.S
By x86-64 specification, 32-bit destination registers are zero-extended
to 64 bits.  There is no need to use 64-bit registers when only the lower
32 bits are non-zero.  Also 2 instructions in:

	mov	%rdi, %rcx
	and	$15, %rcx
	jz	L(length_less16_offset0)

	mov	%rdi, %rcx		<<< redundant
	and	$15, %rcx		<<< redundant

are redundant.

	* sysdeps/x86_64/memrchr.S (__memrchr): Use 32-bit registers for
	the lower 32 bits.  Remove redundant instructions.
2017-06-05 07:41:26 -07:00
H.J. Lu d8a7d10324 x86-64: Update LO_HI_LONG for p{readv,writev}{64}v2
The kernel interface for p{readv,writev}{64}v is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h)

Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64 and
__ARCH_WANT_COMPAT_SYS_PWRITEV64,

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 off64_t pos)

is used for p{readv,writev}{64}v.  X32 is the only such target.  The
LO_HI_LONG macro is used to pass offset to the pos_l and pos_h pair.
Since pos_h is ignored when size of offset == sizeof of pos_l, x86-64
has

 #define LO_HI_LONG(val) (val)

But the kernel interface for p{readv,writev}{64}v2 is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h, int flags)

Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64V2 and
__ARCH_WANT_COMPAT_SYS_PWRITEV64V2,

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 off64_t pos, int flags)

is used for p{readv,writev}{64}v2.  X32 is the only such target.  Update
x86-64 LO_HI_LONG to pass 0 as the high part of the offset argument for
p{readv,writev}{64}v2 and define a different LO_HI_LONG for x32 to only
pass one argument for offset.

Tested on x32 and x86-64.

	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (LO_HI_LONG): Pass
	0 as the high part of offset.
	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (LO_HI_LONG): New.
2017-06-05 07:21:57 -07:00
Joseph Myers c4c96f92f7 Define SIG_HOLD for XPG4 (bug 21538).
Various bits/signum.h headers define SIG_HOLD if __USE_UNIX98.  That
should be __USE_XOPEN, as this macro is in XPG4.  This patch fixes the
conditionals accordingly.  Because of other header bugs, this does not
allow any XFAILs to be removed (however, the XPG4/signal.h/conform
XFAIL only depends on a few such straightforward header bugs, not on
the more complicated to fix ucontext_t issues, as ucontext_t isn't
included in signal.h in XPG4).

Tested for x86_64.

	[BZ #21538]
	* bits/signum.h (SIG_HOLD): Define if [__USE_XOPEN], not
	[__USE_UNIX98].
	* sysdeps/unix/bsd/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/signum.h (SIG_HOLD):
	Likewise.
	* sysdeps/unix/sysv/linux/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/signum.h (SIG_HOLD):
	Likewise.
2017-06-05 10:19:03 +00:00
Joseph Myers 7553131847 Fix struct sigaltstack namespace (bug 21517).
glibc defines the stack_t type with the tag struct sigaltstack.  This
is not permitted by POSIX; sigaltstack is only reserved with file
scope in the namespace of ordinary identifiers, not the tag namespace,
and in the case where stack_t is obtained from ucontext.h rather than
signal.h, it's not reserved with file scope at all.

This patch removes the tag accordingly and updates uses in glibc of
struct sigaltstack.  This is similar to the removal of the "struct
siginfo" tag a few years ago: C++ name mangling changes are an
unavoidable consequence.  A NEWS item is added to note the changed
mangling.  There is inevitably some risk of breaking builds of
anything that relies on the struct sigaltstack name (though the first
few hits I looked at from codesearch.debian.net generally seemed to
involve code that could use the stack_t name conditionally, so
depending on how they determine the conditionals they may work with
glibc not defining the struct tag anyway).

Tested for x86_64 and x86, and with build-many-glibcs.py.

	[BZ #21517]
	* bits/types/stack_t.h (stack_t): Remove struct tag.
	* sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t):
	Likewise.
	* debug/segfault.c (install_handler): Use stack_t instead of
	struct sigaltstack.
	* hurd/hurd/signal.h (struct hurd_sigstate): Likewise.
	* hurd/trampoline.c (_hurd_setup_sighandler): Likewise.
	* include/signal.h (__sigaltstack): Likwise.
	* signal/sigaltstack.c (__sigaltstack): Likewise.
	* signal/signal.h (sigaltstack): Likewise.
	* sysdeps/mach/hurd/i386/signal-defines.sym
	(SIGALTSTACK__SS_SP__OFFSET): Likewise.
	(SIGALTSTACK__SS_SIZE__OFFSET): Likewise.
	(SIGALTSTACK__SS_FLAGS__OFFSET): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/hurd/sigstack.c (sigstack): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus):
	Likewise.
2017-06-05 10:17:46 +00:00
Zack Weinberg 8951dd0b14 Regenerate sysdeps/gnu/errlist.c.
This file needs to be regenerated whenever errno.texi changes.
2017-06-04 15:27:14 -04:00
Florian Weimer 363911ce13 getaddrinfo: Eliminate another strdup call 2017-06-03 08:37:31 +02:00
H.J. Lu 808fd9e6fe x86: Update __x86_shared_non_temporal_threshold
__x86_shared_non_temporal_threshold was set to 6 times of per-core
shared cache size, based on the large memcpy micro benchmark in glibc
on a 8-core processor.  For a processor with more than 8 cores, the
threshold is too low.  Set __x86_shared_non_temporal_threshold to the
3/4 of the total shared cache size so that it is unchanged on 8-core
processors.  On processors with less than 8 cores, the threshold is
lower.

	* sysdeps/x86/cacheinfo.c (__x86_shared_non_temporal_threshold):
	Set to the 3/4 of the total shared cache size.
2017-06-02 17:32:37 -07:00
Florian Weimer 6257fcfd58 getaddrinfo: Fix localplt failure involving strdup 2017-06-02 16:35:13 +02:00
Florian Weimer 673cb072a4 getaddrinfo: Always allocate canonical name on the heap
A further simplification could eliminate the canon variable in
gaih_inet and replace it with canonbuf.  However, canonbuf is
used as a flag in the nscd code, which makes this somewhat
non-straightforward.
2017-06-02 14:54:56 +02:00
Zack Weinberg 72b81552a1 Add shim header for bits/syscall.h.
On Linux-based configurations, bits/syscall.h is a generated file.
To avoid build-ordering problems, the Linux sys/syscall.h only includes
bits/syscall.h if _LIBC is not defined.  After the _ISOMAC-testsuite
changes, this means any test case that includes sys/syscall.h tries to
pull in bits/syscall.h.  This would be fine, because it'll definitely
have been generated by the time we start compiling tests, except that
the generated <builddir>/misc/bits/syscall.h is not visible in the
include path, because nothing needed it till now.  So we either get
the bits/syscall.h from the host system, or the build fails.

The fix is simple: add a shim header for bits/syscall.h.  I put it in
sysdeps/unix/sysv/linux/include instead of the top-level include/
because bits/syscall.h doesn't exist at all on other configurations as
far as I can tell.

This is known to affect nptl/tst-cond2[45].  Thanks to John David
Anglin for noticing the problem.

	[BZ #21514]
	* sysdeps/unix/sysv/linux/include/bits/syscall.h: New shim header
	pointing to the generated file in <builddir>/misc/bits/syscall.h.
2017-06-01 10:56:10 -04:00
Joseph Myers 139904b7e4 Fix more namespace issues in sys/ucontext.h (bug 21457).
Continuing the fixes for namespace issues in sys/ucontext.h, this
patch moves various symbols into the implementation namespace in the
absence of __USE_MISC.  As with previous changes, it is nonexhaustive,
just covering more straightforward cases.

Structure fields are generally changed to have a prefix __ in the
absence of __USE_MISC, via a macro __ctx (used without a space before
the open parenthesis, since the result is a single identifier).
Various macros such as NGREG also have leading __ added.  No changes
are made to structure tags (and thus to C++ name mangling), except
that in the (unused) file sysdeps/i386/sys/ucontext.h, structures
defined inside other structures as the type for a field have their
tags removed in the non-__USE_MISC case (those structure tags would
not in any case have been visible in C++, because in C++ the scope of
such a tag is limited to the containing structure).  No changes are
made to the contents of bits/sigcontext.h, or to whether it is
included.  Because of remaining namespace issues, this patch does not
yet fix the bug or allow any XFAILs to be removed.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (NGREG): Rename to __NGREG and define
	NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/i386/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(__ctxt): Likewise.
	(fpregset_t): Use __ctx and __ctxt in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/m68k/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/mips/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(fpregset_t): Define using __NFPREG.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (__ctx): New
	macro.
	[__WORDSIZE == 32] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__WORDSIZE == 32] (gregset_t): Define using __NGREG.
	[__WORDSIZE == 32] (fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	[__WORDSIZE != 32] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__WORDSIZE != 32] (NFPREG): Rename to __NFPREG and define NFPREG
	to __NFPREG if [__USE_MISC].
	[__WORDSIZE != 32] (NVRREG): Rename to __NVRREG and define NVRREG
	to __NVRREG if [__USE_MISC].
	[__WORDSIZE != 32] (gregset_t): Define using __NGREG.
	[__WORDSIZE != 32] (fpregset_t): Define using __NFPREG.
	[__WORDSIZE != 32] (vscr_t): Use __ctx in defining fields.
	[__WORDSIZE != 32] (vrregset_t): Likewise.
	[__WORDSIZE != 32] (mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): New macro.
	(__psw_t): Use __ctx in defining fields.
	(NGREG): Rename to __NGREG and define NGREG to __NGREG if
	[__USE_MISC].
	(gregset_t): Define using __NGREG.
	(fpreg_t): Use __ctx in defining fields.
	(fpregset_t): Likewise.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(fpregset_t): Define using __NFPREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (__ctx): New macro.
	[__x86_64__] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__x86_64__] (gregset_t): Define using __NGREG.
	[__x86_64__] (struct _libc_fpxreg): Use __ctx in defining fields.
	[__x86_64__] (struct _libc_fpstate): Likewise.
	[__x86_64__] (mcontext_t): Likewise.
	[!__x86_64__] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[!__x86_64__] (gregset_t): Define using __NGREG.
	[!__x86_64__] (struct _libc_fpreg): Use __ctx in defining fields.
	[!__x86_64__] (struct _libc_fpstate): Likewise.
	[!__x86_64__] (mcontext_t): Likewise.
2017-06-01 14:07:40 +00:00
Zack Weinberg 491bb0858e Avoid tickling a linker bug from microblaze pt-vfork.S.
libpthread used to have its own vfork implementation that differed
from libc's only in having a pointless micro-optimization.  There is
no longer any use to having a separate copy in libpthread, but the
historical ABI requires a compatibility shim.  microblaze was trying
to be slightly too clever about how it did this, and tickled a linker
bug.  The linker bug should get fixed eventually, but there's no
reason for us to keep tickling it in the meantime.

This doesn't reuse the generic pt-vfork.c because microblaze doesn't
have IFUNC support yet, and it doesn't reuse aarch64/pt-vfork.c
because that fails to generate a tailcall (with GCC 7.1.1).

	* sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Don't include
	alpha/pt-vfork.S.  Provide own compat shim for vfork and __vfork.
	* sysdeps/unix/sysv/linux/microblaze/vfork.S: Add __libc_vfork alias.
	* sysdeps/unix/sysv/linux/microblaze/localplt.data:
	libpthread.so no longer references __errno_location.
2017-06-01 08:53:56 -04:00
Adhemerval Zanella 52bd938169 posix: Implement preadv2 and pwritev2
This patch adds support of preadv2 and pwritev2 which are similar to
preadv/pwritev but with an extra flag argument.  As for preadv/pwritev
both interfaces are added a non-standard GNU API.

For default 'posix' implementation trying to emulate the Linux supported
flags is troublesome:

   * We can not temporary change the file state of the O_DSYNC and O_SYNC
     flags to emulate RWF_{D}SYNC (attempts to change the state of using
     fcntl are silently ignored).

   * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
     semantic not provided by any other flag (O_NONBLOCK for instance).

So default sysdeps/posix implementations fails with EOPNOTSUPP for any non
supported flag (which are none currently) calls generic preadv/pwritev.
Basically this implementation supports only preadv2 called as preadv (with
flags sets to 0).

The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
call preadv/writev.  Instead of using the previous __ASSUME_* to
unconditionally issue the syscall (and avoid building the fallback routine),
it call pread/write if the preadv2/pwritev2 syscalls fails.  The idea
is just avoid adding another __ASSUME_* and checking each architecture
on every kernel bump and simplify code conditionals.

Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
gcc 6.3).

	* NEWS: Add note about pwritev2 and preadv2 inclusion.
	* misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
	pwritev64v2.
	(tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
	* misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
	pwritev64v2.
	* misc/preadv2.c: New file.
	* misc/preadv64v2.c: Likewise.
	* misc/pwritev2.c: Likewise.
	* misc/pwritev64v2.c: Likewise.
	* misc/tst-preadvwritev2.c: Likewise.
	* misc/tst-preadvwritev64v2.c: Likewise.
	* manual/llio.texi: Add preadv2 and pwritev2 documentation.
	* misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
	prototype.
	[__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2):	Likewise.
	[__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
	[__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
	* misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
	(PWRITEV): Likewise.
	(do_test_with_offset): Use PREADV and PWRITEV macros and check for
	ENOSYS.
	* nptl/tst-cancel4.c (tf_pwritev2): New test.
	(tf_preadv2): Likewise.
	(tf_fsync): Add tf_pwritev2 and tf_preadv2.
	* sysdeps/posix/preadv2.c: Likewise.
	* sysdeps/posix/preadv64v2.c: Likewise.
	* sysdeps/posix/pwritev2.c: Likewise.
	* sysdeps/posix/pwritev64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
	support in kernel.
	* sysdeps/unix/sysv/linux/preadv2.c: Likewise.
	* sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
	* sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
	* sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
	* sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
	* sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
	* sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
	support flags on Linux.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
	preadv2, preadv64v2, pwritev2, pwritev64v2.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
	Likewise.
2017-05-31 17:35:46 -03:00
Siddhesh Poyarekar 4158ba082c Delay initialization of CPU features struct in static binaries
Allow the CPU features structure set up to be overridden by tunables
by delaying it to until after tunables are initialized.  The
initialization is already delayed in dynamically linked glibc, it is
only in static binaries that the initialization is set early to allow
it to influence IFUNC relocations that happen in libc-start.  It is a
bit too early however and there is a good place between tunables
initialization and IFUNC relocations where this can be done.

Verified that this does not regress the testsuite.

	* csu/libc-start.c [!ARCH_INIT_CPU_FEATURES]: Define
	ARCH_INIT_CPU_FEATURES.
	(LIBC_START_MAIN): Call it.
	* sysdeps/unix/sysv/linux/aarch64/libc-start.c
	(__libc_start_main): Remove.
	(ARCH_INIT_CPU_FEATURES): New macro.
	* sysdeps/x86/libc-start.c (__libc_start_main): Remove.
	(ARCH_INIT_CPU_FEATURES): New macro.
2017-05-31 06:38:33 +05:30
Dennis Wölfing 2e0bbbfbf9 Add reallocarray function
The reallocarray function is an extension from OpenBSD.  It is an
integer-overflow-safe replacement for realloc(p, X*Y) and
malloc(X*Y) (realloc(NULL, X*Y)).  It can therefore help in preventing
certain security issues in code.

This is an updated version of a patch originally submitted by Rüdiger
Sonderfeld in May 2014 [1].

Checked on i686-linux-gnu and x86_64-linux-gnu.

[1] <https://sourceware.org/ml/libc-alpha/2014-05/msg00481.html>.

2017-05-30  Dennis Wölfing  <denniswoelfing@gmx.de>
            Rüdiger Sonderfeld  <ruediger@c-plusplus.de>

	* include/stdlib.h (__libc_reallocarray): New declaration.
	* malloc/Makefile (routines): Add reallocarray.
	(tests): Add tst-reallocarray.c.
	* malloc/Versions: Add reallocarray and __libc_reallocarray.
	* malloc/malloc-internal.h (check_mul_overflow_size_t): New inline
	function.
	* malloc/malloc.h (reallocarray): New declaration.
	* stdlib/stdlib.h (reallocarray): Likewise.
	* malloc/reallocarray.c: New file.
	* malloc/tst-reallocarray.c: New test file.
	* manual/memory.texi: Document reallocarray.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add reallocarray.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
2017-05-30 18:27:57 -03:00
H.J. Lu 4f26ef1b67 x86_64: Remove redundant REX bytes from memchr.S
By x86-64 specification, 32-bit destination registers are zero-extended
to 64 bits.  There is no need to use 64-bit registers when only the lower
32 bits are non-zero.

	* sysdeps/x86_64/memchr.S (MEMCHR): Use 32-bit registers for
	the lower 32 bits.
2017-05-30 12:39:14 -07:00
Andreas Schwab 542a34783c m68k: handle default PIE 2017-05-29 08:41:50 +02:00
Paul E. Murphy 302bb1a3c3 float128: Add wrappers to override ldbl-128 as float128.
This change defines float128_private.h which contains
macros used to override long double naming conventions
when building a ldbl file.

	* math/math.h [__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(SNANF128): New macro.
	* math/e_sqrtf128.c: New file.
	* math/s_fmaxmag_template.c: Include math_private.h in order to
	make inline expansion of fabs128().
	* math/s_fminmag_template.c: Likewise.

	* sysdeps/ieee754/float128/e_acosf128.c: New file.
	* sysdeps/ieee754/float128/e_acoshf128.c: New file.
	* sysdeps/ieee754/float128/e_asinf128.c: New file.
	* sysdeps/ieee754/float128/e_atan2f128.c: New file.
	* sysdeps/ieee754/float128/e_atanhf128.c: New file.
	* sysdeps/ieee754/float128/e_coshf128.c: New file.
	* sysdeps/ieee754/float128/e_exp10f128.c: New file.
	* sysdeps/ieee754/float128/e_expf128.c: New file.
	* sysdeps/ieee754/float128/e_fmodf128.c: New file.
	* sysdeps/ieee754/float128/e_gammaf128_r.c: New file.
	* sysdeps/ieee754/float128/e_hypotf128.c: New file.
	* sysdeps/ieee754/float128/e_ilogbf128.c: New file.
	* sysdeps/ieee754/float128/e_j0f128.c: New file.
	* sysdeps/ieee754/float128/e_j1f128.c: New file.
	* sysdeps/ieee754/float128/e_jnf128.c: New file.
	* sysdeps/ieee754/float128/e_lgammaf128_r.c: New file.
	* sysdeps/ieee754/float128/e_log10f128.c: New file.
	* sysdeps/ieee754/float128/e_log2f128.c: New file.
	* sysdeps/ieee754/float128/e_logf128.c: New file.
	* sysdeps/ieee754/float128/e_powf128.c: New file.
	* sysdeps/ieee754/float128/e_rem_pio2f128.c: New file.
	* sysdeps/ieee754/float128/e_remainderf128.c: New file.
	* sysdeps/ieee754/float128/e_scalbf128.c: New file.
	* sysdeps/ieee754/float128/e_sinhf128.c: New file.
	* sysdeps/ieee754/float128/float128_private.h: New file.
	* sysdeps/ieee754/float128/gamma_productf128.c: New file.
	* sysdeps/ieee754/float128/ieee754_float128.h: New file.
	* sysdeps/ieee754/float128/k_cosf128.c: New file.
	* sysdeps/ieee754/float128/k_sincosf128.c: New file.
	* sysdeps/ieee754/float128/k_sinf128.c: New file.
	* sysdeps/ieee754/float128/k_tanf128.c: New file.
	* sysdeps/ieee754/float128/lgamma_negf128.c: New file.
	* sysdeps/ieee754/float128/lgamma_productf128.c: New file.
	* sysdeps/ieee754/float128/s_asinhf128.c: New file.
	* sysdeps/ieee754/float128/s_atanf128.c: New file.
	* sysdeps/ieee754/float128/s_cbrtf128.c: New file.
	* sysdeps/ieee754/float128/s_ceilf128.c: New file.
	* sysdeps/ieee754/float128/s_copysignf128.c: New file.
	* sysdeps/ieee754/float128/s_cosf128.c: New file.
	* sysdeps/ieee754/float128/s_erff128.c: New file.
	* sysdeps/ieee754/float128/s_expm1f128.c: New file.
	* sysdeps/ieee754/float128/s_fabsf128.c: New file.
	* sysdeps/ieee754/float128/s_finitef128.c: New file.
	* sysdeps/ieee754/float128/s_floorf128.c: New file.
	* sysdeps/ieee754/float128/s_fmaf128.c: New file.
	* sysdeps/ieee754/float128/s_fpclassifyf128.c: New file.
	* sysdeps/ieee754/float128/s_frexpf128.c: New file.
	* sysdeps/ieee754/float128/s_fromfpf128.c: New file.
	* sysdeps/ieee754/float128/s_fromfpxf128.c: New file.
	* sysdeps/ieee754/float128/s_getpayloadf128.c: New file.
	* sysdeps/ieee754/float128/s_isinff128.c: New file.
	* sysdeps/ieee754/float128/s_isnanf128.c: New file.
	* sysdeps/ieee754/float128/s_issignalingf128.c: New file.
	* sysdeps/ieee754/float128/s_llrintf128.c: New file.
	* sysdeps/ieee754/float128/s_llroundf128.c: New file.
	* sysdeps/ieee754/float128/s_log1pf128.c: New file.
	* sysdeps/ieee754/float128/s_logbf128.c: New file.
	* sysdeps/ieee754/float128/s_lrintf128.c: New file.
	* sysdeps/ieee754/float128/s_lroundf128.c: New file.
	* sysdeps/ieee754/float128/s_modff128.c: New file.
	* sysdeps/ieee754/float128/s_nearbyintf128.c: New file.
	* sysdeps/ieee754/float128/s_nextafterf128.c: New file.
	* sysdeps/ieee754/float128/s_nexttowardf128.c: New file.
	* sysdeps/ieee754/float128/s_nextupf128.c: New file.
	* sysdeps/ieee754/float128/s_remquof128.c: New file.
	* sysdeps/ieee754/float128/s_rintf128.c: New file.
	* sysdeps/ieee754/float128/s_roundevenf128.c: New file.
	* sysdeps/ieee754/float128/s_roundf128.c: New file.
	* sysdeps/ieee754/float128/s_scalblnf128.c: New file.
	* sysdeps/ieee754/float128/s_scalbnf128.c: New file.
	* sysdeps/ieee754/float128/s_setpayloadf128.c: New file.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c: New file.
	* sysdeps/ieee754/float128/s_signbitf128.c: New file.
	* sysdeps/ieee754/float128/s_significandf128.c: New file.
	* sysdeps/ieee754/float128/s_sincosf128.c: New file.
	* sysdeps/ieee754/float128/s_sinf128.c: New file.
	* sysdeps/ieee754/float128/s_tanf128.c: New file.
	* sysdeps/ieee754/float128/s_tanhf128.c: New file.
	* sysdeps/ieee754/float128/s_totalorderf128.c: New file.
	* sysdeps/ieee754/float128/s_totalordermagf128.c: New file.
	* sysdeps/ieee754/float128/s_truncf128.c: New file.
	* sysdeps/ieee754/float128/s_ufromfpf128.c: New file.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c: New file.
	* sysdeps/ieee754/float128/t_sincosf128.c: New file.
	* sysdeps/ieee754/float128/x2y2m1f128.c: New file.

	* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h:
	(__iscanonicalf128): Define as a macro.
2017-05-25 09:01:37 -03:00
Steve Ellcey 6a2c695266 aarch64: Thunderx specific memcpy and memmove
* sysdeps/aarch64/memcpy.S (MEMMOVE, MEMCPY): New macros.
	(memmove): Use MEMMOVE for name.
	(memcpy): Use MEMCPY for name.  Change internal labels
	to external labels.
	* sysdeps/aarch64/multiarch/Makefile: New file.
	* sysdeps/aarch64/multiarch/ifunc-impl-list.c: Likewise.
	* sysdeps/aarch64/multiarch/init-arch.h: Likewise.
	* sysdeps/aarch64/multiarch/memcpy.c: Likewise.
	* sysdeps/aarch64/multiarch/memcpy_generic.S: Likewise.
	* sysdeps/aarch64/multiarch/memcpy_thunderx.S: Likewise.
	* sysdeps/aarch64/multiarch/memmove.c: Likewise.
2017-05-24 16:46:48 -07:00
Siddhesh Poyarekar 6edbe546d6 arm: Fix typo in array count
I just noticed that the array count for the hwcap flags list in ARM is
off by 10, i.e. 37 instead of 27.  Following patch fixes this.

	* sysdeps/unix/sysv/linux/arm/dl-procinfo.c
	(_dl_arm_cap_flags): Fix array subscript.
	* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_DL_HWCAP_COUNT):
	Fix count.
2017-05-24 22:26:37 +05:30
H.J. Lu 9c450f6f6f x86: Don't include cacheinfo.c in ld.so
Since cacheinfo.c isn't used by ld.so, there is no need to include it
in ld.so.

	* sysdeps/x86/cacheinfo.c: Skip if not in libc.
2017-05-24 06:33:43 -07:00
H.J. Lu 7c1d722554 x86: Use __get_cpu_features to get cpu_features
Remove is_intel, is_amd and max_cpuid macros.  Use __get_cpu_features
to get cpu_features instead.

	* sysdeps/x86/cacheinfo.c (is_intel): Removed.
	(is_amd): Likewise.
	(max_cpuid): Likewise.
	(__cache_sysconf): Use __get_cpu_features to get cpu_features.
	(init_cacheinfo): Likewise.
2017-05-24 06:28:52 -07:00
Joseph Myers cfed8ece79 Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).
The various sys/ucontext.h headers include <signal.h> and all the
headers split out of <bits/sigstack.h>.  (Except that the powerpc
version does not include <signal.h>.)

None of the standard versions defining ucontext.h require or permit
such inclusions; rather, they all say that the stack_t and sigset_t
types from signal.h are defined.  This patch fixes the headers to
include just the bits/ headers for those types (and the existing
includes of bits/sigcontext.h).  Since bits/types/sigset_t.h is now
being included instead of bits/types/__sigset_t.h, __sigset_t uses in
the headers are replaced by direct use of the public sigset_t type.
sysdeps/unix/sysv/linux/x86/bits/sigcontext.h was relying on the prior
inclusion of <signal.h> to define types such as __uint32_t, so gets a
bits/types.h include added to provide those types.

Although one could keep some or all of the includes under a __USE_MISC
conditional, that seems unnecessary to me, especially given the lack
of a <signal.h> include in the powerpc version meaning that portable
programs already cannot rely on such an include.

Tested for x86_64 and x86, and with build-many-glibcs.py.  As with
other such fixes, more namespace issues remain so this does not permit
any XFAILs to be removed or bugs to be closed.

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h: Do not include <signal.h>,
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/generic/sys/ucontext.h: Do not include <signal.h>,
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/i386/sys/ucontext.h: Do not include <signal.h>,
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/m68k/sys/ucontext.h: Do not include <signal.h>,
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/mips/sys/ucontext.h: Do not include <signal.h>,
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h>.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
	<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
	* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: Include
	<bits/types.h>.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
	<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
	<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
	<bits/types/__sigset_t.h>.
	(ucontext_t): Use sigset_t instead of __sigset_t.
2017-05-23 11:49:48 +00:00
Zack Weinberg 231a59ce2c Fix a bug in 'Remove __need macros from signal.h' (a992f506)
siginfo-arch.h is included in two different places, so the default
definitions of the macros that it might or might not define need to
be done conditionally afterward, not unconditionally beforehand.

	* sysdeps/unix/sysv/linux/bits/siginfo-consts.h
	(__SI_ASYNCIO_AFTER_SIGIO): Define default after including
	bits/siginfo-arch.h, only if not already defined.
	* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h
	(__SI_ALIGNMENT, __SI_BAND_TYPE, __SI_CLOCK_T)
	(__SI_ERRNO_THEN_CODE, __SI_HAVE_SIGSYS, __SI_SEGFAULT_ADDL):
	Likewise.

	* sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h:
	Unconditionally define __SI_* macros.
2017-05-22 22:32:09 -04:00
Siddhesh Poyarekar d26db8fbb4 Remove useless comment from sysdeps/sparc/sparc32/dl-machine.h
David Miller has not been shot yet AFAIK (yes, I googled for any news
that may seem relevant and I poked him on twitter some days ago) so
either nobody uses SPARC or the code is correct or nobody read the
instructions in the comment to shoot him.  In all of those cases the
comment is clearly not useful, so getting rid of it.
2017-05-23 01:10:29 +05:30
Zack Weinberg a992f506ff Remove __need macros from signal.h.
The types affected are __sig_atomic_t, sig_atomic_t, __sigset_t,
sigset_t, sigval_t, sigevent_t, and siginfo_t. __sig_atomic_t is a
scalar, so it's now directly available from bits/types.h.  The others
get bits/types/ headers.

Side effects include: There have been small changes to which
non-signal headers expose which subset of the signal-related types.
A couple of architectures' nested siginfo_t fields had to be renamed
to prevent undesired macro expansion.  Internal code that wants to
manipulate signal masks must now include <sigsetops.h> (which is not
installed) and should be aware that __sigaddset, __sigandset,
__sigdelset, __sigemptyset, and __sigorset no longer return a value
(unlike the public API).  Relatedly, the public signal.h no longer
declares any of those functions.  The obsolete sigmask() macro no
longer has a system-specific definition -- in the cases where it
matters, it didn't work anyway.

New Linux architectures should create bits/siginfo-arch.h and/or
bits/siginfo-consts-arch.h to customize their siginfo_t, rather than
duplicating everything in bits/siginfo.h (which no longer exists).
Add new __SI_* macros if necessary.  Ports to other operating systems
are strongly encouraged to generalize this scheme further.

	* bits/sigevent-consts.h
	* bits/siginfo-consts.h
	* bits/types/__sigset_t.h
	* bits/types/sigevent_t.h
	* bits/types/siginfo_t.h
	* sysdeps/unix/sysv/linux/bits/sigevent-consts.h
	* sysdeps/unix/sysv/linux/bits/siginfo-consts.h
	* sysdeps/unix/sysv/linux/bits/types/__sigset_t.h
	* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h
	* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h:
	New system-dependent bits headers.

	* sysdeps/unix/sysv/linux/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h
	* sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h
	* sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h
	* sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h
	* sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h:
	New Linux-only system-dependent bits headers.

	* signal/bits/types/sig_atomic_t.h
	* signal/bits/types/sigset_t.h
	* signal/bits/types/sigval_t.h:
	New non-system-dependent bits headers.

	* sysdeps/generic/sigsetops.h
	* sysdeps/unix/sysv/linux/sigsetops.h:
	New internal headers.

	* include/bits/types/sig_atomic_t.h
	* include/bits/types/sigset_t.h
	* include/bits/types/sigval_t.h:
	New wrappers.

	* signal/sigsetops.h
	* bits/siginfo.h
	* bits/sigset.h
	* sysdeps/unix/sysv/linux/bits/siginfo.h
	* sysdeps/unix/sysv/linux/bits/sigset.h
	* sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
	* sysdeps/unix/sysv/linux/mips/bits/siginfo.h
	* sysdeps/unix/sysv/linux/s390/bits/siginfo.h
	* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
	* sysdeps/unix/sysv/linux/tile/bits/siginfo.h
	* sysdeps/unix/sysv/linux/x86/bits/siginfo.h:
	Deleted.

	* signal/Makefile, sysdeps/unix/sysv/linux/Makefile:
	Update lists of installed headers.

	* posix/bits/types.h: Define __sig_atomic_t here.
	* signal/signal.h: Use the new bits headers; no need to handle
	__need_sig_atomic_t nor __need_sigset_t.  Don't use __sigmask
	to define sigmask.
	* include/signal.h: No need to handle __need_sig_atomic_t
	nor __need_sigset_t.  Don't define __sigemptyset.

	* io/sys/poll.h, setjmp/setjmp.h
	* sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h
	* sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h
	* sysdeps/mach/hurd/i386/bits/sigcontext.h
	* sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h
	* sysdeps/pthread/bits/sigthread.h
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
	Use bits/types/__sigset_t.h.

	* misc/sys/select.h, posix/spawn.h
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
	* sysdeps/unix/sysv/linux/sys/epoll.h
	* sysdeps/unix/sysv/linux/sys/signalfd.h:
	Use bits/types/sigset_t.h.

	* resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h.
	* rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h.
	* socket/sys/socket.h: Don't include bits/sigset.h.

	* login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c
	* signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c
	* sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c
	* sysdeps/posix/signal.c, sysdeps/posix/sigset.c
	* sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c
	* sysdeps/unix/sysv/linux/nptl-signals.h:
	Include sigsetops.h.

	* signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c
	* signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c
	* sysdeps/posix/signal.c, sysdeps/posix/sigset.c:
	__sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset
	now return no value.

	* signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c
	Include <errno.h>, <signal.h>, and <sigsetops.h> instead of
	"sigsetops.h".

	* signal/sigsetops.c: Explicitly define __sigismember,
	__sigaddset, and __sigdelset as compatibility symbols.

	* signal/Versions: Correct commentary on __sigpause,
	__sigaddset, __sigdelset, __sigismember.

	* inet/rcmd.c: Include sigsetops.h.  Convert old code using
	__sigblock/__sigsetmask to use __sigprocmask and friends.
2017-05-20 19:04:43 -04:00
H.J. Lu 1f655beb08 x86_64: Remove L(return_null) from rawmemchr.S
L(return_null) is unused.

	* sysdeps/x86_64/rawmemchr.S (L(return_null)): Removed.
2017-05-20 06:13:38 -07:00
Zack Weinberg 81cb7a0b2b Remove sfi_* annotations from ARM assembly files.
This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files.  These were only used by NaCl.

	* sysdeps/arm/sysdep.h
        (ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.

	* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
	* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
	* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
	* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
	* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
	* sysdeps/arm/armv6t2/strlen.S
	* sysdeps/arm/armv7/multiarch/memcpy_impl.S
	* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
	* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
	* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
	* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
        Remove all uses of sfi_breg, sfi_pld, and sfi_sp.
2017-05-20 08:12:11 -04:00
Zack Weinberg 42a844c6a2 Remove the bulk of the NaCl port.
The NaCl port has not been actively maintained since before the 2.25
release.  The complementary GCC back-end was never contributed to GCC,
and we are given to understand that the current NaCl SDK has switched
to Clang and therefore cannot be used to build glibc anymore, so we
doubt that the port remains useful.

This commit simply removes the sysdeps/arm/nacl and sysdeps/nacl
directories and the abi-tags entry.

	Remove the NaCl port.
	* abi-tags: Remove .*-.*-nacl.* entry.
	* sysdeps/arm/nacl: Remove directory and contents.
	* sysdeps/nacl: Likewise.
2017-05-20 08:09:10 -04:00
Rical Jasan a429d2ff07 manual: Convert errno @comments to new @errno macro.
errno.texi documents error macros, their values, and error strings in
Texinfo @comments, some of which are also used for @standards.  The
purpose of this commit is to separate the standards from the error
strings so that both the @standards conversion script picks up clean
@standards and the errno documentation framework is improved.

The error names, values, and messages are consolidated in a new custom
macro, @errno.  It is not clear that scripts within the sources rely
on the special Texinfo @comment-based format to generate files used
throughout the library, so the definition of @errno in macros.texi now
provides a comment indicating the dependency.  The dependent scripts
are updated to use @errno, which also simplifies them a bit.  The
files those scripts generate were verified to be unchanged.

The @errno macro is not visibly rendered in any way at this time, but
it does use an @cindex command to add the error string to the Concept
Index, to facilitate searching on error messages.

	* manual/errno.texi: Convert @comment-based errno
	documentation to @errno.
	* manual/macros.texi (@errno): New macro.  Consolidate errors,
	their values, and messages, adding the error string to the
	Concept Index.  Provide a warning in the comment about
	external (to the manual) dependencies.
	* sysdeps/gnu/errlist.awk: Use @errno instead of @comments.
	* sysdeps/mach/hurd/errnos.awk: Likewise.
2017-05-19 22:47:53 -07:00
Joseph Myers 0bcec5321f Split up bits/sigstack.h.
bits/sigstack.h contains four things: the legacy struct sigstack type,
the preferred stack_t type, the SS_* enum values and macros for signal
stack sizes.

These vary in different ways between glibc configurations; in
particular, the stack sizes vary much more than any of the other
pieces.  Furthermore, these pieces have different standard namespace
rules for when they should be visible (not currently visible in
conform/ results both because the relevant tests are XFAILed for
sys/ucontext.h namespace issues, and because some of the expectations
are incorrect in the same way as the headers, e.g. neither
expectations nor headers reflect that current POSIX no longer has
either the sigstack function or the sigstack structure).

To reduce duplication of identical definitions, and facilitate
namespace fixes without requiring the same feature test macro
conditions to be repeated in many versions of the same header, this
patch splits bits/sigstack.h up into four headers.  It keeps the stack
size macros, while new bits/types/struct_sigstack.h,
bits/types/stack_t.h and bits/ss_flags.h are added for the other
pieces.  bits/types/struct_sigstack.h is the same everywhere,
bits/types/stack_t.h has three variants different in the order of the
structure elements (generic = MIPS Linux, and other Linux), and
bits/ss_flags.h has generic and Linux variants.

This patch includes the new headers everywhere that included
<bits/sigstack.h>, so should cause no difference to what any public
header defines.  Subsequent namespace fixes would then remove or
condition some of those includes.

There should be no conflicts with Zack's changes to signal.h types,
beyond the trivial conflict of both making additions to
signal/Makefile's headers list; the two patches affect disjoint sets
of types and other definitions.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* bits/ss_flags.h: New file.
	* bits/types/stack_t.h: Likewise.
	* include/bits/types/struct_sigstack.h: Likewise.
	* signal/bits/types/struct_sigstack.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ss_flags.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/types/stack_t.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h: Likewise.
	* signal/Makefile (headers): Add bits/types/struct_sigstack.h,
	bits/types/stack_t.h and bits/ss_flags.h.
	* signal/signal.h [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]:
	Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
	<bits/ss_flags.h>.
	* bits/sigstack.h (struct sigstack): Remove.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
	(struct sigstack): Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigstack.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
	(struct sigstack): Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h (struct sigstack):
	Likewise.
	(stack_t): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	* sysdeps/arm/sys/ucontext.h: Include
	<bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
	<bits/ss_flags.h>.
	* sysdeps/generic/sys/ucontext.h: Likewise.
	* sysdeps/i386/sys/ucontext.h: Likewise.
	* sysdeps/m68k/sys/ucontext.h: Likewise.
	* sysdeps/mips/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Likewise.
2017-05-19 20:35:07 +00:00
H.J. Lu 402bf06952 x86: Optimize SSE2 memchr overflow calculation
SSE2 memchr computes "edx + ecx - 16" where ecx is less than 16.  Use
"edx - (16 - ecx)", instead of satured math, to avoid possible addition
overflow.  This replaces

	add	%ecx, %edx
	sbb	%eax, %eax
	or	%eax, %edx
	sub	$16, %edx

with

	neg	%ecx
	add	$16, %ecx
	sub	%ecx, %edx

It is the same for x86_64, except for rcx/rdx, instead of ecx/edx.

	* sysdeps/i386/i686/multiarch/memchr-sse2.S (MEMCHR): Use
	"edx + ecx - 16" to avoid possible addition overflow.
	* sysdeps/x86_64/memchr.S (memchr): Likewise.
2017-05-19 10:48:45 -07:00
Adhemerval Zanella 1d71a63153 Fix makefile rules for vmsplice, splice, and open_by_handle_at
Commits ecade1c, afbbc18, and a5a34d2 added compiler flags for
vmsplice, splice, and open_by_handle_at respectively on default
misc/Makefile.  However such symbols are build only for Linux and
the rules should on linux Makefile only.

Checked on x86_64-linux-gnu.

	* misc/Makefile (CFLAGS-vmsplice.c): Remove rule.
	(CFLAGS-splice.c): Likewise.
	(CFLAGS-open_by_handle_at.c): Likewise.
	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New rule.
	(CFLAGS-splice.c): Likewise.
	(CFLAGS-open_by_handle_at.c): Likewise.
2017-05-19 09:37:00 -03:00
Joseph Myers 9aa4965cdf Also create and use ldbl-compat-choose.h.
This patch makes the glibc build generate an additional header
ldbl-compat-choose.h that defines LONG_DOUBLE_COMPAT_CHOOSE_* macros
for each libc and libm symbol, which select one or the other of their
arguments based on whether the symbol was added before a change to
long double != double.

The effect of this is that it is then possible to define a macro
maybe_long_double_symbol that automatically acts as either
long_double_symbol or weak_alias depending on when the symbol being
defined was added.  This can be used when building long double
functions from type-generic templates.  Thus, with this patch ldbl-opt
no longer needs special long double implementations of each new libm
function added using such a template, and the existing such
implementations are removed.

This is a step towards being able more generally to use common macros
to create all the aliases needed for a libm function, so reducing the
amount of special-case code needed in ldbl-opt and ldbl-64-128, and
facilitating subsequently adding *f32 / *f64 / *f128 / *f32x / *f64x
aliases to existing functions (where the set of aliases that a
function should have may depend on the architecture in various ways).

Tested with build-many-glibcs.py.  Except for on
powerpc64le-linux-gnu, installed stripped shared libraries are
unchanged by the patch.  powerpc64le-linux-gnu is the unique
configuration which used ldbl-opt from the start rather than adding a
new long double choice after originally only having had long double =
double.  The effect of the patch there is that various cases that
previously used long_double_symbol unconditionally now use weak_alias
instead, so .os files contain e.g. a symbol cabsl instead of
cabsl@@GLIBC_2.17.  The final dynamic symbols and versions in the
resulting shared libraries are unchanged (ABI tests pass), as is the
disassembly of the shared libraries, but the differences in the .os
files still result in different .gnu_hash contents in libm.so; the
differences are of no significance and logically using weak_alias is
what's most appropriate in those cases.

	* scripts/versions.awk: Generate ldbl-compat-choose.h.
	* sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Include
	<ldbl-compat-choose.h>.
	(maybe_long_double_symbol): New macro.
	[!declare_mgen_alias] (declare_mgen_alias): Use
	maybe_long_double_symbol.
	* sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Remove.
	* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_nextdownl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise.
	* Makerules [$(build-shared) = yes && !avoid-generated]
	(before-compile): Add $(common-objpfx)ldbl-compat-choose.h.
	[$(build-shared) = yes && !avoid-generated]
	($(common-objpfx)ldbl-compat-choose.h): New target.
2017-05-19 11:30:26 +00:00
Joseph Myers 8f2e1830f2 Create and use first-versions.h with macros for function symbol versions.
This patch arranges for the glibc build to generate a header
first-versions.h that defines macros for the earliest symbol version
in which each public symbol (GLIBC_[0-9]* symbol version, name only
uses C identifier characters) is available.

This is used in sysdeps/ieee754/ldbl-opt/math-type-macros-double.h to
replace the manually defined LDOUBLE_*_libm_version macros for various
functions defined using type-generic templates, the purpose of which
is to use in LONG_DOUBLE_COMPAT tests "was this function originally
added before glibc supported long double != double on this platform?".
As discussed in
<https://sourceware.org/ml/libc-alpha/2016-12/msg00246.html>, I expect
this to be useful more generally in reducing the amount of
special-case code needed in ldbl-opt and ldbl-64-128.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.

	* scripts/versions.awk: Generate first-versions.h.
	* sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Include
	<first-versions.h>.
	(LDOUBLE_cabsl_libm_version): Remove macro.
	(LDOUBLE_cargl_libm_version): Likewise.
	(LDOUBLE_cimagl_libm_version): Likewise.
	(LDOUBLE_conjl_libm_version): Likewise.
	(LDOUBLE_creall_libm_version): Likewise.
	(LDOUBLE_cacosl_libm_version): Likewise.
	(LDOUBLE_cacoshl_libm_version): Likewise.
	(LDOUBLE_ccosl_libm_version): Likewise.
	(LDOUBLE_ccoshl_libm_version): Likewise.
	(LDOUBLE_casinl_libm_version): Likewise.
	(LDOUBLE_csinl_libm_version): Likewise.
	(LDOUBLE_casinhl_libm_version): Likewise.
	(LDOUBLE_csinhl_libm_version): Likewise.
	(LDOUBLE_catanl_libm_version): Likewise.
	(LDOUBLE_catanhl_libm_version): Likewise.
	(LDOUBLE_ctanl_libm_version): Likewise.
	(LDOUBLE_ctanhl_libm_version): Likewise.
	(LDOUBLE_cexpl_libm_version): Likewise.
	(LDOUBLE_clogl_libm_version): Likewise.
	(LDOUBLE_cprojl_libm_version): Likewise.
	(LDOUBLE_csqrtl_libm_version): Likewise.
	(LDOUBLE_cpowl_libm_version): Likewise.
	(LDOUBLE_clog10l_libm_version): Likewise.
	(LDOUBLE___clog10l_libm_version): Likewise.
	(LDOUBLE_fdiml_libm_version): Likewise.
	(LDOUBLE_fmaxl_libm_version): Likewise.
	(LDOUBLE_fminl_libm_version): Likewise.
	(LDOUBLE_ilogbl_libm_version): Likewise.
	(LDOUBLE_nanl_libm_version): Likewise.
	[!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Use
	FIRST_VERSION_libm_* macros.
	[!declare_mgen_libm_compat] (declare_mgen_libm_compat): Likewise.
	* Makerules [$(build-shared) = yes && !avoid-generated]
	(before-compile): Add $(common-objpfx)first-versions.h.
	[$(build-shared) = yes && !avoid-generated]
	($(common-objpfx)first-versions.h): New target.
	($(common-objpfx)sysd-versions): Depend on and change to rule for
	building $(common-objpfx)versions.stmp.
2017-05-19 11:26:00 +00:00
Adhemerval Zanella 332e01c627 posix: Consolidate Linux mq_timedsend syscall
This patch consolidates the mq_timedsend Linux syscall generation
on sysdeps/unix/sysv/linux/mq_timedsend.c.  It basically removes it
from architecture auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* rt/Makefile (CFLAGS-mq_timedsend.c): New flag.
	* sysdeps/unix/sysv/linux/mq_timedsend.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Remove from
	auto-generation list.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella a5fdd30597 posix: Consolidate Linux mq_timedreceive syscall
This patch consolidates the mq_timedreceive Linux syscall generation
on sysdeps/unix/sysv/linux/mq_timedreceive.c.  It basically removes it
from architecture auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* rt/Makefile (CFLAGS-mq_timedreceive.c): New flag.
	* sysdeps/unix/sysv/linux/mq_timedreceive.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list (mq_timedreceive): Remove
	from auto-generation list.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella a5a34d2eaf linux: Consolidate Linux open_by_handle_at syscall
This patch consolidates the open_by_handle_at Linux syscall generation on
sysdeps/unix/sysv/linux/open_by_handle_at.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
	open_by_handle_at.
	(CFLAGS-open_by_handle_at.c): New flag.
	* sysdeps/unix/sysv/linux/open_by_handle_at.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list (open_by_handle_at): New
	file.
	* misc/Makefile (CFLAGS-open_by_handle_at.c): New rule.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella afbbc18f9e linux: Consolidate Linux splice syscall
This patch consolidates the splice Linux syscall generation on
sysdeps/unix/sysv/linux/splice.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add splice.
	(CFLAGS-splice.c): New flag.
	* sysdeps/unix/sysv/linux/splice.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list (splice): Remove from
	auto-generation syscall list.
	* misc/Makefile (CFLAGS-splice.c): New rule.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella ecade1cb0b linux: Consolidate Linux vmsplice syscall
This patch consolidates the vmsplice Linux syscall generation on
sysdeps/unix/sysv/linux/vmsplice.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag.
	* sysdeps/unix/sysv/linux/syscalls.list (vmsplice): Remove from
	auto-generation syscall list.
	* sysdeps/unix/sysv/linux/vmsplice.c: New file.
	* misc/Makefile (CFLAGS-vmsplice.c): New rule.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella fdbb0d98ba posix: Consolidate Linux fsync syscall
This patch consolidates the fsync Linux syscall generation on
sysdeps/unix/sysv/linux/fsync.c.  It basically removes it from
architectures auto-generation list.

For arm it also removes the __errno_location call since fsync
is not called with SYSCALL_CANCEL with call arch-specific
INLINE_SYSCALL macro which in turn will call __set_errno macro
(and setting errno directly).

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* misc/Makefile (CFLAGS-fsync.c): New flag.
	* nptl/Makefile (CFLAGS-fsync.c): Likewise.
	* sysdeps/unix/syscalls.list (fsync): Remove from auto-generation
	syscall list.
	* sysdeps/unix/sysv/linux/fsync.c: New file.
	* sysdeps/unix/sysv/linux/arm/localplt.data [libpthread.so]
	(__errno_location): Remove.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella 51209cbf51 posix: Consolidate Linux fdatasync syscall
This patch consolidates the fdatasync Linux syscall generation on
sysdeps/unix/sysv/linux/fdatasync.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* misc/makefile (CFLAGS-datasync.c): New flag.
	* nptl/makefile (CFLAGS-datasync.c): Likewise.
	* sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Remove from
	auto-generation syscall list.
	* sysdeps/unix/sysv/linux/fdatasync.c: New file.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella 3c9399f507 posix: Consolidate Linux msync syscall
This patch consolidates the msync Linux syscall generation on
sysdeps/unix/sysv/linux/msync.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* misc/Makefile (CFLAGS-msync.c): New rule.
	* nptl/Makefile (CFLAGS-msync.c): Likewise.
	* sysdeps/unix/syscalls.list: Remove msync from auto-generation list.
	* sysdeps/unix/sysv/linux/msync.c: New file.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella b3b00aa8b0 posix: Consolidate Linux sigsuspend implementation
This patch consolidates the sigsuspend Linux syscall generation on
sysdeps/unix/sysv/linux/sigsuspend.c.  It basically removes the alpha
assembly version which call the old sigsusped interface using only
the first doubleword from sigset. Current minimum supported kernel
on alpha (3.2) enforces rt_sigsuspend on the architecture
(__ARCH_WANT_SYS_RT_SIGSUSPEND option on kernel), so it is possible
to use the default implementation.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Remove file.
	* sysdeps/unix/sysv/linux/sigsuspend.c: Simplify include list.
	* nptl/Makefile (CFLAGS-sigsuspend.c): New rule.
	* sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
	(CFLAGS-sigsuspend.c): Remove rule.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella 2de15b61e9 linux: Consolidate Linux tee implementation
This patch consolidates the tee Linux syscall generation on
sysdeps/unix/sysv/linux/tee.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add tee.
	(CFLAGS-tee.c): New rule.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove tee from
	auto-generated list.
	* sysdeps/unix/sysv/linux/tee.c: New file.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella 3d0ad5a8df posix: Consolidate Linux nanosleep syscall
This patch consolidates the nanosleep Linux syscall generation on
sysdeps/unix/sysv/linux/nanosleep.c.  It basically removes it from
architectures auto-generation list.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* nptl/Makefile (CFLAGS-nanosleep.c): New rule.
	* posix/Makefile (CFLAGS-nanosleep.c): Likewise.
	* sysdeps/unix/sysv/linux/nanosleep.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove nanosleep from
	auto-generated list.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella ebfdb12bf0 posix: Consolidate Linux waitpid syscall
This patch consolidates the waitpid Linux syscall generation on
sysdeps/unix/sysv/linux/waitpid.c.  It basically removes it from
architecture auto-generation list and also remove arch specific
implementations.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/sh/syscalls.list: Remove waitpid from
	auto-generated list.
	* sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove file.
	* sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.
2017-05-18 18:06:47 -03:00
Adhemerval Zanella 88499a87ce posix: Consolidate Linux pause syscall
This patch consolidates the pause Linux implementation on
sysdeps/unix/sysv/linux/pause.c.  If defined the pause syscall
(__NR_pause) will be used, other ppoll with 0 arguments will be
used instead.

It has the small advantage of generic pause implementation with
uses rt_sigprocmask plus rt_sigsuspend because it requires only
one syscall and the pause is done atomically regarding signal
handling (for instance, pause may not be interrupted if the
signal arrives between the rt_sigprocmask and rt_sigsuspend
syscall).

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
arch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu,
sparc64-linux-gnu, and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/generic/pause.c: Remove file.
	* sysdeps/unix/sysv/linux/sparc/sparc64/pause.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h [__arch64__]
	(__NR_pause): Undefine.
	* sysdeps/unix/sysv/linux/pause.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove pause from
	auto-generation list.
2017-05-18 18:06:47 -03:00