]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 years agoRemove Roland McGrath/Ulrich Drepper et al. from DSO banner
H.J. Lu [Fri, 1 Sep 2017 17:09:08 +0000 (10:09 -0700)] 
Remove Roland McGrath/Ulrich Drepper et al. from DSO banner

* csu/version.c (banner): Remove "by Roland McGrath et al.".
* nptl/Banner: Remove "by Ulrich Drepper et al.".

6 years ago2017-09-01 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul Pluzhnikov [Fri, 1 Sep 2017 16:31:13 +0000 (09:31 -0700)] 
2017-09-01  Paul Pluzhnikov  <ppluzhnikov@google.com>

* stdlib/tst-atexit-common.c (do_test): Test support for at least
32 atexit handlers.

6 years agomath/math.h (HUGE_VAL): Improve commentary.
Zack Weinberg [Fri, 1 Sep 2017 15:19:47 +0000 (11:19 -0400)] 
math/math.h (HUGE_VAL): Improve commentary.

6 years agoMove all old ChangeLogs to a top-level ChangeLog.old directory.
Zack Weinberg [Fri, 1 Sep 2017 13:31:43 +0000 (09:31 -0400)] 
Move all old ChangeLogs to a top-level ChangeLog.old directory.

6 years agolinux: Implement tmpfile with O_TMPFILE (BZ#21530)
Adhemerval Zanella [Mon, 26 Jun 2017 14:52:14 +0000 (11:52 -0300)] 
linux: Implement tmpfile with O_TMPFILE (BZ#21530)

This patch adds O_TMPFILE support to tmpfile on Linux.  This is
similar to the previous suggestion by Andreas Schwab [1] with the
difference the file descriptor creation is parameterized to
compartmentalize Linux only open flags (O_TMPFILE) on sysdeps.

Checked on x86_64-linux-gnu.

Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Andreas Schwab  <schwab@suse.de>

[BZ #21530]
* include/stdio.h (__gen_tempfd): New function.
* stdio-common/Makefile (routines): Add gentempfd.
* stdio-common/gentempfd.c: New file.
* sysdeps/unix/sysv/linux/gentempfd.c: Likewise.
* stdio-common/tmpfile.c (tmpfile): First try to use a system specific
unnamed file first.

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

6 years agoRemove obsolete notes at top level of source tree.
Zack Weinberg [Fri, 1 Sep 2017 12:04:22 +0000 (08:04 -0400)] 
Remove obsolete notes at top level of source tree.

 * BUGS, CONFORMANCE, NAMESPACE, WUR-REPORT: Deleted.
 * README.pretty-printers, README.tunables: Move to manual/.

6 years agogetaddrinfo: Fix error handling in gethosts [BZ #21915] [BZ #21922]
Florian Weimer [Fri, 1 Sep 2017 07:34:29 +0000 (09:34 +0200)] 
getaddrinfo: Fix error handling in gethosts [BZ #21915] [BZ #21922]

The old code uses errno as the primary indicator for success or
failure.  This is wrong because errno is only set for specific
combinations of the status return value and the h_errno variable.

6 years agogetaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]
Florian Weimer [Fri, 1 Sep 2017 07:15:36 +0000 (09:15 +0200)] 
getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]

6 years agosupport_chroot_create: Add support for /etc/hosts, /etc/host.conf
Florian Weimer [Fri, 1 Sep 2017 06:58:07 +0000 (08:58 +0200)] 
support_chroot_create: Add support for /etc/hosts, /etc/host.conf

6 years agogetaddrinfo: In gaih_inet, use h_errno for certain status values only
Florian Weimer [Fri, 1 Sep 2017 06:57:52 +0000 (08:57 +0200)] 
getaddrinfo: In gaih_inet, use h_errno for certain status values only

h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.

6 years agogetaddrinfo: Properly set errno for NSS function lookup failure
Florian Weimer [Fri, 1 Sep 2017 06:57:28 +0000 (08:57 +0200)] 
getaddrinfo: Properly set errno for NSS function lookup failure

6 years agogetaddrinfo: Use &h_errno has the h_errno pointer
Florian Weimer [Fri, 1 Sep 2017 06:57:07 +0000 (08:57 +0200)] 
getaddrinfo: Use &h_errno has the h_errno pointer

This simplifies the code because it is not necessary to propagate the
temporary h_errno value to the thread-local variable.  It also increases
compatibility with NSS modules which update only one of the two places.

6 years agogetaddrinfo: Use &errno has the errno pointer
Florian Weimer [Fri, 1 Sep 2017 06:56:46 +0000 (08:56 +0200)] 
getaddrinfo: Use &errno has the errno pointer

Similar code in nss/getXXbyYY_r.c is already using &errno as the
argument.

6 years agoILP32 math changes
Steve Ellcey [Thu, 31 Aug 2017 20:38:11 +0000 (13:38 -0700)] 
ILP32 math changes

* sysdeps/aarch64/fpu/s_llrint.c (OREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_llround.c (OREG_SIZE): Likewise.
* sysdeps/aarch64/fpu/s_llrintf.c (OREGS, IREGS): Remove.
(IREG_SIZE, OREG_SIZE): New macros.
* sysdeps/aarch64/fpu/s_llroundf.c: (OREGS, IREGS): Remove.
(IREG_SIZE, OREG_SIZE): New macros.
* sysdeps/aarch64/fpu/s_lrintf.c (IREGS): Remove.
(IREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_lroundf.c (IREGS): Remove.
(IREG_SIZE): New macro.
* sysdeps/aarch64/fpu/s_lrint.c (get-rounding-mode.h, stdint.h):
New includes.
(IREG_SIZE, OREG_SIZE): Initialize if not already set.
(OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.
(__CONCATX): Handle exceptions correctly on large values that may
set FE_INVALID.
* sysdeps/aarch64/fpu/s_lround.c (IREG_SIZE, OREG_SIZE):
Initialize if not already set.
        (OREGS, IREGS): Set based on IREG_SIZE and OREG_SIZE.

6 years agoRemove NO_CANCELLATION macro
Adhemerval Zanella [Thu, 3 Aug 2017 17:29:06 +0000 (14:29 -0300)] 
Remove NO_CANCELLATION macro

The NO_CANCELLATION macro is used currently on generic headers to
define non cancellable syscalls and on Linux fcntl to implement the non
cancellable variation.  Former should be single-handled by not-cancel.h
header and former could be simplified build both cancellable and non
cancellable for default objects and alias the non-cancellable to default
one for rtld ones (since Linux already support cancellation as default).

This patch thus removes the NO_CANCELLATION macro and its usage.  The
generic non cancellable fcntl is route to internal fcntl.

Checked on x86_64-linux-gnu and i686-linux-gnu.  Also checked with
a build again major ABIs.

* sysdeps/generic/not-cancel.h (NO_CANCELLATION): Remove macro.
* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
(NO_CANCELLATION): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (NO_CANCELLATION):
Likewise
* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (NO_CANCELLATION):
Likewise.
* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Add
hidden prototype.
* sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Define only
for !IS_IN (rtld) and remove NO_CANCELLATION usage.

6 years agoChange argument type passed to ifunc resolvers
Steve Ellcey [Thu, 31 Aug 2017 17:34:55 +0000 (10:34 -0700)] 
Change  argument type passed to ifunc resolvers

* sysdeps/aarch64/dl-irel.h: (elf_ifunc_invoke): Change argument type
in resolver call.

6 years agolibc-symbols.h: Remove definition of internal_function
Florian Weimer [Thu, 31 Aug 2017 16:31:04 +0000 (18:31 +0200)] 
libc-symbols.h: Remove definition of internal_function

6 years agostdlib: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 16:30:38 +0000 (18:30 +0200)] 
stdlib: Remove internal_function attribute

6 years agostdio-common: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 16:30:02 +0000 (18:30 +0200)] 
stdio-common: Remove internal_function attribute

6 years agoposix: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 16:25:55 +0000 (18:25 +0200)] 
posix: Remove internal_function attribute

6 years agonptl: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 15:50:26 +0000 (17:50 +0200)] 
nptl: Remove internal_function attribute

6 years agoio: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 15:41:25 +0000 (17:41 +0200)] 
io: Remove internal_function attribute

6 years agoinet: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 15:35:16 +0000 (17:35 +0200)] 
inet: Remove internal_function attribute

6 years agoSimplify NAN definitions.
Joseph Myers [Thu, 31 Aug 2017 16:39:25 +0000 (16:39 +0000)] 
Simplify NAN definitions.

Similar to my patches for HUGE_VAL and INFINITY. this patch eliminates
the bits/nan.h headers.  __builtin_nanf ("") is used to define NAN for
GCC 3.3 and later; the fallback is (0.0f / 0.0f), which is a constant
expression for a quiet NaN of type float, but raises a spurious
"invalid" exception outside static initializers, which seems the best
that can be done purely in standard C.  Again, if anyone actually uses
a compiler with its own incompatible extension for producing a
constant quiet NaN, we can add compiler conditionals.

Tested for x86_64.

*  math/math.h [__USE_ISOC99] (NAN): Define directly here.  Do not
include <bits/nan.h>.
* math/Makefile (headers): Remove bits/nan.h.
* bits/nan.h: Remove.
* sysdeps/ieee754/bits/nan.h: Likewise.
* sysdeps/mips/bits/nan.h: Likewise.

6 years agoSimplify INFINITY definitions.
Joseph Myers [Thu, 31 Aug 2017 16:12:46 +0000 (16:12 +0000)] 
Simplify INFINITY definitions.

Similar to my patch for HUGE_VAL, this patch eliminates the bits/inf.h
headers and just unconditionally uses the same definitions as the
sysdeps/ieee754 version did (__builtin_inff () for GCC >= 3.3,
otherwise HUGE_VALF), directly in math.h, so removing an unnecessary
level of indirection.

Tested for x86_64.

* math/math.h [__USE_ISOC99] (INFINITY): Define directly here.  Do
not include <bits/inf.h>.
* math/Makefile (headers): Remove bits/inf.h.
* bits/inf.h: Remove.
* sysdeps/ieee754/bits/inf.h: Likewise.

6 years agoSimplify HUGE_VAL definitions.
Joseph Myers [Thu, 31 Aug 2017 15:50:50 +0000 (15:50 +0000)] 
Simplify HUGE_VAL definitions.

There are various bits/huge_val*.h headers to define HUGE_VAL and
related macros.  All of them use __builtin_huge_val etc. for GCC 3.3
and later.  Then there are various fallbacks, such as using a large
hex float constant for GCC 2.96 and later, or using unions (with or
without compound literals) to construct the bytes of an infinity, with
this last being the reason for having architecture-specific files.
Supporting TS 18661-3 _FloatN / _FloatNx types that have the same
format as other supported types will mean adding more such macros;
needing to add more headers for them doesn't seem very desirable.

The fallbacks based on bytes of the representation of an infinity do
not meet the standard requirements for a constant expression.  At
least one of them is also wrong: sysdeps/sh/bits/huge_val.h is
producing a mixed-endian representation which does not match what GCC
does.

This patch eliminates all those headers, defining the macros directly
in math.h.  For GCC 3.3 and later, the built-in functions are used as
now.  For other compilers, a large constant 1e10000 (with appropriate
suffix) is used.  This is like the fallback for GCC 2.96 and later,
but without using hex floats (which have no apparent advantage here).
It is unambiguously valid standard C for all floating-point formats
with infinities, which covers all formats supported by glibc or likely
to be supported by glibc in future (C90 DR#025 said that if a
floating-point format represents infinities, all real values lie
within the range of representable values, so the constraints for
constant expressions are not violated), but may generate compiler
warnings and wouldn't handle the TS 18661-1 FENV_ROUND pragma
correctly.  If someone is actually using a compiler with glibc that
does not claim to be GCC 3.3 or later, but which has a better way to
define the HUGE_VAL macros, we can always add compiler conditionals in
with alternative definitions.

I intend to make similar changes for INF and NAN.  The SNAN macros
already just use __builtin_nans etc. with no fallback for compilers
not claiming to be GCC 3.3 or later.

Tested for x86_64.

* math/math.h: Do not include bits/huge_val.h, bits/huge_valf.h,
bits/huge_vall.h or bits/huge_val_flt128.h.
(HUGE_VAL): Define directly here.
[__USE_ISOC99] (HUGE_VALF): Likewise.
[__USE_ISOC99] (HUGE_VALL): Likewise.
[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(HUGE_VAL_F128): Likewise.
* math/Makefile (headers): Remove bits/huge_val.h,
bits/huge_valf.h, bits/huge_vall.h and bits/huge_val_flt128.h.
* bits/huge_val.h: Remove.
* bits/huge_val_flt128.h: Likewise.
* bits/huge_valf.h: Likewise.
* bits/huge_vall.h: Likewise.
* sysdeps/ia64/bits/huge_vall.h: Likewise.
* sysdeps/ieee754/bits/huge_val.h: Likewise.
* sysdeps/ieee754/bits/huge_valf.h: Likewise.
* sysdeps/m68k/m680x0/bits/huge_vall.h: Likewise.
* sysdeps/sh/bits/huge_val.h: Likewise.
* sysdeps/sparc/bits/huge_vall.h: Likewise.
* sysdeps/x86/bits/huge_vall.h: Likewise.

6 years agoelf: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 14:59:37 +0000 (16:59 +0200)] 
elf: Remove internal_function attribute

6 years agogmon: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 14:16:07 +0000 (16:16 +0200)] 
gmon: Remove internal_function attribute

6 years agodlfcn: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 14:12:03 +0000 (16:12 +0200)] 
dlfcn: Remove internal_function attribute

6 years agoresolv: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 14:07:52 +0000 (16:07 +0200)] 
resolv: Remove internal_function attribute

6 years agodirent: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 14:02:40 +0000 (16:02 +0200)] 
dirent: Remove internal_function attribute

6 years agoLinux getcwd: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 13:33:27 +0000 (15:33 +0200)] 
Linux getcwd: Remove internal_function attribute

6 years agotime: Remove the internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 13:58:09 +0000 (15:58 +0200)] 
time: Remove the internal_function attribute

6 years agoiconv, intl, locale, wcsmbs: Remove internal_function
Florian Weimer [Tue, 15 Aug 2017 15:52:59 +0000 (17:52 +0200)] 
iconv, intl, locale, wcsmbs: Remove internal_function

Also adjust parts of the time subdirectory.

6 years agoaio: Remove internal_function function attribute
Florian Weimer [Thu, 31 Aug 2017 13:57:00 +0000 (15:57 +0200)] 
aio: Remove internal_function function attribute

6 years agomisc: Remove internal_function function attribute
Florian Weimer [Thu, 31 Aug 2017 13:56:45 +0000 (15:56 +0200)] 
misc: Remove internal_function function attribute

6 years agoNSS: Remove internal_function function attribute
Florian Weimer [Thu, 31 Aug 2017 13:56:32 +0000 (15:56 +0200)] 
NSS: Remove internal_function function attribute

6 years agomalloc: Remove the internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 13:56:21 +0000 (15:56 +0200)] 
malloc: Remove the internal_function attribute

6 years agosunrpc: Remove internal_function attribute
Florian Weimer [Thu, 31 Aug 2017 13:55:36 +0000 (15:55 +0200)] 
sunrpc: Remove internal_function attribute

6 years agomalloc: Resolve compilation failure in NDEBUG mode
Florian Weimer [Thu, 31 Aug 2017 12:55:11 +0000 (14:55 +0200)] 
malloc: Resolve compilation failure in NDEBUG mode

In _int_free, the locked variable is not used if NDEBUG is defined.

6 years agoPlace $(elf-objpfx)sofini.os last [BZ #22051]
H.J. Lu [Thu, 31 Aug 2017 13:28:31 +0000 (06:28 -0700)] 
Place $(elf-objpfx)sofini.os last [BZ #22051]

Since sofini.os terminates .eh_frame section, it should be placed last.

[BZ #22051]
* Makerules (build-module-helper-objlist): Filter out
$(elf-objpfx)sofini.os.
(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
needed.

6 years agolibio: Assume _LIBC, weak_alias, errno, (__set_)errno &c are defined
Florian Weimer [Thu, 31 Aug 2017 12:07:23 +0000 (14:07 +0200)] 
libio: Assume _LIBC, weak_alias, errno, (__set_)errno &c are defined

Do not define _POSIX_SOURCE.

6 years agomalloc: Change top_check return type to void
Florian Weimer [Thu, 31 Aug 2017 10:02:59 +0000 (12:02 +0200)] 
malloc: Change top_check return type to void

After commit ec2c1fcefb200c6cb7e09553f3c6af8815013d83,
(malloc: Abort on heap corruption, without a backtrace), the function
always returns 0.

6 years agoFix decimal point and thousands separator in es_CU locale to agree with CLDR.
Mike FABIAN [Thu, 31 Aug 2017 10:56:07 +0000 (12:56 +0200)] 
Fix decimal point and thousands separator in es_CU locale to agree with CLDR.

[BZ #15332]
* locales/es_CU (LC_MONETARY): use “,” for mon_decimal_point
and “.” for mon_thousands_sep (to agree with CLDR)
* locales/es_CU (LC_NUMERIC): Likewise.

6 years agoRemove redundant data in li_BE which is identical to the data in li_NL
Akhilesh Kumar [Wed, 30 Aug 2017 13:43:45 +0000 (19:13 +0530)] 
Remove redundant data in li_BE which is identical to the data in li_NL

[BZ #22044]
* locales/li_BE (LC_TIME): copy "li_NL".

6 years agoFix mcontext_t sigcontext namespace (bug 21457).
Joseph Myers [Wed, 30 Aug 2017 22:02:04 +0000 (22:02 +0000)] 
Fix mcontext_t sigcontext namespace (bug 21457).

This patch completes the ucontext.h namespace fixes by fixing issues
related to the use of struct sigcontext as mcontext_t, and inclusion
of <bits/sigcontext.h> even when struct sigcontext is not so used.

Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the
way to get the sigcontext structure is by including <signal.h> (in a
context where __USE_MISC is defined); the sysdeps/generic version of
sys/ucontext.h keeps the inclusion by necessity, with a comment about
how this is not namespace-clean, but the only configuration that used
it, MicroBlaze, gets its own version of the header in this patch.
Where mcontext_t was typedefed to struct sigcontext, the contents of
struct sigcontext are inserted (with appropriate namespace handling to
prefix fields with __ when __USE_MISC is not defined); review should
check that this has been done correctly in each case, whether the
definition of struct sigcontext comes from glibc headers or from the
Linux kernel.  This changes C++ name mangling on affected
architectures (which do not include x86_64/x86).

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

2017-08-14  Joseph Myers  <joseph@codesourcery.com>

[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/generic/sys/ucontext.h: Add comment about use of struct
sigcontext and namespace requirements.
* sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise.  Include <bits/types.h>.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
__glibc_reserved1 instead of __reserved.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): New macro.
(struct __ia64_fpreg_mcontext): New type.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
(_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
(uc_sigmask): Define using __ctx.
(uc_stack): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<bits/sigcontext.h>.  Include <bits/types.h>.
* conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
(test-xfail-XPG42/sys/wait.h/conform): Likewise.
(test-xfail-XPG42/ucontext.h/conform): Likewise.
(test-xfail-UNIX98/signal.h/conform): Likewise.
(test-xfail-UNIX98/sys/wait.h/conform): Likewise.
(test-xfail-UNIX98/ucontext.h/conform): Likewise.
(test-xfail-XOPEN2K/signal.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
(test-xfail-POSIX2008/signal.h/conform): Likewise.
(test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K8/signal.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.

6 years agodynarray: Set errno on overflow-induced allocation failure
Florian Weimer [Wed, 30 Aug 2017 18:10:56 +0000 (20:10 +0200)] 
dynarray: Set errno on overflow-induced allocation failure

This allows the caller to return directly on such an error, with an
appropriate errno value.

6 years agomalloc: Remove corrupt arena flag
Florian Weimer [Wed, 30 Aug 2017 15:16:08 +0000 (17:16 +0200)] 
malloc: Remove corrupt arena flag

This is no longer needed because we now abort immediately
once heap corruption is detected.

6 years agomalloc: Remove check_action variable [BZ #21754]
Florian Weimer [Wed, 30 Aug 2017 17:29:38 +0000 (19:29 +0200)] 
malloc: Remove check_action variable [BZ #21754]

Clean up calls to malloc_printerr and trim its argument list.

This also removes a few bits of work done before calling
malloc_printerr (such as unlocking operations).

The tunable/environment variable still enables the lightweight
additional malloc checking, but mallopt (M_CHECK_ACTION)
no longer has any effect.

6 years agoaarch64: Fix tst-makecontext3 in ILP32 mode.
Steve Ellcey [Wed, 30 Aug 2017 16:25:51 +0000 (09:25 -0700)] 
aarch64: Fix tst-makecontext3 in ILP32 mode.

* sysdeps/unix/sysv/linux/aarch64/makecontext.c (__makecontext):
Use pointer to uint64_t instead of long int for sp.

6 years agomalloc: Abort on heap corruption, without a backtrace [BZ #21754]
Florian Weimer [Wed, 30 Aug 2017 14:39:41 +0000 (16:39 +0200)] 
malloc: Abort on heap corruption, without a backtrace [BZ #21754]

The stack trace printing caused deadlocks and has been itself been
targeted by code execution exploits.

6 years agoDo not scale NPTL tests with available number of CPUs
Florian Weimer [Wed, 30 Aug 2017 14:20:20 +0000 (16:20 +0200)] 
Do not scale NPTL tests with available number of CPUs

On very large multi-processor systems, creating hundreds of threads
runs into a test time out.  The tests do not seem to benefit from
massive over-scheduling.

6 years agoUse “.” in thousands_sep in the ca_ES locale
Mike FABIAN [Wed, 30 Aug 2017 13:19:39 +0000 (15:19 +0200)] 
Use “.” in thousands_sep in the ca_ES locale

[BZ #16148]
* locales/ca_ES (LC_NUMERIC): Use “.” in thousands_sep.
And make it more readable by using ASCII.

6 years agoAdd country_name for mni_IN
Mike FABIAN [Wed, 30 Aug 2017 09:31:44 +0000 (15:01 +0530)] 
Add country_name for mni_IN

[BZ #22022]
* locales/mni_IN (LC_ADDRESS): Add country_name.

6 years agoFix abbreviated weeks and months for Somali to agree with CLDR
Akhilesh Kumar [Wed, 30 Aug 2017 08:39:02 +0000 (14:09 +0530)] 
Fix abbreviated weeks and months for Somali to agree with CLDR

[BZ #22038]
* locales/so_DJ (LC_TIME): Fix abday, abmon and
make t_fmt in the comment agree with the value of t_fmt.
* locales/so_ET (LC_TIME): Fix abday (From Axa to Axd)
* locales/so_KE (LC_TIME): Fix abday (From Axa to Axd)
* locales/so_SO (LC_TIME): Fix abday (From Axa to Axd)

6 years agoUpdate hanzi collation by stroke
Wei-Lun Chao [Tue, 29 Aug 2017 14:52:32 +0000 (16:52 +0200)] 
Update hanzi collation by stroke

[BZ #21951]
        * locales/cns11643_stroke: Update hanzi collation by stroke
        (Add license declaration, use strokes by component).

6 years agoFix m68k bits/math-inline.h macro namespace (bug 22035).
Joseph Myers [Tue, 29 Aug 2017 21:07:51 +0000 (21:07 +0000)] 
Fix m68k bits/math-inline.h macro namespace (bug 22035).

As shown by build bot failures
<https://sourceware.org/ml/libc-testresults/2017-q3/msg00349.html> the
m68k bits/mathinline.h is not namespace-clean: it fails to compile if
the user has defined macros f or l before it is included, because of
expansions of those arguments to __inline_functions.  This patch
changes the __inline_functions definitions to take not the suffix but
a macro that concatenates it with the function name, to avoid the
spurious macro expansions.

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

[BZ #22035]
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__inline_functions):
Define to take a second argument that is a macro that
concatentates a suffix, not the suffix itself.
(__CONCAT_d): New macro.
(__CONCAT_f): Likewise.
(__CONCAT_l): Likewise.

6 years ago2017-08-29 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul Pluzhnikov [Tue, 29 Aug 2017 17:42:42 +0000 (10:42 -0700)] 
2017-08-29  Paul Pluzhnikov  <ppluzhnikov@google.com>

* stdlib/tst-atexit-common.c (do_test): Test handler inheritance
by child.

6 years agoMIPS/o32: Fix internal_syscall5/6/7
Adhemerval Zanella [Tue, 29 Aug 2017 17:31:08 +0000 (18:31 +0100)] 
MIPS/o32: Fix internal_syscall5/6/7

Fix a commit cc25c8b4c119 ("New pthread rwlock that is more scalable.")
regression and prevent uncontrolled stack space usage from happening
when a 5-, 6- or 7-argument syscall wrapper is placed in a loop.

The cause of the problem is the use of `alloca' in regular MIPS/Linux
wrappers to force the use of the frame pointer register in any function
using one or more of these wrappers.  Using the frame pointer register
is required so as not to break frame unwinding as the the stack pointer
is lowered within the inline asm used by these wrappers to make room for
the stack arguments, which 5-, 6- and 7-argument syscalls use with the
o32 ABI.

The regular MIPS/Linux wrappers are macros however, expanded inline, and
stack allocations made with `alloca' are not discarded until the return
of the function they are made in.  Consequently if called in a loop,
then virtual memory is wasted, and if the loop goes through enough
iterations, then ultimately available memory can get exhausted causing
the program to crash.

Address the issue by replacing the inline code with standalone assembly
functions, which rely on the compiler arranging syscall arguments
according to the o32 function calling convention, which MIPS/Linux
syscalls also use, except for the syscall number passed and the error
flag returned.  This way there is no need to fiddle with the stack
pointer anymore and all that has to be handled in the new standalone
functions is the special handling of the syscall number and the error
flag.

Redirect 5-, 6- or 7-argument MIPS16/Linux syscall wrappers to these new
functions as well, so as to avoid an unnecessary double call the
existing wrappers would cause with the new arrangement.

[BZ #21956]
* sysdeps/unix/sysv/linux/mips/mips32/mips16/Makefile
[subdir = misc] (sysdep_routines): Remove `mips16-syscall5',
`mips16-syscall6' and `mips16-syscall7'.
(CFLAGS-mips16-syscall5.c, CFLAGS-mips16-syscall6.c)
(CFLAGS-mips16-syscall7.c): Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/Versions (libc):
Remove `__mips16_syscall5', `__mips16_syscall6' and
`__mips16_syscall7'.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall0.c
(__mips16_syscall0): Rename `__mips16_syscall_return' to
`__mips_syscall_return'.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall1.c
(__mips16_syscall1): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall2.c
(__mips16_syscall2): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall3.c
(__mips16_syscall3): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall4.c
(__mips16_syscall4): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall5.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall6.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall7.c:
Remove.
* sysdeps/unix/sysv/linux/mips/mips32/mips16/mips16-syscall.h
(__mips16_syscall5): Expand to `__mips_syscall5' rather than
`__mips16_syscall5'.  Remove prototype.
(__mips16_syscall6): Expand to `__mips_syscall6' rather than
`__mips16_syscall6'.  Remove prototype.
(__mips16_syscall7): Expand to `__mips_syscall7' rather than
`__mips16_syscall7'.  Remove prototype.
(__nomips16, __mips16_syscall_return): Move to...
* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
(__nomips16, __mips_syscall_return): ... here.
[__mips16] (INTERNAL_SYSCALL_NCS): Rename
`__mips16_syscall_return' to `__mips_syscall_return'.
[__mips16] (INTERNAL_SYSCALL_MIPS16): Pass `number' to
`internal_syscall##nr'.
[!__mips16] (INTERNAL_SYSCALL): Pass `SYS_ify (name)' to
`internal_syscall##nr'.
(FORCE_FRAME_POINTER): Remove.
(__mips_syscall5): New prototype.
(internal_syscall5): Rewrite to call `__mips_syscall5'.
(__mips_syscall6): New prototype.
(internal_syscall6): Rewrite to call `__mips_syscall6'.
(__mips_syscall7): New prototype.
(internal_syscall7): Rewrite to call `__mips_syscall7'.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall5.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall6.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/mips-syscall7.S: New file.
* sysdeps/unix/sysv/linux/mips/mips32/Makefile [subdir = misc]
(sysdep_routines): Add libc-do-syscall.
* sysdeps/unix/sysv/linux/mips/mips32/Versions (libc): Add
`__mips_syscall5', `__mips_syscall6' and `__mips_syscall7'.

6 years agoia64: Fix thread stack allocation permission set (BZ #21672)
Adhemerval Zanella [Mon, 28 Aug 2017 14:24:35 +0000 (11:24 -0300)] 
ia64: Fix thread stack allocation permission set (BZ #21672)

This patch fixes ia64 failures on thread exit by madvise the required
area taking in consideration its disjoing stacks
(NEED_SEPARATE_REGISTER_STACK).  Also the snippet that setup the
madvise call to advertise kernel the area won't be used anymore in
near future is reallocated in allocatestack.c (for consistency to
put all stack management function in one place).

Checked on x86_64-linux-gnu and i686-linux-gnu for sanity (since
it is not expected code changes for architecture that do not
define NEED_SEPARATE_REGISTER_STACK) and also got a report that
it fixes ia64-linux-gnu failures from Sergei Trofimovich
<slyfox@gentoo.org>.

[BZ #21672]
* nptl/allocatestack.c [_STACK_GROWS_DOWN] (setup_stack_prot):
Set to use !NEED_SEPARATE_REGISTER_STACK as well.
(advise_stack_range): New function.
* nptl/pthread_create.c (START_THREAD_DEFN): Move logic to mark
stack non required to advise_stack_range at allocatestack.c

6 years ago[AArch64] Fix procfs.h not to expose stdint.h types
Szabolcs Nagy [Tue, 29 Aug 2017 15:31:08 +0000 (16:31 +0100)] 
[AArch64] Fix procfs.h not to expose stdint.h types

Commit 39e7a5a66828a60008543db5f03f46dc7081668b added stdint.h
to sys/procfs.h, but it is included into signal.h by default and
there is code that does not expect stdint.h to be visible there,
so use __uint64_t instead of uint64_t.

6 years agoiconv_open: Fix heap corruption on gconv_init failure [BZ #22026]
Florian Weimer [Tue, 29 Aug 2017 15:33:58 +0000 (17:33 +0200)] 
iconv_open: Fix heap corruption on gconv_init failure [BZ #22026]

Also mangle the __end_fct function pointer on the error handling
path.

6 years agoiconv: Mangle __btowc_fct even without __init_fct [BZ #22025]
Florian Weimer [Tue, 29 Aug 2017 14:51:20 +0000 (16:51 +0200)] 
iconv: Mangle __btowc_fct even without __init_fct [BZ #22025]

6 years agoFix bits/math-finite.h _MSUF_ expansion namespace (bug 22028).
Joseph Myers [Tue, 29 Aug 2017 14:15:37 +0000 (14:15 +0000)] 
Fix bits/math-finite.h _MSUF_ expansion namespace (bug 22028).

The current bits/math-finite.h approach to defining functions for
different types, involving math.h defining _MSUF_ and _MSUFTO_ for the
function suffixes involved, is not namespace-clean if one of those
suffixes (f, l, f128) is defined as a macro by the user before math.h
is included; too many levels of macro expansion occur.  Instead, those
suffixes should appear directly in the expansion of the macro using ##
so they don't get expanded even if defined as macros by the user (that
is, math.h should be defining __REDIRFROM_X and __REDIRTO_X directly
to use those suffixes rather than suffixes being passed as an argument
by macro callers).  This patch makes that change.

Tested for x86_64.

[BZ #22028]
* math/math.h [__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
(_MSUF_): Remove macro.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (_MSUFTO_):
Likewise.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0]
(__REDIRFROM_X): New macro.
[__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0] (__REDIRTO_X):
Likewise.
* math/bits/math-finite.h (__REDIRFROM_X): Remove macro.
(__REDIRTO_X): Likewise.
(__MATH_REDIRCALL): Do not pass _MSUF_ or _MSUFTO_ macro
arguments.
(__MATH_REDIRCALL_2): Likewise.
(__MATH_REDIRCALL_INTERNAL): Likewise.
(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
(__REDIRFROM (gamma, , _MSUF_)): Likweise.
(__REDIRFROM (__gamma, _r_finite, _MSUF_)): Likewise.
(__REDIRFROM (tgamma, , _MSUF_)): Likewise.
* math/test-finite-macros.c: New file.
* math/Makefile (tests): Add test-finite-macros.
(CFLAGS-test-finite-macros.c): New variable.

6 years agogconv: Consistently mangle NULL function pointers [BZ #22025]
Patsy Franklin [Tue, 29 Aug 2017 13:53:28 +0000 (15:53 +0200)] 
gconv: Consistently mangle NULL function pointers [BZ #22025]

Not mangling NULL pointers is not safe because with very low
probability, a non-NULL function pointer can turn into a NULL pointer
after mangling.

6 years agoUse “,” as mon_decimal_point for ru_RU and os_RU locales (follow CLDR)
Mike FABIAN [Tue, 29 Aug 2017 11:39:18 +0000 (13:39 +0200)] 
Use “,” as mon_decimal_point for ru_RU and os_RU locales (follow CLDR)

[BZ #13805]
* locales/ru_RU (LC_MONETARY): Use “,” for mon_decimal_point
(to agree with CLDR).
* locales/ru_RU (LC_NUMERIC): Write mon_decimal_point in ASCII
for readability.
* locales/os_RU (LC_MONETARY): Copy from ru_RU,
makes it agree with CLDR.

6 years agoAdd locale for mfe_MU
Akhilesh Kumar [Wed, 23 Aug 2017 04:27:23 +0000 (09:57 +0530)] 
Add locale for mfe_MU

Add locale for “Morisyen” which is also called “Mauritian Creole”
and is spoken in Mauritius.

[BZ #21971]
* localedata/SUPPORTED: Add mfe_MU/UTF-8.
* localedata/locales/mfe_MU: New File.

[BZ #21971]
* locale/iso-639.def: add Morisyen.

6 years agoUse NFC for the strings in “day”, “yesstr”, and “nostr” in the sgs_LT locale
Mike FABIAN [Tue, 29 Aug 2017 08:54:53 +0000 (10:54 +0200)] 
Use NFC for the strings in “day”, “yesstr”, and “nostr” in the sgs_LT locale

* locales/sgs_LT (LC_TIME): Use NFC for the strings in “day”.
* locales/sgs_LT (LC_MESSAGES): Use NFC for “yesstr” and “nostr”.

6 years agoProvide a C++ version of iszero that does not use __MATH_TG (bug 21930)
Gabriel F. T. Gomes [Tue, 22 Aug 2017 19:34:42 +0000 (16:34 -0300)] 
Provide a C++ version of iszero that does not use __MATH_TG (bug 21930)

When signaling nans are enabled (with -fsignaling-nans), the C++ version
of iszero uses the fpclassify macro, which is defined with __MATH_TG.
However, when support for float128 is available, __MATH_TG uses the
builtin __builtin_types_compatible_p, which is only available in C mode.

This patch refactors the C++ version of iszero so that it uses function
overloading to select between the floating-point types, instead of
relying on fpclassify and __MATH_TG.

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

[BZ #21930]
* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
(iszero): New C++ implementation that does not use
fpclassify/__MATH_TG/__builtin_types_compatible_p, when
signaling nans are enabled, since __builtin_types_compatible_p
is a C-only feature.
* math/test-math-iszero.cc: When __HAVE_DISTINCT_FLOAT128 is
defined, include ieee754_float128.h for access to the union and
member ieee854_float128.ieee.
[__HAVE_DISTINCT_FLOAT128] (do_test): Call check_float128.
[__HAVE_DISTINCT_FLOAT128] (check_float128): New function.
* sysdeps/powerpc/powerpc64le/Makefile [subdir == math]
(CXXFLAGS-test-math-iszero.cc): Add -mfloat128 to the build
options of test-math-zero on powerpc64le.

6 years agoFix country_name in zu_ZA to agree with CLDR
Akhilesh Kumar [Mon, 28 Aug 2017 10:04:04 +0000 (12:04 +0200)] 
Fix country_name in zu_ZA to agree with CLDR

[BZ #21959]
* locales/zu_ZA (LC_ADDRESS): Fix country name to agree with CLDR.

6 years agox86_64 __redirect_ieee754_expf: Change double to float
H.J. Lu [Mon, 28 Aug 2017 15:45:53 +0000 (08:45 -0700)] 
x86_64 __redirect_ieee754_expf: Change double to float

__redirect_ieee754_expf has type float, not double.

* sysdeps/x86_64/fpu/multiarch/e_expf.c (__redirect_ieee754_expf):
Change double to float.

6 years agoSimplify math-svid-compat code.
Joseph Myers [Mon, 28 Aug 2017 15:19:52 +0000 (15:19 +0000)] 
Simplify math-svid-compat code.

Now there are no more assembly wrappers using _LIB_VERSION or
__kernel_standard, the math-svid-compat code can be slighly
simplified.  math-svid-compat.h no longer needs __ASSEMBLER__
conditionals, and the _LIB_VERSION variable no longer needs to be
built for static libm, since all references are now in C code that
includes math-svid-compat.h and so gets the macro definition of
_LIB_VERSION to _POSIX_ outside the compat case.  This patch makes
those cleanups.

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

* math/math-svid-compat.h [!__ASSEMBLER__]: Make code
unconditional.
* sysdeps/ieee754/s_lib_version.c [!defined SHARED]: Remove
conditional code; define contents only for [LIBM_SVID_COMPAT].

6 years agoRemove abi-*-options compiler flags
Florian Weimer [Mon, 28 Aug 2017 11:47:25 +0000 (13:47 +0200)] 
Remove abi-*-options compiler flags

These options are no longer needed since commit
2dba5ce7b8115d6a2789bf279892263621088e74 (<bits/syscall.h>: Use an
arch-independent system call list on Linux).

6 years agohurd: Remove duplicate symbol version
Samuel Thibault [Mon, 28 Aug 2017 12:19:55 +0000 (14:19 +0200)] 
hurd: Remove duplicate symbol version

* hurd/Versions (GLIBC_2.4): Remove __stack_chk_fail.
* mach/Versions (GLIBC_2.4): Remove __stack_chk_fail.

6 years agohurd: Fix typo
Samuel Thibault [Mon, 28 Aug 2017 12:16:08 +0000 (14:16 +0200)] 
hurd: Fix typo

* hurd/Versions: Fix typo.
* mach/Versions: Fix typo.

6 years ago<bits/syscall.h>: Use an arch-independent system call list on Linux
Florian Weimer [Mon, 28 Aug 2017 09:31:23 +0000 (11:31 +0200)] 
<bits/syscall.h>: Use an arch-independent system call list on Linux

This commit changes the way the list of SYS_* system call macros is
created on Linux.  glibc now contains a list of all known system
calls, and the generated <bits/syscall.h> file defines the SYS_ macro
only if the correspnding __NR_ macro is defined by the kernel headers.

As a result, glibc does not have to be rebuilt to pick up system calls
if the glibc sources already know about them.  This means that glibc
can be built with older kernel headers, and if the installed kernel
headers are upgraded afterwards, additional SYS_ macros become
available as long as glibc has a record for those system calls.

6 years ago2017-08-27 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul Pluzhnikov [Mon, 28 Aug 2017 02:10:40 +0000 (19:10 -0700)] 
2017-08-27  Paul Pluzhnikov  <ppluzhnikov@google.com>

* stdlib/Makefile (tst-atexit, tst-at_quick_exit): New tests.
(tst-cxa_atexit, tst-on_exit): Likewise.
* stdlib/Makefile (tests): Add tst-atexit, tst-at_quick_exit,
tst-cxa_atexit, and tst-on_exit.
* stdlib/tst-atexit-common.c: New file.
* stdlib/tst-atexit.c: New file.
* stdlib/tst-at_quick_exit.c: New file.
* stdlib/tst-cxa_atexit.c: New file.
* stdlib/tst-on_exit.c: New file.

6 years agohurd: Fix static initialization with -fstack-protector-strong
Samuel Thibault [Sun, 27 Aug 2017 20:26:49 +0000 (22:26 +0200)] 
hurd: Fix static initialization with -fstack-protector-strong

When linked statically, TLS initialization is not achieved before
mach_init and alike, so ssp accesses to tcbhead's stack_guard would
crash.  We can just avoid using ssp in the few functions needed before
TLS is set up.

* mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o,
CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o,
CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o,
CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector).
* hurd/Makefile (CFLAGS-hurdstartup.o,
CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).

6 years agohurd: fix build with -fstack-protector-strong
Samuel Thibault [Sun, 27 Aug 2017 20:10:17 +0000 (22:10 +0200)] 
hurd: fix build with -fstack-protector-strong

libmachuser and libhurduser also need stack_chk_fail_local and they do not
link against libc_nonshared.

       * mach/stack_chk_fail_local.c: New file.
       * hurd/stack_chk_fail_local.c: New file.
       * mach/Machrules ($(interface-library)-routines): Add
       stack_chk_fail_local.
       * mach/Versions (GLIBC_2.4): Add __stack_chk_fail.
       * hurd/Versions (GLIBC_2.4): Add __stack_chk_fail.

6 years agohurd: Add system-specific sysmacros.h
Samuel Thibault [Sun, 27 Aug 2017 20:00:05 +0000 (22:00 +0200)] 
hurd: Add system-specific sysmacros.h

* sysdeps/mach/hurd/bits/sysmacros.h: New file.

6 years agox86: Remove assembly versions of index_cpu_*/index_arch_*
H.J. Lu [Fri, 25 Aug 2017 17:49:04 +0000 (10:49 -0700)] 
x86: Remove assembly versions of index_cpu_*/index_arch_*

Since assembly versions of HAS_CPU_FEATURE and HAS_ARCH_FEATURE have
been removed,  assembly versions of index_cpu_* and index_arch_* can
also be removed.

Tested on i686 and x86-64 with and without --disable-multi-arch.

* sysdeps/x86/cpu-features.h [__ASSEMBLER__]
(index_cpu_*, index_arch_*): Removed.

6 years ago[AArch64] Fix elf_greg_t on ILP32
Szabolcs Nagy [Fri, 25 Aug 2017 17:21:35 +0000 (18:21 +0100)] 
[AArch64] Fix elf_greg_t on ILP32

Use uint64_t instead of unsigned long.

6 years agoUse __HAVE_DISTINCT_FLOAT128 in tgmath.h.
Joseph Myers [Fri, 25 Aug 2017 17:02:33 +0000 (17:02 +0000)] 
Use __HAVE_DISTINCT_FLOAT128 in tgmath.h.

When _Float128 is ABI-equivalent to long double, there is no need for
tgmath.h to have any special _Float128 handling: it's always OK to
call the long double versions of functions for _Float128 arguments in
that case, and the logic to determine return types is generic.  Thus,
this patch changes the use of __HAVE_FLOAT128 to
__HAVE_DISTINCT_FLOAT128, as a minor optimization to reduce the size
of the macro expansions in the ABI-equivalent case.

Tested for x86_64.

* math/tgmath.h [__HAVE_FLOAT128]: Change conditional to
[__HAVE_DISTINCT_FLOAT128].

6 years agoClean up bits/math-finite.h for aliasing types.
Joseph Myers [Fri, 25 Aug 2017 16:11:13 +0000 (16:11 +0000)] 
Clean up bits/math-finite.h for aliasing types.

This patch cleans up how bits/math-finite.h handles types that are
ABI-aliases of other types.

For such types, no __*_finite functions exist; instead,
bits/math-finite.h must redirect calls to a the functions for a
canonical choice of type for each floating-point format.  (For the
actual public interfaces, symbols need exporting for each type, even
those that are ABI-aliases, because of standard requirements that
programs can declare the functions themselves without including
<math.h>, but that does not apply to __*_finite.)

At present, there is a special-case conditional in bits/math-finite.h
on __MATH_DECLARING_LDOUBLE && defined __NO_LONG_DOUBLE_MATH to handle
redirecting long double function calls to double __*_finite.  This
patch replaces this by a more general mechanism.  math.h, before each
inclusion of bits/math-finite.h, defines _MSUFTO_ as the suffix to use
on the target of redirection, in addition to the existing _MSUF_.
This way, __MATH_DECLARING_LDOUBLE can go away, as can the special
conditional in bits/math-finite.h.  With this patch, math.h is now
prepared for the case of supporting float128 functions as aliases of
long double ones on platforms where long double is binary128, with
_MSUFTO_ appropriately defined for that case, and appropriate _MSUFTO_
definitions can easily be included when supporting _Float32 / _Float64
/ _Float32x / _Float64x (which will always be ABI-aliases of another
type when supported).

Tested for x86_64, and did a compilation test for ARM with
build-many-glibcs.py to cover the long double = double case.

* math/math.h (_MSUFTO_): Define and undefine for each inclusion
of <bits/math-finite.h>.
(__MATH_DECLARING_LDOUBLE): Do not define and undefine for each
inclusion of <bits/math-finite.h>.
* math/bits/math-finite.h (__REDIRTO_X): Do not define
conditionally on [__MATH_DECLARING_LDOUBLE && defined
__NO_LONG_DOUBLE_MATH].
(__MATH_REDIRCALL): Use _MSUFTO_ in __REDIRTO call.
(__MATH_REDIRCALL_2): Likewise.
(__MATH_REDIRCALL_INTERNAL): Likewise.
(__REDIRFROM (lgamma, , _MSUF_)): Likewise.
(__REDIRFROM (gamma, , _MSUF_)): Likewise.
(__REDIRFROM (tgamma, , _MSUF_)): Likewise.

6 years agoRemove powerpc32 sqrt wrappers.
Joseph Myers [Fri, 25 Aug 2017 11:33:04 +0000 (11:33 +0000)] 
Remove powerpc32 sqrt wrappers.

This patch removes the powerpc32-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

Tested with build-many-glibcs.py for powerpc-linux-gnu-power4.

* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-power5.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrt_compat.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-power5.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/w_sqrtf_compat.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(libm-sysdep-routines): Remove w_sqrt_compat-power5,
w_sqrt_compat-ppc32, w_sqrtf_compat-power5 and
w_sqrtf_compat-ppc32.

6 years agoFix the C++ version of issignaling when __NO_LONG_DOUBLE_MATH is defined
Gabriel F. T. Gomes [Wed, 23 Aug 2017 13:16:54 +0000 (10:16 -0300)] 
Fix the C++ version of issignaling when __NO_LONG_DOUBLE_MATH is defined

When __NO_LONG_DOUBLE_MATH is defined, __issignalingl is not available,
thus issignaling with long double argument should call __issignaling,
instead.

Tested for powerpc64le.

* math/math.h [defined __cplusplus] (issignaling): In the long
double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
is not defined.  Call __issignaling, otherwise.

6 years agoRemove cancellation support for syscall generation
Adhemerval Zanella [Thu, 12 Nov 2015 16:01:36 +0000 (14:01 -0200)] 
Remove cancellation support for syscall generation

This patch removes the cancellation mark from the auto-generation syscall
script.  Now all the cancellable syscalls are done throught C code using
the SYSCALL_CANCEL macro.  It simplifies the assembly required to each
architecture port, since the SYSCALL_CANCEL uses the already defined
INLINE_SYSCALL macros, and allows a more straigh fix on cancellation
machanism (since no more specific assembly fixes will be required).

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.A
Also with build-many-glibc.py with remaning touched architectures.

* sysdeps/unix/make-syscalls.sh: Remove cancellable tagging for
syscall definitions.
* sysdeps/unix/syscall-template.S (SYSCALL_CANCELLABLE): Remove
definition.
* sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (__local_enable_asynccancel): Likewise.
[IS_IN (libpthread)] (__local_disable_asynccancel): Likewise.
[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
[IS_IN (libc)] (__local_enable_asynccancel): Likewise.
[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
[IS_IN (librt)] (__local_disable_asynccancel): Likewise.
(CENABLE): Likewise.
(CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h (PSEUDO): Remove
defintion.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/hppa/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/microblaze/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h (PSEUDO):
Remove definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
(SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/mips/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/nios2/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/sysv/linux/powerpc/powerpc32/sysdep-cancel.h: Remove file.
* sysdeps/sysv/linux/powerpc/powerpc64/sysdep-cancel.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sysdep-cancel.h: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Remove file.
* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep-cancel.h: New file.
* sysdeps/unix/sysv/linux/tile/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Remove
definition.
(PSEUDO_END): Likewise.
[IS_IN (libpthread)] (CENABLE): Likewise.
[IS_IN (libpthread)] (CDISABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (libc)] (CENABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[IS_IN (librt)] (CDISABLE): Likewise.
[__ASSEMBLER__] (SINGLE_THREAD_P): Likewise.

6 years agoFix CFLAGS override in sysdeps/ieee754/dbl-64
Szabolcs Nagy [Thu, 24 Aug 2017 14:56:11 +0000 (15:56 +0100)] 
Fix CFLAGS override in sysdeps/ieee754/dbl-64

Use += instead of = to avoid overriding target specific CFLAGS settings.
Ideally the settings in target Makefiles would have precedence, but the
Makefile inclusion order does not allow that, with this fix at least the
target settings are not dropped.

6 years agox86-64: Regenerate libm-test-ulps for AVX512 mathvec tests
H.J. Lu [Wed, 23 Aug 2017 16:11:41 +0000 (09:11 -0700)] 
x86-64: Regenerate libm-test-ulps for AVX512 mathvec tests

Update libm-test-ulps for AVX512 mathvec tests by running
“make regen-ulps” on Intel Xeon processor with AVX512.

* sysdeps/x86_64/fpu/libm-test-ulps: Regenerated.

6 years agostring/stratcliff.c: Replace int with size_t [BZ #21982]
H.J. Lu [Wed, 23 Aug 2017 15:22:52 +0000 (08:22 -0700)] 
string/stratcliff.c: Replace int with size_t [BZ #21982]

Fix GCC 7 errors when string/stratcliff.c is compiled with -O3:

stratcliff.c: In function ‘do_test’:
cc1: error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]

[BZ #21982]
* string/stratcliff.c (do_test): Declare size, nchars, inner,
middle and outer with size_t instead of int.  Repleace %d and
%Zd with %zu in printf.  Update "MAX (0, nchars - 128)" and
"MAX (outer, nchars - 64)" to support unsigned outer and
nchars.  Also exit loop when outer == 0.

6 years agoConsolidate remaning non cancellable definitions
Adhemerval Zanella [Wed, 23 Aug 2017 13:40:14 +0000 (10:40 -0300)] 
Consolidate remaning non cancellable definitions

This patch consolidate the remaning non cancellable syscall definitions
on not-cancel.h header.  They are:

  * __fcntl_nocancel: Moved from fcntl.h to not-cancel.h.
  * __sigsuspend_nocancel: Removed since 988f991b50 it is not used or
    defined anymore.
  * __nanosleep_nocancel: Removed since 6f33fd046b it is defined on
    not-cancel.h.

Now all non-cancellable syscall definition are defined on not-cancel
(the only exceptions is the stdio symbol __fxprintf_nocancel which
uses non cancellable open and it is used on getopt implementation).

Checked on x86_64-linux-gnu and with build-many-glibc.py.

* include/fcntl.h (__fcntl_nocancel): Remove definition.
* include/signal.h (__sigsuspend_nocancel): Likewise.
* include/time.h (__nanosleep_nocancel): Likewise.
* sysdeps/generic/not-cancel.h (__fcntl_nocancel): New macro.
* login/utmp_file.c: Include non cancellable syscall header.
* sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): New
prototype.

6 years agox86_64: Replace AVX512F .byte sequences with instructions
H.J. Lu [Wed, 23 Aug 2017 13:16:12 +0000 (06:16 -0700)] 
x86_64: Replace AVX512F .byte sequences with instructions

Since binutils 2.25 or later is required to build glibc, we can replace
AVX512F .byte sequences with AVX512F instructions.

Tested on x86-64 and x32.  There are no code differences in libmvec.so
and libmvec.a.

* sysdeps/x86_64/fpu/svml_d_sincos8_core.S: Replace AVX512F
.byte sequences with AVX512F instructions.
* sysdeps/x86_64/fpu/svml_d_wrapper_impl.h: Likewise.
* sysdeps/x86_64/fpu/svml_s_sincosf16_core.S: Likewise.
* sysdeps/x86_64/fpu/svml_s_wrapper_impl.h: Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S:
Likewise.
* sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S:
Likewise.

6 years agoaarch64: Use PTR_REG macro to fix ILP32 bug and make code consistent
Steve Ellcey [Tue, 22 Aug 2017 23:22:05 +0000 (16:22 -0700)] 
aarch64: Use PTR_REG macro to fix ILP32 bug and make code consistent

* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_dynamic):
Use PTR_REG macro in cmp instruction.

6 years agoFix remaining return type of ifunc resolver declaration
Gabriel F. T. Gomes [Tue, 22 Aug 2017 17:01:07 +0000 (14:01 -0300)] 
Fix remaining return type of ifunc resolver declaration

Since Martin Sebor's commit

commit ee4e992ebe5f9712faedeefe8958b67d61eaa0f2
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Aug 22 09:35:23 2017 -0600

    Declare ifunc resolver to return a pointer to the same type as the target
    function to help GCC detect incompatibilities between the two when it's
    enhanced to do so.

builds for powerpc64le fail in the declaration of some ifunc resolvers,
because the ifunc is declared with unmatching return types.  One of the
declarations comes from the __ifunc_resolver macro, which was patched by
the aforementioned commit:

    /* Helper / base  macros for indirect function symbols.  */
    #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
      classifier inhibit_stack_protector                                   \
      __typeof (type_name) *name##_ifunc (arg)                             \

whereas the other comes from the unpatched __ifunc macro when
HAVE_GCC_IFUNC is not defined:

    # define __ifunc(type_name, name, expr, arg, init)                     \
      extern __typeof (type_name) name;                                    \
      void *name##_ifunc (arg) __asm__ (#name);                            \

This patch changes the return type of the ifunc resolver in the __ifunc
macro, so that it matches the return type of the target function,
similarly to what the aforementioned commit does.

Tested for powerpc64le and s390x with unpatched GCC.

* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
Change the return type of the ifunc resolver to match the return
type of the target function.

6 years agoRemove p{read,write}{v} and fallocate from x86 auto-generation list
Adhemerval Zanella [Tue, 19 Jul 2016 13:23:49 +0000 (10:23 -0300)] 
Remove p{read,write}{v} and fallocate from x86 auto-generation list

With {INLINE,INTERNAL}_SYSCALL macros fixed for 64-bits arguments on x32,
we can remove the p{read,write}{v} from auto-generation list.

Tested on x86_64 and x32.

* sysdeps/unix/sysv/linux/x86_64/syscalls.list (pread64): Remove.
(preadv64): Likewise.
(pwrite64(: Likewise.
(pwritev64): Likewise.

6 years agoFix {INLINE,INTERNAL}_SYSCALL macros for x32
Adhemerval Zanella [Wed, 13 Jul 2016 09:50:05 +0000 (10:50 +0100)] 
Fix {INLINE,INTERNAL}_SYSCALL macros for x32

The problem for x32 is the {INTERNAL,INLINE}_SYSCALL C macros explicit
cast the arguments to 'long int', thus passing as 32 bits arguments
that should be passed to 64 bits.

Previous x32 implementation uses the auto-generated syscalls from
assembly macros (syscalls.list), so the {INTERNAL,INLINE}_SYSCALL
macros are never used with 64 bit argument in x32 (which are
internally broken for this ILP).

To fix it I used a strategy similar to MIPS64n32 (although both
ABI differs for some syscalls on how top pass 64-bits arguments)
where argument types for kernel call are defined using GCC extension
'typeof' with a arithmetic operation.  This allows 64-bits arguments
to be defined while 32-bits argument will still passed as 32-bits.

I also cleanup the {INLINE,INTERNAL}_SYSCALL definition by defining
'inline_syscallX' instead of constructing the argument passing using
macros (it adds some readability) and removed the ununsed
INTERNAL_SYSCALL_NCS_TYPES define (since the patch idea is exactly to
avoid requiric explicit types passing).

Tested on x86_64 and x32.

* sysdeps/unix/sysv/linux/x86_64/sysdep.h
(INTERNAL_SYSCALL_NCS_TYPES): Remove define.
(LOAD_ARGS_0): Likewise.
(LOAD_ARGS_1): Likewise.
(LOAD_ARGS_2): Likewise.
(LOAD_ARGS_3): Likewise.
(LOAD_ARGS_4): Likewise.
(LOAD_ARGS_5): Likewise.
(LOAD_ARGS_6): Likewise.
(LOAD_REGS_0): Likewise.
(LOAD_REGS_1): Likewise.
(LOAD_REGS_2): Likewise.
(LOAD_REGS_3): Likewise.
(LOAD_REGS_4): Likewise.
(LOAD_REGS_5): Likewise.
(LOAD_REGS_6): Likewise.
(ASM_ARGS_0): Likewise.
(ASM_ARGS_1): Likewise.
(ASM_ARGS_2): Likewise.
(ASM_ARGS_3): Likewise.
(ASM_ARGS_4): Likewise.
(ASM_ARGS_5): Likewise.
(ASM_ARGS_6): Likewise.
(LOAD_ARGS_TYPES_1): Likewise.
(LOAD_ARGS_TYPES_2): Likewise.
(LOAD_ARGS_TYPES_3): Likewise.
(LOAD_ARGS_TYPES_4): Likewise.
(LOAD_ARGS_TYPES_5): Likewise.
(LOAD_ARGS_TYPES_6): Likewise.
(LOAD_REGS_TYPES_1): Likewise.
(LOAD_REGS_TYPES_2): Likewise.
(LOAD_REGS_TYPES_3): Likewise.
(LOAD_REGS_TYPES_4): Likewise.
(LOAD_REGS_TYPES_5): Likewise.
(LOAD_REGS_TYPES_6): Likewise.
(TYPEFY): New define.
(ARGIFY): Likewise.
(internal_syscall0): Likewise.
(internal_syscall1): Likewise.
(internal_syscall2): Likewise.
(internal_syscall3): Likewise.
(internal_syscall4): Likewise.
(internal_syscall5): Likewise.
(internal_syscall6): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/times.c
(INTERNAL_SYSCALL_NCS): Remove define.
(internal_syscall1): Add define.

6 years agoRemove duplicate inclusion of header math-svid-compat.h
Gabriel F. T. Gomes [Tue, 22 Aug 2017 14:14:15 +0000 (11:14 -0300)] 
Remove duplicate inclusion of header math-svid-compat.h

The header math-svid-compat.h has been unintentionally included twice in
the wrappers for the remainder functions.  This patch removes the
duplicate inclusions.

* math/w_remainder_compat.c: Remove duplicate inclusion of
math-svid-compat.h.
* math/w_remainderf_compat.c: Likewise.
* math/w_remainderl_compat.c: Likewise.

6 years agopowerpc: Shrink ULPs for float128
Gabriel F. T. Gomes [Tue, 8 Aug 2017 21:52:03 +0000 (18:52 -0300)] 
powerpc: Shrink ULPs for float128

During the development of float128 on powerpc64le, the ulps have been
generated since early versions of the patches.  On those versions, the
functions gamma and pow10 were mistakenly thought to be part of the API.
After review, the functions were removed, however the ulps for them were
carried in the ulps file.

This patch removes such entries from the ulps file, as well as it
shrinks the ulps for the cpow and lgamma functions.

Tested for powerpc64le.

* sysdeps/powerpc/fpu/libm-test-ulps: Update.

6 years agoFix tgmath.h handling of complex integers (bug 21684).
Joseph Myers [Tue, 22 Aug 2017 17:55:42 +0000 (17:55 +0000)] 
Fix tgmath.h handling of complex integers (bug 21684).

The tgmath.h macros return a real type not a complex type when an
argument is of complex integer type (a GNU extension) and there are no
arguments of complex floating type.  It seems clear that just as real
integers are mapped to double for tgmath.h, so complex integers should
be mapped to _Complex double.

This patch implements such a mapping.  The main complication in fixing
this bug is that the tgmath.h macros expand their arguments a large
number of times, resulting in exponential blowup of the size of the
expansion when calls to tgmath.h macros are used in the arguments of
such macros; it would be unfortunate for fixing a bug with a fairly
obscure extension to make the macros expand their arguments even more
times.  Thus, this patch optimizes the definitions of the relevant
macros.  __tgmath_real_type previously expanded its argument 7 times
and now expands it 3 times.  __tgmath_complex_type, used in place of
__tgmath_real_type only for functions that might return either real or
complex types, not for complex functions that always return real types
or always return complex types, expands its argument 5 times.  So the
sizes of the macro expansions from nested macro calls are
correspondingly reduced (remembering that each tgmath.h macro expands
__tgmath_real_type, or sometimes now __tgmath_complex_type, several
times).

Sometimes the real return type resulted from calling a complex
function and converting the result to a real type; sometimes it
resulted from calling a real function, because the logic for
determining whether arguments were real or complex, based on sizeof,
was confused by integer promotions applying to e.g. short int but not
_Complex short int.  The relevant tests are converted to use a new
macro __expr_is_real, which, by calling __builtin_classify_type rather
than comparing the results of two calls to sizeof, also reduces the
number of times macros expand their arguments.

Although there are reductions in the number of times macros expand
their arguments, I do not consider this to fix bug 21660, since a
proper fix means each macro expanding its arguments only once (via
using new compiler features designed for that purpose).

Tested for x86_64.

[BZ #21684]
* math/tgmath.h (__floating_type): Simplify definitions.
(__real_integer_type): New macro.
(__complex_integer_type): Likewise.
(__expr_is_real): Likewise.
(__tgmath_real_type_sub): Update comment to describe handling of
complex types.
(__tgmath_complex_type_sub): New macro.
(__tgmath_complex_type): Likewise.
[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(__TGMATH_CF128): Use __expr_is_real.
(__TGMATH_UNARY_REAL_IMAG): Use __tgmath_complex_type and
__expr_is_real.
(__TGMATH_BINARY_REAL_IMAG): Likewise.
(__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __expr_is_real.
* math/gen-tgmath-tests.py (Type.create_type): Create complex
integer types.

6 years agoRemove non cancellable sigsuspend definition
Adhemerval Zanella [Tue, 22 Aug 2017 13:09:52 +0000 (10:09 -0300)] 
Remove non cancellable sigsuspend definition

There is no current internal usage for non cancellable sigsuspend calls.

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

* sysdeps/generic/not-cancel.h (sigsuspend_not_cancel): remove
macro.
* sysdeps/mach/hurd/sigsuspend.c (sigsuspend_not_cancel): remove
alias.
* sysdeps/unix/sysv/linux/not-cancel.h (sigsuspend_not_cancel):
likewise.