Commit Graph

8239 Commits

Author SHA1 Message Date
Anton Blanchard 76a66d510a PowerPC floating point little-endian [14 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00205.html

These all wrongly specified float constants in a 64-bit word.

	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Correct float constants
	for little-endian.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise.
2013-10-04 10:36:24 +09:30
Alan Modra 6a31fe7f9c PowerPC floating point little-endian [13 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00088.html

	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Increase alignment of
	constants to usual value for .cst8 section, and remove redundant
	high address load.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Use float
	constant for 0x1p52.  Load little-endian words of double from
	correct stack offsets.
2013-10-04 10:35:54 +09:30
Alan Modra 7b88401f3b PowerPC floating point little-endian [12 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00087.html

Fixes for little-endian in 32-bit assembly.

	* sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian
	words of double from correct stack offsets.
	* sysdeps/powerpc/powerpc32/fpu/s_copysignl.S: Likewise.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Likewise.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise.
	* sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
	* sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
	* sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT.
	* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
2013-10-04 10:35:43 +09:30
Alan Modra 9c008155b7 PowerPC floating point little-endian [11 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00202.html

Another little-endian fix.

	* sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Rewrite using
	64-bit int/double union.
	(_FPU_SETCW): Likewise.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise.
	(_SET_DI_FPSCR, _GET_SI_FPSCR, _SET_SI_FPSCR): Likewise.
2013-10-04 10:35:21 +09:30
Alan Modra da13146da1 PowerPC floating point little-endian [10 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00201.html

These two functions oddly test x+1>0 when a double x is >= 0.0, and
similarly when x is negative.  I don't see the point of that since the
test should always be true.  I also don't see any need to convert x+1
to integer rather than simply using xr+1.  Note that the standard
allows these functions to return any value when the input is outside
the range of long long, but it's not too hard to prevent xr+1
overflowing so that's what I've done.

(With rounding mode FE_UPWARD, x+1 can be a lot more than what you
might naively expect, but perhaps that situation was covered by the
x - xrf < 1.0 test.)

	* sysdeps/powerpc/fpu/s_llround.c (__llround): Rewrite.
	* sysdeps/powerpc/fpu/s_llroundf.c (__llroundf): Rewrite.
2013-10-04 10:35:10 +09:30
Alan Modra 603e84104c PowerPC floating point little-endian [9 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00200.html

This works around the fact that vsx is disabled in current
little-endian gcc.  Also, float constants take 4 bytes in memory
vs. 16 bytes for vector constants, and we don't need to write one lot
of masks for double (register format) and another for float (mem
format).

	* sysdeps/powerpc/fpu/s_float_bitwise.h (__float_and_test28): Don't
	use vector int constants.
	(__float_and_test24, __float_and8, __float_get_exp): Likewise.
2013-10-04 10:34:57 +09:30
Anton Blanchard 4a28b3ca4b PowerPC floating point little-endian [8 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00199.html

Corrects floating-point environment code for little-endian.

	* sysdeps/powerpc/fpu/fenv_libc.h (fenv_union_t): Replace int
	array with long long.
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Adjust.
	* sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Adjust.
	* sysdeps/powerpc/fpu/fclrexcpt.c (__feclearexcept): Adjust.
	* sysdeps/powerpc/fpu/fedisblxcpt.c (fedisableexcept): Adjust.
	* sysdeps/powerpc/fpu/feenablxcpt.c (feenableexcept): Adjust.
	* sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Adjust.
	* sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Adjust.
	* sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Adjust.
	* sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Adjust.
	* sysdeps/powerpc/fpu/fgetexcptflg.c (__fegetexceptflag): Adjust.
	* sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Adjust.
	* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Adjust.
	* sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Adjust.
2013-10-04 10:34:26 +09:30
Anton Blanchard 2ca85d2bbb PowerPC floating point little-endian [7 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00086.html

	* sysdeps/powerpc/bits/mathinline.h (__signbitf): Use builtin.
	(__signbit): Likewise.  Correct for little-endian.
	(__signbitl): Call __signbit.
	(lrint): Correct for little-endian.
	(lrintf): Call lrint.
2013-10-04 10:34:14 +09:30
Alan Modra 62a728aeff PowerPC floating point little-endian [6 of 15]
http://sourceware.org/ml/libc-alpha/2013-07/msg00197.html

A rewrite to make this code correct for little-endian.

	* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (mynumber): Replace
	union 32-bit int array member with 64-bit int array.
	(t515, tm256): Double rather than long double.
	(__ieee754_sqrtl): Rewrite using 64-bit arithmetic.
2013-10-04 10:33:21 +09:30
Alan Modra 32c301dfc9 PowerPC floating point little-endian [5 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00085.html

Rid ourselves of ieee854.

	* sysdeps/ieee754/ldbl-128ibm/ieee754.h (union ieee854_long_double):
	Delete.
	(IEEE854_LONG_DOUBLE_BIAS): Delete.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Don't include ieee854
	version of math_ldbl.h.
2013-10-04 10:33:05 +09:30
Alan Modra 650ef4bd79 PowerPC floating point little-endian [4 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00084.html

Another batch of ieee854 macros and union replacement.  These four
files also have bugs fixed with this patch.  The fact that the two
doubles in an IBM long double may have different signs means that
negation and absolute value operations can't just twiddle one sign bit
as you can with ieee864 style extended double.  fmodl, remainderl,
erfl and erfcl all had errors of this type.  erfl also returned +1 for
large magnitude negative input where it should return -1.  The hypotl
error is innocuous since the value adjusted twice is only used as a
flag.  The e_hypotl.c tests for large "a" and small "b" are mutually
exclusive because we've already exited when x/y > 2**120.  That allows
some further small simplifications.

	[BZ #15734], [BZ #15735]
	* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite
	all uses of ieee875 long double macros and unions.  Simplify test
	for 0.0L.  Correct |x|<|y| and |x|=|y| test.  Use
	ldbl_extract_mantissa value for ix,iy exponents.  Properly
	normalize after ldbl_extract_mantissa, and don't add hidden bit
	already handled.  Don't treat low word of ieee854 mantissa like
	low word of IBM long double and mask off bit when testing for
	zero.
	* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Rewrite
	all uses of ieee875 long double macros and unions.  Simplify tests
	for 0.0L and inf.  Correct double adjustment of k.  Delete dead code
	adjusting ha,hb.  Simplify code setting kld.  Delete two600 and
	two1022, instead use their values.  Recognise that tests for large
	"a" and small "b" are mutually exclusive.  Rename vars.  Comment.
	* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl):
	Rewrite all uses of ieee875 long double macros and unions.  Simplify
	test for 0.0L and nan.  Correct negation.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Rewrite all uses of
	ieee875 long double macros and unions.  Correct output for large
	magnitude x.  Correct absolute value calculation.
	(__erfcl): Likewise.
	* math/libm-test.inc: Add tests for errors discovered in IBM long
	double versions of fmodl, remainderl, erfl and erfcl.
2013-10-04 10:32:48 +09:30
Alan Modra 765714cafc PowerPC floating point little-endian [3 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00083.html

Further replacement of ieee854 macros and unions.  These files also
have some optimisations for comparison against 0.0L, infinity and nan.
Since the ABI specifies that the high double of an IBM long double
pair is the value rounded to double, a high double of 0.0 means the
low double must also be 0.0.  The ABI also says that infinity and
nan are encoded in the high double, with the low double unspecified.
This means that tests for 0.0L, +/-Infinity and +/-NaN need only check
the high double.

	* sysdeps/ieee754/ldbl-128ibm/e_atan2l.c (__ieee754_atan2l): Rewrite
	all uses of ieee854 long double macros and unions.  Simplify tests
	for long doubles that are fully specified by the high double.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl): Likewise.
	Remove dead code too.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
	(__ieee754_ynl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_log10l.c (__ieee754_log10l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_logl.c (__ieee754_logl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
	Remove dead code too.
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c (__kernel_tanl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_isinf_nsl.c (__isinf_nsl): Likewise.
	Simplify.
	* sysdeps/ieee754/ldbl-128ibm/s_isinfl.c (___isinfl): Likewise.
	Simplify.
	* sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_modfl.c (__modfl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Likewise.
	Comment on variable precision.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c (__nexttowardf):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c (__scalblnl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c (__scalbnl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c (__tanhl): Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Adjust tan_towardzero ulps.
2013-10-04 10:32:36 +09:30
Alan Modra 4ebd120cd9 PowerPC floating point little-endian [2 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00082.html

This patch replaces occurrences of GET_LDOUBLE_* and SET_LDOUBLE_*
macros, and union ieee854_long_double_shape_type in ldbl-128ibm/,
and a stray one in the 32-bit fpu support.  These files have no
significant changes apart from rewriting the long double bit access.

	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_high): Define.
	* sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Rewrite
	all uses of ieee854 long double macros and unions.
	* sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_coshl.c (__ieee754_coshl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_log2l.c (__ieee754_log2l): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c (__ieee754_rem_pio2l):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c (__ieee754_sinhl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_atanl.c (__atanl): Likewise.
	Simplify sign and nan test too.
	* sysdeps/ieee754/ldbl-128ibm/s_cosl.c (__cosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_finitel.c (___finitel): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c (___fpclassifyl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_isnanl.c (___isnanl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c (__issignalingl):
	Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_signbitl.c (___signbitl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_sincosl.c (__sincosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_sinl.c (__sinl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_tanl.c (__tanl): Likewise.
	* sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c (__logbl): Likewise.
2013-10-04 10:32:19 +09:30
Alan Modra 1b6adf888d PowerPC floating point little-endian [1 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html

This is the first of a series of patches to ban ieee854_long_double
and the ieee854_long_double macros when using IBM long double.  union
ieee854_long_double just isn't correct for IBM long double, especially
when little-endian, and pretending it is OK has allowed a number of
bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/.

This changes the few places in generic code that use it.

	* stdio-common/printf_size.c (__printf_size): Don't use
	union ieee854_long_double in fpnum union.
	* stdio-common/printf_fphex.c (__printf_fphex): Likewise.  Use
	signbit macro to retrieve sign from long double.
	* stdio-common/printf_fp.c (___printf_fp): Use signbit macro to
	retrieve sign from long double.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change.
	* sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
	* sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
	* sysdeps/x86_64/fpu/printf_fphex.c: Likewise.
	* math/test-misc.c (main): Don't use union ieee854_long_double.
ports/
	* sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
2013-10-04 10:31:41 +09:30
Alan Modra 4cf69995e2 Fix for [BZ #15680] IBM long double inaccuracy
http://sourceware.org/ml/libc-alpha/2013-06/msg00919.html

I discovered a number of places where denormals and other corner cases
were being handled wrongly.

- printf_fphex.c: Testing for the low double exponent being zero is
unnecessary.  If the difference in exponents is less than 53 then the
high double exponent must be nearing the low end of its range, and the
low double exponent hit rock bottom.

- ldbl2mpn.c: A denormal (ie. exponent of zero) value is treated as
if the exponent was one, so shift mantissa left by one.  Code handling
normalisation of the low double mantissa lacked a test for shift count
greater than bits in type being shifted, and lacked anything to handle
the case where the difference in exponents is less than 53 as in
printf_fphex.c.

- math_ldbl.h (ldbl_extract_mantissa): Same as above, but worse, with
code testing for exponent > 1 for some reason, probably a typo for >= 1.

- math_ldbl.h (ldbl_insert_mantissa): Round the high double as per
mpn2ldbl.c (hi is odd or explicit mantissas non-zero) so that the
number we return won't change when applying ldbl_canonicalize().
Add missing overflow checks and normalisation of high mantissa.
Correct misleading comment: "The hidden bit of the lo mantissa is
zero" is not always true as can be seen from the code rounding the hi
mantissa.  Also by inspection, lzcount can never be less than zero so
remove that test.  Lastly, masking bitfields to their widths can be
left to the compiler.

- mpn2ldbl.c: The overflow checks here on rounding of high double were
just plain wrong.  Incrementing the exponent must be accompanied by a
shift right of the mantissa to keep the value unchanged.  Above notes
for ldbl_insert_mantissa are also relevant.

	[BZ #15680]
	* sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
	(PRINT_FPHEX_LONG_DOUBLE): Tidy code by moving -53 into ediff
	calculation.  Remove unnecessary test for denormal exponent.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c (__mpn_extract_long_double):
	Correct handling of denormals.  Avoid undefined shift behaviour.
	Correct normalisation of low mantissa when low double is denormal.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
	(ldbl_extract_mantissa): Likewise.  Comment.  Use uint64_t* for hi64.
	(ldbl_insert_mantissa): Make both hi64 and lo64 parms uint64_t.
	Correct normalisation of low mantissa.  Test for overflow of high
	mantissa and normalise.
	(ldbl_nearbyint): Use more readable constant for two52.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
	(__mpn_construct_long_double): Fix test for overflow of high
	mantissa and correct normalisation.  Avoid undefined shift.
2013-10-04 10:30:56 +09:30
Alan Modra 9605ca6c08 IBM long double mechanical changes to support little-endian
http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html

This patch starts the process of supporting powerpc64 little-endian
long double in glibc.  IBM long double is an array of two ieee
doubles, so making union ibm_extended_long_double reflect this fact is
the correct way to access fields of the doubles.

	* sysdeps/ieee754/ldbl-128ibm/ieee754.h
	(union ibm_extended_long_double): Define as an array of ieee754_double.
	(IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
	* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references
	to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS.
	* sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
2013-10-04 10:28:42 +09:30
Andreas Schwab b2179107f3 Properly cache the result from looking up the nss database config 2013-09-30 10:29:13 +02:00
Mike Frysinger 47f28d0a66 tst-fanotify: fix style
Reported-by: Andreas Jaeger <aj@suse.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-28 23:53:50 -04:00
Patrick 'P. J.' McDermott 0a834ddecb don't use Bash-specific ${parameter/pattern/string} expansion
sysdeps/unix/make-syscalls.sh and sysdeps/unix/Makefile use GNU Bash's
${parameter/pattern/string} parameter expansion.  Non-Bash shells (e.g.
dash or BusyBox ash when built with CONFIG_ASH_BASH_COMPAT disabled)
don't support this expansion syntax.  So glibc will fail to build when
$(SHELL) expands to a path that isn't provided by Bash.

An example build failure:

    for dir in [...]; do \
      test -f $dir/syscalls.list && \
      { sysdirs='[...]' \
        asm_CPP='gcc -c    -I[...]   -D_LIBC_REENTRANT -include include/libc-symbols.h       -DASSEMBLER  -g -Wa,--noexecstack   -E -x assembler-with-cpp' \
        /bin/sh sysdeps/unix/make-syscalls.sh $dir || exit 1; }; \
      test $dir = sysdeps/unix && break; \
    done > [build-dir]/sysd-syscallsT
    sysdeps/unix/make-syscalls.sh: line 273: syntax error: bad substitution

This patch simply replaces the three instances of the Bash-only syntax
in these files with an echo and sed command substitution.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-28 23:03:09 -04:00
Kaz Kojima 80a83dd70e Add SH implementation of stackguard-macros.h. 2013-09-27 10:59:02 +09:00
Ondřej Bílka dc1a95c730 Faster strrchr. 2013-09-26 19:23:01 +02:00
Adhemerval Zanella 5ebbff8fd1 PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64 2013-09-25 13:43:04 -05:00
Will Newton f02eed105c sysdeps/mach/hurd/i386/tls.h: Remove TLS_INIT_TP_EXPENSIVE.
This define was removed from the rest of the tree eight years ago.

ChangeLog:

2013-09-24  Will Newton  <will.newton@linaro.org>

	* sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): Remove
	macro.
2013-09-24 09:25:53 +01:00
Carlos O'Donell 0b1f8e3564 BZ #15754: Fix test case for ARM.
Statically built binaries use __pointer_chk_guard_local,
while dynamically built binaries use __pointer_chk_guard.
Provide the right definition depending on the test case
we are building.
2013-09-23 01:44:38 -04:00
Carlos O'Donell c61b4d41c9 BZ #15754: CVE-2013-4788
The pointer guard used for pointer mangling was not initialized for
static applications resulting in the security feature being disabled.
The pointer guard is now correctly initialized to a random value for
static applications. Existing static applications need to be
recompiled to take advantage of the fix.

The test tst-ptrguard1-static and tst-ptrguard1 add regression
coverage to ensure the pointer guards are sufficiently random
and initialized to a default value.
2013-09-23 00:52:09 -04:00
Andreas Schwab 5bb43a4319 Make __ffs hidden 2013-09-20 21:25:31 +02:00
Siddhesh Poyarekar 4aafb73cb2 Consolidate common code into macros
Consolidated common Taylor series polynomials into macros in s_sin.c
to make it a bit cleaner.
2013-09-19 20:34:45 +05:30
Siddhesh Poyarekar b348e1e3a6 Consolidate sin/cos table lookup code 2013-09-19 16:51:02 +05:30
Siddhesh Poyarekar 6cce25f814 Consolidate sin/cos computation for large inputs 2013-09-19 16:45:27 +05:30
Siddhesh Poyarekar 5eea0404a8 Remove redundant goto lines 2013-09-19 16:43:53 +05:30
Maciej W. Rozycki 9c21573c02 MIPS: IEEE 754-2008 NaN encoding support
It has been a long practice for software using IEEE 754 floating-point
arithmetic run on MIPS processors to use an encoding of Not-a-Number
(NaN) data different to one used by software run on other processors.
And as of IEEE 754-2008 revision [1] this encoding does not follow one
recommended in the standard, as specified in section 6.2.1, where it
is stated that quiet NaNs should have the first bit (d1) of their
significand set to 1 while signalling NaNs should have that bit set to
0, but MIPS software interprets the two bits in the opposite manner.

As from revision 3.50 [2][3] the MIPS Architecture provides for
processors that support the IEEE 754-2008 preferred NaN encoding format.
As the two formats (further referred to as "legacy NaN" and "2008 NaN")
are incompatible to each other, tools have to provide support for the
two formats to help people avoid using incompatible binary modules.

The change is comprised of two functional groups of features, both of
which are required for correct support.

1. Dynamic linker support.

   To enforce the NaN encoding requirement in dynamic linking a new ELF
   file header flag has been defined.  This flag is set for 2008-NaN
   shared modules and executables and clear for legacy-NaN ones.  The
   dynamic linker silently ignores any incompatible modules it
   encounters in dependency processing.

   To avoid unnecessary processing of incompatible modules in the
   presence of a shared module cache, a set of new cache flags has been
   defined to mark 2008-NaN modules for the three ABIs supported.
   Changes to sysdeps/unix/sysv/linux/mips/readelflib.c have been made
   following an earlier code quality suggestion made here:

   http://sourceware.org/ml/libc-ports/2009-03/msg00036.html

   and are therefore a little bit more extensive than the minimum
   required.

   Finally a new name has been defined for the dynamic linker so that
   2008-NaN and legacy-NaN binaries can coexist on a single system that
   supports dual-mode operation and that a legacy dynamic linker that
   does not support verifying the 2008-NaN ELF file header flag is not
   chosen to interpret a 2008-NaN binary by accident.

2. Floating environment support.

   IEEE 754-2008 features are controlled in the Floating-Point Control
   and Status (FCSR) register and updates are needed to floating
   environment support so that the 2008-NaN flag is set correctly and
   the kernel default, inferred from the 2008-NaN ELF file header flag
   at the time an executable is loaded, respected.

As the NaN encoding format is a property of GCC code generation that is
both a user-selected GCC configuration default and can be overridden
with GCC options, code that needs to know what NaN encoding standard it
has been configured for checks for the __mips_nan2008 macro that is
defined internally by GCC whenever the 2008-NaN mode has been selected.
This mode is determined at the glibc configuration time and therefore a
few consistency checks have been added to catch cases where compilation
flags have been overridden by the user.

The 2008 NaN set of features relies on kernel support as the in-kernel
floating-point emulator needs to be aware of the NaN encoding used even
on hard-float processors and configure the FPU context according to the
value of the 2008 NaN ELF file header flag of the executable being
started.  As at this time work on kernel support is still in progress
and the relevant changes have not made their way yet to linux.org master
repository.

Therefore the minimum version supported has been artificially set to
10.0.0 so that 2008-NaN code is not accidentally run on a Linux kernel
that does not suppport it.  It is anticipated that the version is
adjusted later on to the actual initial linux.org kernel version to
support this feature.  Legacy NaN encoding support is unaffected, older
kernel versions remain supported.

[1] "IEEE Standard for Floating-Point Arithmetic", IEEE Computer
    Society, IEEE Std 754-2008, 29 August 2008

[2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS32 Architecture", MIPS Technologies, Inc., Document Number:
    MD00082, Revision 3.50, September 20, 2012

[3] "MIPS Architecture For Programmers, Volume I-A: Introduction to the
    MIPS64 Architecture", MIPS Technologies, Inc., Document Number:
    MD00083, Revision 3.50, September 20, 2012
2013-09-18 21:33:50 +01:00
Joseph Myers 24d22e65b3 e500 port: fpu_control.h. 2013-09-18 14:47:49 +00:00
Joseph Myers 2e071de0f7 e500 port: setjmp/longjmp. 2013-09-18 14:46:57 +00:00
Joseph Myers d13ef0662f Don't force -msoft-float for powerpc --without-fp. 2013-09-18 14:44:34 +00:00
Siddhesh Poyarekar 97a0650b8a Format sincos32.c 2013-09-18 13:01:34 +05:30
Joseph Myers 11ca09e932 Fix powerpc fpu_control.h namespace and parenthesis issues (bug 15966). 2013-09-17 21:28:19 +00:00
Ondřej Bílka 5905e7b3e2 Faster strchr implementation. 2013-09-11 17:07:38 +02:00
Adhemerval Zanella ddf985af47 Update powerpc-fpu ULPs. 2013-09-11 07:38:57 -05:00
Andreas Schwab ffdd31816a Add O_TMPFILE to <fcntl.h> 2013-09-11 11:52:46 +02:00
Ondřej Bílka c7cabd1355 Remove DO_NOT_USE_THIS conditionals. 2013-09-10 19:15:33 +02:00
Carlos O'Donell 6c82a2f8d7 Coordinate IPv6 definitions for Linux and glibc
This change synchronizes the glibc headers with the Linux kernel
headers and arranges to coordinate the definition of structures
already defined the Linux kernel UAPI headers.

It is now safe to include glibc's netinet/in.h or Linux's linux/in6.h
in any order in a userspace application and you will get the same
ABI. The ABI is guaranteed by UAPI and glibc.
2013-09-06 01:02:30 -04:00
Adhemerval Zanella 5430fc65a1 PowerPC: fix POWER7 memrchr for some large inputs 2013-09-05 09:32:56 -05:00
Mike Frysinger bb8ea71379 tst-fanotify: skip when we get back EPERM
Since fanotify_init requires CAP_SYS_ADMIN in order to work (which usually
means running as root), we need to handle that error case too.

Reported-by: Andreas Jaeger <aj@suse.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-05 03:04:01 -04:00
Joseph Myers 3f2e46a494 Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
Joseph Myers ffa3cd7f1a Fix lgammaf spurious underflow (bug 15427). 2013-09-03 15:32:54 +00:00
Ondřej Bílka 8f02859f17 Add unaligned strcmp. 2013-09-03 16:27:10 +02:00
Mike Frysinger ac44401205 tst-fanotify: new simple test
Basic test for the fanotify functions.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-02 23:22:23 -04:00
Joseph Myers b7835e3223 Fix spurious jnf underflows (bug 14155). 2013-09-02 14:51:24 +00:00
Ondřej Bílka 8220f4f008 Fix typo. 2013-09-02 11:29:34 +02:00
Ondřej Bílka f24a6d086b Fix then/than typos. 2013-08-30 18:10:31 +02:00
Ondřej Bílka 382466e04e Fix typos. 2013-08-30 18:08:59 +02:00
Ondřej Bílka 0186c6e97e Fix rawmemchr regression on bulldozer. 2013-08-30 10:14:37 +02:00
Ondřej Bílka d4e16af1ae Remove aix specific files. 2013-08-29 18:11:45 +02:00
Thomas Schwinge 8833598053 Hurd: Add ESUCCESS error_t value. 2013-08-29 12:22:30 +02:00
Samuel Thibault ed479b02c2 Hurd: Use __executable_start symbol instead of _start.
_start points to the first instruction, not to the ELF header.
__executable_start does point on the ELF header.
2013-08-29 12:22:19 +02:00
Thomas Schwinge d821f07c9e Support ELFOSABI_GNU on all GNU systems. 2013-08-29 12:22:18 +02:00
Thomas Schwinge c54290cf08 Use ELFOSABI_GNU instead of ELFOSABI_LINUX. 2013-08-29 12:22:17 +02:00
Thomas Schwinge 0007fc9bdd [BZ #15522] strtod ("nan(N)") returning a sNaN in some cases 2013-08-29 12:22:10 +02:00
Ondřej Bílka 6f65e66895 Fix typos. 2013-08-29 09:11:45 +02:00
Siddhesh Poyarekar 3a30923983 Use __glibc_unlikely instead of __builtin_expect (..., 0) 2013-08-28 09:44:19 +05:30
Roland McGrath 5d1f0a09f3 True stub __ifreq. 2013-08-27 10:42:52 -07:00
Roland McGrath 6fcf28b352 Clean up __libc_sa_len helper. 2013-08-27 10:34:16 -07:00
Roland McGrath e041fb8b65 Replace generic bits/socket.h with 4.4 file. 2013-08-27 10:33:15 -07:00
Roland McGrath 8cc3269f95 Flesh out 4.4 bits/socket.h with SOCK_CLOEXEC, SOCK_NONBLOCK. 2013-08-27 10:32:30 -07:00
Andreas Schwab 5d228a436a Fix handling LC_CTYPE nonascii-case fallback in i686 SSE4.2 and SSSE3 strcasecmp/strncasecmp 2013-08-27 12:19:03 +02:00
Ondřej Bílka c0c3f78afb Fix typos. 2013-08-21 19:48:48 +02:00
Liubov Dmitrieva 46ed103824 i686: Skip SSE4_2 version for strcmp, strncmp, strncase, strcasecmp
if bit_Slow_SSE4_2 is set.
2013-08-21 18:25:08 +04:00
Adhemerval Zanella d400dcac5e PowerPC: fix backtrace to handle signal trampolines
This patch fixes backtrace for PPC32 and PPC64 to correctly handle
signal trampolines. The 'debug/tst-backtrace6.c' also check for
SA_SIGINFO handling, where is triggers another vDSO symbols for PPC32.
2013-08-20 15:05:49 -05:00
Joseph Myers c980f2f4fe Fix cproj handling of (finite, NaN) arguments (bug 15531). 2013-08-20 19:41:15 +00:00
Joseph Myers 0716c4fc9f Include <string.h> in sysdeps/unix/sysv/linux/mmap64.c. 2013-08-20 19:38:23 +00:00
Joseph Myers 42c8fdd8f1 Use __getpagesize and __ffs in MMAP2_PAGE_SHIFT == -1 case of mmap64. 2013-08-20 16:43:59 +00:00
Andreas Krebbel 4e39af6eca * sysdeps/unix/sysv/linux/s390/sys/procfs.h (struct elf_prstatus):
Align 32 bit compat elf_greg to 8 bytes.
2013-08-20 14:13:59 +02:00
Florian Weimer 91ce40854d CVE-2013-4237, BZ #14699: Buffer overflow in readdir_r
* sysdeps/posix/dirstream.h (struct __dirstream): Add errcode
	member.
	* sysdeps/posix/opendir.c (__alloc_dir): Initialize errcode
	member.
	* sysdeps/posix/rewinddir.c (rewinddir): Reset errcode member.
	* sysdeps/posix/readdir_r.c (__READDIR_R): Enforce NAME_MAX limit.
	Return delayed error code.  Remove GETDENTS_64BIT_ALIGNED
	conditional.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Do not define
	GETDENTS_64BIT_ALIGNED.
	* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise.
	* manual/filesys.texi (Reading/Closing Directory): Document
	ENAMETOOLONG return value of readdir_r.  Recommend readdir more
	strongly.
	* manual/conf.texi (Limits for Files): Add portability note to
	NAME_MAX, PATH_MAX.
	(Pathconf): Add portability note for _PC_NAME_MAX, _PC_PATH_MAX.
2013-08-16 09:40:34 +02:00
Andreas Schwab ca0a6bc4c5 Fix cbrtl for ldbl-96 2013-08-13 09:45:02 +02:00
Adhemerval Zanella 7b1f8b581f PowerPC: use _dl_static_init to set GLRO(gl_pagesize)
This patch fixes dlfcn/tststatic5 for PowerPC where pagesize
variable was not properly initialized in certain cases. This patch
is based on other architecture code.
2013-07-23 07:39:57 -05:00
Andreas Krebbel a8fc7a03a8 S/390: ULPs update. 2013-07-22 09:51:52 +02:00
Carlos O'Donell e4608715e6 CVE-2013-2207, BZ #15755: Disable pt_chown.
The helper binary pt_chown tricked into granting access to another
user's pseudo-terminal.

Pre-conditions for the attack:

 * Attacker with local user account
 * Kernel with FUSE support
 * "user_allow_other" in /etc/fuse.conf
 * Victim with allocated slave in /dev/pts

Using the setuid installed pt_chown and a weak check on whether a file
descriptor is a tty, an attacker could fake a pty check using FUSE and
trick pt_chown to grant ownership of a pty descriptor that the current
user does not own.  It cannot access /dev/pts/ptmx however.

In most modern distributions pt_chown is not needed because devpts
is enabled by default. The fix for this CVE is to disable building
and using pt_chown by default. We still provide a configure option
to enable hte use of pt_chown but distributions do so at their own
risk.
2013-07-21 15:39:55 -04:00
David S. Miller da2d62df77 Update Sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update ULPs to handle minor
	difference between 32-bit and 64-bit.
2013-07-20 16:47:28 -07:00
Carlos O'Donell d7e06450b9 BZ #15711: Avoid circular dependency for syscall.h
The generated header is compiled with `-ffreestanding' to avoid any
circular dependencies against the installed implementation headers.
Such a dependency would require the implementation header to be
installed before the generated header could be built (See bug 15711).
In current practice the generated header dependencies do not include
any of the implementation headers removed by the use of `-ffreestanding'.

---

2013-07-15  Carlos O'Donell  <carlos@redhat.com>

	[BZ #15711]
	* sysdeps/unix/sysv/linux/Makefile ($(objpfx)bits/syscall%h):
	Avoid system header dependency with -ffreestanding.
	($(objpfx)bits/syscall%d): Likewise.
2013-07-16 17:55:43 -04:00
David S. Miller c61f8513f7 Full from-scratch rebuild of sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Regenerate from scratch.
2013-07-07 22:15:36 -07:00
Jeroen Albers 72c90ed01f Update x86 and x86_64 ulps on AMD FX-8350 with GCC 4.8.1. 2013-07-05 12:58:20 +00:00
Adhemerval Zanella 3f16954315 Update powerpc-fpu ULPs. 2013-07-04 07:14:44 -05:00
Andreas Jaeger 521c6785e1 Sync sys/ptrace with Linux 3.10 2013-07-04 09:49:14 +02:00
Allan McRae d2cc15cb50 Update i386 ULPs.
* sysdeps/i386/fpu/libm-test-ulps: Update.
2013-07-03 12:45:40 +10:00
David S. Miller 3aaeeca7a9 Update sparc ULPs.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2013-07-02 16:41:17 -07:00
Markus Trippelsdorf 5314ed1afd Update x86_64 ULPs. 2013-07-02 22:01:13 +00:00
Joseph Myers 67338156ea Regenerate x86 and x86_64 ulps. 2013-07-02 20:01:15 +00:00
H.J. Lu 1c81621c5b Enable static 32-bit SSE4.2 strcasecmp/strncasecmp 2013-07-02 08:06:04 -07:00
Liubov Dmitrieva 6308fd9a46 Skip SSE4.2 versions on Intel Silvermont
SSE2/SSSE3 versions are faster than SSE4.2 versions on Intel Silvermont.
2013-06-28 15:31:40 -07:00
Ryan S. Arnold 89cd956937 PowerPC: Define AT_HWCAP2 bits and AT_HWCAP2 handling for POWER8. 2013-06-28 16:52:49 -05:00
Ryan S. Arnold 1ae8bfe07c Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type. 2013-06-28 16:50:48 -05:00
Joseph Myers 8fbec01098 Consistently use page_shift in sysdeps/unix/sysv/linux/mmap64.c. 2013-06-28 21:45:11 +00:00
Liubov Dmitrieva 11b8a0e1d7 Fix buffers overrun in x86_64 memcmp-ssse3.S 2013-06-26 12:31:51 -07:00
Mike Frysinger 17db6e8d6b [BZ #10283] localedef: align fixed maps to SHMLBA
Many Linux arches require fixed mmaps to be aligned higher than pagesize,
so use the SHMLBA define as it represents this quantity exactly.

This fixes spurious errors seen on those arches like:
cannot map archive header: Invalid argument

URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10283
Reported-by: CHIKAMA Masaki <masaki.chikama@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-06-24 20:26:58 -04:00
Ryan S. Arnold 2f063a6e84 PowerPC: Enable POWER8 platform sans hwcap bits. 2013-06-24 15:33:32 -05:00
Joseph Myers d8412221e6 Include <string.h> in sysdeps/unix/sysv/linux/libc_fatal.c. 2013-06-22 19:30:10 +00:00
Kaz Kojima be09e8c9ec Add sh4 implementation of fegetexceptflag. 2013-06-21 18:07:31 +09:00
Roland McGrath 346d65b33a Rewrite sysd-rules generation using an awk script. 2013-06-17 09:55:21 -07:00
Joseph Myers 3711a167f6 Fix spurious "inexact" exceptions from dbl-64 sqrt (bug 15631). 2013-06-15 19:59:41 +00:00
Siddhesh Poyarekar 61dd6208fb New API to set default thread attributes
This patch introduces two new convenience functions to set the default
thread attributes used for creating threads.  This allows a programmer
to set the default thread attributes just once in a process and then
run pthread_create without additional attributes.
2013-06-15 12:24:15 +05:30