Commit Graph

9490 Commits

Author SHA1 Message Date
John David Anglin fae1aa8d22 hppa: Fix feholdexcpt and fesetenv (Bug 18110).
The constraints in the inline assembly in feholdexcept and fesetenv
are incorrect. The assembly modifies the buffer pointer, but doesn't
express that in the constraints. The simple fix is to remove the
modification of the buffer pointer which is no longer required by
the existing code, and adjust the one constraint that did express
the modification of bufptr.

The change fixes test-fenv when glibc is compiled with recent gcc.
2015-03-11 02:48:22 -04:00
Carlos O'Donell 85ca85ae9a hppa: Update libm-test-ulps. 2015-03-10 16:09:37 -04:00
Adhemerval Zanella d421868bb8 powerpc: Fix incorrect results for pow when using FMA
This patch adds no FMA generation for e_pow to avoid precision issues
for powerpc.  This fixes BZ#18104.
2015-03-10 09:38:54 -04:00
Adhemerval Zanella d439bc56e1 Update powerpc-fpu ULPs. 2015-03-09 13:42:42 -04:00
Samuel Thibault 9f95dc5d22 hurd: Make libc able to call pthread stubs
* sysdeps/mach/hurd/bits/libc-lock.h [_LIBC]: Include
	<bits/libc-lockP.h>
2015-03-08 11:26:57 +01:00
Samuel Thibault 1cdf2ea1fa Fix aio_error thread-safety.
* sysdeps/pthread/aio_error.c: New file
* sysdeps/pthread/aio_misc.c: Remove optimistic comment about
synchronization.
2015-03-06 11:32:24 +01:00
H.J. Lu 209826bcf2 Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY
ELF_RTYPE_CLASS_NOCOPY in comments is a typo.  It should be
ELF_RTYPE_CLASS_COPY.

	[BZ #18082]
	* sysdeps/alpha/dl-machine.h (elf_machine_type_class): Replace
	ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY in comments.
	* sysdeps/arm/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_type_class):
	Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_type_class): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Likewise.
2015-03-05 08:40:41 -08:00
Roland McGrath 8bff5aab5b Define ETH_ALEN in generic <netinet/if_ether.h>. 2015-03-04 16:11:31 -08:00
Adhemerval Zanella 85b290451e powerpc: Fix inline feraiseexcept, feclearexcept macros
This patch fixes the inline feraiseexcept and feclearexcept macros for
powerpc by casting the input argument to integer before operation on it.

It fixes BZ#17776.
2015-03-03 10:01:49 -05:00
Roland McGrath 47465629e7 Deglobalize internal variables in timer_routines.c. 2015-03-02 15:44:27 -08:00
Joseph Myers 6d08b0223a Correct __ASSUME_PRLIMIT64 for hppa/microblaze/sh (bug 17779).
__ASSUME_PRLIMIT64 is defined in kernel-features.h for kernels 2.6.36
and later, but hppa, microblaze and sh did not add the prlimit64
syscall until 2.6.37.  This patch adds corresponding undefines of
__ASSUME_PRLIMIT64 to those architectures' kernel-features.h files.

(This concludes the kernel-features.h fixes arising out of the review
- limited to macros defined in the architecture-independent
kernel-features.h file - I did in connection with the move to 2.6.32
minimum kernel version.  For that subset of macros - I didn't check
any purely architecture-specific macros - I think they are now defined
for the correct kernel versions on each architecture after this
patch.)

	[BZ #17779]
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
	Undefine.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
	Likewise.
2015-03-02 23:05:55 +00:00
Joseph Myers 2ca725c594 Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047).
The threshold in ldbl-96 atanhl for when to return the argument,
0x1p-28, is a bit too big, and that in ldbl-128ibm atanhl is much too
big (the relevant condition being x^3/3 being < 0.5ulp of x),
resulting in errors a bit above the limits of those considered
acceptable in glibc in the ldbl-96 case, and in large errors in the
ldbl-128ibm case.  This patch changes those implementations to use
more appropriate thresholds and adds tests around the thresholds for
various formats.

Tested for x86_64, x86 and powerpc.  x86_64 and x86 ulps updated
accordingly.

	[BZ #18046]
	[BZ #18047]
	* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Use
	0x1p-56L as threshold for just returning the argument.
	* sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Use
	0x1p-32L as threshold for just returning the argument.
	* math/auto-libm-test-in: Add more tests of atanh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulp: Likewise.
2015-02-27 17:48:37 +00:00
John David Anglin 49f476f479 hppa: fix __O_SYNC to match the kernel 2015-02-27 01:46:01 -05:00
Joseph Myers f8ab5d38fd Add comment to CSTR macro in k_standard.c.
* sysdeps/ieee754/k_standard.c (CSTR): Add comment.
2015-02-27 01:12:19 +00:00
Joseph Myers 31331a07a5 Avoid -Wno-write-strings for k_standard.c.
We want to avoid -Wno- options in makefiles as far as possible, by
cleaning up the underlying issues if possible or failing that by using
diagnostic pragmas.  This patch eliminates the use of
-Wno-write-strings for sysdeps/ieee754/k_standard.c by using casts in
the source file to cast away const; those casts are encapsulated in a
macro that also deals with the choice of strings for float / double /
long double functions (for which the logic was previously replicated
many times).

Tested for x86_64; the only change to disassembly of installed
stripped shared libraries was a line number in an assertion.

	* sysdeps/ieee754/k_standard.c (CSTR): New macro.
	(__kernel_standard): Use CSTR macro when setting exc.name.
	* sysdeps/ieee754/Makefile [$(subdir) = math]
	(CFLAGS-k_standard.c): Remove variable.
2015-02-26 22:50:54 +00:00
Joseph Myers 09220e6634 Avoid uninitialized warnings in Bessel functions.
math/Makefile currently has:

  # The fdlibm code generates a lot of these warnings but is otherwise clean.
  override CFLAGS += -Wno-uninitialized

This is of course undesirable; warnings should be disabled as narrowly
as possible.  To remove this override, we need to fix files that
generate such warnings, or put warning-disabling pragmas in them.
This patch does so for Bessel function implementations, one of the
cases that have the warnings if the override is removed.  The warnings
arise because functions set pointer variables p and q only for certain
values of the function argument, then use them unconditionally.  As
the static functions in question only get called for arguments that
satisfy the last condition in the if/else chain, the natural fix is to
change the last "else if" to just "else", which this patch does.  (The
ldbl-128 / ldbl-128ibm implementation of these functions is
substantially different and looks like it already does use "else" in
the last case in the nearest corresponding code.)

Tested for x86_64 and x86.

	* sysdeps/ieee754/dbl-64/e_j0.c (pzero): Change last case for
	setting p and q from "else if" to "else".
	(qzero): Likewise.
	* sysdeps/ieee754/dbl-64/e_j1.c (pone): Likewise.
	(qone): Likewise.
	* sysdeps/ieee754/flt-32/e_j0f.c (pzerof): Likewise.
	(qzerof): Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c (ponef): Likewise.
	(qonef): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j0l.c (pzero): Likewise.
	(qzero): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j1l.c (pone): Likewise.
	(qone): Likewise.
2015-02-26 21:49:19 +00:00
Joseph Myers 1d9ab20c14 Fix ldbl-128/ldbl-128ibm acosl inaccuracy (bug 18038, bug 18039).
The ldbl-128 and ldbl-128ibm implementations of acosl have similar
bugs, using a threshold of 0x1p-57L to determine when they just return
pi/2.  Since the result pi/2 - asinl (x) is roughly pi/2 - x for small
x, the relevant cut-off is actually x being < 0.5ulp of 1.  This patch
fixes the implementations to use that cut-off and adds tests of small
acos arguments.

Tested for powerpc and mips64.  Also tested for x86_64 and x86; no
ulps updates needed.

	[BZ #18038]
	[BZ #18039]
	* sysdeps/ieee754/ldbl-128/e_acosl.c (__ieee754_acosl): Only
	return pi/2 for arguments below 0x1p-113L.
	* sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Only
	return pi/2 for arguments below 0x1p-106L.
	* math/auto-libm-test-in: Add more tests of acos.
	* math/auto-libm-test-out: Regenerated.
2015-02-26 21:06:34 +00:00
Joseph Myers ec0ce0d3be Fix asin missing underflows (bug 16351).
Similar to various other bugs in this area, some asin implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, powerpc and mips64.

	[BZ #16351]
	* sysdeps/i386/fpu/e_asin.S (dbl_min): New object.
	(MO): New macro.
	(__ieee754_asin): Force underflow exception for results with small
	absolute value.
	* sysdeps/i386/fpu/e_asinf.S (flt_min): New object.
	(MO): New macro.
	(__ieee754_asinf): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/dbl-64/e_asin.c: Include <float.h> and <math.h>.
	(__ieee754_asin): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/flt-32/e_asinf.c: Include <float.h>.
	(__ieee754_asinf): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/x86_64/fpu/multiarch/e_asin.c [HAVE_FMA4_SUPPORT]:
	Include <math.h>.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 16351.
	* math/auto-libm-test-out: Regenerated.
2015-02-26 17:18:54 +00:00
Joseph Myers 380bd0fd24 Fix ldbl-128ibm logbl near powers of 2 (bug 18030).
The ldbl-128ibm implementation of logbl produces incorrect results
when the high part of the argument is a power of 2 and the low part a
nonzero number with the opposite sign (and so the returned exponent
should be 1 less than that of the high part).  For example, logbl
(0x1.ffffffffffffffp1L) returns 2 but should return 1.  (This is
similar to (fixed) bug 16740 for frexpl, and (fixed) bug 18029 for
ilogbl.)  This patch adds checks for that case.

Tested for powerpc.

	[BZ #18030]
	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Adjust exponent
	of power of 2 down when low part has opposite sign.
	* math/libm-test.inc (logb_test_data): Add more tests.
2015-02-26 15:14:58 +00:00
Joseph Myers 524ae9ea2e Fix ldbl-128ibm ilogbl near powers of 2 (bug 18029).
The ldbl-128ibm implementation of ilogbl produces incorrect results
when the high part of the argument is a power of 2 and the low part a
nonzero number with the opposite sign (and so the returned exponent
should be 1 less than that of the high part).  For example, ilogbl
(0x1.ffffffffffffffp1L) returns 2 but should return 1.  (This is
similar to (fixed) bug 16740 for frexpl, and bug 18030 for logbl.)
This patch adds checks for that case.

Tested for powerpc.

	[BZ #18029]
	* sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl):
	Adjust exponent of power of 2 down when low part has opposite
	sign.
	* math/libm-test.inc (ilogb_test_data): Add more tests.
2015-02-26 12:57:21 +00:00
Adhemerval Zanella 115e0de72a powerpc: Fix memmove static build
This patch fixes the missing "__memcpy_ppc" symbol for memmove-ppc64
object in static builds.  Since memcpy ifunc is not enabled in static
mode, the specialized symbols are not provided.  The patch changed the
it to just "__memcpy" instead.
2015-02-25 13:25:54 -05:00
Joseph Myers 137cef7d43 Fix ldbl-128ibm asinhl inaccuracy (bug 18020).
The ldbl-128ibm implementation of asinhl uses cut-offs of 0x1p28 and
0x1p-29 to determine when to use simpler formulas that avoid possible
overflow / underflow.  Both those cut-offs are inappropriate for this
format, resulting in large errors.  This patch changes the code to use
more appropriate cut-offs of 0x1p56 and 0x1p-56, adding tests around
the cut-offs for various floating-point formats.

Tested for powerpc.  Also tested for x86_64 and x86 and updated ulps.

	[BZ #18020]
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Use 2**56 and
	2**-56 not 2**28 and 2**-29 as thresholds for simpler formulas.
	* math/auto-libm-test-in: Add more tests of asinh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-02-25 11:13:41 +00:00
Cong Wang cb43bb0d68 in.h: Coordinate in6_pktinfo and ip6_mtuinfo for kernel and glibc [BZ #15850]
Similarly to what we did for in6_addr, we need a macro
to guard in6_pktinfo and ip6_mtuinfo too.

Cc: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2015-02-25 00:13:28 -05:00
Miroslav Lichvar b433df00ae Update timex.h for ADJ_SETOFFSET.
ADJ_SETOFFSET is a new adjtimex() mode that can be used to precisely
step the clock. It was introduced in kernel 2.6.39.
2015-02-24 23:53:30 -05:00
Joseph Myers 440169d681 Fix ldbl-128ibm acoshl inaccuracy (bug 18019).
The ldbl-128ibm implementation of acoshl uses a cut-off of 0x1p28 to
determine when to use log(x) + log(2) as a formula.  That cut-off is
too small for this format, resulting in large errors.  This patch
changes it to a more appropriate cut-off of 0x1p56, adding tests
around the cut-offs for various floating-point formats.

Tested for powerpc.  Also tested for x86_64 and x86 and updated ulps.

	[BZ #18019]
	* sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Use
	2**56 not 2**28 as threshold for log (2x) formula.
	* math/auto-libm-test-in: Add more tests of acosh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-02-25 00:01:15 +00:00
Joseph Myers 9438b237ab Fix x86/x86_64 scalb (qNaN, -Inf) (bug 16783).
Various x86 / x86_64 versions of scalb / scalbf / scalbl produce
spurious "invalid" exceptions for (qNaN, -Inf) arguments, because this
is wrongly handled like (+/-Inf, -Inf) which *should* raise such an
exception.  (In fact the NaN case of the code determining whether to
quietly return a zero or a NaN for second argument -Inf was
accidentally dead since the code had been made to return a NaN with
exception.)  This patch fixes the code to do the proper test for an
infinity as distinct from a NaN.

(Since the existing code does nothing to distinguish qNaNs and sNaNs
here, this patch doesn't either.  If in future we systematically
implement proper sNaN semantics following TS 18661-1:2014, there will
be lots of bugs to address - Thomas found lots of issues with his
patch <https://sourceware.org/ml/libc-ports/2013-04/msg00008.html> to
add SNaN tests (which never went in and would now require significant
reworking).)

Tested for x86_64 and x86.  Committed.

	[BZ #16783]
	* sysdeps/i386/fpu/e_scalb.S (__ieee754_scalb): Do not handle
	arguments (NaN, -Inf) the same as (+/-Inf, -Inf).
	* sysdeps/i386/fpu/e_scalbf.S (__ieee754_scalbf): Likewise.
	* sysdeps/i386/fpu/e_scalbl.S (__ieee754_scalbl): Likewise.
	* sysdeps/x86_64/fpu/e_scalbl.S (__ieee754_scalbl): Likewise.
	* math/libm-test.inc (scalb_test_data): Add more tests.
2015-02-24 17:30:02 +00:00
Eric Rannaud 65f6f938cd linux: open and openat ignore 'mode' with O_TMPFILE in flags
Both open and openat load their last argument 'mode' lazily, using
va_arg() only if O_CREAT is found in oflag. This is wrong, mode is also
necessary if O_TMPFILE is in oflag.

By chance on x86_64, the problem wasn't evident when using O_TMPFILE
with open, as the 3rd argument of open, even when not loaded with
va_arg, is left untouched in RDX, where the syscall expects it.

However, openat was not so lucky, and O_TMPFILE couldn't be used: mode
is the 4th argument, in RCX, but the syscall expects its 4th argument in
a different register than the glibc wrapper, in R10.

Introduce a macro __OPEN_NEEDS_MODE (oflag) to test if either O_CREAT or
O_TMPFILE is set in oflag.

Tested on Linux x86_64.

	[BZ #17523]
	* io/fcntl.h (__OPEN_NEEDS_MODE): New macro.
	* io/bits/fcntl2.h (open): Use it.
	(openat): Likewise.
	* io/open.c (__libc_open): Likewise.
	* io/open64.c (__libc_open64): Likewise.
	* io/open64_2.c (__open64_2): Likewise.
	* io/open_2.c (__open_2): Likewise.
	* io/openat.c (__openat): Likewise.
	* io/openat64.c (__openat64): Likewise.
	* io/openat64_2.c (__openat64_2): Likewise.
	* io/openat_2.c (__openat_2): Likewise.
	* sysdeps/mach/hurd/open.c (__libc_open): Likewise.
	* sysdeps/mach/hurd/openat.c (__openat): Likewise.
	* sysdeps/posix/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
	* sysdeps/unix/sysv/linux/generic/open.c (__libc_open): Likewise.
	(__open_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/generic/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__OPENAT): Likewise.
2015-02-24 13:19:22 +05:30
Mike Frysinger cda700b4c8 hppa: fix build failure with RTLD_PRIVATE_ERRNO
Pull in dl-sysdep.h like every other linux sysdep.h header does when it
wants to use RTLD_PRIVATE_ERRNO.
2015-02-24 00:10:42 -05:00
Stefan Liebler 7133957fe8 s390: Use generic lowlevellock-futex.h
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Include
      <sysdeps/nptl/lowlevellock.h> and remove macros and
      functions that are now defined there.
      (SYS_futex): Remove.
      (lll_compare_and_swap): Remove.
      * sysdeps/s390/bits/atomic.h (atomic_exchange_acq): Define.
2015-02-20 10:48:06 +01:00
Joseph Myers 4629c866ad Fix atan / atan2 missing underflows (bug 15319).
This patch fixes bug 15319, missing underflows from atan / atan2 when
the result of atan is very close to its small argument (or that of
atan2 is very close to the ratio of its arguments, which may be an
exact division).

The usual approach of doing an underflowing computation if the
computed result is subnormal is followed.  For 32-bit x86, there are
extra complications: the inline __ieee754_atan2 in bits/mathinline.h
needs to be disabled for float and double because other libm functions
using it generally rely on getting proper underflow exceptions from
it, while the out-of-line functions have to remove excess range and
precision from the underflowing result so as to return an exact 0 in
the case where errno should be set for underflow to 0.  (The failures
I saw without that are similar to those Carlos reported for other
functions, where I haven't seen a response to
<https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>
confirming if my diagnosis is correct.  Arguably all libm functions
with float and double returns should remove excess range and
precision, but that's a separate matter.)

The x86_64 long double case reported in a comment in bug 15319 is not
a bug (it's an argument of LDBL_MIN, and x86_64 is an after-rounding
architecture so the correct IEEE result is not to raise underflow in
the given rounding mode, in addition to treating the result as an
exact LDBL_MIN being within the newly clarified documentation of
accuracy goals).  I'm presuming that the fpatan instruction can be
trusted to raise appropriate exceptions when the (long double) result
underflows (after rounding) and so no changes are needed for x86 /
x86_64 long double functions here; empirically this is the case for
the cases covered in the testsuite, on my system.

Tested for x86_64, x86, powerpc and mips64.  Only 32-bit x86 needs
ulps updates (for the changes to inlines meaning some functions no
longer get excess precision from their __ieee754_atan2* calls).

	[BZ #15319]
	* sysdeps/i386/fpu/e_atan2.S (dbl_min): New object.
	(MO): New macro.
	(__ieee754_atan2): For results with small absolute value, force
	underflow exception and remove excess range and precision from
	return value.
	* sysdeps/i386/fpu/e_atan2f.S (flt_min): New object.
	(MO): New macro.
	(__ieee754_atan2f): For results with small absolute value, force
	underflow exception and remove excess range and precision from
	return value.
	* sysdeps/i386/fpu/s_atan.S (dbl_min): New object.
	(MO): New macro.
	(__atan): For results with small absolute value, force underflow
	exception and remove excess range and precision from return value.
	* sysdeps/i386/fpu/s_atanf.S (flt_min): New object.
	(MO): New macro.
	(__atanf): For results with small absolute value, force underflow
	exception and remove excess range and precision from return value.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Include <float.h> and
	<math.h>.
	(__ieee754_atan2): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/dbl-64/s_atan.c: Include <float.h> and
	<math_private.h>.
	(atan): Force underflow exception for results with small absolute
	value.
	* sysdeps/ieee754/flt-32/s_atanf.c: Include <float.h>.
	(__atanf): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/ldbl-128/s_atanl.c: Include <float.h> and
	<math.h>.
	(__atanl): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <float.h>.
	(__atanl): Force underflow exception for results with small
	absolute value.
	* sysdeps/x86/fpu/bits/mathinline.h
	[!__SSE2_MATH__ && !__x86_64__ && __LIBC_INTERNAL_MATH_INLINES]
	(__ieee754_atan2): Only define inline for long double.
	* sysdeps/x86_64/fpu/multiarch/e_atan2.c
	[HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Include <math.h>.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 15319.  Add more tests of atan2.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (casin_test_data): Do not mark underflow
	exceptions as possibly missing for bug 15319.
	(casinh_test_data): Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-02-18 21:10:49 +00:00
Steve Ellcey 9ee16d8b34 2015-02-18 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/unix/sysv/linux/mips/bits/endian.h: Remove.
	* sysdeps/mips/bits/endian.h: Fix comments.
2015-02-18 10:51:37 -08:00
Joseph Myers 1a2325c06c Fix posix_spawn getrlimit64 namespace (bug 17991).
posix_spawn (a standard POSIX function) brings in a use of getrlimit64
(not a standard POSIX function).  This patch fixes this by using
__getrlimit64 and making getrlimit64 a weak alias.

This is more complicated than some such changes because of files that
define getrlimit64 in their own way using symbol versioning after
including the main sysdeps/unix/sysv/linux/getrlimit64.c with a
getrlimit macro defined.  There are various existing patterns for such
cases in glibc; the one I've used here is that a getrlimit64 macro
disables the weak_alias / libc_hidden_weak calls, leaving it to the
including file to define the getrlimit64 name in whatever way is
appropriate.

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

	[BZ #17991]
	* include/sys/resource.h (__getrlimit64): Declare.  Use
	libc_hidden_proto.
	* resource/getrlimit64.c (getrlimit64): Rename to __getrlimit64
	and define as weak alias of __getrlimit64.  Use libc_hidden_weak.
	* sysdeps/posix/spawni.c (__spawni): Call __getrlimit64 instead of
	getrlimit64.
	* sysdeps/unix/sysv/linux/getrlimit64.c (getrlimit64): Rename to
	__getrlimit64.
	[!getrlimit64] (getrlimit64): Define as weak alias of
	__getrlimit64.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/i386/getrlimit64.c (getrlimit64): Define
	using __getrlimit64 not __new_getrlimit64.
	(__GI_getrlimit64): Likewise.
	* sysdeps/unix/sysv/linux/mips/getrlimit64.c (getrlimit64):
	Likewise.
	(__GI_getrlimit64): Likewise.
	(__old_getrlimit64): Use __getrlimit64 not __new_getrlimit64.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list
	(getrlimit): Add __getrlimit64 alias.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (getrlimit):
	Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/spawn.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/spawn.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/spawn.h/linknamespace): Likewise.
2015-02-18 00:26:35 +00:00
Steve Ellcey e72ad0ef31 2015-02-17 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memcpy.S: Move R6 PREFETCH_STORE_HINT check.
	* sysdeps/mips/memset.S: Ditto.
2015-02-17 13:38:49 -08:00
Steve Ellcey 2caa4099de 2015-02-17 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/bits/endian.h (__MIPSEL): Use #ifdef instead of #if.
2015-02-17 10:04:33 -08:00
Stefan Liebler f20bfc9b5e S390: Build failure due to nptl/pt-longjmp.c changes. 2015-02-17 08:47:49 +01:00
Torvald Riegel 71c06b69d3 ia64: Remove custom lowlevellock.h
ia64 seems to use the same implementation of low-level locks as the
generic Linux lowlevellock.h.  The futex syscalls are somewhat
different, but Roland thought it shouldn't matter.  Note that the futex
calls are on the slow path always (except for PI mutexes).

Removing the custom low-level lock implementation will make further
refactoring easier, for example adding proper error checking to futex
operations.
2015-02-17 02:45:12 -05:00
Mike Frysinger a9a05adb24 ia64: drop custom getpagesize
This is equivalent to the common linux version now, so we can drop it.
2015-02-17 02:37:20 -05:00
Joseph Myers ce8fc784e6 Fix sign of remquo zero remainder in round-downward mode (bug 17987).
Various remquo implementations produce a zero remainder with the wrong
sign (a zero remainder should always have the sign of the first
argument, as specified in IEEE 754) in round-downward mode, resulting
from the sign of 0 - 0.  This patch checks for zero results and fixes
their sign accordingly.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #17987]
	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Ensure sign of
	zero result does not depend on the sign resulting from
	subtraction.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Likewise.
	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
	* math/libm-test.inc (remquo_test_data): Add more tests.
2015-02-17 00:41:50 +00:00
Joseph Myers a820f9b3c0 Fix remquo spurious overflows (bug 17978).
Various remquo implementations, when computing the last three bits of
the quotient, have spurious overflows when 4 times the second argument
to remquo overflows.  These overflows can in turn cause bad results in
rounding modes where that overflow results in a finite value.  This
patch adds tests to avoid the problem multiplications in cases where
they would overflow, similar to those that control an earlier
multiplication by 8.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #17978]
	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Do not form
	products 4 * y and 2 * y where those would overflow.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Likewise.
	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
	* math/libm-test.inc (remquo_test_data): Add more tests.
2015-02-16 22:38:28 +00:00
Joseph Myers be802953a1 Fix MIPS _ABIO64 -Werror=undef build.
I see an error

../sysdeps/mips/memcpy.S:209:68: error: "_ABIO64" is not defined [-Werror=undef]
 #if defined(_MIPS_SIM) && ((_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABIO64))
                                                                    ^
cc1: some warnings being treated as errors

in MIPS builds.  This patch arranges for _ABIO64 to be defined with
the same value as GCC uses when building for O64 (the ABI itself isn't
supported by glibc, but defining the macro seems the simplest way of
avoiding the error in code that may be shared with other C libraries).

	* sysdeps/mips/sgidefs.h [!_ABIO64] (_ABIO64): New macro.
2015-02-16 22:25:02 +00:00
Joseph Myers e5e72fe9cd Fix MIPS _COMPILING_NEWLIB -Werror=undef build.
I see an error

../sysdeps/mips/strcmp.S:25:7: error: "_COMPILING_NEWLIB" is not defined [-Werror=undef]
 #elif _COMPILING_NEWLIB
       ^
cc1: some warnings being treated as errors

in MIPS builds.  (This is with GCC 4.9; it's possible that the DR#412
change in GCC 5 - see
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60570> - means that
-Wundef diagnostics no longer occur for #elif conditions where a
previous group's condition was true, just as with other errors there.)
This patch duly adjusts the conditionals to test whether
_COMPILING_NEWLIB is defined.

	* sysdeps/mips/memcpy.S [_COMPILING_NEWLIB]: Change condition to
	[defined _COMPILING_NEWLIB].
	* sysdeps/mips/memset.S [_COMPILING_NEWLIB]: Likewise.
	* sysdeps/mips/strcmp.S [_COMPILING_NEWLIB]: Likewise.
2015-02-16 22:18:53 +00:00
Joseph Myers 86c56b164c Fix MIPS __mips_isa_rev -Werror=undef build.
I see an error

In file included from ../sysdeps/mips/include/sys/asm.h:20:0,
                 from ../sysdeps/mips/start.S:39:
../sysdeps/mips/sys/asm.h:421:5: error: "__mips_isa_rev" is not defined [-Werror=undef]
 #if __mips_isa_rev < 6
     ^
cc1: some warnings being treated as errors

in MIPS builds.  As sys/asm.h is an installed header, it seems better
to test for !defined __mips_isa_rev here, instead of defining it to 0
as done in sysdeps/unix/mips/sysdep.h, to avoid perturbing any code
outside glibc that tests whether __mips_isa_rev is defined; this patch
does so.

	* sysdeps/mips/sys/asm.h [__mips_isa_rev < 6]: Change condition to
	[!defined __mips_isa_rev || __mips_isa_rev < 6].
2015-02-16 22:12:15 +00:00
Matthew Fortune 6f49e32aa5 ia64: remove fixed page size macros and others [BZ #17792]
Remove IA64 PAGE_SIZE related macros as PAGE_SIZE is not defined.
Also remove macros that are only used for BFD's trad-core support
which is not relavant for IA64 according to the thread starting
here:

https://sourceware.org/ml/libc-ports/2013-11/msg00028.html

This patch is neither built nor tested but is equivalent to a MIPS
patch for the same fix.
2015-02-15 00:59:00 -05:00
Steve Ellcey e525154e84 2015-02-13 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/bits/endian.h (__MIPSEB): Use #ifdef instead of #if.
	* sysdeps/mips/memcpy.S (__MIPSEB): Ditto.
	* sysdeps/mips/memset.S (__MIPSEB): Ditto.
2015-02-13 17:38:06 -08:00
Roland McGrath 4ab770b7b1 Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
Joseph Myers d9afe48d55 Fix dbl-64/wordsize-64 remquo (bug 17569).
The dbl-64/wordsize-64 remquo implementation follows similar logic to
various other implementations, but where that logic computes some
absolute values, it wrongly uses a previously computed bit-pattern for
the absolute value of the first argument, where actually it needs the
absolute value of the first argument mod 8 times the second.  This
patch fixes it to compute the correct absolute value.

The integer quotient result of remquo is only specified mod 8
(including its sign); architecture-specific versions may well vary in
what results they give for higher bits of that result (and indeed bug
17569 gives an example correct result from __builtin_remquo giving 9
for that result, where the particular glibc implementation used in
that bug report would give 1 after this fix).  Thus, this patch adapts
the tests of remquo to test that result only mod 8, to allow for such
variation when tests with higher quotient are included.

Tested for x86_64 and x86.

	[BZ #17569]
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Compute absolute value of x as modified by fmod, not original
	value of x.
	* math/libm-test.inc (RUN_TEST_ffI_f1): Rename to
	RUN_TEST_ffI_f1_mod8.  Check extra return value mod 8.
	(RUN_TEST_LOOP_ffI_f1): Rename to RUN_TEST_LOOP_ffI_f1_mod8.  Call
	RUN_TEST_ffI_f1_mod8.
	(remquo_test_data): Add more tests.
2015-02-13 21:54:44 +00:00
Roland McGrath 3846188b21 NPTL: Initializer for .init_array-only configurations. 2015-02-13 13:19:11 -08:00
Joseph Myers 95c26233a1 Fix powerpc software sqrtf (bug 17967).
Similarly to sqrt in
<https://sourceware.org/ml/libc-alpha/2015-02/msg00353.html>, the
powerpc sqrtf implementation for when _ARCH_PPCSQ is not defined also
relies on a * b + c being contracted into a fused multiply-add.
Although this contraction is not explicitly disabled for e_sqrtf.c, it
still seems appropriate to make the file explicit about its
requirements by using __builtin_fmaf; this patch does so.
Furthermore, it turns out that doing so fixes the observed inaccuracy
and missing exceptions (that is, that without explicit __builtin_fmaf
usage, it was not being compiled as intended).

Tested for powerpc32 (hard float).

	[BZ #17967]
	* sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Use
	__builtin_fmaf instead of relying on contraction of a * b + c.
2015-02-13 16:20:36 +00:00
Joseph Myers e8bd5286c6 Fix powerpc software sqrt (bug 17964).
As Adhemerval noted in
<https://sourceware.org/ml/libc-alpha/2015-01/msg00451.html>, the
powerpc sqrt implementation for when _ARCH_PPCSQ is not defined is
inaccurate in some cases.

The problem is that this code relies on fused multiply-add, and relies
on the compiler contracting a * b + c to get a fused operation.  But
sysdeps/ieee754/dbl-64/Makefile disables contraction for e_sqrt.c,
because the implementation in that directory relies on *not* having
contracted operations.

While it would be possible to arrange makefiles so that an earlier
sysdeps directory can disable the setting in
sysdeps/ieee754/dbl-64/Makefile, it seems a lot cleaner to make the
dependence on fused operations explicit in the .c file.  GCC 4.6
introduced support for __builtin_fma on powerpc and other
architectures with such instructions, so we can rely on that; this
patch duly makes the code use __builtin_fma for all such fused
operations.

Tested for powerpc32 (hard float).

2015-02-12  Joseph Myers  <joseph@codesourcery.com>

	[BZ #17964]
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Use
	__builtin_fma instead of relying on contraction of a * b + c.
2015-02-12 23:05:37 +00:00
Roland McGrath 96a157490c Use -Werror=undef for assembly code. 2015-02-12 13:57:32 -08:00
Joseph Myers 03d95bd483 Fix exp2 spurious underflows (bug 16560).
This patch fixes the remaining part of bug 16560, spurious underflows
from exp2 of arguments close to 0 (when the result is close to 1, so
should not underflow), by just using 1+x instead of a more complicated
calculation when the argument is sufficiently small.

Tested for x86_64, x86 and mips64.

	[BZ #16560]
	* math/e_exp2l.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
	and redefine.
	(__ieee754_exp2l): Do not multiply small fractional parts by
	M_LN2l.
	* sysdeps/i386/fpu/e_exp2l.S (__ieee754_exp2l): Just add 1 to
	small argument.
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Likewise.
	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
	* sysdeps/x86_64/fpu/e_exp2l.S (__ieee754_exp2l): Likewise.
	* math/auto-libm-test-in: Add more tests of exp2.
	* math/auto-libm-test-out: Regenerated.
2015-02-12 19:02:45 +00:00
Rajalakshmi Srinivasaraghavan 98408b95b1 powerpc: POWER7 strncpy optimization for unaligned string
This patch optimizes strncpy for power7 for unaligned source or
destination address. The source or destination address is aligned
to doubleword and data is shifted based on the alignment and
added with the previous loaded data to be written as a doubleword.
For each load, cmpb instruction is used for faster null check.

The new optimization shows 10 to 70% of performance improvement
for longer string though it does not show big difference on string
size less than 16 due to additional checks.Hence this new algorithm
is restricted to string greater than 16.
2015-02-12 13:16:08 -05:00
Adhemerval Zanella 6f74150338 powerpc: Fix TABORT encoding for little endian
This patch fix the TABORT encoding for toolchains with no support for
HTM builtins.
2015-02-12 05:34:16 -06:00
Joseph Myers d435569cd6 Fix sincos errno setting (bug 15467).
This patch makes sincos set errno to EDOM when passed an infinity,
similarly to sin and cos.

Tested for x86_64, x86, powerpc and mips64.  I don't know if the
architecture-specific implementations for ia64 and m68k might need
corresponding fixes.

2015-02-11  Joseph Myers  <joseph@codesourcery.com>

	[BZ #15467]
	* sysdeps/ieee754/dbl-64/s_sincos.c: Include <errno.h>.
	(__sincos): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/flt-32/s_sincosf.c: Include <errno.h>.
	(SINCOSF_FUNC): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-128/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-128ibm/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-96/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* math/libm-test.inc (sincos_test_data): Test errno setting.
2015-02-11 23:17:25 +00:00
Joseph Myers 306bc0d1ed Remove sysdeps/mips soft-fp subdirectories.
As noted in
<https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>, soft-fp
sysdeps subdirectories (and more generally, subdirectories where
sysdeps/foo/Implies contains foo/bar) are unnecessary and should be
eliminated.  This patch does so for MIPS.

Tested for MIPS64 (all three ABIs, soft-float) that installed stripped
shared libraries are unchanged by this patch.

	* sysdeps/mips/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/mips/mips32/sfp-machine.h: ... here.
	* sysdeps/mips/mips64/soft-fp/Makefile: Move to ....
	* sysdeps/mips/mips64/Makefile: ... here.
	* sysdeps/mips/mips64/soft-fp/e_sqrtl.c: Move to ....
	* sysdeps/mips/mips64/e_sqrtl.c: ... here.
	* sysdeps/mips/mips64/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/mips/mips64/sfp-machine.h: ... here.
	* sysdeps/mips/mips32/Implies: Remove mips/soft-fp.
	* sysdeps/mips/mips64/n32/Implies: Remove mips/mips64/soft-fp.
	* sysdeps/mips/mips64/n64/Implies: Likewise.
2015-02-10 22:01:39 +00:00
Evangelos Foutras 132a1328ec Fix __memcpy_chk on non-SSE2 CPUs
In commit 8b4416d, the 1: jump label in __mempcpy_chk was accidentally
moved.  This resulted in failures of mempcpy on CPU without SSE2.
2015-02-10 21:39:06 +10:00
Adhemerval Zanella bc0cdc4981 powerpc: drop R_PPC_REL16 check
Current minimum support binutils (2.22) supports R_PPC_REL16 as default,
so no need to extra configure checks.
2015-02-10 06:09:22 -05:00
Adhemerval Zanella 83658961f0 powerpc: sysdeps/powerpc configure cleanup
Current minimum binutils supported (2.22) has ".machine altivec" support
as default, so there is no need to add a configure check for such
functionality.  This patches removes the configure checks for it.
2015-02-10 06:08:24 -05:00
Adhemerval Zanella 10169938b1 powerpc: wordcopy/memmove cleanup for ppc32
This patch cleanup some multiarch code related to memmmove
optimization. Initial IFUNC support added specialized wordcopy
symbols which turned in local IFUNC calls used by memmove default
implementation.  The patch removes the internal IFUNC for wordcopy
symbols and uses local branches in the memmmove optimization instead.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 8548a53d69 powerpc: multiarch Makefile cleanup for powerpc32
This patch cleanups the multiarch Makefile by putting the wide chars
implementation to correct wcsmbs rule.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella b269211467 powerpc: wordcopy/memmove cleanup for ppc64
This patch cleanup some multiarch code related to memmmove
optimization. Initial IFUNC support added specialized wordcopy
symbols which turned in local IFUNC calls used by memmove default
implementation.

This change by removing then and used the optimized memmove instead
for supported chips.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 18e270aada powerpc: Remove POWER7 wordcopy ifunc
This patch remove the POWER7 ifunc wordcopy function
(_wordcopy_*_power7), since now GLIBC provides a optimized memmove/bcopy
for POWER7.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 6f0993a638 powerpc: Simplify bcopy default implementation
This patch simplify the default bcopy symbol for powerpc64 by just using
memmove instead of implementing using the default bcopy.  Since the
symbol is deprecated, it trades speed by code size.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 3001e54c57 powerpc: multiarch Makefile cleanup for powerpc64
This patch cleanups the multiarch Makefile by putting the wide chars
implementation to correct wcsmbs rule.
2015-02-09 06:42:27 -05:00
Andreas Schwab 59b61c82fe Fix value of O_TMPFILE for architectures with non-default O_DIRECTORY (bug 17912) 2015-02-09 10:41:48 +01:00
Samuel Thibault 28b067571e hurd: fix unwind-resume.c build 2015-02-08 18:46:00 +01:00
Samuel Thibault ff78268891 hurd: fix unwind-resume.c build 2015-02-08 18:35:54 +01:00
Samuel Thibault 4fc81a777a hurd: fix tls.h build 2015-02-08 05:06:17 +01:00
Samuel Thibault a5eb23deb6 hurd: Ignore bytes beyond sockaddr length for AF_UNIX 2015-02-08 04:26:54 +01:00
Samuel Thibault f05826f07f hurd: add basic types for ioctls 2015-02-07 22:26:09 +01:00
Samuel Thibault e86c5b6459 hurd: support mmap with PROT_NONE 2015-02-07 22:22:40 +01:00
Samuel Thibault 5d2556c4fa hurd: fix f?chflags prototypes, declare them and their flags 2015-02-07 21:56:15 +01:00
Samuel Thibault e2049d17a0 hurd: fix build with pthread aio 2015-02-07 21:48:32 +01:00
Roland McGrath f8d1bb4c25 ARM: Add missing sfi_breg in LDR_GLOBAL macro. 2015-02-06 14:42:18 -08:00
Roland McGrath 9e7265f4e5 NPTL: Build tests using clone directly only for Linux. 2015-02-06 12:30:23 -08:00
Roland McGrath ea02c6b812 x86: Clean up __vdso_clock_gettime variable. 2015-02-06 10:44:11 -08:00
Roland McGrath ac9e0e5e40 Clean up sysdep-dl-routines variable. 2015-02-06 10:42:08 -08:00
Carlos O'Donell 3c0c543b87 hppa: Sync with pthread.h.
This reverts part of the previous commit to refactor pthread.h.
The refactoring must be done by having pthread.h include arch
bits headers, not the other way around. Then hppa provides the
arch bits header. For now we synchronzie again with pthread.h
and include the entire contents in the hppa copy.
2015-02-06 01:59:32 -05:00
Carlos O'Donell 04cb913ddf glibc 2.21 pre-release update.
Update all translations.

Update contributions in the manual.

Update installation notes with information about newest working tools.

Reconfigure using exactly autoconf 2.69.

Regenerate INSTALL.
2015-02-05 23:14:38 -05:00
Carlos O'Donell 3f823f488a hppa: Remove warnings and fix conformance errors.
(1) Fix warnings.

This is a bulk update to fix all the warnings that were causing
build failures with -Werror on hppa.

The most egregious problems are in dl-fptr.c which needs to be
entirely rewritten, thus I've used -Wno-error for that.

(2) Fix conformance errors.

The sysdep.c file had __syscall_error and syscall in one file
which caused conformance issues by including syscall when
__syscall_error was linked to. The fix is obviously to split
the file and use syscall.c to implement syscall.
2015-02-05 21:37:47 -05:00
Chung-Lin Tang 34c5604814 Function name typo error in non-PIC case, fixed in this patch. 2015-02-05 06:19:36 -08:00
David S. Miller edac0a60c7 Fix two bugs in sparc atomics.
* sysdeps/sparc/sparc32/bits/atomic.h
	(__sparc32_atomic_do_unlock24): Put the memory barrier before the
	unlock not after it.
	(__v9_compare_and_exchange_val_32_acq): Use unions to avoid getting
	volatile register usage warnings from the compiler.
2015-01-31 23:39:50 -08:00
David S. Miller d4abeca504 Fix sparc semaphore implementation after recent changes.
* sysdeps/sparc/nptl/sem_init.c: Delete.
	* sysdeps/sparc/nptl/sem_post.c: Delete.
	* sysdeps/sparc/nptl/sem_timedwait.c: Delete.
	* sysdeps/sparc/nptl/sem_wait.c: Delete.
	* sysdeps/sparc/sparc32/sem_init.c: New file.
	* sysdeps/sparc/sparc32/sem_waitcommon.c: New file.
	* sysdeps/sparc/sparc32/sem_open.c: Generic nptl version with
	padding explicitly initialized.
	* sysdeps/sparc/sparc32/sem_post.c: Generic nptl version using
	padding for in-semaphore spinlock.
	* sysdeps/sparc/sparc32/sem_wait.c: Likewise.
	* sysdeps/sparc/sparc32/sem_trywait.c: Delete.
	* sysdeps/sparc/sparc32/sem_timedwait.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/sem_init.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/sem_open.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/sem_post.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/sem_waitcommon.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/sem_wait.c: Redirect to nptl
	version.
	* sysdeps/sparc/sparc32/sparcv9/sem_timedwait.c: Delete.
	* sysdeps/sparc/sparc32/sparcv9/sem_trywait.c: Delete.
2015-01-31 23:39:50 -08:00
H.J. Lu 5f3d0b78e0 Use AVX unaligned memcpy only if AVX2 is available
memcpy with unaligned 256-bit AVX register loads/stores are slow on older
processorsl like Sandy Bridge.  This patch adds bit_AVX_Fast_Unaligned_Load
and sets it only when AVX2 is available.

	[BZ #17801]
	* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
	Set the bit_AVX_Fast_Unaligned_Load bit for AVX2.
	* sysdeps/x86_64/multiarch/init-arch.h (bit_AVX_Fast_Unaligned_Load):
	New.
	(index_AVX_Fast_Unaligned_Load): Likewise.
	(HAS_AVX_FAST_UNALIGNED_LOAD): Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Check the
	bit_AVX_Fast_Unaligned_Load bit instead of the bit_AVX_Usable bit.
	* sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk): Likewise.
	* sysdeps/x86_64/multiarch/memmove.c (__libc_memmove): Replace
	HAS_AVX with HAS_AVX_FAST_UNALIGNED_LOAD.
	* sysdeps/x86_64/multiarch/memmove_chk.c (__memmove_chk): Likewise.
2015-01-30 15:37:58 -08:00
Andreas Schwab b658fdd82b Include <signal.h> in sysdeps/nptl/allocrtsig.c
Architectures which don't use hp-timing-common.h don't include <signal.h>
via <sys/param.h>.
2015-01-29 10:00:25 +01:00
Chris Metcalf 06991eb816 tilegx32: set __HAVE_64B_ATOMICS to 0
This is because of alignment issues in the sem_t support.
tilegx32 does in fact support 64-bit atomics and we will need
to revisit this after the 2.21 freeze.
2015-01-28 14:51:21 -05:00
Joseph Myers df34134284 Disable 64-bit atomics for MIPS n32.
This patch disables use of 64-bit atomics for MIPS n32 to fix the
problems with unaligned semaphores.

Before 64-bit atomics are used for anything for which such alignment
issues do not arise, and before the addition of any new ILP32 ports
with 64-bit semaphores for which the ABI can be set to have the
greater alignment (AARCH64?), a better approach will need to be
established that allows architectures to declare their 64-bit atomics
availability accurately, without doing so causing inappropriate use of
such atomics on unaligned semaphores.

Tested for MIPS n32 that this fixes the nptl/tst-sem3 failure.

	* sysdeps/mips/bits/atomic.h [_MIPS_SIM == _ABIN32]
	(__HAVE_64B_ATOMICS): Define to 0.
2015-01-28 18:40:35 +00:00
Adhemerval Zanella d4d0ecb244 powerpc: Fix fesetexceptflag [BZ#17885]
This patch fixes a bug introduced by 18f2945ae9, where it optimizes
the FPSCR set by just issuing a mtfs instruction if new flag is different
from older one.  The issue is a typo, where the new flag should the the
new value, instead of the old one.

It fixes BZ#17885.
2015-01-28 05:59:21 -05:00
Adhemerval Zanella 08cee2a464 powerpc: Fix fsqrt build in libm [BZ#16576]
Some powerpc64 processors (e5500 core for instance) does not provide the
fsqrt instruction, however current check to use in math_private.h is
__WORDSIZE and _ARCH_PWR4 (ISA 2.02).  This is patch change it to use
the compiler flag _ARCH_PPCSQ (which is the same condition GCC uses to
decide whether to generate fsqrt instruction).

It fixes BZ#16576.
2015-01-28 05:59:16 -05:00
Andreas Schwab fa20da31c8 ia64: avoid set-but-not-used warning 2015-01-25 23:38:04 +01:00
Andreas Schwab 45819cbca1 m68k/coldfire: avoid warning about volatile register variables 2015-01-25 23:36:02 +01:00
Andreas Schwab 403cc231e6 m68k: fix missing definition of __feraiseexcept 2015-01-25 23:36:02 +01:00
Andreas Schwab 24bb7432a7 m68k: force inlining bswap functions 2015-01-25 23:35:51 +01:00
Adhemerval Zanella bea5801360 powerpc: Fix powerpc64 build failure with binutils 2.22
GLIBC memset optimization for POWER8 uses the '.machine power8'
directive, which is only supported officially on binutils 2.24+.  This
causes a build failure on older binutils.

Since the requirement of .machine power8 is to correctly assembly the
'mtvsrd' instruction and it is already handled by the MTVSRD_V1_R4
macro, there is no really needed of using it.

The patch replaces the power8 with power7 for .machine directive.

It fixes BZ#17869.
2015-01-24 08:40:04 -05:00
Adhemerval Zanella 0e87343e20 powerpc: Fix ifuncmain6pie failure with GCC 4.9
This patch fix the elf/ifuncmain6pie failure when building with GCC
4.9+.  For some reason, the compiler removes the branch taken code at
resolve_ifunc (sysdeps/powerpc/powerpc64/dl-machine.h) as dead-code
and thus the testcase fails because the ifunc resolves branches to an
invalid memory location.  It fixes by explicit adding a dependency of
value based on odp variable to avoid compiler optimization.

It fixes BZ#17868.
2015-01-24 08:38:39 -05:00
H.J. Lu 972af9e8dd Also treat model numbers 0x5a/0x5d as Silvermont 2015-01-23 18:52:45 -08:00
H.J. Lu ede0236c86 Treat model numbers 0x4a/0x4d as Silvermont
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
	Treat model numbers 0x4a/0x4d as Intel Silvermont architecture.
2015-01-23 18:08:10 -08:00
H.J. Lu 22971c35e2 Use uint64_t and (uint64_t) 1 for 64-bit int
This patch replaces unsigned long int and 1UL with uint64_t and
(uint64_t) 1 to support ILP32 targets like x32.

	[BZ #17870]
	* nptl/sem_post.c (__new_sem_post): Replace unsigned long int
	with uint64_t.
	* nptl/sem_waitcommon.c (__sem_wait_cleanup): Replace 1UL with
	(uint64_t) 1.
	(__new_sem_wait_slow): Replace unsigned long int with uint64_t.
	Replace 1UL with (uint64_t) 1.
	* sysdeps/nptl/internaltypes.h (new_sem): Replace unsigned long
	int with uint64_t.
2015-01-23 14:48:40 -08:00
Adhemerval Zanella 6b2ba95b6b BZ #16418: Fix powerpc get_clockfreq raciness
This patch fix powerpc __get_clockfreq racy and cancel-safe issues by
dropping internal static cache and by using nocancel file operations.
The vDSO failure check is also removed, since kernel code does not
return an error (it cleans cr0.so bit on function return) and the static
code (to read value /proc) now uses non-cancellable calls.
2015-01-21 10:46:49 -05:00
Carlos O'Donell 191220b306 Update copyright year to 2015 for new files. 2015-01-21 10:35:31 -05:00
Carlos O'Donell ccdb048df4 Fix recursive dlopen.
The ability to recursively call dlopen is useful for malloc
implementations that wish to load other dynamic modules that
implement reentrant/AS-safe functions to use in their own
implementation.

Given that a user malloc implementation may be called by an
ongoing dlopen to allocate memory the user malloc
implementation interrupts dlopen and if it calls dlopen again
that's a reentrant call.

This patch fixes the issues with the ld.so.cache mapping
and the _r_debug assertion which prevent this from working
as expected.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00446.html
2015-01-21 01:51:10 -05:00
Carlos O'Donell 042e1521c7 Fix semaphore destruction (bug 12674).
This commit fixes semaphore destruction by either using 64b atomic
operations (where available), or by using two separate fields when only
32b atomic operations are available.  In the latter case, we keep a
conservative estimate of whether there are any waiting threads in one
bit of the field that counts the number of available tokens, thus
allowing sem_post to atomically both add a token and determine whether
it needs to call futex_wake.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00155.html
2015-01-21 00:46:16 -05:00
Chung-Lin Tang 522e6ee3b4 Commit nios2 port to master. 2015-01-17 22:29:12 -08:00
Stefan Liebler 026eb207ed S390: Get rid of linknamespace failures for utmp functions. 2015-01-16 09:18:58 +01:00
Stefan Liebler 1d53248326 S390: Get rid of linknamespace failures for string functions. 2015-01-16 09:17:32 +01:00
Joseph Myers 53fbd16918 Fix powerpc-nofpu fesetenv namespace (bug 17748).
When fixing namespace issues for <fenv.h> functions I missed one call
to fesetenv for powerpc-nofpu.  This patch changes this to a call to
__fesetenv.

Tested for powerpc-nofpu; it fixes the previously observed math.h
linknamespace test failures.

	[BZ #17748]
	* sysdeps/powerpc/nofpu/feholdexcpt.c (__feholdexcept): Call
	__fesetenv instead of fesetenv.
2015-01-14 21:35:40 +00:00
Siddhesh Poyarekar d639a36345 [s390] Define a __tls_get_addr macro to avoid declaring it again
commit 050f7298e1 added an extern
declaration for __tls_get_addr that conflicts with the one in s390
dl-tls.h, based on whether __tls_get_addr is defined as a macro.  The
rationale seems to be based on the assumption that __tls_get_addr is
exported for every architecture and hence an internal non-plt alias is
needed.  This is not true for s390 though, since it exports
__tls_get_offset and not __tls_get_addr.  This results in tst-audit9
being stuck in an infinite loop.

This patch fixes this by defining a __tls_get_addr macro to itself so
as to not use the conflicting declaration.
2015-01-14 21:26:50 +05:30
Adhemerval Zanella ce6615c9c6 powerpc: Fix POWER7/PPC64 performance regression on LE
This patch fixes a performance regression on the POWER7/PPC64 memcmp
porting for Little Endian.  The LE code uses 'ldbrx' instruction to read
the memory on byte reversed form, however ISA 2.06 just provide the indexed
form which uses a register value as additional index, instead of a fixed value
enconded in the instruction.

And the port strategy for LE uses r0 index value and update the address
value on each compare loop interation.  For large compare size values,
it adds 8 more instructions plus some more depending of trailing
size.  This patch fixes it by adding pre-calculate indexes to remove the
address update on loops and tailing sizes.

For large sizes it shows a considerable gain, with double performance
pairing with BE.
2015-01-13 14:35:40 -05:00
Adhemerval Zanella d3b00f468b powerpc: Optimized strncmp for POWER8/PPC64
This patch adds an optimized POWER8 strncmp.  The implementation focus
on speeding up unaligned cases follwing the ideas of power8 strcmp.

The algorithm first check the initial 16 bytes, then align the first
function source and uses unaligned loads on second argument only.
Aditional checks for page boundaries are done for unaligned cases
(where sources alignment are different).
2015-01-13 14:35:40 -05:00
Rajalakshmi Srinivasaraghavan 72607db038 powerpc: Optimize POWER7 strcmp trailing checks
This patch optimized the POWER7 trailing check by avoiding using byte
read operations and instead use the doubleword already readed with
bitwise operations.
2015-01-13 14:35:40 -05:00
Adhemerval Zanella 8bedcb5f03 powerpc: Optimized strcmp for POWER8/PPC64
This patch adds an optimized POWER8 strcmp using unaligned accesses.
The algorithm first check the initial 16 bytes, then align the first
function source and uses unaligned loads on second argument only.
Aditional checks for page boundaries are done for unaligned cases
2015-01-13 11:28:58 -05:00
Adhemerval Zanella f06a4faf8a powerpc: Optimized st{r,p}ncpy for POWER8/PPC64
This patch adds an optimized POWER8 st{r,p}ncpy using unaligned accesses.
It shows 10%-80% improvement over the optimized POWER7 one that uses
only aligned accesses, specially on unaligned inputs.

The algorithm first read and check 16 bytes (if inputs do not cross a 4K
page size).  The it realign source to 16-bytes and issue a 16 bytes read
and compare loop to speedup null byte checks for large strings.  Also,
different from POWER7 optimization, the null pad is done inline in the
implementation using possible unaligned accesses, instead of realying on
a memset call.  Special case is added for page cross reads.
2015-01-13 11:28:44 -05:00
Adhemerval Zanella 9f2f36e5a9 powerpc: Optimized strncat for POWER7/PPC64
With 3eb38795db (Simplify strncat) the generic algorithms uses
strlen, strnlen, and memcpy.  This is faster than POWER7 current
implementation, especially for unaligned strings (where POWER7 code
uses byte-byte operations).

This patch removes the assembly implementation and uses a multiarch
specialization based on default algorithm calling optimized POWER7
symbols.
2015-01-13 11:28:40 -05:00
Adhemerval Zanella 94c9680945 powerpc: Optimized strcat for POWER8/PPC64
With new optimized strcpy for POWER8, this patch adds an optimized
strcat which uses it along with default implementation at strings/.
2015-01-13 11:28:36 -05:00
Adhemerval Zanella 96d6fd6c40 powerpc: Optimized st{r,p}cpy for POWER8/PPC64
This patch adds an optimized POWER8 strcpy using unaligned accesses.
For strings up to 16 bytes the implementation first calculate the
string size, like strlen, and issues a memcpy.  For larger strings,
source is first aligned to 16 bytes and then tested over a loop that
reads 16 bytes am combine the cmpb results for speedup.  Special case is
added for page cross reads.

It shows 30%-60% improvement over the optimized POWER7 one that uses
only aligned accesses.
2015-01-13 11:28:30 -05:00
Torvald Riegel c60ec0e016 Fix wake-up in sysdeps/nptl/fork.c. 2015-01-13 01:09:29 +01:00
Joseph Myers 5a9e4c09a2 Fix ldbl-96 scalblnl underflowing results (bug 17803).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) uses
a condition k <= -63 to determine when a standard underflowing result
tiny*__copysignl(tiny,x) should be returned.  However, that condition
corresponds to values with exponent -16446 or less, and in the case of
-16446, the correct result for round-to-nearest depends on whether the
value is exactly 0x1p-16446 (half the least subnormal) or more than
that.  This patch fixes the bug by changing the condition to k <= -64
and accordingly adjusting the exponent by 64 not 63 when converting to
a normal value.

Tested for x86_64.

	[BZ #17803]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (twom63): Rename to
	twom64.  Adjust value to 0x1p-64L.
	(__scalblnl): Only return standard underflowing result for K <=
	-64 not K <= -63; adjust exponent for underflowing result by 64
	not 63.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 23:02:14 +00:00
Joseph Myers 34e93d6c76 Fix ldbl-96 scalblnl for subnormal arguments (bug 17834).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) is
incorrect for subnormal arguments (this is a separate bug from bug
17803, which is about underflowing results).  There are two problems
with the adjustments of subnormal arguments: the "two63" variable
multiplied by is actually 0x1p52L not 0x1p63L, so is insufficient to
make values normal, and then GET_LDOUBLE_EXP(es,x), used to extract
the new exponent, extracts it into a variable that isn't used, while
the value taken to by the new exponent is wrongly taken from the high
part of the mantissa before the adjustment (hx).  This patch fixes
both those problems and adds appropriate tests.

Tested for x86_64.

	[BZ #17834]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (two63): Change value to
	0x1p63L.
	(__scalblnl): Get new exponent of adjusted subnormal value from ES
	not HX.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 22:34:58 +00:00
Adhemerval Zanella ca677d3c3c Add x86 32 bit vDSO time function support
Linux 3.15 adds support for clock_gettime, gettimeofday, and time vDSO
(commit id 37c975545ec63320789962bf307f000f08fabd48).  This patch adds
GLIBC supports to use such symbol when they are avaiable.

Along with x86 vDSO support, this patch cleanup x86_64 code by moving
all common code to x86 common folder.  Only init-first.c is different
between implementations.
2015-01-12 16:03:58 -02:00
Adhemerval Zanella 49a9f6ab64 powerpc: Fix Copyright dates and CL entry
This patch fixes the copyright dates from files created by commit
8d2c0a5, 4b45943, and 56cf276.
2015-01-12 12:58:34 -05:00
Adhemerval Zanella 56cf276381 powerpc: abort transaction in syscalls
Linux kernel powerpc documentation states issuing a syscall inside a
transaction is not recommended and may lead to undefined behavior. It
also states syscalls does not abort transactoin neither they run in
transactional state.

To avoid side-effects being visible outside transactions, GLIBC with
lock elision enabled will issue a transaction abort instruction just
before all syscalls if hardware supports hardware transactions.
2015-01-12 06:32:08 -05:00
Adhemerval Zanella 4b45943a6f powerpc: Add adaptive elision to rwlocks
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory for rwlocks.  The logic is similar to the
one presented in pthread_mutex lock elision.
2015-01-12 06:30:54 -05:00
Adhemerval Zanella 8d2c0a593b powerpc: Add the lock elision using HTM
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory instructions for pthread_mutex primitives.
Similar to s390 version, the for elision logic defined in
'force-elision.h' is only enabled if ENABLE_LOCK_ELISION is defined.

Also, the lock elision code should be able to be built even with
a compiler that does not provide HTM support with builtins.
However I have noted the performance is sub-optimal due scheduling
pressures.
2015-01-12 06:30:19 -05:00
Roland McGrath bc0ed9f755 Fix shm-directory.h #include. 2015-01-09 16:08:14 -08:00
Matthew Fortune aee6626c30 MicroBlaze: Fix BZ17791 - Remove fixed page size macros and others
Microblaze apparently has a variable page size (see thread below) and
should not hard-code any page-size related macros.
Also remove macros that are only used for BFD's trad-core support
which is not relavant for microblaze also according to the thread
starting here:

https://sourceware.org/ml/libc-ports/2013-11/msg00028.html

This patch is neither built nor tested but mirrors a MIPS patch that
fixes the same issue.

Thanks,
Matthew

     * sysdepsysdeps/unix/sysv/linux/microblaze/sys/user.h
     (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Remove.
     (HOST_TEXT_START_ADDR, HOST_STACK_END_ADDR): Remove.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 17:34:46 +10:00
Torvald Riegel 9e560f4838 MicroBlaze: Remove custom lowlevellock.h.
2015-01-06  Torvald Riegel <triegel@redhat.com>

  * sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Delete file.

Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:58:49 +10:00
Torvald Riegel e1cfbd0c37 MicroBlaze: Remove custom pthread_once implementation on microblaze.
2015-01-06  Torvald Riegel <triegel@redhat.com>

  * sysdeps/unix/sysv/linux/microblaze/pthread_once.c: Delete file.

Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:56:33 +10:00
David Holsgrove cf71e44f1b MicroBlaze: Avoid pointer to integer conversion warning
2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

  * sysdeps/microblaze/jmpbuf-unwind.h (_jmpbuf_sp): Declare SP as void
    pointer and cast to uintptr_t.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:49:27 +10:00
David Holsgrove b360ee62d2 MicroBlaze: Fix volatile-register-var warning in READ_THREAD_POINTER
Resolves warning: 'optimization may eliminate reads and/or writes to
register variables'

2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

  * sysdeps/microblaze/nptl/tls.h: Remove inline
    __microblaze_get_thread_area and update READ_THREAD_POINTER.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:49:22 +10:00
David Holsgrove caff764e8c MicroBlaze: Fix integer-pointer conversion warning
2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

    * sysdeps/microblaze/nptl/tls.h (TLS_INIT_TP): Use NULL instead
      of 0.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:30:11 +10:00
Roland McGrath c97d27f1bb Some #include cleanup in aio/timer code. 2015-01-08 15:38:15 -08:00
Roland McGrath 08734ccd98 Clean up allocrtsig code. 2015-01-08 15:31:15 -08:00
Roland McGrath 24abc20040 Fix copyright year on new stub sys/procfs.h file. 2015-01-08 14:29:45 -08:00
Roland McGrath 9287adf089 Add stub sys/procfs.h file 2015-01-08 13:24:56 -08:00
Roland McGrath 59ff172f80 NPTL: Refactor cpu_set_t validation to be sysdeps-controlled
This removes Linuxisms related to cpu_set_t validation from the
generic NPTL code and puts them into a new sysdeps header file.
2015-01-08 10:49:40 -08:00
Adhemerval Zanella dd6e8af6ba powerpc: Fix compiler warning on some syscalls
GCC 5.0 emits an warning when using sizeof on array function parameters
and powerpc internal syscall macros add a check for such cases.  More
specifically, on powerpc64 and powerpc32 sysdep.h:

  if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \
          __illegally_sized_syscall_arg3 (); \

And for sysdeps/unix/sysv/linux/utimensat.c build GCC emits:

error: ‘sizeof’ on array function parameter ‘tsp’ will return size of
‘const struct timespec *’

This patch uses the address of first struct member instead of the struct
itself in syscall macro.
2015-01-08 08:03:31 -05:00
Joseph Myers 8116321f65 Fix libm feupdateenv namespace (bug 17748).
Concluding the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feupdateenv by making it a weak alias for
__feupdateenv and making the affected code call __feupdateenv.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  Also tested for ARM
(soft-float) that the math.h linknamespace tests now pass.

	[BZ #17748]
	* include/fenv.h (__feupdateenv): Use libm_hidden_proto.
	* math/feupdateenv.c (__feupdateenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Rename to __feupdateenv
	and define as weak alias of __feupdateenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
	(__feupdateenv): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feupdateenv): New inline
	function.
	* sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/generic/math_private.h (default_libc_feupdateenv): Call
	__feupdateenv instead of feupdateenv.
	(default_libc_feupdateenv_test): Likewise.
	(libc_feresetround_ctx): Likewise.
2015-01-07 19:01:20 +00:00
Adhemerval Zanella 882dfe184a mips: Fix __libc_pread prototype
This patch fixes the __libc_pread prototype change from
14bb4e57c0.
2015-01-07 16:26:26 -02:00
Richard Earnshaw dc400d7b73 AArch64: Optimized implementations of strcpy and stpcpy. 2015-01-07 11:31:10 +00:00
Richard Earnshaw ec582ca0f3 AArch64 optimized implementation of strrchr. 2015-01-07 11:26:13 +00:00
Joseph Myers 01238691bb Fix libm fesetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fesetround by making it a weak alias of
__fesetround and making the affected code call __fesetround.  An
existing __fesetround function in fenv_libc.h for powerpc is renamed
to __fesetround_inline.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fesetround failures disappear from the linknamespace
test results (feupdateenv remains to be addressed to complete fixing
bug 17748).

	[BZ #17748]
	* include/fenv.h (__fesetround): Declare.  Use libm_hidden_proto.
	* math/fesetround.c (fesetround): Rename to __fesetround and
	define as weak alias of __fesetround.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/alpha/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/arm/fesetround.c (fesetround): Likewise.
	* sysdeps/hppa/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/i386/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/ia64/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/m68k/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/mips/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/powerpc/fpu/fenv_libc.h (__fesetround): Rename to
	__fesetround_inline.
	* sysdeps/powerpc/fpu/fenv_private.h (libc_fesetround_ppc): Call
	__fesetround_inline instead of __fesetround.
	* sysdeps/powerpc/fpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.  Call __fesetround_inline instead of
	__fesetround.
	* sysdeps/powerpc/nofpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c (fesetround):
	Likewise.
	* sysdeps/s390/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/sh/sh4/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/sparc/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/tile/math_private.h (__fesetround): New inline function.
	* sysdeps/x86_64/fpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.
	* sysdeps/generic/math_private.h (default_libc_fesetround): Call
	__fesetround instead of fesetround.
	(default_libc_feholdexcept_setround): Likewise.
	(libc_feholdsetround_ctx): Likewise.
	(libc_feholdsetround_noex_ctx): Likewise.
2015-01-07 00:41:23 +00:00
Joseph Myers cd42798aef Fix libm fesetenv namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fesetenv by making it a weak alias of
__fesetenv and making the affected code (including various copies of
feupdateenv which also gets called from C90 functions) call
__fesetenv.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fesetenv failures disappear from the linknamespace
test results (fsetround and feupdateenv remain to be addressed to
complete fixing bug 17748).

	[BZ #17748]
	* include/fenv.h (__fesetenv): Use libm_hidden_proto.
	* math/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv
	and define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/alpha/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/arm/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise.
	* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/ia64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/m68k/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/mips/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fesetenv.c (__fesetenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c (__fesetenv):
	Likewise.
	* sysdeps/s390/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fesetenv.c (fesetenv): Likewise.
	* sysdeps/sparc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/tile/math_private.h (__fesetenv): New inline function.
	* sysdeps/x86_64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv
	and define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/generic/math_private.h (default_libc_fesetenv): Use
	__fesetenv instead of fesetenv.
	(libc_feresetround_noex_ctx): Likewise.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
	(__feupdateenv): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Likewise.
2015-01-06 23:36:20 +00:00
Ondřej Bílka 4790d9a2c0 Clean up check_pf allocation pattern. addresses
We simplify allocation strategy there so instead of using temporary linked list
and then copying entries to output array we keep them in resizable
array.
2015-01-06 17:26:44 +01:00
Adhemerval Zanella 14bb4e57c0 Function declaration cleanup
This patch changes the some function declaration from K&R style to
default ANSI C.

	* nptl/pthread_cancel.c (pthread_cancel): Use ANSI prototype.
	* nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
	* nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
	* nptl/pthread_exit.c (__pthread_exit): Likewise.
	* nptl/pthread_join.c (pthread_join): Likewise.
	* nptl/pthread_timedjoin.c (pthread_timedjoin_np): Likewise.
	* sysdeps/posix/waitid.c (__waitid): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
	(__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
	(__libc_pwrite64): Likewsie.
	* sysdeps/unix/sysv/linux/mips/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/mips/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Likewise.
	* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (OPENAT_NOT_CANCEL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c (__libc_pwrite):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
	(__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/preadv.c (PREADV): Likewise.
	* sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/pwritev.c (__libc_pwritev): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite64.c (__libc_write64): Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c (__sigsuspend): Likewise.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c (__libc_msgrcv):
	Likewise.
2015-01-06 08:23:58 -08:00
H.J. Lu 57ada0e7e7 Define CLOCKS_PER_SEC type to the type clock_t
C99 specifies that CLOCKS_PER_SEC is an expression with the type clock_t.
This patch adds a generic <bits/time2.h> to define CLOCKS_PER_SEC and
provides the Linux/x86-64 version of <bits/time2.h> to support x32.

	[BZ #17797]
	* bits/time.h (CLOCKS_PER_SEC): Changed to ((clock_t) 1000000).
	* sysdeps/unix/sysv/linux/bits/time.h (CLOCKS_PER_SEC): Likewise.
	* sysdeps/unix/sysv/linux/clock.c (clock): _Static_assert
	CLOCKS_PER_SEC == 1000000.
	* time/clocktest.c (main): Replace %ld with %jd and cast to
	intmax_t.
2015-01-06 04:59:13 -08:00
Roland McGrath 46abb64d62 ARM: Consolidate with generic unwinder wrapper code 2015-01-05 15:42:16 -08:00
Steve Ellcey 61695fb2ba Merge branch 'master' of ssh://sourceware.org/git/glibc 2015-01-05 15:07:26 -08:00
Steve Ellcey 295a453e21 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memset.S (memset): Modify for mips32r6/mips64r6
	to avoid using stl/str to align destination.
2015-01-05 15:06:42 -08:00
Joseph Myers ef9faf1385 Fix libm feholdexcept namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feholdexcept by making it a weak alias of
__feholdexcept and making the affected code call __feholdexcept.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that feholdexcept failures disappear from the
linknamespace test failures (fesetenv, fsetround and feupdateenv
remain to be addressed to complete fixing bug 17748).

	[BZ #17748]
	* include/fenv.h (__feholdexcept): Declare.  Use
	libm_hidden_proto.
	* math/feholdexcpt.c (feholdexcept): Rename to __feholdexcept and
	define as weak alias of __feholdexcept.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/alpha/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/arm/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/m68k/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/mips/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
	(feholdexcept): Likewise.
	* sysdeps/s390/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sparc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/generic/math_private.h (default_libc_feholdexcept): Use
	__feholdexcept instead of feholdexcept.
	(default_libc_feholdexcept_setround): Likewise.
2015-01-05 23:06:14 +00:00
Steve Ellcey 882c4b9f1d 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memcpy.S: Add support for mips32r6/mips64r6.
2015-01-05 13:28:42 -08:00
Joseph Myers ac4c11f580 Fix MIPS n64 posix_fadvise namespace (bug 17796).
sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c defines
posix_fadvise64 as a strong alias for posix_fadvise (for
!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) - i.e., for static
linking, which is the case when this matters), but it should be a weak
alias.  This patch makes it a weak alias.

Tested for MIPS that this fixes the observed linknamespace test
failures.

	[BZ #17796]
	* sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
	[!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)] (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 18:02:31 +00:00
Steve Ellcey 03403e3061 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/dl-machine.h (elf_machine_load_address): Replace
	bltzal with addiupc.
	(RTLD_START): Ditto.
2015-01-05 09:39:33 -08:00
Chris Metcalf 7ea793f39c tile: check error properly for vDSO calls
The tile vDSO vsyscalls were not properly setting the error value.
Conventionally, tile returns the same "non-negative success, negative
errno" value that x86 does (in r0), but it also returns "zero or positive
errno" in r1, which is what the regular syscall code checks.  This change
uses that convention for the vDSO calls as well.
2015-01-05 12:06:15 -05:00
Chris Metcalf 1dca195e1c lround: provide cast for wordsize-64 version if needed
Platforms with 64-bit registers where 32-bit values need to have the
high 32 bits set in a particular way need to have an explicit cast
when using the 64-bit sysdeps/ieee754/dbl-64/wordsize-64 version
of llround() as lround().  This includes tilegx32, and likely MIPS.
x32 does not need this, and AArch64 ILP32 will not either.  Require
it to be specified in sysdep.h to be explicit.
2015-01-05 11:59:32 -05:00
Joseph Myers ab70da77ea Fix ARM posix_fadvise64 namespace (bug 17793).
ARM posix_fadvise calls __posix_fadvise64_l64, to which
posix_fadvise64 is a strong alias, but posix_fadvise is a POSIX
function and posix_fadvise64 isn't.  This patch changes it into a weak
alias.

Tested for ARM that this fixes the corresponding linknamespace test
failures.

	[BZ #17793]
	* sysdeps/unix/sysv/linux/arm/posix_fadvise64.c (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 16:05:34 +00:00
Joseph Myers a287953a45 Fix wordsize-64 posix_fadvise64, posix_fallocate64 namespace (bug 17777).
On systems using sysdeps/unix/sysv/linux/wordsize-64, posix_fadvise64
and posix_fallocate64 (non-POSIX) are strong aliases for posix_fadvise
and posix_fallocate (POSIX), meaning references to the latter wrongly
bring in definitions of the former.  They should be weak aliases; this
patch makes them so.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17777]
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise.c
	(posix_fadvise64): Define as weak alias not strong alias.
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
	(posix_fallocate64): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/fcntl.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/mqueue.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/fcntl.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/mqueue.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/fcntl.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/mqueue.h/linknamespace): Likewise.
2015-01-05 14:37:07 +00:00
Matthew Fortune b1efe3bbcf Fix MIPS variable PAGE_SIZE bug (16191)
MIPS supports a variable page size but glibc defines a constant.
This causes at least two glibc tests to fail when the page size
does not match the hard-coded size:

inet/test-ifaddrs
inet/test_ifindex

	[BZ #16191]
	* NEWS: Mention bug fix.
	* sysdeps/unix/sysv/linux/mips/sys/user.h (PAGE_SHIFT): Remove.
	(PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Likewise.
	(HOST_TEXT_START_ADDR, HOST_DATA_START_ADDR): Likewise.
	(HOST_STACK_END_ADDR): Likewise.
2015-01-05 13:45:16 +00:00
Joseph Myers b93c2205ec Fix libm fegetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fegetround by making it a weak alias of
__fegetround and making the affected code call __fegetround.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fegetround failures disappear from the linknamespace
test failures (feholdexcept, fesetenv, fesetround and feupdateenv
remain to be addressed before bug 17748 is fully fixed, although this
patch may suffice to fix the failures in some cases, when the libc_fe*
functions are implemented but there is no architecture-specific sqrt
implementation in use so there were failures from fegetround used by
sqrt but no other such failures).

	[BZ #17748]
	* include/fenv.h (__fegetround): Declare.  Use libm_hidden_proto.
	* math/fegetround.c (fegetround): Rename to __fegetround and
	define as weak alias of __fegetround.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/alpha/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/arm/fegetround.c (fegetround): Likewise.
	* sysdeps/hppa/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/i386/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/ia64/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/m68k/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/mips/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise.
	Undefine after rather than before function definition; use
	parentheses around function name in definition.
	(__fegetround): Also undefine macro after function definition.
	* sysdeps/powerpc/nofpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.  Do not undefine as macro.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround):
	Likewise.
	* sysdeps/s390/fpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/tile/math_private.h (__fegetround): New inline function.
	* sysdeps/x86_64/fpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.
	* sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Use
	__fegetround instead of fegetround.
2015-01-02 20:44:42 +00:00
Joseph Myers 253a59ccb5 Fix MIPS TIOCSER_TEMT namespace (bug 17782).
sysdeps/unix/sysv/linux/mips/bits/termios.h defines TIOCSER_TEMT
unconditionally, but it's in the user's namespace.  This patch
conditions it on __USE_MISC, as on powerpc.  I've filed bug 17783 for
the residual inconsistency in conditions on this macro (sparc defines
it for __USE_GNU only).

	[BZ #17782]
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (TIOCSER_TEMT):
	Condition macro definition on [__USE_MISC].
2015-01-02 18:31:41 +00:00
Joseph Myers 27dae0113e Fix MIPS sa_flags type (bug 17781).
sysdeps/unix/sysv/linux/mips/bits/sigaction.h gives sa_flags type
unsigned int, but POSIX says it should be signed int.  This patch
gives it the correct type (the layout is unchanged, so there are no
ABI issues involved).

	[BZ #17781]
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h
	(struct sigaction): Change type of sa_flags field to int.
2015-01-02 18:30:32 +00:00
Joseph Myers 172019c0ec Fix MIPS bits/fcntl.h namespace (bug 17780).
sysdeps/unix/sysv/linux/mips/bits/fcntl.h has a structure field called
pad, which is in the user's namespace.  This patch changes it to
__glibc_reserved0.

	[BZ #17780]
	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h (struct flock)
	[!__USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64]: Rename pad field to
	__glibc_reserved0.
2015-01-02 18:29:24 +00:00
Joseph Myers 9706dc5f53 Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2015.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  Apart from the files updated
last time (of which sotruss.ksh had moved to sotruss.sh during the
year) this also updates nptl/version.c (missed from 2006 until
October) and sysdeps/unix/sysv/linux/lddlibc4.c (missed since 2009).

	* NEWS: Update copyright dates.
	* catgets/gencat.c (print_version): Likewise.
	* csu/version.c (banner): Likewise.
	* debug/catchsegv.sh: Likewise.
	* debug/pcprofiledump.c (print_version): Likewise.
	* debug/xtrace.sh (do_version): Likewise.
	* elf/ldconfig.c (print_version): Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/pldd.c (print_version): Likewise.
	* elf/sotruss.sh: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* iconv/iconv_prog.c (print_version): Likewise.
	* iconv/iconvconfig.c (print_version): Likewise.
	* locale/programs/locale.c (print_version): Likewise.
	* locale/programs/localedef.c (print_version): Likewise.
	* login/programs/pt_chown.c (print_version): Likewise.
	* malloc/memusage.sh (do_version): Likewise.
	* malloc/memusagestat.c (print_version): Likewise.
	* malloc/mtrace.pl: Likewise.
	* manual/libc.texinfo: Likewise.
	* nptl/version.c (banner): Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* nss/getent.c (print_version): Likewise.
	* nss/makedb.c (print_version): Likewise.
	* posix/getconf.c (main): Likewise.
	* scripts/test-installation.pl: Likewise.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
2015-01-02 16:54:45 +00:00
Will Newton b8607aac4f ARM: Remove configure check for binutils 2.21 for ARMv7
The default required version of binutils has been increased to 2.22
making this check redundant.

ChangeLog:

2015-01-02  Will Newton  <will.newton@linaro.org>

	* sysdeps/arm/armv7/configure: Removed.
	* sysdeps/arm/armv7/configure.ac: Likewise.
2015-01-02 16:52:40 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers 73a268c759 Fix libm fegetenv namespace (bug 17748).
Some C90 libm functions call fegetenv via libc_feholdsetround*
functions in math_private.h.  This patch makes them call __fegetenv
instead, making fegetenv into a weak alias for __fegetenv as needed.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fegetenv failures disappear from the linknamespace
test failures (however, similar fixes will also be needed for
fegetround, feholdexcept, fesetenv, fesetround and feupdateenv before
this set of namespace issues covered by bug 17748 is fully fixed and
those linknamespace tests start passing).

	[BZ #17748]
	* include/fenv.h (__fegetenv): Use libm_hidden_proto.
	* math/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
	and define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/alpha/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/arm/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/fegetenv.c (fegetenv): Likewise.
	* sysdeps/i386/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/ia64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/mips/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/powerpc/fpu/fegetenv.c (__fegetenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fegetenv.c (__fegetenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (__fegetenv):
	Likewise.
	* sysdeps/s390/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Likewise.
	* sysdeps/sparc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/tile/math_private.h (__fegetenv): New inline function.
	* sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
	and define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/generic/math_private.h (libc_feholdsetround_ctx): Use
	__fegetenv instead of fegetenv.
	(libc_feholdsetround_noex_ctx): Likewise.
2014-12-31 22:07:52 +00:00
Matthew Fortune 0bd956720c Add support for MIPS O32 FPXX and .MIPS.abiflags
* elf/elf.h (PT_MIPS_ABIFLAGS): Define.
	(Elf_MIPS_ABIFlags_v0): New structure.
	(EF_MIPS_FP64): Define.
	(MIPS_AFL_REG_NONE, MIPS_AFL_REG_32, MIPS_AFL_REG_64): Likewise.
	(MIPS_AFL_REG_128, MIPS_AFL_ASE_DSP, MIPS_AFL_ASE_DSP64): Likewise.
	(MIPS_AFL_ASE_DSPR2, MIPS_AFL_ASE_EVA, MIPS_AFL_ASE_MCU): Likewise.
	(MIPS_AFL_ASE_MDMX, MIPS_AFL_ASE_MIPS3D, MIPS_AFL_ASE_MT): Likewise.
	(MIPS_AFL_ASE_SMARTMIPS, MIPS_AFL_ASE_VIRT): Likewise.
	(MIPS_AFL_ASE_VIRT64, MIPS_AFL_ASE_MSA, MIPS_AFL_ASE_MSA64): Likewise.
	(MIPS_AFL_ASE_MIPS16, MIPS_AFL_ASE_MICROMIPS): Likewise.
	(MIPS_AFL_ASE_XPA, MIPS_AFL_EXT_XLR, MIPS_AFL_EXT_OCTEON2): Likewise.
	(MIPS_AFL_EXT_OCTEONP, MIPS_AFL_EXT_LOONGSON_3A): Likewise.
	(MIPS_AFL_EXT_OCTEON, MIPS_AFL_EXT_5900, MIPS_AFL_EXT_4010): Likewise.
	(MIPS_AFL_EXT_4100, MIPS_AFL_EXT_3900, MIPS_AFL_EXT_10000): Likewise.
	(MIPS_AFL_EXT_SB1, MIPS_AFL_EXT_4111, MIPS_AFL_EXT_4120): Likewise.
	(MIPS_AFL_EXT_5400, MIPS_AFL_EXT_5500): Likewise.
	(MIPS_AFL_EXT_LOONGSON_2E, MIPS_AFL_EXT_LOONGSON_2F): Likewise.
	(Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE): New enum values.
	(Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT): Likewise.
	(Val_GNU_MIPS_ABI_FP_OLD_64, Val_GNU_MIPS_ABI_FP_XX): Likewise.
	(Val_GNU_MIPS_ABI_FP_64, Val_GNU_MIPS_ABI_FP_64A): Likewise.
	(Val_GNU_MIPS_ABI_FP_MAX): Likewise.
	* sysdeps/mips/Makefile [subdir=elf]: Add tst-abi-interlink,
	tst-mode-switch-1, tst-mode-switch-2, tst-mode-switch-3 tests.
	* sysdeps/mips/bits/linkmap.h (struct link_map_machine): Add fpmode
	field.
	* sysdeps/mips/dl-machine.h (elf_machine_matches_host): Reject
	EF_MIPS_FP64.
	* sysdeps/mips/dl-machine-reject-phdr.h: New file.
	* sysdeps/mips/tst-abi-fp32mod.c: Likewise.
	* sysdeps/mips/tst-abi-fpxxmod.c: Likewise.
	* sysdeps/mips/tst-abi-fpxxomod.c: Likewise.
	* sysdeps/mips/tst-abi-fp64mod.c: Likewise.
	* sysdeps/mips/tst-abi-fp64amod.c: Likewise.
	* sysdeps/mips/tst-abi-interlink.c: Likewise.
	* sysdeps/mips/tst-mode-switch-1.c: Likewise.
	* sysdeps/mips/tst-mode-switch-2.c: Likewise.
	* sysdeps/mips/tst-mode-switch-3.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/configure.ac (o32-fpabi): Define to
	record the current FP ABI extension.
	(mips-mode-switch): Define to show if kernel headers support mode
	switching.
	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
	* sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increase maximum
	supported SYSV ABI version to 3.
	* sysdeps/unix/sysv/linux/mips/libc-abis: Add new MIPS_O32_FP64
	feature.
2014-12-31 21:09:21 +00:00
Rajalakshmi Srinivasaraghavan f59ad976ed powerpc: POWER7 strcpy optimization for unaligned strings
This patch optimizes strcpy for ppc64/power7 for unaligned source or
destination address.  The source or destination address is aligned
to doubleword and data is shifted based on the alignment and
added with the previous loaded data to be written as a doubleword.
For each load, cmpb instruction is used for faster null check.

The word aligned optimization is also removed, since the new unaligned
code path shows better results handling word-aligned strings.

More combination of unaligned inputs is also added in benchtest
to measure the improvement.The new optimization shows 2 to 80% of
performance improvement for longer string though it does not show
big difference on string size less than 16 due to additional checks.
2014-12-31 14:35:59 -05:00
Joseph Myers 4a3d39994e Clean up powerpc fegetround / __fegetround inlines.
The natural fix for some linknamespace test failures, where C90 libm
functions call C99 <fenv.h> functions, is to make fe* into weak
aliases for __fe* and call __fe* from within libm as needed.

To do this, the __fe* names need to be available for that purpose -
that is, they must not be used for something other than aliases of
fe*.  On powerpc, however, __fegetround is an inline function in
fenv_libc.h, with no corresponding fegetround inline function;
fegetround has an equivalent macro expansion in bits/fenvinline.h, but
that is disabled if __NO_MATH_INLINES (which is defined for building
libm).

I see no need for that disabling; it's not even clear that
__NO_MATH_INLINES should affect <fenv.h>, and the results of
fegetround are completely defined so there is no semantic effect of
that disabling at all outside glibc.  The x86 inline feraiseexcept is
conditioned on __USE_EXTERN_INLINES not __NO_MATH_INLINES (but that's
an inline function rather than a macro).

This patch removes the __NO_MATH_INLINES conditional on that
fegetround macro, so resulting in it being expanded inline inside
glibc.  In turn, this means that direct calls to __fegetround from C99
functions in ldbl-128ibm can be changed to calls to fegetround, so
that nofpu fenv_libc.h files don't need to define __fegetround at all
and, by changing ldbl-128ibm files to use <fenv.h> not <fenv_libc.h>,
non-e500 nofpu no longer needs an fenv_libc.h file.

The other macros in fenvinline.h are left conditional on
__NO_MATH_INLINES, although since the only case where this should make
a difference is one involving undefined behavior (if the argument to
the function is not a valid exception macro).

The out-of-line definition for fegetround uses __fegetround (the
inline function removed by this patch).  So this continues to work,
the fenvinline.h header is made to define __fegetround, and then to
define fegetround to call __fegetround.

Tested for powerpc32 (hard float) that installed stripped shared
libraries are unchanged by this patch; also tested that powerpc-nofpu
build still works.  (This patch does not itself fix any bugs; it
simply cleans things up in preparation for separate bug fixes.)

	* sysdeps/powerpc/bits/fenvinline.h (fegetround): Rename macro to
	__fegetround and redefine to call __fegetround.  Remove condition
	on [!__NO_MATH_INLINES].
	* sysdeps/powerpc/fpu/fenv_libc.h (__fegetround): Remove inline
	function.
	* sysdeps/powerpc/nofpu/fenv_libc.h: Remove file.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (__fegetround):
	Remove macro.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	(__llrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	(__lrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	(__rintl): Call fegetround instead of __fegetround.
2014-12-31 19:16:34 +00:00
H.J. Lu 7062bd4230 Don't check PI_STATIC_AND_HIDDEN in i386 dl-machine.h
PI_STATIC_AND_HIDDEN is always defined for i386.  There is no need to
check PI_STATIC_AND_HIDDEN in sysdeps/i386/dl-machine.h.

	[BZ #17775]
	* sysdeps/i386/dl-machine.h (PI_STATIC_AND_HIDDEN): Removed.
	(elf_machine_dynamic) [!PI_STATIC_AND_HIDDEN]: Likewise.
	(elf_machine_load_address) [!PI_STATIC_AND_HIDDEN]: Likewise.
2014-12-30 14:31:58 -08:00
Andrew Senkevich 07256e183e i386: Fix build by GCC 5.0
Fixed 3 "make check" failures on glibc 32bit built by gcc 5.0 due to EBX
was enabled for allocation:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html

Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
were failed because EBX was used as PIC register.

	* sysdeps/i386/tls-macros.h: Include <features.h>.
	(TLS_LE): Use non-PIC version for GCC >= 5.0.
	(TLS_IE): Likewise.
	(TLS_LD): Likewise.
	(TLS_GD): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Don't
	define for GCC >= 5.0.
2014-12-30 11:37:41 -08:00
Joseph Myers 0747f81811 Fix libm feraiseexcept namespace (bug 17723).
Various C90 and UNIX98 libm functions call feraiseexcept, which is not
in those standards.  This causes linknamespace test failures - except
on x86 / x86_64, where feraiseexcept is inline (for the relevant
constant arguments) in bits/fenv.h.

This patch fixes this by making those functions call __feraiseexcept
instead.  All changes are applied to all architectures rather than
considering the possibility that some might not be needed in some
cases (e.g. x86) as it seems most maintainable to keep architectures
consistent.

Where __feraiseexcept does not exist, it is added, with feraiseexcept
made a weak alias; where it is a strong alias, it is made weak.
libm_hidden_def / libm_hidden_proto are used with __feraiseexcept
(this might in some cases improve code generation for existing calls
to __feraiseexcept in some code on some architectures).  Where there
are dummy feraiseexcept macros (on architectures without
floating-point exceptions support, to avoid compile errors from
references to undefined FE_* macros), corresponding dummy
__feraiseexcept macros are added.  And on x86, to ensure
__feraiseexcept calls still get inlined, the inline function in
bits/fenv.h is refactored so that most of it can be reused in an
inline __feraiseexcept in a separate include/bits/fenv.h.

Calls are changed in C90/UNIX98 functions, but generally not in
functions missing from those standards.  They are also changed in
libc_fe* functions (on the basis that those might be used in any libm
function), and in feupdateenv (on the same basis - may be used, via
default libc_*, in any libm function - of course feupdateenv will need
changing to __feupdateenv in a subsequent patch to make that fully
namespace-clean).

No __feraiseexcept is added corresponding to the feraiseexcept in
powerpc bits/fenvinline.h, because that macro definition is
conditional on !defined __NO_MATH_INLINES, and glibc libm is built
with -D__NO_MATH_INLINES, so changing internal calls to use
__feraiseexcept should make no difference.

Tested for x86_64 (testsuite; the only change in disassembly of
installed shared libraries is a slight code reordering in clog10, of
no apparent significance).  Also tested for MIPS, where (in the
configuration tested) it eliminates math.h linknamespace failures for
n32 and n64 (some for o32 remain because of other issues).

	[BZ #17723]
	* include/fenv.h (__feraiseexcept): Use libm_hidden_proto.
	* math/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/arm/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/i386/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/m68k/coldfire/fpu/fraiseexcpt.c (feraiseexcept):
	Likewise.
	* sysdeps/microblaze/math_private.h (__feraiseexcept): New macro.
	* sysdeps/mips/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
	(__feraiseexcept): Likewise.
	* sysdeps/s390/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feraiseexcept): New macro.
	* sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (__feraiseexcept):
	Use libm_hidden_def.
	* sysdeps/x86_64/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	(feraiseexcept): Define as weak not strong alias.  Use
	libm_hidden_weak.
	* sysdeps/x86/fpu/bits/fenv.h (__feraiseexcept_invalid_divbyzero):
	New inline function.  Factored out of ...
	(feraiseexcept): ... here.  Use __feraiseexcept_invalid_divbyzero.
	* sysdeps/x86/fpu/include/bits/fenv.h: New file.
	* math/e_scalb.c (invalid_fn): Call __feraiseexcept instead of
	feraiseexcept.
	* math/w_acos.c (__acos): Likewise.
	* math/w_asin.c (__asin): Likewise.
	* math/w_ilogb.c (__ilogb): Likewise.
	* math/w_j0.c (y0): Likewise.
	* math/w_j1.c (y1): Likewise.
	* math/w_jn.c (yn): Likewise.
	* math/w_log.c (__log): Likewise.
	* math/w_log10.c (__log10): Likewise.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/aarch64/fpu/math_private.h
	(libc_feupdateenv_test_aarch64): Likewise.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/arm/fenv_private.h (libc_feupdateenv_test_vfp): Likewise.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
2014-12-30 17:08:09 +00:00
H.J. Lu 37f469007d Replace %ld with %jd and cast to intmax_t 2014-12-30 08:09:06 -08:00
Andrew Senkevich 8b4416d83c i386: memcpy functions with SSE2 unaligned load/store
These new memcpy functions are the 32-bit version of x86_64 SSE2 unaligned
memcpy.  Memcpy average performace benefit is 18% on Silvermont, other
platforms also improved about 35%, benchmarked on Silvermont, Haswell, Ivy
Bridge, Sandy Bridge and Westmere, performance results attached in

https://sourceware.org/ml/libc-alpha/2014-07/msg00157.html

	* sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S: New file.
	* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/bcopy.S: Select the sse2_unaligned
	version if bit_Fast_Unaligned_Load is set.
	* 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/Makefile (sysdep_routines): Add
	bcopy-sse2-unaligned, memcpy-sse2-unaligned,
	memmove-sse2-unaligned and mempcpy-sse2-unaligned.
	* sysdeps/i386/i686/multiarch/ifunc-impl-list.c (MAX_IFUNC): Set
	to 4.
	(__libc_ifunc_impl_list): Test __bcopy_sse2_unaligned,
	__memmove_chk_sse2_unaligned, __memmove_sse2_unaligned,
	__memcpy_chk_sse2_unaligned, __memcpy_sse2_unaligned,
	__mempcpy_chk_sse2_unaligned, and __mempcpy_sse2_unaligned.
2014-12-30 07:19:38 -08:00
Chris Metcalf 6d6d7fde04 Fix a couple of -Wundef warnings. 2014-12-29 23:14:38 -05:00
Chris Metcalf cd2c37c979 tile: prefer inlines to macros in math_private.h. 2014-12-29 19:48:43 -05:00
Siddhesh Poyarekar 50cbbaa935 Use posix-conf-vars.list to generate spec array
This patch adds support to generate the spec array in getconf from the
conf.list.  The generated code is mostly unchanged.  the only changes
are due to the change in layout of the spec and val arrays in the ELF.

The val array can also be auto-generated from posix-conf-vars.list
once the remaining macros are added to it.

	* posix/posix-conf-vars.list (SPEC:XBS5): Add sysconf prefix.
	* posix/confstr.c: Define NEED_SPEC_ARRAY to 0.
	* posix/posix-envs.def: Likewise.
	* sysdeps/posix/sysconf.c: Likewise.
	* posix/getconf.c: Define NEED_SPEC_ARRAY to 1.
	(specs): Remove array.
	* scripts/gen-posix-conf-vars.awk: Support generation of specs
	array.
2014-12-29 19:56:27 +05:30
Siddhesh Poyarekar 3b566046c3 Add _POSIX namespace SYSCONF macros to posix-conf-vars.list
This fixes the remaining -Wundef warnings.  Tested on x86_64.

	* posix/posix-conf-vars.list: Add _POSIX sysconf namespace.
	* sysdeps/posix/sysconf.c: Include posix-conf-vars.h.
	(__sysconf): Use CONF_IS_* macros.
2014-12-29 19:56:01 +05:30
Chris Metcalf 0025b4cc84 tile: add no-op fe*() routines for libc internal use
These avoid having tile generate real calls to the no-op
functions, which then causes linknamespace test failures.

It might make sense to factor all of these out into a common
header that can be shared by tile, microblaze, etc., but for
now just fix the test failures.
2014-12-26 18:39:47 -05:00
Chris Metcalf d8aaf74be9 linux/clock_settime: remove unnecessary vDSO definitions
These definitions were added back before __ASSUME_POSIX_CPU_TIMERS
was removed.  There used to be a vsyscall to clock_getres() in
maybe_syscall_settime_cpu(), but that function was removed in commit
26889eac.  The presence of the vsyscall definitions means that platforms
that don't provide clock_getres as a vsyscall hit a symbol redefinition
warning in this file, becoming fatal with -Werror.  Removing the
vsyscall definitions is the obvious fix.

No change to generated code on x86_64.
2014-12-26 16:34:02 -05:00
Chris Metcalf 5d24aa6056 tilegx: fix sysdep.h to avoid a redefinition warning
The symbol for HAVE_CLOCK_GETTIME_VSYSCALL was being
only conditionally defined under [SHARED].  However, it turns
out this causes a preprocessor symbol redefinition warning
when building clock_gettime.o.  Move the symbol definition
down to make it unconditional, like other platforms do.
2014-12-26 16:22:28 -05:00
Chris Metcalf 7c1395a7e4 tilegx32: avoid a a -Werror warning from unwinding
The _Unwind_GetCFA() routine returns a 64-bit value,
which we interpret as a pointer.  Add an intermediate
cast to long so that in ILP32 mode we don't get a warning
about casting a wrong-sized integer to a pointer.
2014-12-26 16:18:40 -05:00
Chris Metcalf 3c87c6167e tilegx: enable wordsize-64 support for ieee745 dbl-64.
I missed this during the initial port.  Some testing shows that
enabling this mode does, unsurprisingly, yield some nice speedups
on the math functions in question.
2014-12-23 14:04:35 -05:00
Joseph Myers 90aa3d0945 Make __ASSUME_UTIMES hppa-specific.
This patch makes __ASSUME_UTIMES hppa-specific, removing mentions of
the macro from architecture-independent code and code for other
architectures.  (All other architectures either have the utimes
syscall in all relevant kernel versions, or use the asm-generic
interface so only have utimensat and won't get the utimes syscall.)  A
similar approach is used to that used for futimesat for MicroBlaze: if
the kernel is recent enough that the utimes syscall can be assumed to
be present, use the implementation in terms of the utimes syscall, and
otherwise use the linux/generic implementation in terms of utimensat.

Tested x86_64 that the disassembly of installed shared libraries is
unchanged by the patch.  Not tested for hppa.

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_UTIMES): Do
	not define.
	* sysdeps/unix/sysv/linux/utimes.c: Do not include
	<kernel-features.h>.
	(__utimes) [__NR_utimes]: Make code unconditional.
	(__utimes) [!__ASSUME_UTIMES]: Remove conditional code.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_UTIMES): Do not undefine.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_UTIMES): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_UTIMES): Define for [__LINUX_KERNEL_VERSION >= 0x030e00]
	instead of undefining for [__LINUX_KERNEL_VERSION < 0x030e00].
	* sysdeps/unix/sysv/linux/hppa/utimes.c: New file.
2014-12-22 21:42:03 +00:00
Steve Ellcey 4c0c0e2aef Fix preprocessor indentation in sysdeps/mips/memcpy.S.
Checked in as obvious.
2014-12-22 13:29:20 -08:00
Chris Metcalf 0dacd7a3b9 tilegx: remove implicit boolean conversion in strstr.
[BZ #17746]
The __builtin_expect() truncated a uint64_t to a 32-bit long
in ILP32 mode, discarding the high 32 bits, and potentially
missing the NUL terminator that we were searching for with SIMD
operations.  Explicitly compare to zero to fix the problem.
2014-12-22 14:50:26 -05:00
Steve Ellcey 528479c472 2014-12-22 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/unix/mips/sysdep.h (__mips_isa_rev): Set
	to zero if not already defined.
2014-12-22 10:49:56 -08:00
Joseph Myers f56f91245a Split __kernel_standard* functions (fixes bug 17724).
Bug 17724 reports references to fesetround being brought in by
ldbl-128ibm rintl via references to __rintl from __kernel_standard_l.
Because all three __kernel_standard* functions are in the same file,
this gets brought in even though only the long double version
__kernel_standard_l needs __rintl, and the C90 functions use only
__kernel_standard.

This patch fixes this by splitting the three versions into separate
files; it's fine for long double functions to refer to fe* functions
directly, unless they get called by C90 double functions.

Tested for x86_64 (testsuite; the reordering of code means disassembly
of shared libraries can't usefully be compared).  Tested for powerpc
that the relevant issue disappears from the linknamespace test
output.

	[BZ #17724]
	* sysdeps/ieee754/k_standard.c: Don't include <float.h>.
	(__kernel_standard_f): Remove.  Moved to k_standardf.c.
	(__kernel_standard_l): Remove.  Moved to k_standardl.c with
	(char *) casts added.
	* sysdeps/ieee754/k_standardf.c: New file.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* math/Makefile (libm-support): Remove k_standard.
	(libm-calls): Add k_standard.
2014-12-22 18:45:50 +00:00
Wilco Dijkstra 9b47df5814 Call libc_fetestexcept_aarch64. 2014-12-22 17:14:54 +00:00
Wilco Dijkstra 97be3cacec Call libc_fesetround_aarch64. 2014-12-22 16:57:41 +00:00
Joseph Myers 935ab81792 Fix resolver bind, getsockname namespace (bug 17733).
On Linux architectures using socketcall, the resolver ends up bringing
in strong symbols for bind and getsockname, which are not in
POSIX.1-1996.  This causes linknamespace test failures:

FAIL: conform/POSIX/pthread.h/linknamespace
FAIL: conform/POSIX/sched.h/linknamespace
FAIL: conform/POSIX/time.h/linknamespace

These functions are defined as strong symbols with __bind and
__getsockname as weak aliases.  This patch switches this to the other
way round by removing the NO_WEAK_ALIAS definitions and so letting the
default case in socket.S act; I see no reason for the existing
arrangements.

Tested for x86 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17733]
	* sysdeps/unix/sysv/linux/bind.S (NO_WEAK_ALIAS): Do not define.
	(__bind): Do not define as weak alias.
	* sysdeps/unix/sysv/linux/getsockname.S (NO_WEAK_ALIAS): Do not
	define.
	(__getsockname): Do not define as weak alias.
2014-12-22 12:46:27 +00:00
Chris Metcalf e969965afd tile: separate ffsll from ffs
This avoids a linknamespace failure when ffs is legal
but ffsll is not.
2014-12-21 17:12:54 -05:00
Chris Metcalf a19ca65ade tile: remove localplt.data and use generic one again.
With the __tls_get_addr removed, it works for tile.
2014-12-21 16:09:36 -05:00
H.J. Lu 050f7298e1 Add hidden __tls_get_addr/___tls_get_addr alias
__tls_get_addr/___tls_get_addr is always defined in ld.so.  There is
no need to call them via PLT inside ld.so.  This patch adds the hidden
__tls_get_addr/___tls_get_addr aliases and calls them directly from
_dl_tlsdesc_dynamic.  There is no need to set up the EBX register in
i386 _dl_tlsdesc_dynamic when calling the hidden ___tls_get_addr.

	* elf/dl-tls.c (__tls_get_addr): Provide the hidden definition
	if not defined.
	* sysdeps/i386/dl-tls.h (___tls_get_addr): Provide the hidden
	definition.
	* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
	hidden ___tls_get_addr.
	* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
	hidden __tls_get_addr.
	* sysdeps/generic/localplt.data (__tls_get_addr): Removed.
	* sysdeps/unix/sysv/linux/i386/localplt.data (___tls_get_addr):
	Likewise.
2014-12-21 09:27:11 -08:00
Andreas Schwab 6df5547e93 m68k: remove @PLTPC from _dl_init call 2014-12-21 15:21:14 +01:00
H.J. Lu 7432d613cd Remove @PLT from "call _dl_init@PLT" in _dl_start_user
_dl_start_user in ld.so calls the local function _dl_init.  There is no
need to go through PLT.

	* sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
	from "call _dl_init@PLT".
	* sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
	from "call _dl_init@PLT".
2014-12-21 05:27:31 -08:00
Chris Metcalf d12455f596 tile: provide localplt.data with __tls_get_addr optional 2014-12-20 13:56:57 -05:00
Chris Metcalf 95dee05f17 tilegx: fix strstr to build and link better
The two_way_short_needle() routine included from str-two-way.h
is not used, so mark it so to avoid compiler warnings.

Calling strnlen() breaks linknamespace tests, so change it
to __strnlen().
2014-12-19 22:54:35 -05:00
Steve Ellcey 0c73b4ea0c Remove trailing white space. 2014-12-19 14:40:29 -08:00
Steve Ellcey 8b2800c0fb 2014-12-19 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/addmul_1.S (__mpn_addmul_1): Use mulu/muhu instead
	of multu on MIPSr6.
	* sysdeps/mips/mul_1.S (__mpn_mul_1): Ditto.
	* sysdeps/mips/submul_1.S (__mpn_submul_1): Ditto.
	* sysdeps/mips/mips64/addmul_1.S (__mpn_addmul_1): Ditto.
	* sysdeps/mips/mips64/mul_1.S (__mpn_mul_1): Ditto.
	* sysdeps/mips/mips64/submul_1.S (__mpn_submul_1): Ditto.
2014-12-19 14:39:18 -08:00
Steve Ellcey 04d5556197 2014-12-19 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/sys/asm.h (PTR_ADDU): Use addu on mips32r6/mips64r6.
	(PTR_ADDIU): Use addiu for mips32r6/mips64r6.
	(PTR_SUBU): Use subu for mips32r6/mips64r6.
	(PTR_SUBIU): Use subu for mips32r6/mips64r6 (subiu does not exist).
	* sysdeps/mips/machine-gmon.h (PTR_ADDU_STRING) Use addu for
	mips32r6/mips64r6.
	(PTR_SUBU_STRING) Use subu for mips32r6/mips64r6.
2014-12-19 14:37:44 -08:00