platform/upstream/glibc.git
8 years agoRevert not defining NO_HIDDEN on hurd
Samuel Thibault [Wed, 25 Nov 2015 01:48:22 +0000 (02:48 +0100)]
Revert not defining NO_HIDDEN on hurd

       * sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Define.
       * sysdeps/mach/hurd/configure: Regenerate.

8 years agoFix hurd build with hidden support
Samuel Thibault [Wed, 25 Nov 2015 01:35:18 +0000 (02:35 +0100)]
Fix hurd build with hidden support

* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Destroy reply port
of interrupted RPC instead of restoring it.

* sysdeps/i386/setjmp.S (__sigsetjmp): Add hidden_def.
* sysdeps/mach/hurd/accept4.c (__libc_accept4): Remove
libc_hidden_def.
* sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Add relro
attribute, define rtld_hidden_data_def.
* sysdeps/mach/hurd/fxstatat64.c (__fxstatat64): Add libc_hidden_def.
* sysdeps/mach/hurd/if_index.c (__if_freenameindex): Add
libc_hidden_def.
(if_freenameindex): Add libc_hidden_weak.
(if_nameindex): Add libc_hidden_weak.
* sysdeps/mach/hurd/open.c (_open64): Rename libc_hidden_weak into
__open64.
* sysdeps/mach/hurd/sigwait.c (__sigwait): Add libc_hidden_def.
* sysdeps/mach/hurd/xmknodat.c (__xmknodat): Add libc_hidden_def.
* sysdeps/mach/nanosleep.c: Include <time.h>
(__nanosleep): Rename to __libc_nanosleep.
(__nanosleep): Add weak_alias.
(nanosleep): Update alias.
* sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not define.
* sysdeps/mach/hurd/configure: Regenerate.

8 years agoFix RPC breakage when longjumping from signal handler
Samuel Thibault [Wed, 25 Nov 2015 00:09:13 +0000 (01:09 +0100)]
Fix RPC breakage when longjumping from signal handler

* hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Destroy reply port
of interrupted RPC instead of restoring it.

8 years agoRefactor strtod parsing of NaN payloads.
Joseph Myers [Tue, 24 Nov 2015 22:24:52 +0000 (22:24 +0000)]
Refactor strtod parsing of NaN payloads.

The nan* functions handle their string argument by constructing a
NAN(...) string on the stack as a VLA and passing it to strtod
functions.

This approach has problems discussed in bug 16961 and bug 16962: the
stack usage is unbounded, and it gives incorrect results in certain
cases where the argument is not a valid n-char-sequence.

The natural fix for both issues is to refactor the NaN payload parsing
out of strtod into a separate function that the nan* functions can
call directly, so that no temporary string needs constructing on the
stack at all.  This patch does that refactoring in preparation for
fixing those bugs (but without actually using the new functions from
nan* - which will also require exporting them from libc at version
GLIBC_PRIVATE).  This patch is not intended to change any user-visible
behavior, so no tests are added (fixes for the above bugs will of
course add tests for them).

This patch builds on my recent fixes for strtol and strtod issues in
Turkish locales.  Given those fixes, the parsing of NaN payloads is
locale-independent; thus, the new functions do not need to take a
locale_t argument.

Tested for x86_64, x86, mips64 and powerpc.

* stdlib/strtod_nan.c: New file.
* stdlib/strtod_nan_double.h: Likewise.
* stdlib/strtod_nan_float.h: Likewise.
* stdlib/strtod_nan_main.c: Likewise.
* stdlib/strtod_nan_narrow.h: Likewise.
* stdlib/strtod_nan_wide.h: Likewise.
* stdlib/strtof_nan.c: Likewise.
* stdlib/strtold_nan.c: Likewise.
* sysdeps/ieee754/ldbl-128/strtod_nan_ldouble.h: Likewise.
* sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h: Likewise.
* sysdeps/ieee754/ldbl-96/strtod_nan_ldouble.h: Likewise.
* wcsmbs/wcstod_nan.c: Likewise.
* wcsmbs/wcstof_nan.c: Likewise.
* wcsmbs/wcstold_nan.c: Likewise.
* stdlib/Makefile (routines): Add strtof_nan, strtod_nan and
strtold_nan.
* wcsmbs/Makefile (routines): Add wcstod_nan, wcstold_nan and
wcstof_nan.
* include/stdlib.h (__strtof_nan): Declare and use
libc_hidden_proto.
(__strtod_nan): Likewise.
(__strtold_nan): Likewise.
(__wcstof_nan): Likewise.
(__wcstod_nan): Likewise.
(__wcstold_nan): Likewise.
* include/wchar.h (____wcstoull_l_internal): Declare.
* stdlib/strtod_l.c: Do not include <ieee754.h>.
(____strtoull_l_internal): Remove declaration.
(STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
(STRTOULL): Likewise.
(____STRTOF_INTERNAL): Use STRTOF_NAN to parse NaN payload.
* stdlib/strtof_l.c (____strtoull_l_internal): Remove declaration.
(STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-128/strtold_l.c (STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c (STRTOF_NAN): Define
macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-64-128/strtold_l.c (STRTOF_NAN): Define
macro.
(SET_MANTISSA): Remove macro.
* sysdeps/ieee754/ldbl-96/strtold_l.c (STRTOF_NAN): Define macro.
(SET_MANTISSA): Remove macro.
* wcsmbs/wcstod_l.c (____wcstoull_l_internal): Remove declaration.
* wcsmbs/wcstof_l.c (____wcstoull_l_internal): Likewise.
* wcsmbs/wcstold_l.c (____wcstoull_l_internal): Likewise.

8 years agoFix strtod ("NAN(I)") in Turkish locales (bug 19266).
Joseph Myers [Tue, 24 Nov 2015 22:21:59 +0000 (22:21 +0000)]
Fix strtod ("NAN(I)") in Turkish locales (bug 19266).

The implementations of strtod and related functions use
locale-specific conversions to lower case when parsing the contents of
a string NAN(n-char-sequence_opt).  This has the consequence that
NAN(I) is not treated as being of that form (only the initial NAN part
is accepted).  The syntax of n-char-sequence directly maps to the
ASCII letters, digits and underscore as in identifiers, so it is
unambiguous that all ASCII letters must be accepted in all locales.

This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2015-11/msg00258.html> (pending
review) applied and depending on that patch, fixes this problem by
checking directly for ASCII letters.  This will have the side effect
of no longer accepting 'İ' (dotted 'I') inside NAN() in Turkish
locales, which seems appropriate (that letter wouldn't have been
interpreted as having any meaning in the NaN payload anyway, as not
acceptable to strtoull).

Tested for x86_64 and x86.

[BZ #19266]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Check directly for
upper case and lower case letters inside NAN(), not using TOLOWER.
* stdlib/tst-strtod-nan-locale-main.c: New file.
* stdlib/tst-strtod-nan-locale.c: Likewise.
* stdlib/Makefile (tests): Add tst-strtod-nan-locale.
[$(run-built-tests) = yes] ($(objpfx)tst-strtod-nan-locale.out):
Depend on $(gen-locales).
($(objpfx)tst-strtod-nan-locale): Depend on $(libm).
* wcsmbs/tst-wcstod-nan-locale.c: New file.
* wcsmbs/Makefile (tests): Add tst-wcstod-nan-locale.
[$(run-built-tests) = yes] ($(objpfx)tst-wcstod-nan-locale.out):
Depend on $(gen-locales).
($(objpfx)tst-wcstod-nan-locale): Depend on $(libm).

8 years agomisc/tst-tsearch.c: bump up TIMEOUT to 10 seconds.
Chris Metcalf [Tue, 24 Nov 2015 19:07:02 +0000 (14:07 -0500)]
misc/tst-tsearch.c: bump up TIMEOUT to 10 seconds.

8 years agotile: define __NO_LONG_DOUBLE_MATH
Chris Metcalf [Tue, 24 Nov 2015 15:09:16 +0000 (10:09 -0500)]
tile: define __NO_LONG_DOUBLE_MATH

This avoids build failures in the tests, and matches what is in
bits/mathdef.h.

Update the libc and libm abilist files to include __finitel,
__isinfl, and __isnanl.

8 years agomalloc: remove redundant getenv call
Gleb Fotengauer-Malinovskiy [Tue, 24 Nov 2015 16:19:32 +0000 (16:19 +0000)]
malloc: remove redundant getenv call

* malloc/memusage.c (me): Remove redundant getenv call.

8 years agoRemove CPU set size checking from affinity functions [BZ #19143]
Florian Weimer [Tue, 24 Nov 2015 16:21:01 +0000 (17:21 +0100)]
Remove CPU set size checking from affinity functions [BZ #19143]

With current kernel versions, the check does not reliably detect that
unavailable CPUs are requested, for these reasons:

(1) The kernel will silently ignore non-allowed CPUs, that is, CPUs
    which are physically present but disallowed for the thread
    based on system configuration.

(2) Similarly, CPU bits which lack an online CPU (possible CPUs)
    are ignored.

(3) The existing probing code assumes that the CPU mask size is a
    power of two and at least 1024.  Neither has it to be a power
    of two, nor is the minimum possible value 1024, so the value
    determined is often too large.  This means that the CPU set
    size check in glibc accepts CPU bits beyond the actual hard
    system limit.

(4) Future kernel versions may not even have a fixed CPU set size.

After the removal of the probing code, the kernel still returns
EINVAL if no CPU in the requested set remains which can run the
thread after the affinity change.

Applications which care about the exact affinity mask will have
to query it using sched_getaffinity after setting it.  Due to the
effects described above, this commit does not change this.

The new tests supersede tst-getcpu, which is removed.  This
addresses bug 19164 because the new tests allocate CPU sets
dynamically.

* nptl/check-cpuset.h: Remove.
* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
Remove CPU set size check.
* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
Likewise.
* sysdeps/unix/sysv/linux/check-cpuset.h: Remove.
* sysdeps/unix/sysv/linux/pthread_setaffinity.c
(__kernel_cpumask_size, __determine_cpumask_size): Remove.
(__pthread_setaffinity_new): Remove CPU set size check.
* sysdeps/unix/sysv/linux/sched_setaffinity.c
(__kernel_cpumask_size): Remove.
(__sched_setaffinity_new): Remove CPU set size check.
* manual/threads.texi (Default Thread Attributes): Remove stale
reference to check_cpuset_attr, determine_cpumask_size in comment.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == posix] (tests):
Remove tst-getcpu.  Add tst-affinity, tst-affinity-pid.
[$(subdir) == nptl] (tests): Add tst-thread-affinity-pthread,
tst-thread-affinity-pthread2, tst-thread-affinity-sched.
* sysdeps/unix/sysv/linux/tst-affinity.c: New file.
* sysdeps/unix/sysv/linux/tst-affinity-pid.c: New file.
* sysdeps/unix/sysv/linux/tst-skeleton-affinity.c: New skeleton test file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-sched.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread2.c: New file.
* sysdeps/unix/sysv/linux/tst-thread-skeleton-affinity.c: New
skeleton test file.
* sysdeps/unix/sysv/linux/tst-getcpu.c: Remove.  Superseded by
tst-affinity-pid.

8 years agoImplement "make update-all-abi"
Florian Weimer [Tue, 24 Nov 2015 16:10:19 +0000 (17:10 +0100)]
Implement "make update-all-abi"

* scripts/update-abilist.sh: New file.
* Makefile (+subdir_targets): Add subdir_update-all-abi.
* Makerules (update-all-abi-%, update-all-abi)
(subdir_update-all-abi): New targets.
* elf/Makefile (update-all-abi): New target.

8 years agoReplace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code
Florian Weimer [Tue, 24 Nov 2015 15:37:15 +0000 (16:37 +0100)]
Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code

* sysdeps/mach/hurd/libc-lock.h (_LIBC_LOCK_INITIALIZER): Define.
(__libc_lock_define_initialized): Use it.
* sysdeps/nptl/libc-lockP.h (_LIBC_LOCK_INITIALIZER): Define.
* malloc/arena.c (list_lock): Use _LIBC_LOCK_INITIALIZER.
* malloc/malloc.c (main_arena): Likewise.
* sysdeps/generic/malloc-machine.h (MUTEX_INITIALIZER): Remove.
* sysdeps/nptl/malloc-machine.h (MUTEX_INITIALIZER): Remove.

8 years agoUpdate <sys/ptrace.h> for Linux 4.3.
Joseph Myers [Mon, 23 Nov 2015 17:53:08 +0000 (17:53 +0000)]
Update <sys/ptrace.h> for Linux 4.3.

This patch updates <sys/ptrace.h> for Linux 4.3, adding
PTRACE_O_SUSPEND_SECCOMP and updating the value of PTRACE_O_MASK.
Some architectures were missing the older PTRACE_O_EXITKILL, so that
was added to the files missing it as well.

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

* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
(PTRACE_O_EXITKILL): New value in enum __ptrace_setoptions.
(PTRACE_O_SUSPEND_SECCOMP): Likewise.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h (PTRACE_O_EXITKILL):
New value in enum __ptrace_setoptions.
(PTRACE_O_SUSPEND_SECCOMP): Likewise.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
(PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
(PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
(PTRACE_O_SUSPEND_SECCOMP): New value in enum __ptrace_setoptions.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_O_SUSPEND_SECCOMP):
New value in enum __ptrace_setoptions.
(PTRACE_O_MASK): Update value.
* sysdeps/unix/sysv/linux/tile/sys/ptrace.h (PTRACE_O_EXITKILL):
New value in enum __ptrace_setoptions.
(PTRACE_O_SUSPEND_SECCOMP): Likewise.
(PTRACE_O_MASK): Update value.

8 years agoUpdate <netpacket/packet.h> for Linux 4.3.
Joseph Myers [Mon, 23 Nov 2015 17:52:08 +0000 (17:52 +0000)]
Update <netpacket/packet.h> for Linux 4.3.

In the course of reviewing Linux 4.3 changes for any glibc header
updates needed, I found that
sysdeps/unix/sysv/linux/netpacket/packet.h was extremely out of date
(last updated for Linux 2.3.15, it seems).  This patch updates the
sets of constants present in that header to include those added to
those sets in newer kernels (include/uapi/linux/if_packet.h).

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

* sysdeps/unix/sysv/linux/netpacket/packet.h (PACKET_COPY_THRESH):
New macro.
(PACKET_AUXDATA): Likewise.
(PACKET_ORIGDEV): Likewise.
(PACKET_VERSION): Likewise.
(PACKET_HDRLEN): Likewise.
(PACKET_RESERVE): Likewise.
(PACKET_TX_RING): Likewise.
(PACKET_LOSS): Likewise.
(PACKET_VNET_HDR): Likewise.
(PACKET_TX_TIMESTAMP): Likewise.
(PACKET_TIMESTAMP): Likewise.
(PACKET_FANOUT): Likewise.
(PACKET_TX_HAS_OFF): Likewise.
(PACKET_QDISC_BYPASS): Likewise.
(PACKET_ROLLOVER_STATS): Likewise.
(PACKET_FANOUT_DATA): Likewise.
(PACKET_MR_UNICAST): Likewise.

8 years agoFix strtol in Turkish locales (bug 19242).
Joseph Myers [Mon, 23 Nov 2015 08:50:53 +0000 (08:50 +0000)]
Fix strtol in Turkish locales (bug 19242).

The implementations of strtol and related functions use
locale-specific conversions to upper case before determining whether a
character is a valid letter in the argument.  This means that in
Turkish locales such as tr_TR.UTF-8 and tr_TR.ISO-8859-9, "i" is
interpreted as not being a valid number, when if the base passed to
strtol is 19 or more it should be interpreted as the number 18.

ISO C explicitly says "The letters from a (or A) through z (or Z) are
ascribed the values 10 through 35", so clearly intends the standard
ASCII letters (otherwise you wouldn't generally have exactly 26
letters to ascribe such values) (whereas white-space must be
identified according to the locale).  In particular, 'i' and 'I' must
be understood to be in that sequence.

This patch makes the code do the case conversions and classification
in the C locale; the user's locale remains used for whitespace testing
(explicitly correct according to ISO C).  Note that the way the code
worked, the only non-ASCII letter that would previously have been
accepted would have been the Turkish 'ı' (dotless 'i'), because the
uppercase version of that in Turkish locales is 'I'.  This patch means
that will no longer be accepted, which seems appropriate.

Tested for x86_64 and x86.

[BZ #19242]
* stdlib/strtol_l.c (ISALPHA): Use _nl_C_locobj_ptr for locale.
(TOUPPER): Likewise.
* stdlib/tst-strtol-locale-main.c: New file.
* stdlib/tst-strtol-locale.c: Likewise.
* stdlib/Makefile (tests): Add tst-strtol-locale.
[$(run-built-tests) = yes] (LOCALES): Add tr_TR.ISO-8859-9.
[$(run-built-tests) = yes] ($(objpfx)tst-strtol-locale.out):
Depend on $(gen-locales).
* wcsmbs/tst-wcstol-locale.c: New file.
* wcsmbs/Makefile (tests): Add tst-wcstol-locale.
[$(run-built-tests) = yes] (LOCALES): Add tr_TR.UTF-8 and
tr_TR.ISO-8859-9.
[$(run-built-tests) = yes] ($(objpfx)tst-wcstol-locale.out):
Depend on $(gen-locales).

8 years agoNaCl: Use allocate_code_data after dyncode_create
Roland McGrath [Sat, 21 Nov 2015 00:16:35 +0000 (16:16 -0800)]
NaCl: Use allocate_code_data after dyncode_create

8 years agoFix math_private.h multiple include guards.
Joseph Myers [Fri, 20 Nov 2015 23:46:23 +0000 (23:46 +0000)]
Fix math_private.h multiple include guards.

Various math_private.h headers are guarded by "#ifndef
_MATH_PRIVATE_H", but never define the macro.  Nothing else defines
the macro either (the generic math_private.h that they include defines
a different macro, _MATH_PRIVATE_H_), so those guards are ineffective.

With the recent inclusion of s_sin.c in s_sincos.c, this breaks the
build for MIPS, since the build of s_sincos.c ends up including
<math_private.h> twice and the MIPS version defines inline functions
such as libc_feholdexcept_mips, without a separate fenv_private.h
header with its own guards such as some architectures have.

This patch fixes all the problem headers to use architecture-specific
guard macro names, and to define those macros in the headers they
guard, just as some architectures already do.

Tested for x86 (testsuite, and that installed shared libraries are
unchanged by the patch), and for mips64 (that it fixes the build).

* sysdeps/arm/math_private.h [!_MATH_PRIVATE_H]: Change guard to
[!ARM_MATH_PRIVATE_H].
[!ARM_MATH_PRIVATE_H] (ARM_MATH_PRIVATE_H): Define macro.
* sysdeps/hppa/math_private.h [!_MATH_PRIVATE_H]: Change guard to
[!HPPA_MATH_PRIVATE_H].
[!HPPA_MATH_PRIVATE_H] (HPPA_MATH_PRIVATE_H): Define macro.
* sysdeps/i386/fpu/math_private.h [!_MATH_PRIVATE_H]: Change guard
to [!I386_MATH_PRIVATE_H].
[!I386_MATH_PRIVATE_H] (I386_MATH_PRIVATE_H): Define macro.
* sysdeps/m68k/m680x0/fpu/math_private.h [!_MATH_PRIVATE_H]:
Change guard to [!M68K_MATH_PRIVATE_H].
[!M68K_MATH_PRIVATE_H] (M68K_MATH_PRIVATE_H): Define macro.
* sysdeps/microblaze/math_private.h [!_MATH_PRIVATE_H]: Change
guard to [!MICROBLAZE_MATH_PRIVATE_H].
[!MICROBLAZE_MATH_PRIVATE_H] (MICROBLAZE_MATH_PRIVATE_H): Define
macro.
* sysdeps/mips/math_private.h [!_MATH_PRIVATE_H]: Change guard to
[!MIPS_MATH_PRIVATE_H].
[!MIPS_MATH_PRIVATE_H] (MIPS_MATH_PRIVATE_H): Define macro.
* sysdeps/nios2/math_private.h [!_MATH_PRIVATE_H]: Change guard to
[!NIO2_MATH_PRIVATE_H].
[!NIO2_MATH_PRIVATE_H] (NIO2_MATH_PRIVATE_H): Define macro.
* sysdeps/tile/math_private.h [!_MATH_PRIVATE_H]: Change guard to
[!TILE_MATH_PRIVATE_H].
[!TILE_MATH_PRIVATE_H] (TILE_MATH_PRIVATE_H): Define macro.

8 years agoFix lgamma setting signgam for ISO C (bug 15421).
Joseph Myers [Fri, 20 Nov 2015 22:49:59 +0000 (22:49 +0000)]
Fix lgamma setting signgam for ISO C (bug 15421).

The lgamma (and likewise lgammaf, lgammal) function wrongly sets the
signgam variable even when building for strict ISO C conformance
(-std=c99 / -std=c11), although the user may define such a variable
and it's only in the implementation namespace for POSIX with XSI
extensions enabled.

Following discussions starting at
<https://sourceware.org/ml/libc-alpha/2013-04/msg00767.html> and
<https://sourceware.org/ml/libc-alpha/2015-10/msg00844.html>, it seems
that the safest approach for fixing this particular issue is for
signgam to become a weak alias for a newly exported symbol __signgam,
with the library functions only setting __signgam, at which point
static linker magic will preserve the alias for newly linked binaries
that refer to the library's signgam rather than defining their own,
while breaking the alias for programs that define their own signgam,
with new symbol versions for lgamma functions and with compat symbols
for existing binaries that set both signgam and __signgam.

This patch implements that approach for the fix.  signgam is made into
a weak alias.  The four symbols __signgam, lgamma, lgammaf, lgammal
get new symbol versions at version GLIBC_2.23, with the existing
versions of lgamma, lgammaf and lgammal becoming compat symbols.

When the compat versions are built, gamma, gammaf and gammal are
aliases for the compat versions (i.e. always set signgam); this is OK
as they are not ISO C functions, and avoids adding new symbol versions
for them unnecessarily.  When the compat versions are not built
(i.e. for static linking and for future glibc ports), gamma, gammaf
and gammal are aliases for the new versions that set __signgam.  The
ldbl-opt versions are updated accordingly.

The lgamma wrappers are adjusted so that the same source files,
included from different files with different definitions of
USE_AS_COMPAT, can build either the new versions or the compat
versions.  Similar changes are made to the ia64 versions (untested).

Tests are added that the lgamma functions do not interfere with a user
variable called signgam for ISO C, with various choices for the size
of that variable, whether it is initialized, and for static and
dynamic linking.  The conformtest whitelist entry is removed as well.

Tested for x86_64, x86, mips64 and powerpc, including looking at
objdump --dynamic-syms output to make sure the expected sets of
symbols were aliases.  Also spot-tested that a binary built with old
glibc works properly (i.e. gets signgam set) when run with new glibc.

[BZ #15421]
* sysdeps/ieee754/s_signgam.c (signgam): Rename to __signgam,
initialize with 0 and define as weak alias of __signgam.
* include/math.h [!_ISOMAC] (__signgam): Declare.
* math/Makefile (libm-calls): Add w_lgamma_compat.
(tests): Add test-signgam-uchar, test-signgam-uchar-init,
test-signgam-uint, test-signgam-uint-init, test-signgam-ullong and
test-signgam-ullong-init.
(tests-static): Add test-signgam-uchar-static,
test-signgam-uchar-init-static, test-signgam-uint-static,
test-signgam-uint-init-static, test-signgam-ullong-static and
test-signgam-ullong-init-static.
(CFLAGS-test-signgam-uchar.c): New variable.
(CFLAGS-test-signgam-uchar-init.c): Likewise.
(CFLAGS-test-signgam-uchar-static.c): Likewise.
(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
(CFLAGS-test-signgam-uint.c): Likewise.
(CFLAGS-test-signgam-uint-init.c): Likewise.
(CFLAGS-test-signgam-uint-static.c): Likewise.
(CFLAGS-test-signgam-uint-init-static.c): Likewise.
(CFLAGS-test-signgam-ullong.c): Likewise.
(CFLAGS-test-signgam-ullong-init.c): Likewise.
(CFLAGS-test-signgam-ullong-static.c): Likewise.
(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
* math/Versions (libm): Add GLIBC_2.23.
* math/lgamma-compat.h: New file.
* math/test-signgam-main.c: Likewise.
* math/test-signgam-uchar-init-static.c: Likewise.
* math/test-signgam-uchar-init.c: Likewise.
* math/test-signgam-uchar-static.c: Likewise.
* math/test-signgam-uchar.c: Likewise.
* math/test-signgam-uint-init-static.c: Likewise.
* math/test-signgam-uint-init.c: Likewise.
* math/test-signgam-uint-static.c: Likewise.
* math/test-signgam-uint.c: Likewise.
* math/test-signgam-ullong-init-static.c: Likewise.
* math/test-signgam-ullong-init.c: Likewise.
* math/test-signgam-ullong-static.c: Likewise.
* math/test-signgam-ullong.c: Likewise.
* math/w_lgamma.c: Rename to w_lgamma_main.c and replace by
wrapper of w_lgamma_main.c.
* math/w_lgamma_compat.c: New file.
* math/w_lgamma_compatf.c: Likewise.
* math/w_lgamma_compatl.c: Likewise.
* math/w_lgamma_main.c: New file.  Based on w_lgamma.c.  Include
<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
defining compatibility symbols.
(__lgamma): Change to LGFUNC (__lgamma).  Use CALL_LGAMMA.
* math/w_lgammaf.c: Rename to w_lgammaf_main.c and replace by
wrapper of w_lgammaf_main.c.
* math/w_lgammaf_main.c: New file.  Based on w_lgammaf.c.  Include
<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
defining compatibility symbols.
(__lgammaf): Change to LGFUNC (__lgammaf).  Use CALL_LGAMMA.
* math/w_lgammal.c: Rename to w_lgammal_main.c and replace by
wrapper of w_lgammal_main.c.
* math/w_lgammal_main.c: New file.  Based on w_lgammal.c.  Include
<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
defining compatibility symbols.
(__lgammal): Change to LGFUNC (__lgammal).  Use CALL_LGAMMA.
* sysdeps/ia64/fpu/lgamma-compat.h: New file.
* sysdeps/ia64/fpu/w_lgamma.c: Move to ....
* sysdeps/ia64/fpu/w_lgamma_main.c: ...here.  Include
<lgamma-compat.h>.
(__ieee754_lgamma): Change to LGFUNC (lgamma).  Use CALL_LGAMMA.
(__ieee754_gamma): Define as alias.
* sysdeps/ia64/fpu/w_lgammaf.c: Move to ....
* sysdeps/ia64/fpu/w_lgammaf_main.c: ...here.  Include
<lgamma-compat.h>.
(__ieee754_lgammaf): Change to LGFUNC (lgammaf).  Use CALL_LGAMMA.
(__ieee754_gammaf): Define as alias.
* sysdeps/ia64/fpu/w_lgammal.c: Move to ....
* sysdeps/ia64/fpu/w_lgammal_main.c: ...here.  Include
<lgamma-compat.h>.
(__ieee754_lgammal): Change to LGFUNC (lgammal).  Use CALL_LGAMMA.
(__ieee754_gammal): Define as alias.
* sysdeps/ieee754/ldbl-opt/w_lgamma.c: Move to ....
* sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c: ...here.  Include
<math/w_lgamma_compat.c>.
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__lgammal_dbl_compat):
Define as alias of __lgamma_compat and use in defining lgammal.
* sysdeps/ieee754/ldbl-opt/w_lgammal.c: Move to ....
* sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c: ...here.  Include
<math/lgamma-compat.h> and <math/w_lgamma_compatl.c>.
(USE_AS_COMPAT): New macro.
(LGAMMA_OLD_VER): Undefine and redefine.
(lgammal): Do not define here.
(gammal): Only define here if [GAMMA_ALIAS].
* conform/linknamespace.pl (@whitelist): Remove signgam.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

8 years agoRemove signal handling for nanosleep (bug 16364)
Adhemerval Zanella [Sun, 8 Nov 2015 22:06:42 +0000 (20:06 -0200)]
Remove signal handling for nanosleep (bug 16364)

Linux 2.6.32 and forward do not show the issue regarding SysV SIGCHLD
vs. SIG_IGN for nanosleep which make it feasible to use it for sleep
implementation without requiring any hacking to handle the spurious
wake up.  The issue is likely being fixed before 2.6 and git
history [1] [2].

This patch simplifies the sleep code to call nanosleep directly by
using the posix default version.  It also removes the early cancellation
tests for zero argument, since nanosleep will handle cancellation
in this case.

[1] https://lkml.org/lkml/2004/11/25/5
[2] https://lkml.org/lkml/2003/11/8/50

Checked on x86_64, ppc64le, and aarch64.

[BZ #16364]
* sysdeps/unix/sysv/linux/sleep.c: Remove file
* sysdeps/posix/sleep.c (__sleep): Simplify cancellation handling.

8 years agoS390: Use __asm__ instead of asm.
Stefan Liebler [Fri, 20 Nov 2015 07:56:40 +0000 (08:56 +0100)]
S390: Use __asm__ instead of asm.

* sysdeps/s390/fpu/bits/mathinline.h:
Use __asm__ [__volatile__] instead of asm [volatile].
* sysdeps/s390/abort-instr.h: Likewise.
* sysdeps/s390/atomic-machine.h: Likewise.
* sysdeps/s390/bits/string.h: Likewise.
* sysdeps/s390/dl-tls.h: Likewise.
* sysdeps/s390/fpu/e_sqrt.c: Likewise.
* sysdeps/s390/fpu/e_sqrtf.c: Likewise.
* sysdeps/s390/fpu/e_sqrtl.c: Likewise.
* sysdeps/s390/fpu/fesetround.c: Likewise.
* sysdeps/s390/fpu/fpu_control.h: Likewise.
* sysdeps/s390/fpu/s_fma.c: Likewise.
* sysdeps/s390/fpu/s_fmaf.c: Likewise.
* sysdeps/s390/memusage.h: Likewise.
* sysdeps/s390/multiarch/ifunc-resolve.h: Likewise.
* sysdeps/s390/nptl/pthread_spin_lock.c: Likewise.
* sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise.
* sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise.
* sysdeps/s390/nptl/tls.h: Likewise.
* sysdeps/s390/s390-32/__longjmp.c: Likewise.
* sysdeps/s390/s390-32/backtrace.c: Likewise.
* sysdeps/s390/s390-32/dl-machine.h: Likewise.
* sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise.
* sysdeps/s390/s390-32/stackguard-macros.h: Likewise.
* sysdeps/s390/s390-32/tls-macros.h: Likewise.
* sysdeps/s390/s390-64/__longjmp.c: Likewise.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
* sysdeps/s390/s390-64/dl-machine.h: Likewise.
* sysdeps/s390/s390-64/iso-8859-1_cp037_z900.c: Likewise.
* sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise.
* sysdeps/s390/s390-64/stackguard-macros.h: Likewise.
* sysdeps/s390/s390-64/tls-macros.h: Likewise.
* sysdeps/s390/s390-64/utf16-utf32-z9.c: Likewise.
* sysdeps/s390/s390-64/utf8-utf16-z9.c: Likewise.
* sysdeps/s390/s390-64/utf8-utf32-z9.c: Likewise.
* sysdeps/unix/sysv/linux/s390/brk.c: Likewise.
* sysdeps/unix/sysv/linux/s390/elision-trylock.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sysconf.c: Likewise.

8 years agopowerpc: Spinlock optimization and cleanup
Paul Murphy [Thu, 29 Oct 2015 20:48:47 +0000 (15:48 -0500)]
powerpc: Spinlock optimization and cleanup

This patch optimizes powerpc spinlock implementation by:

* Use the correct EH hint bit on the larx for supported ISA.  For lock
  acquisition, the thread that acquired the lock with a successful stcx
  does not want to give away the write ownership on the cacheline.  The
  idea is to make the load reservation "sticky" about retaining write
  authority to the line.  That way, the store that must inevitably come
  to release the lock can succeed quickly and not contend with other
  threads issuing lwarx.  If another thread does a store to the line
  (false sharing), the winning thread must give up write authority to
  the proper value of EH for the larx for a lock acquisition is 1.

* Increase contented lock performance by up to 40%, and no measurable
  impact on uncontended locks on P8.

Thanks to Adhemerval Zanella who did most of the work.  I've run some
tests, and addressed some minor feedback.

* sysdeps/powerpc/nptl/pthread_spin_lock.c (pthread_spin_lock):
Add lwarx hint, and use macro for acquire instruction.
* sysdeps/powerpc/nptl/pthread_spin_trylock.c (pthread_spin_trylock):
Likewise.
* sysdep/unix/sysv/linux/powerpc/pthread_spin_unlock.c: Move to ...
* sysdeps/powerpc/nptl/pthread_spin_unlock.c: ... here, and
update to use new atomic macros.

8 years agopowerpc: More elision improvements
Paul Murphy [Wed, 28 Oct 2015 22:34:31 +0000 (17:34 -0500)]
powerpc: More elision improvements

__lll_trylock_elision sets the adapt_count variable too
aggressively, and incorrectly on persistent aborts.  Taking
a cue from s390, adapt_count is only updated if the lock
is locked, or a persistent failure occurs.

In addition, the abort codes have been renumbered and
refactored for clarity.  As it stands, glibc only cares
if the abort is persistent or not.

All aborts are now persistent, excepting a busy lock.  This
includes changing _ABORT_NESTED_TRYLOCK into a persistent
abort.

* sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
(__lll_trylock_elision): Fix setting of adapt_count.
* sysdeps/unix/sysv/linux/powerpc/htm.h
(_ABORT_PERSISTENT): Define to clarify persistent aborts.
(_ABORT_NESTED_TRYLOCK): Renumber, and make persistent.
(_ABORT_SYSCALL): Renumber, and clarify definition.
(_ABORT_LOCK_BUSY): Renumber, make non-persistent.

8 years agoShuffle includes in ldbl-128ibm/mpn2ldl.c
Paul Murphy [Tue, 17 Nov 2015 18:27:39 +0000 (12:27 -0600)]
Shuffle includes in ldbl-128ibm/mpn2ldl.c

Kind of hokey, but errno.h drags in misc/sys/param.h which
defines MIN/MAX causing an error.  Include system headers
first to grab MIN/MAX definition in param.h, and define
HAVE_ALLOCA to preserve existing behavior.

* sysdeps/ieee754/ldbl-128ibm/mpn2ldl.c: Include gmp headers
after system headers to prevent MIN/MAX redefinition.  Define
HAVE_ALLOCA to preserve builtin alloca usage.

8 years agoInclude s_sin.c in s_sincos.c
Siddhesh Poyarekar [Tue, 17 Nov 2015 10:50:20 +0000 (16:20 +0530)]
Include s_sin.c in s_sincos.c

Include the __sin and __cos functions as local static copies to allow
deper optimization of the functions.  This change shows an improvement
of about 17% in the min case and 12.5% in the mean case for the sincos
microbenchmark on x86_64.

* sysdeps/ieee754/dbl-64/s_sin.c (__sin)[IN_SINCOS]: Mark function
static and don't set or restore rounding.
(__cos)[IN_SINCOS]: Likewise.
* sysdeps/ieee754/dbl-64/s_sincos.c: Include s_sin.c.
(__sincos): Set and restore rounding mode.  Remove check for infinite
or NaN input.

8 years agoRemove redundant else clauses in s_sin.c
Siddhesh Poyarekar [Tue, 17 Nov 2015 10:33:11 +0000 (16:03 +0530)]
Remove redundant else clauses in s_sin.c

Makes the code easier to read due to the reduced nesting.  The
generated binary is unchanged.

8 years agobenchtests: Mark output variables as used
Siddhesh Poyarekar [Tue, 17 Nov 2015 10:31:15 +0000 (16:01 +0530)]
benchtests: Mark output variables as used

Prevent function calls that don't return anything from being optimized
out by the compiler by marking its input variables as used.

This prevents the sincos function call from being optimized out in the
benchmark.

8 years agoWork around conflicting declarations of math functions
Florian Weimer [Mon, 16 Nov 2015 20:29:14 +0000 (21:29 +0100)]
Work around conflicting declarations of math functions

This restores compilation on architectures such as armhfp which
alias acos and acosl because double and long double are the same.

8 years agoRun tst-prelink test for GLOB_DAT reloc
H.J. Lu [Sat, 14 Nov 2015 20:00:16 +0000 (12:00 -0800)]
Run tst-prelink test for GLOB_DAT reloc

Run tst-prelink test on targets with GLOB_DAT relocaton.

* config.make.in (have-glob-dat-reloc): New.
* configure.ac (libc_cv_has_glob_dat): New.  Set to yes if
target supports GLOB_DAT relocaton. AC_SUBST.
* configure: Regenerated.
* elf/Makefile (tests): Add tst-prelink.
(tests-special): Add $(objpfx)tst-prelink-cmp.out.
(tst-prelink-ENV): New.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
* sysdeps/x86/tst-prelink.c: Moved to ...
* elf/tst-prelink.c: Here.
* sysdeps/x86/tst-prelink.exp: Moved to ...
* elf/tst-prelink.exp: Here.
* sysdeps/x86/Makefile (tests): Don't add tst-prelink.
(tst-prelink-ENV): Removed.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
(tests-special): Don't add $(objpfx)tst-prelink-cmp.out.

8 years agoFix ldbl-128ibm strtold overflow handling (bug 14551).
Joseph Myers [Fri, 13 Nov 2015 12:03:46 +0000 (12:03 +0000)]
Fix ldbl-128ibm strtold overflow handling (bug 14551).

For ldbl-128ibm, if the result of strtold overflows in the final
conversion from MPN to IBM long double (because the exponent for a
106-bit IEEE result is 1023 but the high part would end up as
0x1p1024, which overflows), that conversion code fails to handle this
and produces an invalid long double value (high part infinite, low
part not zero) without raising exceptions or setting errno.  This
patch adds an explicit check for this case to ensure an appropriate
result is returned in a way that ensures the right exceptions are
raised, with errno set.

Tested for powerpc.

[BZ #14551]
* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Include <errno.h>.
(__mpn_construct_long_double): If high part overflows to infinity,
set errno and recompute overflowed result of the correct sign.
* sysdeps/ieee754/ldbl-128ibm/Makefile
[$(subdir) = stdlib] (tests): Add tst-strtold-ldbl-128ibm.
[$(subdir) = stdlib] ($(objpfx)tst-strtold-ldbl-128ibm): Depend on
$(libm).
* sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c: New file.

8 years agoFix powerpc round, roundf spurious "inexact" (bug 19238).
Joseph Myers [Thu, 12 Nov 2015 19:00:06 +0000 (19:00 +0000)]
Fix powerpc round, roundf spurious "inexact" (bug 19238).

The powerpc hard-float round and roundf functions, both 32-bit and
64-bit, raise spurious "inexact" exceptions for integer arguments from
adding 0.5 and rounding to integer toward zero.

Since these functions already save and restore the rounding mode, it's
natural to make them restore the full floating-point state instead to
fix this bug, which this patch does.  The save of the state is moved
after the first floating-point operation on the input so that any
"invalid" exceptions from signaling NaN inputs are properly
preserved.  As a consequence of this approach to the fix, "inexact"
for noninteger arguments (disallowed by TS 18661-1 but not by C99/C11,
see bug 15479) is also avoided for these implementations; this is
*not* a general fix for bug 15479 since plenty of other
implementations of various functions still raise spurious "inexact"
for noninteger arguments.

This issue and fix do not apply to builds using power5+ versions of
round and roundf, which use the frin instruction and avoid "inexact"
exceptions that way.

This patch should get hard-float powerpc32 and powerpc64 (default
function implementations) back to a state where test-float and
test-double will pass after ulps regeneration.

Tested for powerpc32 and powerpc64.

[BZ #15479]
[BZ #19238]
* sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Save
floating-point state after first operation on input.  Restore full
state rather than just rounding mode.
* sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_round.S (__round): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_roundf.S (__roundf): Likewise.

8 years agoFix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug...
Joseph Myers [Thu, 12 Nov 2015 16:24:00 +0000 (16:24 +0000)]
Fix powerpc64 lround, lroundf, llround, llroundf spurious "inexact" exceptions (bug 19235).

Similar to bug 19134 for powerpc32, the powerpc64 implementations of
lround, lroundf, llround, llroundf can raise spurious "inexact"
exceptions for integer arguments from adding 0.5 then converting to
integer (this does not apply to the power5+ version for double, which
uses the frin instruction which is defined never to raise "inexact"; I
don't know why power5+ doesn't use that version for float as well).

This patch fixes the bug in a similar way to the powerpc32 bug, by
testing for integers (adding and subtracting 2^52 and comparing with
the value before that addition and subtraction) and not adding 0.5 in
that case.

The powerpc maintainers may wish to look at making power5+ / power6x /
power8 use frin for float lround / llround as well as for double,
unless there's some reason I've missed that this isn't beneficial.

Tested for powerpc64.

[BZ #19235]
* sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Do not
add 0.5 to integer arguments.
* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf):
Likewise.
(.LC2): New object.

8 years agopylintrc: disable reports
Mike Frysinger [Tue, 10 Nov 2015 05:45:41 +0000 (00:45 -0500)]
pylintrc: disable reports

I've never found these useful, nor found anyone else who likes them.
Turn them off by default.

8 years agoNaCl: Use open_resource API for shared objects
Roland McGrath [Wed, 11 Nov 2015 03:44:48 +0000 (19:44 -0800)]
NaCl: Use open_resource API for shared objects

8 years agoFix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug...
Joseph Myers [Wed, 11 Nov 2015 00:06:09 +0000 (00:06 +0000)]
Fix powerpc nearbyint wrongly clearing "inexact" and leaving traps disabled (bug 19228).

Similar to bug 15491 recently fixed for x86_64 / x86, the powerpc
(both powerpc32 and powerpc64) hard-float implementations of
nearbyintf and nearbyint wrongly clear an "inexact" exception that was
raised before the function was called; this shows up as failure of the
test math/test-nearbyint-except added when that bug was fixed.  They
also wrongly leave traps on "inexact" disabled if they were enabled
before the function was called.

This patch fixes the bugs similar to how the x86 bug was fixed: saving
and restoring the whole floating-point state, both to restore the
original "inexact" flag state and to restore the original state of
whether traps on "inexact" were enabled.  Because there's a convenient
point in the powerpc implementations to save state after any sNaN
arguments will have raised "invalid" but before "inexact" traps need
to be disabled, no special handling for "invalid" is needed as in the
x86 version.

Tested for powerpc64 and powerpc32, where it fixes the
math/test-nearbyint-except failure as well as fixing the new test
math/test-nearbyint-except-2 added by this patch.  Also tested for
x86_64 and x86 that the new test passes.

If powerpc experts see a more efficient way of doing this
(e.g. instruction positioning that's better for pipelines on typical
processors) then of course followups optimizing the fix are welcome.

[BZ #19228]
* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (__nearbyint): Save
and restore full floating-point state.
* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (__nearbyintf):
Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (__nearbyint):
Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (__nearbyintf):
Likewise.
* math/test-nearbyint-except-2.c: New file.
* math/Makefile (tests): Add test-nearbyint-except-2.

8 years agoAdd a test for prelink output
H.J. Lu [Tue, 10 Nov 2015 20:27:24 +0000 (12:27 -0800)]
Add a test for prelink output

This test applies to i386 and x86_64 which set R_386_GLOB_DAT and
R_X86_64_GLOB_DAT to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA.

[BZ #19178]
* sysdeps/x86/Makefile (tests): Add tst-prelink.
(tst-prelink-ENV): New.
($(objpfx)tst-prelink-conflict.out): Likewise.
($(objpfx)tst-prelink-cmp.out): Likewise.
(tests-special): Add $(objpfx)tst-prelink-cmp.out.
* sysdeps/x86/tst-prelink.c: New file.
* sysdeps/x86/tst-prelink.exp: Likewise.

8 years agoAdd more tests of pow.
Joseph Myers [Tue, 10 Nov 2015 17:34:13 +0000 (17:34 +0000)]
Add more tests of pow.

Prompted by a gcc-patches discussion, this patch adds tests of pow for
the cases where pow (x, 0.5) is required to return a different result
from sqrt (x), as those cases were previously missing from the tests
(although they worked correctly).

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add another test of pow.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (pow_test_data): Add another test.

8 years agoFix nearbyintl linkage for ia64 (bug 19219)
Adhemerval Zanella [Mon, 2 Nov 2015 17:19:45 +0000 (15:19 -0200)]
Fix nearbyintl linkage for ia64 (bug 19219)

GLIBC fails to build for ia64 since commit d0d286d32dda654f8983e8fe77bca0a2cda2051b.
It is because this commit uses the internal definition for nearbyintl,
but ia64 specialized implementation (sysdeps/ia64/fpu/s_nearbyintl.S)
does not define it.

Tested with a ia64 build.

        [BZ #19219]
        * sysdeps/ia64/fpu/s_nearbyintl.S (__nearbyint): Define and
        weak_alias to nearbyintl.

8 years agoEnable _STRING_ARCH_unaligned on AArch64.
Wilco Dijkstra [Tue, 10 Nov 2015 11:13:23 +0000 (11:13 +0000)]
Enable _STRING_ARCH_unaligned on AArch64.

        * sysdeps/aarch64/bits/string.h: New file.
        (_STRING_ARCH_unaligned): Define.

8 years agoRemove __signbit* from localplt.data as they are no longer called from within GLIBC.
Wilco Dijkstra [Tue, 10 Nov 2015 11:07:33 +0000 (11:07 +0000)]
Remove __signbit* from localplt.data as they are no longer called from within GLIBC.

* sysdeps/unix/sysv/linux/aarch64/localplt.data: Remove __signbit*.
* sysdeps/unix/sysv/linux/arm/localplt.data: Likewise.
* sysdeps/unix/sysv/linux/microblaze/localplt.data: Likewise.
* sysdeps/unix/sysv/linux/nios2/localplt.data: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data: Likewise.

8 years agold.so: Add original DSO name if overridden by audit module [BZ #18251]
Florian Weimer [Mon, 9 Nov 2015 15:52:31 +0000 (16:52 +0100)]
ld.so: Add original DSO name if overridden by audit module [BZ #18251]

* elf/dl-load.c (_dl_map_object_from_fd): Add additional parameter
for original name of the DSO.  Add it to the name list of the DSO
if it is actually given.
(_dl_map_object): Keep track of whether an audit module rewrote
the file name.  If yes, pass the original name to
_dl_map_object_from_fd in a new parameter, otherwise NULL.  When
debugging is enabled, log the change of the file name.
* sysdeps/mach/hur/dl-sysdep.c: Adjust commented-out call to
_dl_map_object_from_fd.
* elf/Makefile: Build and run tst-audit11 and tst-audit12.
* elf/tst-audit11.c: New file
* elf/tst-auditmod11.c: New file.
* elf/tst-audit11mod1.c: New file.
* elf/tst-audit11mod2.c: New file.
* elf/tst-audit11mod2.map: New file.
* elf/tst-audit12.c: New file
* elf/tst-auditmod12.c: New file.
* elf/tst-audit12mod1.c: New file.
* elf/tst-audit12mod2.c: New file.
* elf/tst-audit12mod2.map: New file.
* elf/tst-audit12mod3.c: New file.

8 years agoS390: Clean setjmp, longjmp, getcontext symbols.
Stefan Liebler [Mon, 9 Nov 2015 15:14:49 +0000 (16:14 +0100)]
S390: Clean setjmp, longjmp, getcontext symbols.

For each function setjmp, longjmp, getcontext, there exist a symbol
<func> and a default/versioned symbol <func>@@GLIBC_2.x in the build
obj-files.
This is wrong because it should only exist an unversioned or a
default-versioned symbol with the same name in an obj-file.
Glibc can't be build with recent binutils. See the already fixed linker
bug https://sourceware.org/bugzilla/show_bug.cgi?id=19073.
Nevertheless, this patch cleans this up.

Furthermore the BSD entry points setjmp, _setjmp were marked as weak,
but should be strong as on other architectures.
(see https://sourceware.org/ml/libc-alpha/2014-07/msg00568.html for an
older discussion with Andreas Schwab)

Some whitespace issues are corrected in sysdeps/s390/s390-64/setjmp.S,
too. But there is no change in the assembler code.

ChangeLog:

* sysdeps/s390/longjmp.c (longjmp, _longjmp, siglongjmp):
Don't create weak aliases,
because versioned symbols are created later.
* sysdeps/s390/s390-32/setjmp.S
(setjmp, _setjmp): Remove weak and rename to an unique name
in SHARED case due to existing versioned symbols.
* sysdeps/s390/s390-64/setjmp.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
(getcontext): Create weak alias only in non SHARED case.
* sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Likewise.

8 years agoS390: Call direct system calls for socket operations.
Stefan Liebler [Mon, 9 Nov 2015 15:14:49 +0000 (16:14 +0100)]
S390: Call direct system calls for socket operations.

this patch calls direct system calls for socket operations in the same way as power does. The system calls were introduced in kernel commit https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=977108f89c989b1eeb5c8d938e1e71913391eb5f.
There are no direct recv, send, accept syscalls available on s390. Thus
recvfrom, sendto, accept4 are called instead of the socketcall by defining __ASSUME_*_FOR_*_SYSCALL macros. See recv.c, send.c, accept.c in sysdeps/unix/sysv/linux/ folder.

The socketcalls in syscalls.list for s390-64 are removed. They were never used on s390x.

ChangeLog:

* sysdeps/unix/sysv/linux/s390/kernel-features.h:
(__ASSUME_*_SYSCALL) Define new macros.
* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list:
Remove socketcall syscalls.
* sysdeps/unix/sysv/linux/accept.c (__libc_accept):
Use accept4 if defined __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL.
* sysdeps/unix/sysv/linux/recv.c (__libc_recv):
Use recvfrom if defined __ASSUME_RECVFROM_FOR_RECV_SYSCALL.
* sysdeps/unix/sysv/linux/send.c (__libc_send):
Use sendto if defined __ASSUME_SENDTO_FOR_SEND_SYSCALL.

8 years agoTerminate process on invalid netlink response from kernel [BZ #12926]
Florian Weimer [Mon, 9 Nov 2015 11:48:41 +0000 (12:48 +0100)]
Terminate process on invalid netlink response from kernel [BZ #12926]

The recvmsg system calls for netlink sockets have been particularly
prone to picking up unrelated data after a file descriptor race
(where the descriptor is closed and reopened concurrently in a
multi-threaded process, as the result of a file descriptor
management issue elsewhere).  This commit adds additional error
checking and aborts the process if a datagram of unexpected length
(without the netlink header) is received, or an error code which
cannot happen due to the way the netlink socket is used.

[BZ #12926]
Terminate process on invalid netlink response.
* sysdeps/unix/sysv/linux/netlinkaccess.h
(__netlink_assert_response): Declare.
* sysdeps/unix/sysv/linux/netlink_assert_response.c: New file.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == inet]
(sysdep_routines): Add netlink_assert_response.
* sysdeps/unix/sysv/linux/check_native.c (__check_native): Call
__netlink_assert_response.
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise.
* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise.
* sysdeps/unix/sysv/linux/Versions (GLIBC_PRIVATE): Add
__netlink_assert_response.

8 years agoKeep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink
H.J. Lu [Sat, 7 Nov 2015 14:32:30 +0000 (06:32 -0800)]
Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink

prelink runs ld.so with the environment variable LD_TRACE_PRELINKING
set to dump the relocation type class from _dl_debug_bindings.  prelink
has the following relocation type classes:

 #define RTYPE_CLASS_VALID       8
 #define RTYPE_CLASS_PLT         (8|1)
 #define RTYPE_CLASS_COPY        (8|2)
 #define RTYPE_CLASS_TLS         (8|4)

where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with
RTYPE_CLASS_TLS.

Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is
set.

[BZ #19178]
* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
(RTYPE_CLASS_PLT): Likewise.
(RTYPE_CLASS_COPY): Likewise.
(RTYPE_CLASS_TLS): Likewise.
(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
to set relocation type class for DL_DEBUG_PRELINK.  Keep only
ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
DL_DEBUG_PRELINK.

8 years agoFix typo in signgam test messages.
Joseph Myers [Fri, 6 Nov 2015 18:45:32 +0000 (18:45 +0000)]
Fix typo in signgam test messages.

I noticed a typo in the messages from the signgam tests I recently
added.  This patch fixes it.

Tested for x86_64 and x86.

* math/test-signgam-finite.c (RUN_TESTS): Correct messages about
calls with argument -0.5.
* math/test-signgam-finite-c99.c (RUN_TESTS): Likewise.

8 years agoRemove configure tests for some linker -z options.
Joseph Myers [Fri, 6 Nov 2015 13:20:26 +0000 (13:20 +0000)]
Remove configure tests for some linker -z options.

There are configure tests for the linker -z nodelete, -z nodlopen and
-z initfirst options.  These options were added in binutils 2.11, so
the tests are obsolete; this patch removes them.

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

* configure.ac (libc_cv_z_nodelete): Remove configure test.
(libc_cv_z_nodlopen): Likewise.
(libc_cv_z_initfirst): Likewise.
* configure: Regenerated.

8 years agoSimplify the abilist format
Florian Weimer [Thu, 29 Oct 2015 14:33:54 +0000 (15:33 +0100)]
Simplify the abilist format

The new format lists the version on each line, as in:

VERSION SYMBOL TYPE [VALUE]

This makes it easier to process the files with line-oriented tools.

The abilist files were converted with this awk script:

/^[^ ]/ { version = $1 }
/^ / { print version, substr($0, 2) }

And sorted under the "C" locale with sort.

8 years agoAdd LFS support for fts functions (bug 11460)
Mark Wielaard [Fri, 6 Nov 2015 10:22:38 +0000 (11:22 +0100)]
Add LFS support for fts functions (bug 11460)

fts didn't have large-file support yet and fts.h had an #error preventing
usage when _FILE_OFFSET_BITS was set. This required nasty workarounds for
programs using fts with LFS. This patch implements LFS support for fts by
adding FTS64 and FTENT64 variants plus fts64 functions. Which are simple
aliases for 64bit off_t arches.

Also includes a simple testcase for some of the fts functions with or
without LFS enabled.

[BZ #11460]
* io/Makefile (routines): Add fts64.
(tests): Add tst-fts and tst-fts-lfs.
(CFLAGS-fts64.c): New.
* io/Versions (GLIBC_2.23): New.
* io/fts.c: Replace FTS with FTSOBJ, FTSENT with FTSENTRY. Use
function defines FTS_OPEN, FTS_CLOSE, FTS_READ, FTS_SET and
FTS_CHILDREN. Define FTSOBJ, FTSENTRY, FTS_OPEN, FTS_CLOSE,
FTS_READ, FTS_SET, FTS_CHILDREN, INO_T, STAT and LSTAT if necessary.
* io/fts.h (FTS64): New if _USE_LARGEFILE64.
(FTSENT64): Likewise.
(fts64_children): Likewise.
(fts64_close): Likewise.
(fts64_open): Likewise.
(fts64_read): Likewise.
(fts64_set): Likewise.
* io/fts64.c: New file.
* io/tst-fts.c: New test.
* io/tst-fts-lfs.c: Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.23): Add
GLIBC_2.23, fts64_children, fts64_close, fts64_open, fts64_read and
fts64_set.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/wordsize-64/fts.c: New file.
* sysdeps/wordsize-64/fts64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/fts.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/fts64.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/fts.c: likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/fts64.c: likewise.

8 years agoRun libm-test tests for finite-math-only functions.
Joseph Myers [Thu, 5 Nov 2015 23:28:16 +0000 (23:28 +0000)]
Run libm-test tests for finite-math-only functions.

This patch arranges for the libm-test tests to be run for the
finite-math-only function variants, in addition to the existing runs
for out-of-line and bits/mathinline.h inline variants.

gen-libm-test.pl is made to add a flag to all tests with non-finite
inputs or outputs so that they can be skipped at runtime when the
finite-math-only variants are being tested (skipping is for all
rounding modes; that is, -ffinite-math-only is being treated as
excluding overflow cases even when the rounding mode is such that the
overflowed result is finite).  errno setting is not tested for these
variants (in general they don't set it, and it's
implementation-defined in ISO C whether it's set on underflow, with
the glibc definition being that it may not be for -ffinite-math-only;
other cases where errno would normally be expected to be set are
mostly excluded as having non-finite or overflowing arguments or
results).

As with the inline function tests, these ones are built with
-D__FINITE_MATH_ONLY=1 to select the function variants, rather than
-ffinite-math-only.  Use of -ffinite-math-only would not be suitable
for these tests because it would also affect libm-test.inc code that
e.g. tests whether results are infinities or NaNs - if these function
variants have bugs that incorrectly produce such results, we want them
to show up in the tests, which means the compiler should not be
optimizing the tests on the basis of results being finite.

The finite-math-only functions share the same ulps settings as the
main out-of-line functions.

These interfaces were one significant group of untested ABIs listed at
<https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>.  I
haven't rerun the script to list untested interfaces, but I expect
that the vast bulk of interfaces there are still untested and could do
with testcases being added (or, if applicable, being made compat
symbols; in general, most symbols not starting '_' are safe bets to
add tests for, while _* need more investigation of what the actual
public API is, if any).  I'd like to encourage people to help reduce
the accumulation of untested interfaces by adding more tests.

Tested for x86_64 and x86.  Given my recent lgamma/gamma and log*
fixes, the new tests pass (before those fixes, the new tests showed up
those bugs, so illustrating the practical utility of having tests for
these function variants).

* math/libm-test.inc (NON_FINITE): New macro.
(enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE.
* math/gen-libm-test.pl (show_exceptions): Add argument
$non_finite.
(parse_args): Update call to show_exceptions.
* math/test-math-finite.h: New file.
* math/test-math-no-finite.h: Likewise.
* math/test-double-finite.c: Likewise.
* math/test-float-finite.c: Likewise.
* math/test-ldouble-finite.c: Likewise.
* math/test-double.c: Include "test-math-no-finite.h".
* math/test-float.c: Include "test-math-no-finite.h".
* math/test-ldouble.c: Include "test-math-no-finite.h".
* math/test-math-inline.h (TEST_FINITE): New macro.
* math/test-math-vector.h (TEST_FINITE): Likewise.
* math/Makefile (test-longdouble-yes): Add test-ldouble-finite.
(libm-tests): Add test-float-finite and test-double-finite.
($(objpfx)test-float-finite.o): New dependency on
$(objpfx)libm-test.stmp.
($(objpfx)test-double-finite.o): Likewise.
($(objpfx)test-ldouble-finite.o): Likewise.
(libm-test-no-inline-cflags): New variable.
(libm-test-finite-cflags): Likewise.
(CFLAGS-test-float-finite.c): Likewise.
(CFLAGS-test-double-finite.c): Likewise.
(CFLAGS-test-ldouble-finite.c): Likewise.
(CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags).
(CFLAGS-test-double.c): Likewise.
(CFLAGS-test-ldouble.c): Likewise.

8 years agoFix some stub prototypes missing ... after K&R conversion
Roland McGrath [Thu, 5 Nov 2015 23:00:12 +0000 (15:00 -0800)]
Fix some stub prototypes missing ... after K&R conversion

8 years agoAdd script to list fixed bugs for the NEWS file.
Joseph Myers [Thu, 5 Nov 2015 22:18:32 +0000 (22:18 +0000)]
Add script to list fixed bugs for the NEWS file.

This patch adds a script to list fixed bugs for the NEWS file, as
proposed in
<https://sourceware.org/ml/libc-alpha/2015-10/msg01043.html>, with the
bugs listed in the format proposed in
<https://sourceware.org/ml/libc-alpha/2015-11/msg00088.html>.

* scripts/list-fixed-bugs.py: New file.

8 years agoFix i386/x86_64 log* (1) zero sign for -ffinite-math-only (bug 19213).
Joseph Myers [Thu, 5 Nov 2015 21:56:31 +0000 (21:56 +0000)]
Fix i386/x86_64 log* (1) zero sign for -ffinite-math-only (bug 19213).

For the -ffinite-math-only versions of various x86_64 and x86 log*
functions, a zero result from log* (1) is returned with incorrect sign
in round-downward mode.  This patch fixes this in a similar way to the
previous fixes for the non-*_finite versions of the functions.

Tested for x86_64 and x86 (including an i586 build), together with a
patch that will be applied separately to enable the main libm-test.inc
tests for the finite-math-only functions.

[BZ #19213]
* sysdeps/i386/fpu/e_log.S (__log_finite): Ensure +0 is always
returned for argument 1.
* sysdeps/i386/fpu/e_logf.S (__logf_finite): Likewise.
* sysdeps/i386/fpu/e_logl.S (__logl_finite): Likewise.
* sysdeps/i386/i686/fpu/e_logl.S (__logl_finite): Likewise.
* sysdeps/x86_64/fpu/e_log10l.S (__log10l_finite): Likewise.
* sysdeps/x86_64/fpu/e_log2l.S (__log2l_finite): Likewise.
* sysdeps/x86_64/fpu/e_logl.S (__logl_finite): Likewise.

8 years agoFix finite-math-only lgamma functions signgam setting (bug 19211).
Joseph Myers [Thu, 5 Nov 2015 21:23:07 +0000 (21:23 +0000)]
Fix finite-math-only lgamma functions signgam setting (bug 19211).

The lgamma inline functions in bits/math-finite.h do not set signgam
if __USE_ISOC99, even when other feature test macros mean a standard
such as XSI POSIX is selected for which it should be set.  (This is
essentially the opposite issue to bug 15421, the out-of-line versions
setting signgam even when they shouldn't.)

This patch fixes those functions to use __USE_MISC || __USE_XOPEN as
the condition for when to set signgam, since it's the condition for
when math.h declares signgam.  The legacy gamma* names are only
declared at all if __USE_MISC || __USE_XOPEN, so they just set signgam
unconditionally.

Tests for certain standards or not using _GNU_SOURCE cannot use
test-skeleton.c (this is a known issue noted on the wiki todo list).
Thus, the new tests that signgam remains not set in ISO C modes do not
use test-skeleton.c.  They also define _ISOMAC to avoid running into
declarations in the internal include/ headers that only work in
_GNU_SOURCE mode.

Tested for x86_64 and x86.

[BZ #19211]
* math/bits/math-finite.h (lgamma): Set signgam if [__USE_MISC ||
__USE_XOPEN], not if [!__USE_ISOC99].
(lgammaf): Likewise.
(lgammal): Likewise.
(gamma): Set signgam unconditionally, not if [!__USE_ISOC99].
(gammaf): Likewise.
(gammal): Likewise.
* math/test-signgam-finite-c11.c: New file.
* math/test-signgam-finite-c99.c: Likewise.
* math/test-signgam-finite.c: Likewise.
* math/Makefile (tests): Add test-signgam-finite,
test-signgam-finite-c99 and test-signgam-finite-c11.
(CFLAGS-test-signgam-finite.c): New variable.
(CFLAGS-test-signgam-finite-c99.c): Likewise.
(CFLAGS-test-signgam-finite-c11.c): Likewise.

8 years agoFix features.h for -Wundef (bug 19212).
Joseph Myers [Thu, 5 Nov 2015 21:19:37 +0000 (21:19 +0000)]
Fix features.h for -Wundef (bug 19212).

features.h is not clean with -Wundef (for the installed header, of
course this only appears with -Wsystem-headers).  In ISO C standards
modes, you get a series of warnings / errors relating to
_POSIX_C_SOURCE and _XOPEN_SOURCE not being defined when tested in
standards mode and uses #undef _GNU_SOURCE to avoid the default
_GNU_SOURCE from libc-symbols.h.  This patch changes the relevant #if
conditionals to avoid these warnings / errors.

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

[BZ #19212]
* include/features.h [(_XOPEN_SOURCE - 0) >= 500]: Change
conditional to [defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >=
500].
[_POSIX_C_SOURCE >= 1]: Change conditional to [defined
_POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1].
[(_POSIX_C_SOURCE - 0) >= 199309L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L].
[(_POSIX_C_SOURCE - 0) >= 199506L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L].
[(_POSIX_C_SOURCE - 0) >= 200112L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L].
[(_POSIX_C_SOURCE - 0) >= 200809L]: Change conditional to [defined
_POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L].

8 years agoDon't redirect ldexp to scalbn in bits/math-finite.h (bug 19209).
Joseph Myers [Thu, 5 Nov 2015 17:00:31 +0000 (17:00 +0000)]
Don't redirect ldexp to scalbn in bits/math-finite.h (bug 19209).

bits/math-finite.h maps ldexp functions to corresponding scalbn
functions.  This is (a) a namespace bug for C90, which has ldexp but
not scalbn, and (b) in any case useless, since the ldexp and scalbn
functions have identical semantics (for floating-point types with
radix 2), and since the fix for bug 6803 are actually aliases
(presumably the mapping was based around the old bug of scalbn not
setting errno).  This patch removes the bogus redirections.

Tested for x86_64 and x86.

[BZ #19209]
* math/bits/math-finite.h (ldexp): Remove declaration.
(ldexpf): Likewise.
(ldexpl): Likewise.

8 years agoMake bits/math-finite.h conditions match other headers (bug 19205).
Joseph Myers [Thu, 5 Nov 2015 00:48:57 +0000 (00:48 +0000)]
Make bits/math-finite.h conditions match other headers (bug 19205).

bits/math-finite.h declares -ffinite-math-only variants of various
functions under conditions not matching those under which the normal
versions are declared.

* math.h only ever includes bits/mathcalls.h to declare float and long
  double functions if __USE_ISOC99, but bits/math-finite.h declares
  some float functions regardless (long double ones are conditioned on
  __MATH_DECLARE_LDOUBLE).  (For C90 functions this isn't a
  conformance bug because C90 reserves the float and long double
  names, but is still contrary to good glibc practice.  For some other
  functions in older XSI standards it *is* a conformance bug.)

* Some functions are defined as inlines using lgamma_r functions under
  conditions where those lgamma_r functions are not themselves
  declared.

* hypot is declared under __USE_XOPEN || __USE_ISOC99 in
  bits/mathcalls.h, __USE_ISOC99 only in bits/math-finite.h.

* float and long double versions of Bessel functions should be limited
  to __USE_MISC (as in bug 18977).

* gamma should not be declared for __USE_XOPEN2K (as in bug 18967).

* remainder should be restricted to __USE_XOPEN_EXTENDED ||
  __USE_ISOC99, not unconditional.

* scalb should not be declared for __USE_XOPEN2K8, and scalbf and
  scalbl are non-POSIX (as in bug 18967).

This patch fixes all these issues (it doesn't seem worth splitting
them into separate patches or bugs).  I put __USE_ISOC99 conditionals,
where needed, around both float and long double declarations, even
though formally redundant around the long double declarations because
__MATH_DECLARE_LDOUBLE isn't defined without __USE_ISOC99; it seemed
clearer that way.  The missing declarations of lgamma_r functions are
dealt with by directly using declarations of __lgamma*_r_finite, in
the implementation namespace, rather than having the inlines rely on
asm redirection of lgamma*_r.

After this patch, there are some apparently redundant nested
__USE_ISOC99 conditionals in lgamma / gamma definitions.  These
actually reflect a separate bug (the correct condition for the lgamma
inline functions to set signgam is __USE_MISC || __USE_XOPEN, the
condition under which signgam is declared, rather than disabling
setting it if __USE_ISOC99, which includes XSI POSIX versions for
which signgam *should* be set).  They'll be fixed as part of a fix for
that bug, which will also add tests for these inlines.  I've put a
note about more general conform/ test coverage for -ffinite-math-only
on
<https://sourceware.org/glibc/wiki/Development_Todo/Master#conformtest_improvements>,
alongside other options for which this is also relevant (some of which
have also had such bugs in the past relating to mismatched
conditionals).

I also intend to enable the main libm-test.inc tests for the
math-finite.h functions, but some other bugs in __*_finite need fixing
first.

[BZ #19205]
* math/bits/math-finite.h (acosf): Condition declaration on
[__USE_ISOC99].
(acosl): Likewise.
(acoshf): Likewise.
(acoshl): Likewise.
(asinf): Likewise.
(asinl): Likewise.
(atan2f): Likewise.
(atan2l): Likewise.
(atanhf): Likewise.
(atanhl): Likewise.
(coshf): Likewise.
(coshl): Likewise.
(expf): Likewise.
(expl): Likewise.
(fmodf): Likewise.
(fmodl): Likewise.
(hypot): Change condition to [__USE_XOPEN || __USE_ISOC99].
(j0f): Change condition to [__USE_MISC && __USE_ISOC99].
(j0l): Likewise.
(y0f): Likewise.
(y0l): Likewise.
(j1f): Likewise.
(j1l): Likewise.
(y1f): Likewise.
(y1l): Likewise.
(jnf): Likewise.
(jnl): Likewise.
(ynf): Likewise.
(ynl): Likewise.
(lgammaf_r): Condition declaration on [__USE_ISOC99].
(lgammal_r): Likewise.
(__lgamma_r_finite): New declaration.
(__lgammaf_r_finite): Likewise.
(__lgammal_r_finite): Likewise.
(lgamma): Use __lgamma_r_finite.
(lgammaf): Condition definition on [__USE_ISOC99].  Use
__lgammaf_r_finite.
(lgammal): Condition definition on [__USE_ISOC99].  Use
__lgammal_r_finite.
(gamma): Do not define for [!__USE_MISC && __USE_XOPEN2K].  Use
__lgamma_r_finite.
(gammaf): Condition definition on [__USE_ISOC99].  Use
__lgammaf_r_finite.
(gammal): Condition definition on [__USE_ISOC99].  Use
__lgammal_r_finite.
(logf): Condition declaration on [__USE_ISOC99].
(logl): Likewise.
(log10f): Likewise.
(log10l): Likewise.
(ldexpf): Likewise.
(ldexpl): Likewise.
(powf): Likewise.
(powl): Likewise.
(remainder): Condition declaration on [__USE_XOPEN_EXTENDED ||
__USE_ISOC99].
(remainderf): Condition declaration on [__USE_ISOC99].
(remainderl): Likewise.
(scalb): Do not declare for [!__USE_MISC && __USE_XOPEN2K8].
(scalbf): Change condition to [__USE_MISC && __USE_ISOC99].
(scalbl): Likewise.
(sinhf): Condition declaration on [__USE_ISOC99].
(sinhl): Likewise.
(sqrtf): Likewise.
(sqrtl): Likewise.

8 years agoRemove miscellaneous GCC >= 4.7 version conditionals.
Joseph Myers [Wed, 4 Nov 2015 21:34:36 +0000 (21:34 +0000)]
Remove miscellaneous GCC >= 4.7 version conditionals.

This patch removes miscellaneous __GNUC_PREREQ (4, 7) conditionals
that are now dead.

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

* sysdeps/arm/atomic-machine.h
[__GNUC_PREREQ (4, 7) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]:
Change conditional to [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4].
[__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 && !__GNUC_PREREQ (4, 7)]:
Remove conditional code.
[!__GNUC_PREREQ (4, 7) || !__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4]:
Change conditional to [!__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4].
* sysdeps/i386/sysdep.h [__ASSEMBLER__ && __GNUC_PREREQ (4, 7)]:
Change conditional to [__ASSEMBLER__].
[__ASSEMBLER__ && !__GNUC_PREREQ (4, 7)]: Remove conditional code.
[!__ASSEMBLER__ && __GNUC_PREREQ (4, 7)]: Change conditional to
[!__ASSEMBLER__].
[!__ASSEMBLER__ && !__GNUC_PREREQ (4, 7)]: Remove conditional
code.
* sysdeps/unix/sysv/linux/sh/atomic-machine.h (rNOSP): Remove
conditional macro definitions.
(__arch_compare_and_exchange_val_8_acq): Use "u" instead of rNOSP.
(__arch_compare_and_exchange_val_16_acq): Likewise.
(__arch_compare_and_exchange_val_32_acq): Likewise.
(atomic_exchange_and_add): Likewise.
(atomic_add): Likewise.
(atomic_add_negative): Likewise.
(atomic_add_zero): Likewise.
(atomic_bit_set): Likewise.
(atomic_bit_test_set): Likewise.
* sysdeps/x86_64/atomic-machine.h [__GNUC_PREREQ (4, 7)]: Make
code unconditional.
[!__GNUC_PREREQ (4, 7)]: Remove conditional code.

8 years agoRefactor libm-test inline tests disabling.
Joseph Myers [Wed, 4 Nov 2015 21:30:26 +0000 (21:30 +0000)]
Refactor libm-test inline tests disabling.

This patch refactors how libm-test.inc handles disabling
errno/exception handling tests, and some other tests, for
__FAST_MATH__ inline function tests.

The macro TEST_INLINE is changed from being defined/undefined to being
defined to 1 or 0, so that it can be tested in "if" conditionals
instead of #if.  For tests of errno and exception setting, separate
macros TEST_ERRNO and TEST_EXCEPTIONS are added, and TEST_ERRNO is
also used in the disabling of errno testing for vector function
tests.  The relevant conditionals are moved up a function, so that
they take effect before the code that counts the number of tests, so
the inline function tests now accurately report that 0 tests for
exceptions and errno were executed (whereas they previously reported a
large number desipte not running any such tests).

Tested for x86_64 and x86.

* math/test-math-errno.h: New file.
* math/test-math-inline.h (TEST_INLINE): Define to 1 instead of
empty.
(TEST_ERRNO): New macro.
(TEST_EXCEPTIONS): Likewise.
* math/test-math-no-inline.h (TEST_INLINE): Likewise.
(TEST_EXCEPTIONS): Likewise.
* math/test-math-vector.h (TEST_ERRNO): Likewise.
* math/test-double.c: Include "test-math-errno.h".
* math/test-float.c: Likewise.
* math/test-ldouble.c: Likewise.
* math/libm-test.inc (test_single_exception) [!TEST_INLINE]: Make
code unconditional.
(test_exceptions): Only run code if TEST_EXCEPTIONS.
(test_single_errno) [!TEST_INLINE && !TEST_MATHVEC]: Make code
unconditional.
(test_errno): Only run code if TEST_ERRNO.
(enable_test): Use "if" conditional on TEST_INLINE, not #ifdef.

8 years agoAdd bug 18604 to the correct section
Florian Weimer [Wed, 4 Nov 2015 16:48:40 +0000 (17:48 +0100)]
Add bug 18604 to the correct section

8 years agoRemove a spurious attribution
Florian Weimer [Wed, 4 Nov 2015 10:32:36 +0000 (11:32 +0100)]
Remove a spurious attribution

Martin Sebor confirmed that this attribution was inserted by mistake.

8 years agoAdd bug 18604 to NEWS
Florian Weimer [Wed, 4 Nov 2015 07:09:06 +0000 (08:09 +0100)]
Add bug 18604 to NEWS

8 years agoAdd more libm tests (scalb*, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma...
Joseph Myers [Wed, 4 Nov 2015 00:45:23 +0000 (00:45 +0000)]
Add more libm tests (scalb*, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, y0, y1, yn, significand).

This patch improves the libm test coverage for a few more functions.

Tested for x86_64 and x86.

* math/auto-libm-test-in: Add more tests of sin, sincos, sinh,
sqrt, tan, tanh, y0, y1 and yn.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (scalb_test_data): Add more tests.
(scalbn_test_data): Likewise.
(scalbln_test_data): Likewise.
(signbit_test_data): Likewise.
(sin_test_data): Likewise.
(sincos_test_data): Likewise.
(sinh_test_data): Likewise.
(sqrt_test_data): Likewise.
(tan_test_data): Likewise.
(tanh_test_data): Likewise.
(tgamma_test_data): Likewise.
(y0_test_data): Likewise.
(y1_test_data): Likewise.
(yn_test_data): Likewise.
(significand_test_data): Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Update.

8 years agoDon't macro-expand failed assertion expression [BZ #18604]
David Kastrup [Tue, 3 Nov 2015 22:08:54 +0000 (23:08 +0100)]
Don't macro-expand failed assertion expression [BZ #18604]

[BZ #18604]
* assert/assert.h (assert): Don't macro-expand failed assertion
expression in error message.
* malloc/malloc.c (assert): Likewise.

8 years agoRemove --no-whole-archive configure test.
Joseph Myers [Tue, 3 Nov 2015 13:03:52 +0000 (13:03 +0000)]
Remove --no-whole-archive configure test.

There is a configure test for the --no-whole-archive linker option.
This option was added in binutils 2.7, so the test is obsolete; this
patch removes it.

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

* configure.ac (libc_cv_ld_no_whole_archive): Remove configure
test.
* configure: Regenerated.

8 years agoAdd more libm tests (modf, nearbyint, nextafter, nexttoward, pow, remainder, remquo...
Joseph Myers [Tue, 3 Nov 2015 00:20:29 +0000 (00:20 +0000)]
Add more libm tests (modf, nearbyint, nextafter, nexttoward, pow, remainder, remquo, rint).

This patch improves the libm test coverage for a few more functions.

Tested for x86_64 and x86.

* math/libm-test.inc (modf_test_data): Add more tests.
(nearbyint_test_data): Likewise.
(nextafter_test_data): Likewise.
(nexttoward_test_data): Likewise.
(pow_test_data): Likewise.
(remainder_test_data): Likewise.
(remquo_test_data): Likewise.
(rint_test_data): Likewise.

8 years agoFix dbl-64 remainder sign of zero result (bug 19201).
Joseph Myers [Tue, 3 Nov 2015 00:11:49 +0000 (00:11 +0000)]
Fix dbl-64 remainder sign of zero result (bug 19201).

For some large arguments, the dbl-64 implementation of remainder gives
zero results with the wrong sign, resulting from a subtraction that is
mathematically correct but does not guarantee that a zero result has
the sign of the first argument to remainder.  This patch adds an
appropriate check for this case, similar to other implementations of
remainder in the case of equality, and adds tests of remainder on
inputs already used to test remquo.

Tested for x86_64 and x86.

[BZ #19201]
* sysdeps/ieee754/dbl-64/e_remainder.c (__ieee754_remainder):
Check for zero remainder in case of large exponents and ensure
correct sign of result in that case.
* math/libm-test.inc (remainder_test_data): Add more tests.

8 years agoMake nextafter, nexttoward set errno (bug 6799).
Joseph Myers [Mon, 2 Nov 2015 18:54:19 +0000 (18:54 +0000)]
Make nextafter, nexttoward set errno (bug 6799).

nextafter and nexttoward fail to set errno on overflow and underflow.
This patch makes them do so in cases that should include all the cases
where such errno setting is required by glibc's goals for when to set
errno (but not all cases of underflow where the result is nonzero and
so glibc's goals do not require errno setting).

Tested for x86_64, x86, mips64 and powerpc.

[BZ #6799]
* math/s_nextafter.c: Include <errno.h>.
(__nextafter): Set errno on overflow and underflow.
* math/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/i386/fpu/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/flt-32/s_nextafterf.c: Include <errno.h>.
(__nextafterf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-96/s_nexttoward.c: Include <errno.h>.
(__nexttoward): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include <errno.h>.
(__nexttowardf): Set errno on overflow and underflow.
* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include <errno.h>.
(__nldbl_nexttowardf): Set errno on overflow and underflow.
* sysdeps/m68k/m680x0/fpu/s_nextafterl.c: Include <errno.h>.
(__nextafterl): Set errno on overflow and underflow.
* math/libm-test.inc (nextafter_test_data): Do not allow errno
setting to be missing on overflow.  Add more tests.
(nexttoward_test_data): Likewise.

8 years agoRemove init_array / fini_array configure test.
Joseph Myers [Mon, 2 Nov 2015 15:08:25 +0000 (15:08 +0000)]
Remove init_array / fini_array configure test.

There is a configure test "for .preinit_array/.init_array/.fini_array
support".  Support for this feature was added in binutils 2.13, so the
configure test is obsolete; this patch removes it.

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

* configure.ac (libc_cv_initfini_array): Remove configure test.
* configure: Regenerated.

8 years agoFix ldbl-128 log1pl (-qNaN) spurious "invalid" exception (bug 19189).
Joseph Myers [Thu, 29 Oct 2015 23:09:51 +0000 (23:09 +0000)]
Fix ldbl-128 log1pl (-qNaN) spurious "invalid" exception (bug 19189).

The ldbl-128 version of log1pl raises a spurious "invalid" exception
for a -qNaN argument.  This patch fixes this by making the initial
check for infinities and NaNs handle arguments of both signs in such a
way that NaNs result in a NaN being returned (quietly if the input NaN
was quiet) while +Inf results in +Inf being returned and -Inf results
in a qNaN being returned with "invalid" exception raised.

Tested for mips64.

[BZ #19189]
* sysdeps/ieee754/ldbl-128/s_log1pl.c (__log1pl): Make check for
non-finite argument handle arguments with negative sign.

8 years agoDo not test sign of zero result from infinite argument to Bessel functions.
Joseph Myers [Thu, 29 Oct 2015 22:45:47 +0000 (22:45 +0000)]
Do not test sign of zero result from infinite argument to Bessel functions.

When Bessel functions return a zero result from an infinite argument,
the function oscillates as it approaches 0, so the sign of that zero
result should be indeterminate.  This patch weakens the expectations
accordingly not to check the sign of such results (the tests were
causing spurious failures for j1 (-Inf) for ldbl-128).

Tested for x86_64 and x86.

* math/libm-test.inc (j0_test_data): Do not test sign of zero
result from infinite argument.
(j1_test_data): Likewise.
(jn_test_data): Likewise.
(y0_test_data): Likewise.
(y1_test_data): Likewise.
(yn_test_data): Likewise.

8 years agoMake drem an alias of remainder (bug 16171).
Joseph Myers [Thu, 29 Oct 2015 22:29:21 +0000 (22:29 +0000)]
Make drem an alias of remainder (bug 16171).

The libm drem functions just call the corresponding __remainder
functions.  This patch removes the unnecessary wrappers by making them
into weak aliases at the ELF level.

Tested for x86_64, x86, mips64 and powerpc.

[BZ #16171]
* math/w_remainder.c (drem): Define as weak alias of __remainder.
[NO_LONG_DOUBLE] (dreml): Define as weak alias of __remainder.
* math/w_remainderf.c (dremf): Define as weak alias of
__remainderf.
* math/w_remainderl.c (dreml): Define as weak alias of
__remainderl.
* sysdeps/ia64/fpu/e_remainder.S (drem): Define as weak alias of
__remainder.
* sysdeps/ia64/fpu/e_remainderf.S (dremf): Define as weak alias of
__remainderf.
* sysdeps/ia64/fpu/e_remainderl.S (dreml): Define as weak alias of
__remainderl.
* sysdeps/ieee754/ldbl-opt/nldbl-remainder.c (dreml): Define as
weak alias of remainderl.
* sysdeps/ieee754/ldbl-opt/w_remainder.c
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__drem): Define as strong
alias of __remainder.
[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (dreml): Use compat_symbol.
* sysdeps/ieee754/ldbl-opt/w_remainderl.c (__dreml): Define as
strong alias of __remainderl.
(dreml): Use long_double_symbol.
* math/Makefile (libm-calls): Remove w_drem.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Remove drem.
(CFLAGS-nldbl-drem.c): Remove variable.
(CFLAGS-nldbl-remainder.c): Add -fno-builtin-dreml.
* math/w_drem.c: Remove file.
* math/w_dremf.c: Likewise.
* math/w_dreml.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-drem.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_drem.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_dreml.c: Likewise.

8 years agoRemove cpuid.h configure tests.
Joseph Myers [Thu, 29 Oct 2015 14:43:46 +0000 (14:43 +0000)]
Remove cpuid.h configure tests.

There are configure tests for the cpuid.h header for x86 / x86_64.
GCC 4.3 and later install this header, so those tests are obsolete.
This patch removes them.

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

* sysdeps/i386/configure.ac (cpuid.h): Do not test for header.
* sysdeps/i386/configure: Regenerated.
* sysdeps/x86_64/configure.ac (cpuid.h): Do not test for header.
* sysdeps/x86_64/configure: Regenerated.

8 years agoRemove configure tests for visibility support.
Joseph Myers [Thu, 29 Oct 2015 12:48:24 +0000 (12:48 +0000)]
Remove configure tests for visibility support.

There are various configure tests for visibility support in the
compiler and assember.

GCC support for visibility attributes was added in GCC 3.3.  I don't
know what specific fix was intended by the test "for broken
__attribute__((visibility())", but it was added by
<https://sourceware.org/ml/libc-hacker/2002-08/msg00030.html>, and GCC
3.3 appears not to have that breakage, so I suspect it was only ever
in development versions before 3.3 was released.  The assembler
support was added in binutils 2.10.

This patch removes the tests in question as obsolete.  Two tests that
were formerly conditional on "if test $libc_cv_visibility_attribute =
yes", including the one for linker support for protected data, are now
unconditional.

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

* configure.ac (libc_cv_asm_protected_directive): Remove configure
test.
(libc_cv_visibility_attribute): Likewise.
(libc_cv_protected_data): Test unconditionally.
(libc_cv_broken_visibility_attribute): Remove configure test.
(libc_cv_have_sdata_section): Test unconditionally.
* configure: Regenerated.

8 years agoUse max_align_t from <stddef.h>.
Joseph Myers [Thu, 29 Oct 2015 12:46:22 +0000 (12:46 +0000)]
Use max_align_t from <stddef.h>.

Now that we build with -std=gnu11 and can rely on a compiler providing
max_align_t in <stddef.h>, we no longer need our own version
libc_max_align_t.  This patch removes it and replaces the single user
with a use of max_align_t.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch for x86_64; for x86, I see
some code reordering of no significance).

* include/libc-internal.h (libc_max_align_t): Remove typedef.
* include/scratch_buffer.h: Include <stddef.h> instead of
<libc-internal.h>.
(struct scratch_buffer): Use max_align_t instead of
libc_max_align_t.

8 years ago_dl_fini: Rewrite to use VLA instead of extend_alloca
Florian Weimer [Thu, 29 Oct 2015 08:26:03 +0000 (09:26 +0100)]
_dl_fini: Rewrite to use VLA instead of extend_alloca

In this case, extend_alloca is used to work around the lack of
deallocation on scope exit.  A VLA is automatically deallocated in this
way, so it is the more fitting approach.

To implement this, it is necessary to eliminate the goto.  In addition,
this change eliminates the trivially-true assert; the assert is always
skipped if nloaded > 0.

* elf/dl-fini.c (_dl_fini): Rewrite to use variable-length array
instead of extend_alloca.  Change control flow to avoid a goto.
Remove assert which is trivially always true.

8 years agoHandle more state in i386/x86_64 fesetenv (bug 16068).
Joseph Myers [Wed, 28 Oct 2015 22:58:29 +0000 (22:58 +0000)]
Handle more state in i386/x86_64 fesetenv (bug 16068).

fenv_t should include architecture-specific floating-point modes and
status flags.  i386 and x86_64 fesetenv limit which bits they use from
the x87 status and control words, when using saved state, and limit
which parts of the state they set to fixed values, when using
FE_DFL_ENV / FE_NOMASK_ENV.  The following should be included but are
excluded in at least some cases: status and masking for the "denormal
operand" exception (which isn't part of FE_ALL_EXCEPT); precision
control (explicitly mentioned in Annex F as something that counts as
part of the floating-point environment); MXCSR FZ and DAZ bits (for
FE_DFL_ENV and FE_NOMASK_ENV).  This patch arranges for this extra
state to be handled by fesetenv (and thereby by feupdateenv, which
calls fesetenv).

(Note that glibc functions using floating point are not generally
expected to work correctly with non-default values of this state,
especially precision control, but it is still logically part of the
floating-point environment and should be handled as such by fesetenv.
Changes to the state relating to subnormals ought generally to work
with libm functions when the arguments aren't subnormal and neither
are the expected results; that's a consequence of functions avoiding
spurious internal underflows.)

A question arising from this is whether FE_NOMASK_ENV should or should
not mask the "denormal operand" exception.  I decided it should mask
that exception.  This is the status quo - previously that exception
could only be unmasked by direct manipulation of control registers
(possibly via <fpu_control.h>).  In addition, it means that use of
FE_NOMASK_ENV leaves a floating-point environment the same as could be
obtained by fesetenv (FE_DFL_ENV); feenableexcept (FE_ALL_EXCEPT);,
rather than an environment in which an exception is unmasked that
could only be masked again by using fesetenv with FE_DFL_ENV (or a
previously saved environment) - this exception not being usable with
other <fenv.h> functions because it's outside FE_ALL_EXCEPT.

Tested for x86_64 and x86.

[BZ #16068]
* sysdeps/i386/fpu/fesetenv.c: Include <fpu_control.h>.
(FE_ALL_EXCEPT_X86): New macro.
(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
FE_ALL_EXCEPT.  Ensure precision control is included in
floating-point state.  Ensure that FE_DFL_ENV and FE_NOMASK_ENV
handle "denormal operand exception" and clear FZ and DAZ bits.
* sysdeps/x86_64/fpu/fesetenv.c: Include <fpu_control.h>.
(FE_ALL_EXCEPT_X86): New macro.
(__fesetenv): Use FE_ALL_EXCEPT_X86 in most places instead of
FE_ALL_EXCEPT.  Ensure precision control is included in
floating-point state.  Ensure that FE_DFL_ENV and FE_NOMASK_ENV
handle "denormal operand exception" and clear FZ and DAZ bits.
* sysdeps/x86/fpu/test-fenv-sse-2.c: New file.
* sysdeps/x86/fpu/test-fenv-x87.c: Likewise.
* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
test-fenv-x87 and test-fenv-sse-2.
[$(subdir) = math] (CFLAGS-test-fenv-sse-2.c): New variable.

8 years agoUse C11 CMPLX* macros in libm tests.
Joseph Myers [Wed, 28 Oct 2015 21:57:10 +0000 (21:57 +0000)]
Use C11 CMPLX* macros in libm tests.

libm-test.inc has a macro BUILD_COMPLEX to construct a complex number
with given real and imaginary parts while allowing properly for signed
zeroes, infinities and NaNs (which don't work properly with a simple
real + I * imag, in the absence of compiler support for imaginary
types), using assignment to __real__ and __imag__ parts of the number.
C11 defines CMPLX* macros for this purpose, which GCC 4.7 and above
provide suitable built-in functions for.  This patch redefines
BUILD_COMPLEX in terms of the standard macros.

Tested for x86_64 and x86.

* math/libm-test.inc (BUILD_COMPLEX): Remove macro.
* math/test-double.h (BUILD_COMPLEX): New macro.
* math/test-float.h (BUILD_COMPLEX): Likewise.
* math/test-ldouble.h (BUILD_COMPLEX): Likewise.

8 years agoUse C11 *_TRUE_MIN macros where applicable.
Joseph Myers [Wed, 28 Oct 2015 21:42:52 +0000 (21:42 +0000)]
Use C11 *_TRUE_MIN macros where applicable.

C11 defines standard <float.h> macros *_TRUE_MIN for the least
positive subnormal value of a type.  Now that we build with
-std=gnu11, we can use these macros in glibc.  This patch replaces
previous uses of the GCC predefines __*_DENORM_MIN__ (used in
<float.h> to define *_TRUE_MIN), as well as *_DENORM_MIN references in
comments.

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

* math/libm-test.inc (min_subnorm_value): Use LDBL_TRUE_MIN,
DBL_TRUE_MIN and FLT_TRUE_MIN instead of __LDBL_DENORM_MIN__,
__DBL_DENORM_MIN__ and __FLT_DENORM_MIN__.
* sysdeps/ieee754/dbl-64/s_fma.c (__fma): Refer to DBL_TRUE_MIN
instead of DBL_DENORM_MIN in comment.
* sysdeps/ieee754/ldbl-128/s_fmal.c (__fmal): Refer to
LDBL_TRUE_MIN instead of LDBL_DENORM_MIN in comment.
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Include <float.h>.
(__nextafterl): Use LDBL_TRUE_MIN instead of __LDBL_DENORM_MIN__.
* sysdeps/ieee754/ldbl-96/s_fmal.c (__fmal): Refer to
LDBL_TRUE_MIN instead of LDBL_DENORM_MIN in comment.

8 years agomalloc: Prevent arena free_list from turning cyclic [BZ #19048]
Florian Weimer [Wed, 28 Oct 2015 18:32:46 +0000 (19:32 +0100)]
malloc: Prevent arena free_list from turning cyclic [BZ #19048]

[BZ# 19048]
* malloc/malloc.c (struct malloc_state): Update comment.  Add
attached_threads member.
(main_arena): Initialize attached_threads.
* malloc/arena.c (list_lock): Update comment.
(ptmalloc_lock_all, ptmalloc_unlock_all): Likewise.
(ptmalloc_unlock_all2): Reinitialize arena reference counts.
(deattach_arena): New function.
(_int_new_arena): Initialize arena reference count and deattach
replaced arena.
(get_free_list, reused_arena): Update reference count and deattach
replaced arena.
(arena_thread_freeres): Update arena reference count and only put
unreferenced arenas on the free list.

8 years agoFix i386/x86_64 fesetenv SSE exception clearing (bug 19181).
Joseph Myers [Wed, 28 Oct 2015 18:50:20 +0000 (18:50 +0000)]
Fix i386/x86_64 fesetenv SSE exception clearing (bug 19181).

The i386 and x86_64 versions of fesetenv, when called with FE_DFL_ENV
or FE_NOMASK_ENV as argument, do not clear SSE exceptions raised in
MXCSR.  These arguments should, like other fenv_t values, represent
the whole of the floating-point state, so such exceptions should be
cleared; this patch adds the required clearing.  (Discovered while
working on bug 16068.)

Tested for x86_64 and x86.

[BZ #19181]
* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Clear already-raised
SSE exceptions when argument is FE_DFL_ENV or FE_NOMASK_ENV.
* sysdeps/x86_64/fpu/fesetenv.c (__fesetenv): Likewise.
* math/test-fenv-clear-main.c: New file.
* math/test-fenv-clear.c: Likewise.
* math/Makefile (tests): Add test-fenv-clear.
* sysdeps/x86/fpu/test-fenv-clear-sse.c: New file.
* sysdeps/x86/fpu/Makefile [$(subdir) = math] (tests): Add
test-fenv-clear-sse.
[$(subdir) = math] (CFLAGS-test-fenv-clear-sse.c): New variable.

8 years agoUse C11 *_DECIMAL_DIG macros in libm-test.inc.
Joseph Myers [Wed, 28 Oct 2015 17:12:20 +0000 (17:12 +0000)]
Use C11 *_DECIMAL_DIG macros in libm-test.inc.

Now that we build with -std=gnu11, we can use C11 <float.h> macros
such as FLT_DECIMAL_DIG instead of the GCC predefines such as
__FLT_DECIMAL_DIG__ that are used internally in <float.h>.  This patch
makes libm-test.inc do so.

Tested for x86_64 and x86.

* math/libm-test.inc (TYPE_DECIMAL_DIG): Use LDBL_DECIMAL_DIG,
DBL_DECIMAL_DIG and FLT_DECIMAL_DIG instead of __DECIMAL_DIG__,
__DBL_DECIMAL_DIG__ and __FLT_DECIMAL_DIG__.

8 years agopowerpc: Provide __tls_get_addr () in static libc
Carlos Eduardo Seo [Thu, 8 Oct 2015 17:26:23 +0000 (14:26 -0300)]
powerpc: Provide __tls_get_addr () in static libc

Since '--no-tls-optimize' is available for Power in ld, we need to provide
__tls_get_addr () in static libc in order to avoid undefined references to this
symbol when that flag is used.

* sysdeps/powerpc/libc-tls.c: New file. Provides __tls_get_addr () in
static libc.

8 years agoRemove -mavx2 configure tests.
Joseph Myers [Wed, 28 Oct 2015 13:29:03 +0000 (13:29 +0000)]
Remove -mavx2 configure tests.

There are configure tests for the -mavx2 compiler option.  AVX2
support was added in GCC 4.7, so these tests are now obsolete; this
patch removes them.

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

* sysdeps/i386/configure.ac (libc_cv_cc_avx2): Remove configure
test.
* sysdeps/i386/configure: Regenerated.
* sysdeps/x86_64/configure.ac (libc_cv_cc_avx2): Remove configure
test.
* sysdeps/x86_64/configure: Regenerated.
* config.h.in (HAVE_AVX2_SUPPORT): Remove #undef.
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
memset-avx2 unconditionally instead of conditionally on
[$(config-cflags-avx2) = yes].
* sysdeps/x86_64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list) [HAVE_AVX2_SUPPORT]: Make code
unconditional.
* sysdeps/x86_64/multiarch/memset.S [HAVE_AVX2_SUPPORT]: Likewise.
* sysdeps/x86_64/multiarch/memset_chk.S
[IS_IN (libc) && SHARED && HAVE_AVX2_SUPPORT]: Change conditional
to [IS_IN (libc) && SHARED].

8 years agoRemove configure test for ARM TLS descriptors support.
Joseph Myers [Tue, 27 Oct 2015 23:56:50 +0000 (23:56 +0000)]
Remove configure test for ARM TLS descriptors support.

GCC 4.7 added support for ARM TLS descriptors.  The binutils support
is present in binutils 2.22.  Thus, this patch removes the associated
configure test as obsolete (leaving Makefile conditionals, as NaCl
sets have-arm-tls-desc = no in its sysdeps fragment).

Tested for ARM that installed shared libraries are unchanged by the
patch.

* sysdeps/arm/configure.ac (libc_cv_arm_tls_desc): Remove
configure test.
* sysdeps/arm/configure: Regenerated.
* sysdeps/arm/Makefile [!have-arm-tls-desc] (have-arm-tls-desc):
Define variable if not already defined.

8 years agoRemove MIPS16 atomics using __sync_* (bug 17404).
Joseph Myers [Tue, 27 Oct 2015 23:47:56 +0000 (23:47 +0000)]
Remove MIPS16 atomics using __sync_* (bug 17404).

MIPS16 atomics used __sync_* with GCC before 4.7, which as noted in
bug 17404 is missing the required barrier semantics for
atomic_exchange_rel.  This patch removes the code in question as dead
now GCC before 4.7 is no longer supported for building glibc.

Sanity tested with builds for MIPS.

[BZ #17404]
* sysdeps/mips/atomic-machine.h
[__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]:
Change conditional to [__GNUC_PREREQ (4, 8) || __mips16].
[__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code.

8 years agoRemove GCC version conditionals on -Wmaybe-uninitialized pragmas.
Joseph Myers [Tue, 27 Oct 2015 23:42:20 +0000 (23:42 +0000)]
Remove GCC version conditionals on -Wmaybe-uninitialized pragmas.

One common case of __GNUC_PREREQ (4, 7) conditionals is use of
diagnostic control pragmas for -Wmaybe-uninitialized, an option
introduced in GCC 4.7 where older GCC needed -Wuninitialized to be
controlled instead if the warning appeared with older GCC.  This patch
removes such conditionals.

(There remain several older uses of -Wno-uninitialized in makefiles
that still need to be converted to diagnostic control pragmas if the
issue is still present with current sources and supported GCC
versions, and it's likely that in most cases those pragmas also will
end up controlling -Wmaybe-uninitialized.)

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch, except for libresolv
since res_send.c contains assertions whose line numbers are changed by
the patch).

* resolv/res_send.c (send_vc) [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
* soft-fp/fmadf4.c [__GNUC_PREREQ (4, 7)]: Likewise.
[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* soft-fp/fmasf4.c [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* soft-fp/fmatf4.c [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
[!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* stdlib/setenv.c
[((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)]: Make
code unconditional.
[!(((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7))]:
Remove conditional code.
* sysdeps/ieee754/dbl-64/e_lgamma_r.c
(__ieee754_lgamma_r) [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
(__ieee754_lgamma_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
code.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c
(__ieee754_lgammaf_r) [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
(__ieee754_lgammaf_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
code.
* sysdeps/ieee754/ldbl-128/k_tanl.c
(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c
(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.
* sysdeps/ieee754/ldbl-96/e_lgammal_r.c
(__ieee754_lgammal_r) [__GNUC_PREREQ (4, 7)]: Make code
unconditional.
(__ieee754_lgammal_r) [!__GNUC_PREREQ (4, 7)]: Remove conditional
code.
* sysdeps/ieee754/ldbl-96/k_tanl.c
(__kernel_tanl) [__GNUC_PREREQ (4, 7)]: Make code unconditional.
(__kernel_tanl) [!__GNUC_PREREQ (4, 7)]: Remove conditional code.

8 years agoAdd -std=gnu11 and -std=c11 NPTL initializers tests.
Joseph Myers [Tue, 27 Oct 2015 21:48:34 +0000 (21:48 +0000)]
Add -std=gnu11 and -std=c11 NPTL initializers tests.

NPTL has tests that initializers work with various -std= options.  Now
that we can rely on -std=gnu11 and -std=c11 being available, this
patch adds versions of those tests for those options.

Tested for x86_64 and x86 (testsuite).

* nptl/tst-initializers1-c11.c: New file.
* nptl/tst-initializers1-gnu11.c: Likewise.
* nptl/Makefile (tests): Add these new tests.
(CFLAGS-tst-initializers1-c11.c): New variable.
(CFLAGS-tst-initializers1-gnu11.c): Likewise.

8 years agoUse -std=gnu11 instead of -std=gnu99.
Joseph Myers [Tue, 27 Oct 2015 21:47:22 +0000 (21:47 +0000)]
Use -std=gnu11 instead of -std=gnu99.

Now that GCC 4.7 or later is required to build glibc, this patch moves
the build from using -std=gnu99 to -std=gnu11 (option added in 4.7).
This allows use of C11 features from GCC's headers, such as new
float.h macros and max_align_t.

Tested for x86_64 and x86 (testsuite; installed stripped shared
libraries are unchanged by the patch on x86_64, while I see some
slight code reordering of no significance on x86).

* Makeconfig (CFLAGS): Use -std=gnu11 instead of -std=gnu99.
* Makefile ($(objpfx)c++-types-check.out): Filter out -std=gnu11
instead of -std=gnu99.
* configure.ac (systemtap): Test with -std=gnu11 instead of
-std=gnu99.
* configure: Regenerated.
* math/gen-auto-libm-tests.c: Use -std=gnu11 instead of -std=gnu99
in compilation command in comment.

8 years agoRemove sysdeps/nptl/configure.ac.
Joseph Myers [Tue, 27 Oct 2015 21:46:03 +0000 (21:46 +0000)]
Remove sysdeps/nptl/configure.ac.

sysdeps/nptl/configure.ac tests for forced unwind support and the C
cleanup attribute, giving errors if either is unsupported.  It does
nothing beyond running those two tests.

Both the attribute, and _Unwind_GetCFA which is used in the forced
unwind test, were added in GCC 3.3.  Thus these tests are long
obsolete, and this patch removes the configure fragment running them,
along with associated conditionals.

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

* sysdeps/nptl/configure.ac: Remove file.
* sysdeps/nptl/configure: Remove generated file.
* configure.ac (libc_cv_forced_unwind): Do not substitute.
* configure: Regenerated.
* config.h.in (HAVE_FORCED_UNWIND): Remove #undef.
* config.make.in (have-forced-unwind): Remove variable.
* nptl/Makefile [$(have-forced-unwind) = yes]: Make code
unconditional.
* nptl/descr.h [HAVE_FORCED_UNWIND]: Likewise.
* nptl/unwind.c [HAVE_FORCED_UNWIND]: Likewise.
(__pthread_unwind) [!HAVE_FORCED_UNWIND]: Remove conditional code.
* nptl/version.c [HAVE_FORCED_UNWIND]: Make code unconditional.
* sysdeps/nptl/Makefile [$(have-forced-unwind) = yes]: Make code
unconditional.

8 years agopowerpc: Fix usage of elision transient failure adapt param
Paul Murphy [Thu, 27 Aug 2015 14:48:04 +0000 (09:48 -0500)]
powerpc: Fix usage of elision transient failure adapt param

The skip_lock_out_of_tbegin_retries adaptive parameter was
not being used correctly, nor as described.  This prevents
a fallback for all users of the lock if a transient abort
occurs within the accepted number of retries.

[BZ #19174]
* sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
.skip_lock_out_of_tbegin_retries.
* sysdeps/unix/sysv/linux/powerpc/elision-lock.c
(__lll_lock_elision): Likewise, and respect a value of
try_tbegin <= 0.

8 years agoAdd AT_PLATFORM to _dl_aux_init ()
Carlos Eduardo Seo [Fri, 9 Oct 2015 19:01:35 +0000 (16:01 -0300)]
Add AT_PLATFORM to _dl_aux_init ()

Added AT_PLATFORM to _dl_aux_init () function to keep it in sync with
_dl_sysdep_start ().

* elf/dl-support.c (_dl_aux_init): Added AT_PLATFORM to the case
statement.

8 years agoRemove pre-GCC-4.7 conform/ test XFAILs.
Joseph Myers [Tue, 27 Oct 2015 17:13:14 +0000 (17:13 +0000)]
Remove pre-GCC-4.7 conform/ test XFAILs.

Now that GCC 4.7 or later is required to build glibc, this patch
removes three conform/ test XFAILs that related to missing C11 support
in GCC 4.6.

Tested for x86_64 and x86 (conform/ tests).

* conform/Makefile (test-xfail-ISO11/complex.h/conform): Remove
variable.
(test-xfail-ISO11/stdalign.h/conform): Likewise.
(test-xfail-ISO11/stdnoreturn.h/conform): Likewise.

8 years agoUse -std=c11 for C11 conform/ tests.
Joseph Myers [Tue, 27 Oct 2015 17:11:31 +0000 (17:11 +0000)]
Use -std=c11 for C11 conform/ tests.

Now that GCC 4.7 or later is required to build glibc, this patch makes
the conformance tests use -std=c11 for C11 tests instead of -std=c1x
-D_ISOC11_SOURCE.

Tested for x86_64 and x86 (conform/ tests).

* conform/GlibcConform.pm ($CFLAGS{"ISO11"}): Use -std=c11 instead
of -std=c1x -D_ISOC11_SOURCE.

8 years agoRequire GCC 4.7 or later to build glibc.
Joseph Myers [Tue, 27 Oct 2015 16:34:12 +0000 (16:34 +0000)]
Require GCC 4.7 or later to build glibc.

This patch implements a requirement of GCC 4.7 or later to build
glibc.

This was discussed in the thread starting at
<https://sourceware.org/ml/libc-alpha/2015-08/msg00851.html>.
Concerns were expressed by Mike and David.  At
<https://sourceware.org/ml/libc-alpha/2015-10/msg00453.html> I have
provided a 14-patch series showing in outline the cleanups facilitated
by this version requirement, as requested by Mike (this patch is the
first in that series, with the addition of a NEWS entry).  Given the
absence of further concerns or alternative proposals for criteria for
updates to this version requirement as requested in
<https://sourceware.org/ml/libc-alpha/2015-10/msg00065.html>, I am
interpreting this as "absence of sustained opposition" under Carlos's
definition at <https://sourceware.org/glibc/wiki/Consensus> and
proposing this patch for inclusion in glibc.  I'd like to remind
people testing with 4.6 that if they move to testing with GCC 5 then
it will probably be about four years before they need to update the
compiler they use to test glibc again.

Although on the principles of time-based updates I think a move to
requiring binutils 2.23 would be reasonable, I'm not currently aware
of any cleanups that would facilitate so am not proposing that at this
time (but would expect to propose a move to requiring binutils 2.24 in
a year's time, as that brings features such as AVX512 support that
should allow some conditionals to be cleaned up).  If someone thinks a
move to requiring 2.23 would help clean things up for their
architecture, please speak up.  (And in general, I suspect there are
lots of architecture-specific configure tests that could be removed on
the basis of current GCC and binutils version requirements, given how
I've found architecture-independent tests obsolete on the basis of
version requirements going back 20 years.)

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

* configure.ac (libc_cv_compiler_ok): Require GCC 4.7 or later.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for GCC 4.7 or later.
* INSTALL: Regenerated.

8 years agoGracefully handle incompatible locale data
Ludovic Courtès [Tue, 27 Oct 2015 12:33:26 +0000 (13:33 +0100)]
Gracefully handle incompatible locale data

* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
on CNT to a conditional jump to 'puntdata'.

8 years agoRemove TLS configure tests.
Joseph Myers [Tue, 27 Oct 2015 10:48:05 +0000 (10:48 +0000)]
Remove TLS configure tests.

There seemed to be support in response to
<https://sourceware.org/ml/libc-alpha/2015-10/msg00510.html> for
removing configure tests that exist only to produce errors, where we
expect that tool versions failing the tests would also fail the tests
of minimum GCC / binutils versions.

This patch removes the tests for TLS support as one instance of such
tests.  Since the addition of TLS emulation support in GCC 4.3, I
don't think these tests would have failed even if proper TLS support
(as required by glibc) was missing in that architecture's GCC back
end, so any new glibc ports wanting a substantive test (if there are
actual GCC or binutils versions for those architectures, with
supported version numbers, missing TLS support) would have needed an
architecture-specific test anyway.

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

* configure.ac (libc_cv_gcc___thread): Remove configure test.
(libc_cv_gcc_tls_model_attr): Likewise.
* configure: Regenerated.

8 years agoRemove configure test for needing -P for .S files.
Joseph Myers [Tue, 27 Oct 2015 10:46:15 +0000 (10:46 +0000)]
Remove configure test for needing -P for .S files.

There is a configure test for "whether we need to use -P to assemble
.S files".

I think this test is long obsolete.  I don't have a specific reference
to a binutils change or version that obsoleted this test, but: (a) we
only support GNU binutils; (b) it looks like every architecture
supported by glibc has '#' as a line comment character in its gas
port; (c) in any case, if the (compiler, assembler) combination in use
cannot compile a .S file without special options, that would clearly
be a substantially broken combination, which I don't think we need to
allow for at all.

The test in question was added by:

Thu Jan 27 16:46:03 1994  Roland McGrath  (roland@churchy.gnu.ai.mit.edu)

        * configure.in (asm-CPPFLAGS): Add new check to see if assembling
        a .S file loses without -P.  If so, set asm-CPPFLAGS=-P in config.make.

This patch removes the test and the reference to this issue in the
comment on the default empty definition of asm-CPPFLAGS.  (Various
other settings of asm-CPPFLAGS remain in sysdeps Makefile fragments.)

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

* configure.ac (libc_cv_need_minus_P): Remove configure test.
* configure: Regenerated.
* Makeconfig (asm-CPPFLAGS): Remove reference to -P in comment.

8 years agoRemove support for removing glibc 2.0 headers.
Joseph Myers [Mon, 26 Oct 2015 22:46:04 +0000 (22:46 +0000)]
Remove support for removing glibc 2.0 headers.

There is a configure test for the presence of glibc 2.0 headers (that
were renamed / no longer installed in glibc 2.1) and associated
support for removing them on "make install".

Normal practice for subsequent removal / renaming of installed files
has been not to do anything special about removing them; if you want
installed files from an old installation removed reliably, you need to
use a packaging system that tracks what files were installed by a
previous glibc package (via installing in an intermediate directory
with install_root).  I think it's been long enough since 2.0 that it's
not particularly useful to have that special logic for those old
headers either; this patch removes it.

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

* configure.ac (old_glibc_headers): Remove configure test.
* configure: Regenerated.
* config.make.in (old-glibc-headers): Remove variable.
* Makefile [!$(install_root) && $(old-glibc-headers) = yes]
(install): Remove dependency on remove-old-headers.
(headers2_0): Remove variable.
(remove-old-headers): Remove rule.

8 years agoRemove configure test for assembler .text directive.
Joseph Myers [Mon, 26 Oct 2015 22:44:18 +0000 (22:44 +0000)]
Remove configure test for assembler .text directive.

There is a configure test for assembler support for the .text
directive.

I suppose this test must have been aimed at some non-ELF platform or
non-GNU assembler.  Certainly the GNU assembler has had ELF-specific
architecture-independent handling for .text since version 2.2, and
generic non-ELF-specific support predates that.

This patch removes this test as obsolete.

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

* configure.ac (libc_cv_dot_text): Remove configure test.
(libc_cv_asm_set_directive): Use .text instead of
${libc_cv_dot_text} in configure test.
* configure: Regenerated.

8 years agox86_64: Regenerate ulps [BZ #19168]
Florian Weimer [Mon, 26 Oct 2015 12:15:48 +0000 (13:15 +0100)]
x86_64: Regenerate ulps [BZ #19168]

This comes from running “make regen-ulps” on AMD Opteron 6272 CPUs.

8 years agoUse the CXX compiler only if it can create dynamic and static programs
Florian Weimer [Mon, 26 Oct 2015 08:41:10 +0000 (09:41 +0100)]
Use the CXX compiler only if it can create dynamic and static programs

* configure.ac (CXX): Clear the variable if the C++ toolchain does
not support static linking.
* configure: Regenerate.