Commit Graph

22680 Commits

Author SHA1 Message Date
Samuel Thibault c1b7586c54 hurd: Avoid PLT references to shortcuts
* sysdeps/mach/include/mach-shortcuts-hidden.h: New file.
	* mach/shortcut.awk: Make syscall stubs include
	<mach-shortcuts-hidden.h> and add hidden definition.
	* sysdeps/mach/include/mach.h: Include <mach-shortcuts-hidden.h>.
2018-06-16 02:48:41 +02:00
Samuel Thibault 932d05f0dc hurd: Avoid missing PLT ref from ld.so requirement
* sysdeps/mach/hurd/localplt.data (ld.so): Make ref to __open optional.
2018-06-16 01:49:29 +02:00
Samuel Thibault 57e1651557 hurd: Avoid PLT ref for __pthread_get_cleanup_stack
* htl/pt-cleanup.c (___pthread_get_cleanup_stack): Rename to
	__pthread_get_cleanup_stack.
	(__pthread_get_cleanup_stack): Remove alias, add hidden def.
	* htl/pt-exit.c (__pthread_exit): Use __pthread_get_cleanup_stack
	instead of ___pthread_get_cleanup_stack.
	* sysdeps/htl/pthread-functions.h [libpthread]
	(__pthread_get_cleanup_stack): Add hidden proto.
	* sysdeps/htl/pthreadP.h (___pthread_get_cleanup_stack): Remove
	prototype.
2018-06-16 01:37:42 +02:00
Samuel Thibault faf7bbc2d0 hurd: Detect 32bit overflow in value returned by lseek
* sysdeps/mach/hurd/lseek.c: Include <errno.h>.
	* sysdeps/mach/hurd/lseek.c (__libc_lseek): Check that the value returned
	by __lseek64 can fit off_t, return EOVERFLOW otherwise.
2018-06-16 01:37:14 +02:00
Samuel Thibault 298a8b59d4 hurd: avoid PLT ref between sendfile and sendfile64
* include/sys/sendfile.h (__sendfile64): Declare hidden prototype.
	* sysdeps/mach/hurd/sendfile.c (sendfile): Call __sendfile64 instead
	of sendfile.
	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Rename to __sendfile64.
	(sendfile64): New strong alias.
2018-06-16 00:44:57 +02:00
Joseph Myers b12c1e7991 Add tests for sign of NaN returned by strtod (bug 23007).
This patch adds tests for bug 23007, strtod ignoring any sign in the
input string in the case of a NaN result.

Tested for x86_64.

	[BZ #23007]
	* stdlib/tst-strtod-nan-sign-main.c: New file.
	* stdlib/tst-strtod-nan-sign.c: Likewise.
	* wcsmbs/tst-wcstod-nan-sign.c: Likewise.
	* stdlib/Makefile (tests): Add tst-strtod-nan-sign.
	($(objpfx)tst-strtod-nan-sign): Depend on $(libm).
	* wcsmbs/Makefile (tests) Add tst-wcstod-nan-sign.
	($(objpfx)tst-wcstod-nan-sign): Depend on $(libm).
2018-06-15 17:36:21 +00:00
Herman ten Brugge b0debe14fc Fix sign of NaN returned by strtod (bug 23007).
As reported in bug 23007, strtod ignores any sign in the input string
in the case of a NaN result.  Thes patch fixes this.

Tested for x86_64 (in conjunction with tests to be added separately).

	[BZ #23007]
	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of
	appropriate sign.
2018-06-15 17:35:17 +00:00
Florian Weimer 14beef7575 localedata: Make IBM273 compatible with ISO-8859-1 [BZ #23290]
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-14 22:34:10 +02:00
Samuel Thibault c596630bbd hurd: Fix htl link failure
126b3ec370 ("hurd: Avoid PLTs for __mach_thread_self and
__mach_reply_port") made mach traps hidden, but htl actually uses two of
them. Re-expose them for now. Exposing them properly will be more involved
since their definition is generated.

	* sysdeps/mach/include/mach/mach_traps.h (__mach_thread_self,
	__mach_task_self): Remove attribute_hidden.
2018-06-14 17:09:18 +02:00
Joseph Myers 35ebb6b0c4 Ignore -Wrestrict for one strncat test.
With current GCC mainline, one strncat test involving a size close to
SIZE_MAX results in a -Wrestrict warning that that buffer size would
imply that the two buffers must overlap.  This patch fixes the build
by adding disabling of -Wrestrict (for GCC versions supporting that
option) to the already-present disabling of -Wstringop-overflow= and
-Warray-bounds for this test.

Tested with build-many-glibcs.py that this restores the testsuite
build with GCC mainline for aarch64-linux-gnu.

	* string/tester.c (test_strncat) [__GNUC_PREREQ (7, 0)]: Also
	ignore -Wrestrict for one test.
2018-06-14 14:20:00 +00:00
Steve Ellcey 3c7b9f1fc3 aarch64: Use an ifunc/VDSO to implement gettimeofday in shared glibc.
This patch uses an ifunc to implement gettimeofday in the shared libc.
This is faster compared to the vsyscall mechanism that has to check a
global pointer, demangle it and call it indirectly when the VDSO is
present. Resolving the gettimeofday symbol directly to the VDSO code
is safe because there are no failures that the libc has to handle by
setting errno like in a generic vsyscall (the only failure when the
VDSO code falls back to a syscall is EFAULT, but passing an invalid
pointer is undefined behaviour so returning -EFAULT is fine).

If the kernel supports the VDSO interface we use it for extern calls,
otherwise the old vsyscall method is used which falls back to a syscall.
The static version of gettimeofday continues to use a syscall, libc.so
internal calls use the old vsyscall method.

	* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: New file.
2018-06-14 13:56:57 +01:00
Florian Weimer c59ee916a6 scripts/update-abilist.sh: Accept empty list of files to patch
Commit b289cd9db8 (“Ignore absolute
symbols in ABI tests.”) broke “make update-all-abi” because an empty
list of files is now passed to scripts/update-abilist.sh.
2018-06-14 09:37:31 +02:00
Samuel Thibault 06d1a8263d hurd: Avoid a PLT reference
* sysdeps/mach/hurd/i386/____longjmp_chk.S (____longjmp_chk): Do not
	use PLT to call _hurd_self_sigstate.
2018-06-14 01:43:23 +02:00
Samuel Thibault 126b3ec370 hurd: Avoid PLTs for __mach_thread_self and __mach_reply_port
* mach/mach/mach_traps.h (__mach_reply_port, __mach_thread_self,
	__mach_task_self, __mach_host_self, __swtch, __swtch_pri,
	__thread_switch, __evc_wait): Move declarations to...
	* sysdeps/mach/include/mach/mach_traps.h: ... new file, and add
	attribute_hidden.
2018-06-14 01:01:57 +02:00
Samuel Thibault c8c6e6d6d0 hurd: Avoid PLTs for _hurd_port_locked_get/set
* sysdeps/hurd/include/hurd/port.h: New file.
2018-06-14 00:28:03 +02:00
Samuel Thibault c8c910ed9c hurd: update localplt.data
after 329ea513b4 ("Avoid cancellable I/O primitives in ld.so.")

	* sysdeps/mach/hurd/localplt.data (ld.so): Add __open64, rename
	__libc_read and __libc_write to __read and __write.
2018-06-14 00:22:20 +02:00
Samuel Thibault 43b5ff50b5 hurd: xfail missing abilist for libmachuser and libhurduser
They need more work to implement, see bug 23286.

	* sysdeps/mach/hurd/i386/Makefile (test-xfail-check-abi-libhurduser,
	test-xfail-check-abi-libmachuser): Add.
2018-06-13 21:12:23 +02:00
Joseph Myers fcd6b5ac36 Fix strtod overflow detection (bug 23279).
As shown by bug 23279, strtod's round_and_return has an off-by-one
error in its overflow detection, only counting an exponent greater
than MAX_EXP as overflowing when an exponent of MAX_EXP also means
overflow (recall the ISO C definition of DBL_MAX_EXP etc. is based on
a floating-point model where 2^exp is multiplied by a value in the
interval [0.5, 1), so 2^MAX_EXP is not representable).

For decimal arguments to strtod, a separate overflow check in the main
implementation covers the case where the integer part of the argument
(truncated to the nearest integer towards zero) has more than MAX_EXP
bits, meaning that this issue in round_and_return only affects cases
(arguments with absolute value strictly between the maximum
representable value and 2^MAX_EXP) where overflow depends on the
rounding mode; in such cases, the returned value would still have been
correct on overflow but without the overflow exception being raised or
errno being set to ERANGE.  For hex float arguments, however, other
cases can arise, as shown in bug 23279, where a value with exponent
already set to MAX_EXP is passed into round_and_return and a result
can wrongly end up being NaN, or infinity instead of the largest
finite value.

This patch fixes the off-by-one error, adds testing of overflow
exceptions to the tst-strtod-round framework, and adds tests of these
issues.

Tested for x86_64.  Also ran the tst-strtod-round tests for powerpc to
make sure the new tests didn't introduce any new failures for IBM long
double.

	[BZ #23279]
	* stdlib/strtod_l.c (round_and_return): Handle an exponent of
	MAX_EXP as overflowing.
	* stdlib/gen-tst-strtod-round.c (string_to_fp): Clear MPFR
	overflow flag.
	(round_str): Output also whether result overflows in each rounding
	mode.
	* stdlib/tst-strtod-round-data: Add more tests.
	* stdlib/tst-strtod-round-data.h: Regenerated.
	* stdlib/tst-strtod-round-skeleton.c (_XNTRY): Update comment.
	(TEST): Handle extra arguments for overflow flags.
	(struct test_overflow): New type.
	[!FE_OVERFLOW] (FE_OVERFLOW): Define to 0.
	(GEN_ONE_TEST): Clear all exceptions.  Test overflow flag.
	(test_in_one_mode): Take argument with overflow information.
	(do_test): Update calls to test_in_one_mode.
2018-06-13 16:06:14 +00:00
Carlos O'Donell a745c837cb Fix comments in _dl_dst_count and _dl_dst_substitute.
The comments in _dl_dst_count is adjusted to match what the code does
which is count DSTs from the start of the string. With the removal of
DL_DST_COUNT we no longer accept an input that starts at the first $.

In _dl_dst_substitute we adjust the comment to indicate that both
conditions must be true for the SUID/SGID $ORIGIN exception.
2018-06-12 23:35:06 -04:00
Carlos O'Donell 35df5a77f3 Fix fallback path in __pthread_mutex_timedlock ().
Fix the typo in the fallback path in __pthread_mutex_timedlock ()
whic hcalls lll_futex_timed_wait ().  This is only useful for cases
where the patch is being backported to older distributions where
only lll_futex_timed_wait () is available.
2018-06-12 16:17:05 -04:00
Joseph Myers 48b12ed54c Do not use const attribute for nan functions (bug 23277).
As in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86113 for
__builtin_nan, bits/mathcalls.h wrongly declares the nan function with
the __const__ attribute.  Because the function reads memory pointed to
by an argument, it's only pure, not const.  This patch removes the
incorrect attribute and adds a testcase for the bug.  No __pure__
attribute is added to replace the incorrect __const__ one, since that
would introduce problems when using GCC versions that have the
incorrect built-in __const__ attribute and warn for the combination of
those two attributes.

Tested for x86_64.

	[BZ #23277]
	* math/bits/mathcalls.h [__USE_ISOC99] (nan): Do not use __const__
	attribute.
	* math/test-nan-const.c: New file.
	* math/Makefile (tests): Add test-nan-const.
	(CFLAGS-test-nan-const.c): New variable.
2018-06-12 16:57:26 +00:00
H.J. Lu cb8f6affed benchtests: Add -f/--functions argument
On x86-64, there may be multiple IFUNC implementations for a given
function.  But we may be only interested in a subset of them.  This
patch adds -f/--functions argument to compare a subset of IFUNC
implementations.

	* benchtests/scripts/compare_strings.py (process_results): Add
	funcs argument.  Compare only functions which are selected.
	(main): Check if base function is among selected functions.
	Pass selected functions to process_results.
	(__main__): Add -f/--functions argument.
2018-06-12 09:10:42 -07:00
Hongbo Zhang fc2ba8037d aarch64: add HXT Phecda core memory operation ifuncs
Phecda is HXT semiconductor's CPU core, this patch adds memory operation
ifuncs for it: sharing the same optimized implementation with Qualcomm's
Falkor core.

2018-06-07  Minfeng Kang <minfeng.kang@hxt-semitech.com>
	    Hongbo Zhang <hongbo.zhang@linaro.org>

	* sysdeps/aarch64/multiarch/memcpy.c (libc_ifunc): reuse
	__memcpy_falkor for phecda core.
	* sysdeps/aarch64/multiarch/memmove.c (libc_ifunc): reuse
	__memmove_falkor for phecda core.
	* sysdeps/aarch64/multiarch/memset.c (libc_ifunc): reuse
	__memset_falkor for phecda core.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c: add MIDR entry
	for phecda core.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_PHECDA): add
	macro to identify phecda core.
2018-06-12 21:29:11 +05:30
Carlos O'Donell 5aad5f6178 Improve DST handling (Bug 23102, Bug 21942, Bug 18018, Bug 23259).
This commit improves DST handling significantly in the following
ways: firstly is_dst () is overhauled to correctly process DST
sequences that would be accepted given the ELF gABI.  This means that
we actually now accept slightly more sequences than before.  Now we
accept $ORIGIN$ORIGIN, but in the past we accepted only $ORIGIN\0 or
$ORIGIN/..., but this kind of behaviour results in unexpected
and uninterpreted DST sequences being used as literal search paths
leading to security defects.  Therefore the first step in correcting
this defect is making is_dst () properly account for all DSTs
and making the function context free in the sense that it counts
DSTs without knowledge of path, or AT_SECURE.  Next, _dl_dst_count ()
is also simplified to count all DSTs regardless of context.
Then in _dl_dst_substitute () we reintroduce context-dependent
processing for such things as AT_SECURE handling.  At the level of
_dl_dst_substitute we can have access to things like the true start
of the string sequence to validate $ORIGIN-based paths rooted in
trusted directories.  Lastly, we tighten up the accepted sequences
in AT_SECURE, and avoid leaving known unexpanded DSTs, this is
noted in the NEWS entry.

Verified with a sequence of 68 tests on x86_64 that cover
non-AT_SECURE and AT_SECURE testing using a sysroot (requires root
to run).  The tests cover cases for bug 23102, bug 21942, bug 18018,
and bug 23259.  These tests are not yet appropriate for the glibc
regression testsuite, but with the upcoming test-in-container testing
framework it should be possible to include these tests upstream soon.

See the mailing list for the tests:
https://www.sourceware.org/ml/libc-alpha/2018-06/msg00251.html
2018-06-12 11:07:56 -04:00
Zack Weinberg 329ea513b4 Avoid cancellable I/O primitives in ld.so.
Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor
initial shared library load-up, are cancellation points, so ld.so
should exclusively use I/O primitives that are not cancellable.  We
currently achieve this by having the cancellation hooks compile as
no-ops when IS_IN(rtld); this patch changes to using exclusively
_nocancel primitives in the source code instead, which makes the
intent clearer and significantly reduces the amount of code compiled
under IS_IN(rtld) as well as IS_IN(libc) -- in particular,
elf/Makefile no longer thinks we require a copy of unwind.c in
rtld-libc.a.  (The older mechanism is preserved as a backstop.)

The bulk of the change is splitting up the files that define the
_nocancel I/O functions, so they don't also define the variants that
*are* cancellation points; after which, the existing logic for picking
out the bits of libc that need to be recompiled as part of ld.so Just
Works.  I did this for all of the _nocancel functions, not just the
ones used by ld.so, for consistency.

fcntl was a little tricky because it's only a cancellation point for
certain opcodes (F_SETLKW(64), which can block), and the existing
__fcntl_nocancel wasn't applying the FCNTL_ADJUST_CMD hook, which
strikes me as asking for trouble, especially as the only nontrivial
definition of FCNTL_ADJUST_CMD (for powerpc64) changes F_*LK* opcodes.
To fix this, fcntl_common moves to fcntl_nocancel.c along with
__fcntl_nocancel, and changes its name to the extern (but hidden)
symbol __fcntl_nocancel_adjusted, so that regular fcntl can continue
calling it.  __fcntl_nocancel now applies FCNTL_ADJUST_CMD; so that
both both fcntl.c and fcntl_nocancel.c can see it, the only nontrivial
definition moves from sysdeps/u/s/l/powerpc/powerpc64/fcntl.c to
.../powerpc64/sysdep.h and becomes entirely a macro, instead of a macro
that calls an inline function.

The nptl version of libpthread also changes a little, because its
"compat-routines" formerly included files that defined all the
_nocancel functions it uses; instead of continuing to duplicate them,
I exported the relevant ones from libc.so as GLIBC_PRIVATE.  Since the
Linux fcntl.c calls a function defined by fcntl_nocancel.c, it can no
longer be used from libpthread.so; instead, introduce a custom
forwarder, pt-fcntl.c, and export __libc_fcntl from libc.so as
GLIBC_PRIVATE.  The nios2-linux ABI doesn't include a copy of vfork()
in libpthread, and it was handling that by manipulating
libpthread-routines in .../linux/nios2/Makefile; it is cleaner to do
what other such ports do, and have a pt-vfork.S that defines no symbols.

Right now, it appears that Hurd does not implement _nocancel I/O, so
sysdeps/generic/not-cancel.h will forward everything back to the
regular functions.  This changed the names of some of the functions
that sysdeps/mach/hurd/dl-sysdep.c needs to interpose.

	* elf/dl-load.c, elf/dl-misc.c, elf/dl-profile.c, elf/rtld.c
	* sysdeps/unix/sysv/linux/dl-sysdep.c
	Include not-cancel.h.  Use __close_nocancel instead of __close,
	__open64_nocancel instead of __open, __read_nocancel instead of
	__libc_read, and __write_nocancel instead of __libc_write.

	* csu/check_fds.c (check_one_fd)
	* sysdeps/posix/fdopendir.c (__fdopendir)
	* sysdeps/posix/opendir.c (__alloc_dir): Use __fcntl_nocancel
        instead of __fcntl and/or __libc_fcntl.

	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np)
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np)
        * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system):
	Use __open64_nocancel instead of __open_nocancel.

	* sysdeps/unix/sysv/linux/not-cancel.h: Move all of the
	hidden_proto declarations to the end and issue them if either
	IS_IN(libc) or IS_IN(rtld).
	* sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines):
	Add close_nocancel, fcntl_nocancel, nanosleep_nocancel,
	open_nocancel, open64_nocancel, openat_nocancel, pause_nocancel,
	read_nocancel, waitpid_nocancel, write_nocancel.

        * io/Versions [GLIBC_PRIVATE]: Add __libc_fcntl,
        __fcntl_nocancel, __open64_nocancel, __write_nocancel.
        * posix/Versions: Add __nanosleep_nocancel, __pause_nocancel.

        * nptl/pt-fcntl.c: New file.
        * nptl/Makefile (pthread-compat-wrappers): Remove fcntl.
        (libpthread-routines): Add pt-fcntl.
        * include/fcntl.h (__fcntl_nocancel_adjusted): New function.
        (__libc_fcntl): Remove attribute_hidden.
	* sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Call
	__fcntl_nocancel_adjusted, not fcntl_common.
        (__fcntl_nocancel): Move to new file fcntl_nocancel.c.
	(fcntl_common): Rename to __fcntl_nocancel_adjusted; also move
	to fcntl_nocancel.c.
	* sysdeps/unix/sysv/linux/fcntl_nocancel.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Remove file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h:
	Define FCNTL_ADJUST_CMD here, as a self-contained macro.

	* sysdeps/unix/sysv/linux/close.c: Move __close_nocancel to...
	* sysdeps/unix/sysv/linux/close_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/nanosleep.c: Move __nanosleep_nocancel to...
	* sysdeps/unix/sysv/linux/nanosleep_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/open.c: Move __open_nocancel to...
	* sysdeps/unix/sysv/linux/open_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/open64.c: Move __open64_nocancel to...
	* sysdeps/unix/sysv/linux/open64_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/openat.c: Move __openat_nocancel to...
	* sysdeps/unix/sysv/linux/openat_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/openat64.c: Move __openat64_nocancel to...
	* sysdeps/unix/sysv/linux/openat64_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/pause.c: Move __pause_nocancel to...
	* sysdeps/unix/sysv/linux/pause_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/read.c: Move __read_nocancel to...
	* sysdeps/unix/sysv/linux/read_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/waitpid.c: Move __waitpid_nocancel to...
	* sysdeps/unix/sysv/linux/waitpid_nocancel.c: ...this new file.
	* sysdeps/unix/sysv/linux/write.c: Move __write_nocancel to...
	* sysdeps/unix/sysv/linux/write_nocancel.c: ...this new file.

        * sysdeps/unix/sysv/linux/nios2/Makefile: Don't override
        libpthread-routines.
        * sysdeps/unix/sysv/linux/nios2/pt-vfork.S: New file which
        defines nothing.

        * sysdeps/mach/hurd/dl-sysdep.c: Define __read instead of
        __libc_read, and __write instead of __libc_write.  Define
        __open64 in addition to __open.
2018-06-12 09:53:04 -04:00
H.J. Lu 0221ce2a90 i386: Change offset of __private_ss to 0x30 [BZ #23250]
sysdeps/i386/nptl/tls.h has

typedef struct
{
  void *tcb;            /* Pointer to the TCB.  Not necessarily the
                           thread descriptor used by libpthread.  */
  dtv_t *dtv;
  void *self;           /* Pointer to the thread descriptor.  */
  int multiple_threads;
  uintptr_t sysinfo;
  uintptr_t stack_guard;
  uintptr_t pointer_guard;
  int gscope_flag;
  int __glibc_reserved1;
  /* Reservation of some values for the TM ABI.  */
  void *__private_tm[4];
  /* GCC split stack support.  */
  void *__private_ss;
} tcbhead_t;

The offset of __private_ss is 0x34.  But GCC defines

/* We steal the last transactional memory word.  */
 #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30

and libgcc/config/i386/morestack.S has

	cmpl	%gs:0x30,%eax		# See if we have enough space.
	movl	%eax,%gs:0x30		# Save the new stack boundary.
	movl	%eax,%gs:0x30		# Save the new stack boundary.
	movl	%ecx,%gs:0x30		# Save new stack boundary.
	movl	%eax,%gs:0x30
	movl	%gs:0x30,%eax
	movl	%eax,%gs:0x30

Since update TARGET_THREAD_SPLIT_STACK_OFFSET changes split stack ABI,
this patch updates tcbhead_t to match GCC.

	[BZ #23250]
	[BZ #10686]
	* sysdeps/i386/nptl/tls.h (tcbhead_t): Change __private_tm[4]
	to _private_tm[3] and add __glibc_reserved2.
	Add _Static_assert of offset of __private_ss == 0x30.
	* sysdeps/x86_64/nptl/tls.h: Add _Static_assert of offset of
	__private_ss == 0x40 for ILP32 and == 0x70 for LP64.
2018-06-12 06:34:48 -07:00
Florian Weimer e826574c98 x86: Make strncmp usable from rtld
Due to the way the conditions were written, the rtld build of strncmp
ended up with no definition of the strncmp symbol at all: The
implementations were renamed for use within an IFUNC resolver, but the
IFUNC resolver itself was missing (because rtld does not use IFUNCs).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-06-12 15:00:33 +02:00
Rafal Luzynski c4ad5782c4 gd_GB, hsb_DE, wa_BE: Add alternative month names (bug 23140).
As a followup of fixing bug 10871, these three languages now support two
grammatical cases of the month names.

This commit does not resolve the bug because there are more languages
to be committed.

	[BZ #23140]
	* localedata/locales/gd_GB (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).
	* localedata/locales/hsb_DE (mon): Rename to...
	(alt_mon): This.
	(mon): Import from CLDR (genitive case).
	* localedata/locales/wa_BE (mon): Rename to...
	(alt_mon): This.
	(mon): Add, fill with the proper genitive forms, but CLDR data
	is incomplete; completed according to the comments in this file.
	(d_t_fmt): Do not use "di" before the month name, no longer needed.

	* localedata/locales/wa_BE (country_name): Reword
	"Beljike" -> "Beldjike".
2018-06-12 01:33:55 +02:00
Joseph Myers ca121b117f Fix ldbl-96 fma (Inf, Inf, finite) (bug 23272).
As reported in bug 23272, the ldbl-96 implementation of fma (fma for
double, in terms of ldbl-96 as the internal arithmetic type, as used
on 32-bit x86) is missing some of the special-case handling for
non-finite arguments, resulting in incorrect NaN results when the
first two arguments are infinities, the third is finite and so the
infinities go through the logic for finite arguments.  This patch
fixes it by handling all cases of non-finite arguments up front, with
additional fma tests for the problem cases being added to the
testsuite.

Tested for x86_64 and x86.

	[BZ #23272]
	* sysdeps/ieee754/ldbl-96/s_fma.c (__fma): Start by handling all
	cases of non-finite arguments.
	* math/libm-test-fma.inc (fma_test_data): Add more tests.
2018-06-11 16:33:42 +00:00
John David Anglin 2b69fecb9d The hppa-linux target still requires an executable stack for kernel
syscall restarts and signal returns.  Thus, we need to xfail the
check-execstack test.

        [BZ #23174]
        * sysdeps/unix/sysv/linux/hppa/Makefile: xfail check-execstack.
2018-06-10 13:57:32 -04:00
Adhemerval Zanella 283d985122 posix: Fix posix_spawnp to not execute invalid binaries in non compat mode (BZ#23264)
Current posix_spawnp implementation wrongly tries to execute invalid
binaries (for instance script without shebang) as a shell script in
non compat mode.  It was a regression introduced by
9ff72da471 when __spawni started to use
__execvpe instead of __execve (glibc __execvpe try to execute ENOEXEC
as shell script regardless).

This patch fixes it by using an internal symbol (__execvpex) with the
faulty semantic (since compat mode is handled by spawni.c itself).

It was reported by Daniel Drake on libc-help [1].

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

	[BZ #23264]
	* include/unistd.h (__execvpex): New prototype.
	* posix/Makefile (tests): Add tst-spawn4.
	(tests-internal): Add tst-spawn4-compat.
	* posix/execvpe.c (__execvpe_common, __execvpex): New functions.
	* posix/tst-spawn4-compat.c: New file.
	* posix/tst-spawn4.c: Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni): Do not interpret invalid
	binaries as shell scripts.
	* sysdeps/posix/spawni.c (__spawni): Likewise.

[1] https://sourceware.org/ml/libc-help/2018-06/msg00012.html
2018-06-08 17:27:46 -03:00
H.J. Lu 67c0579669 Mark _init and _fini as hidden [BZ #23145]
_init and _fini are special functions provided by glibc for linker to
define DT_INIT and DT_FINI in executable and shared library.  They
should never be put in dynamic symbol table.  This patch marks them as
hidden to remove them from dynamic symbol table.

Tested with build-many-glibcs.py.

	[BZ #23145]
	* elf/Makefile (tests-special): Add $(objpfx)check-initfini.out.
	($(all-built-dso:=.dynsym): New target.
	(common-generated): Add $(all-built-dso:$(common-objpfx)%=%.dynsym).
	($(objpfx)check-initfini.out): New target.
	(generated): Add check-initfini.out.
	* scripts/check-initfini.awk: New file.
	* sysdeps/aarch64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/alpha/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/arm/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/hppa/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/i386/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/ia64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/m68k/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/microblaze/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips64/n32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/mips/mips64/n64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/nios2/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/powerpc/powerpc32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/powerpc/powerpc64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/s390/s390-32/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/s390/s390-64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/sh/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/sparc/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
	* sysdeps/x86_64/crti.S (_init): Mark as hidden.
	(_fini): Likewise.
2018-06-08 10:28:52 -07:00
Tulio Magno Quites Machado Filho 1c09524e4d powerpc64le: Fix TFtype in sqrtf128 when using -mabi=ieeelongdouble
When building with -mlong-double-128 or -mabi=ibmlongdouble, TFtype
represents the IBM 128-bit extended floating point type, while KFtype
represents the IEEE 128-bit floating point type.
The soft float implementation of e_sqrtf128 had to redefine TFtype and
TF in order to workaround this issue.  However, this behavior changes
when -mabi=ieeelongdouble is used and the macros are not necessary.

	* sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c
	[__HAVE_FLOAT128_UNLIKE_LDBL] (TFtype, TF): Restrict TFtype
	and TF redirection to KFtype and KF only when the default
	long double type is not the IEEE 128-bit floating point type.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-06-06 12:27:39 -03:00
Joseph Myers 0c1c33b2f5 Add AArch64 hwcap values from Linux 4.17.
Linux 4.17 adds four new AArch64 hwcap values.  This patch adds them
to glibc's AArch64 bits/hwcap.h, with corresponding dl-procinfo.c
updates.

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

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_DIT): New
	macro.
	(HWCAP_USCAT): Likewise.
	(HWCAP_ILRCPC): Likewise.
	(HWCAP_FLAGM): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
	Increase to 28.
	(_dl_aarch64_cap_flags): Add new flag names.
2018-06-05 15:51:12 +00:00
Joseph Myers bef1cbf4da Add MAP_FIXED_NOREPLACE from Linux 4.17 to bits/mman.h.
Linux 4.17 adds MAP_FIXED_NOREPLACE (value 0x100000 on most
architectures, 0x200000 on alpha).  This patch adds that macro to
glibc's bits/mman.h headers.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/aarch64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): New macro.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/arm/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/nios2/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/riscv/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sh/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/mman.h [__USE_MISC]
	(MAP_FIXED_NOREPLACE): Likewise.
2018-06-05 11:04:46 +00:00
Joseph Myers 0e0577c93f Update kernel version in syscall-names.list to 4.17.
As far as I can tell, Linux 4.17 does not add any new syscalls; this
patch updates the version number in syscall-names.list to reflect that
it's still current for 4.17.

Tested for x86_64-linux-gnu with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 4.17.
2018-06-05 11:03:22 +00:00
Joseph Myers ab3a0da0b5 Use Linux 4.17 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	version to 4.17
2018-06-04 17:11:11 +00:00
Samuel Thibault d2d9dfb663 hurd: Fix shmid_ds's shm_segsz field type
* bits/shm.h (struct shmid_ds): Make shm_segsz field size_t instead of
	int.
	* sysdeps/gnu/bits/shm.h (struct shmid_ds): Likewise.
2018-06-02 21:52:43 +02:00
Leonardo Sandoval a650b05ebe benchtests: Catch exceptions in input arguments
Catch runtime exceptions in case the user provided: wrong base
function, attribute(s) or input file. In any of the latter, quit
immediately with non-zero return code.

	* benchtests/scripts/compare_string.py: (process_results) Catch
	exception in non-existent base_func and catch exception in
	non-existent attribute.
	(parse_file) Catch exception in non-existent input file.
2018-06-01 16:32:43 -05:00
Leonardo Sandoval 195abbf4cd benchtests: Add --no-diff and --no-header options
Having a string comparison report with neither diff numbers nor header
yields a more useful output to be consumed by other tools.

	* benchtests/scripts/compare_string.py: Add --no-diff and --no-header
	options to avoid diff calculation and omit header, respectively.
	(main): process --no-diff and --no-header
2018-06-01 16:32:43 -05:00
Leonardo Sandoval 1457016337 x86-64: Optimize strcmp/wcscmp and strncmp/wcsncmp with AVX2
Optimize x86-64 strcmp/wcscmp and strncmp/wcsncmp with AVX2. It uses vector
comparison as much as possible. Peak performance observed on a SkyLake
machine: 9x, 3x, 2.5x and 5.5x for strcmp, strncmp, wcscmp and wcsncmp,
respectively. The larger the comparison length, the more benefit using
avx2 functions, except on the strcmp, where peak is observed at length
== 32 bytes. Select AVX2 strcmp/wcscmp on AVX2 machines where vzeroupper
is preferred and AVX unaligned load is fast.

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

	* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
	strcmp-avx2, strncmp-avx2, wcscmp-avx2, wcscmp-sse2, wcsncmp-avx2 and
	wcsncmp-sse2.
	* sysdeps/x86_64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add tests for __strcmp_avx2,
	__strncmp_avx2,	__wcscmp_avx2, __wcsncmp_avx2, __wcscmp_sse2
	and __wcsncmp_sse2.
	* sysdeps/x86_64/multiarch/strcmp.c (OPTIMIZE (avx2)):
	(IFUNC_SELECTOR): Return OPTIMIZE (avx2) on AVX 2 machines if
	AVX unaligned load is fast and vzeroupper is preferred.
	* sysdeps/x86_64/multiarch/strncmp.c: Likewise.
	* sysdeps/x86_64/multiarch/strcmp-avx2.S: New file.
	* sysdeps/x86_64/multiarch/strncmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp-sse2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcscmp.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp-avx2.S: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp-sse2.c: Likewise.
	* sysdeps/x86_64/multiarch/wcsncmp.c: Likewise.
	* sysdeps/x86_64/wcscmp.S (__wcscmp): Add alias only if __wcscmp
	is undefined.
2018-06-01 16:32:43 -05:00
Florian Weimer e02c026f38 math: Update i686 ulps (--disable-multi-arch configuration)
The results are from configuring with --disable-multi-arch,  building
with “-march=x86-64 -mtune=generic -mfpmath=sse” and running the
testsuite on a Haswell-era CPU.
2018-06-01 22:37:55 +02:00
Florian Weimer d8c1927561 math: Update i686 ulps
The results are from building with “-march=x86-64 -mtune=generic
-mfpmath=sse” and running the testsuite on a Haswell-era CPU.
2018-06-01 19:32:18 +02:00
Joseph Myers 0d2163ebf2 Make powerpc-nofpu __sqrtsf2, __sqrtdf2 compat symbols (bug 18473).
powerpc-nofpu libc exports __sqrtsf2 and __sqrtdf2 symbols.  The
export of these soft-fp symbols is a mistake; they aren't part of the
libgcc interface and GCC will never generate code that calls them.
This patch makes them into compat symbols (no code built for static
libc), moving their sources from the generic soft-fp sources to
sysdeps/powerpc/nofpu (the underlying soft-fp FP_SQRT functionality
remains of use to implement actual sqrt public interfaces, such as
sqrtl / sqrtf128 for which it is used on various platforms, but
__sqrt[sdt]f2 are not such interfaces).

Tested with build-many-glibcs.py for relevant platforms.

	[BZ #18473]
	* soft-fp/sqrttf2.c: Remove file.
	* soft-fp/sqrtdf2.c: Move to ....
	* sysdeps/powerpc/nofpu/sqrtdf2.c: ... here.  Include
	<shlib-compat.h>.
	(__sqrtdf2): Make conditional on
	[SHLIB_COMPAT (libc, GLIBC_2_3_2, GLIBC_2_28)].  Define as compat
	symbol.
	* soft-fp/sqrtsf2.c: Move to ....
	* sysdeps/powerpc/nofpu/sqrtsf2.c: ... here.  Include
	<shlib-compat.h>.
	(__sqrtsf2): Make conditional on
	[SHLIB_COMPAT (libc, GLIBC_2_3_2, GLIBC_2_28)].  Define as compat
	symbol.
	* soft-fp/Makefile (gcc-single-routines): Remove sqrtsf2.
	(gcc-double-routines): Remove sqrtdf2.
	(gcc-quad-routines): Remove sqrttf2.
	* sysdeps/nios2/Makefile [$(subdir) = soft-fp] (sysdep_routines):
	Do not filter out sqrtsf2 and sqrtdf2.
	* sysdeps/powerpc/nofpu/Makefile [$(subdir) = soft-fp]
	(sysdep_routines): Add sqrtsf2 and sqrtdf2.
2018-06-01 17:25:12 +00:00
Florian Weimer 104502102c Remove sysdeps/generic/libcidn.abilist
This file was left behind by the libidn removal in commit
7f9f1ecb71.
2018-06-01 11:25:41 +02:00
Florian Weimer 4e8a6346cd libio: Avoid _allocate_buffer, _free_buffer function pointers [BZ #23236]
These unmangled function pointers reside on the heap and could
be targeted by exploit writers, effectively bypassing libio vtable
validation.  Instead, we ignore these pointers and always call
malloc or free.

In theory, this is a backwards-incompatible change, but using the
global heap instead of the user-supplied callback functions should
have little application impact.  (The old libstdc++ implementation
exposed this functionality via a public, undocumented constructor
in its strstreambuf class.)
2018-06-01 10:41:03 +02:00
Paul Pluzhnikov 50d004c91c Update ulps with "make regen-ulps" on AMD Ryzen 7 1800X.
2018-05-30  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* sysdeps/x86_64/fpu/libm-test-ulps (log_vlen8_avx2): Update for
	AMD Ryzen 7 1800X.
2018-05-30 09:17:47 -07:00
Rajalakshmi Srinivasaraghavan 2c93fce76a powerpc: Add multiarch sqrtf128 for ppc64le
This patch creates ifunc for sqrtf128() to make use of new xssqrtqp
instruction for POWER9 when --enable-multi-arch and --with-cpu=power8
options are used on power9 system.  This is achieved by explicitly
adding -mcpu=power9 flag for sqrtf128-power9.
2018-05-30 21:31:27 +05:30
Florian Weimer 0ce2fa6973 support: Add wrappers for pthread_barrierattr_t 2018-05-29 15:37:00 +02:00
H.J. Lu 7f7b5d8ded static-PIE: Update DT_DEBUG for debugger [BZ #23206]
This is needed to support debugging dlopened shared libraries in static
PIE.

	[BZ #23206]
	* elf/dl-reloc-static-pie.c (_dl_relocate_static_pie): Initialize
	_r_debug and update DT_DEBUG for debugger.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-05-29 06:33:57 -07:00
Florian Weimer e48903000b stdlib: Additional tests need generated locale dependencies
Without these dependencies, the tests fail at high make parallelism
levels if the locale data has not been generated for other reasons.
2018-05-29 10:34:53 +02:00
Joseph Myers b5453d9f7a Remove sysdeps/sparc/sparc64/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the
sysdeps/sparc/sparc64/soft-fp directory accordingly, merging its
contents into sysdeps/sparc/sparc64.  This completes removing the
unnecessary <arch>/soft-fp sysdeps directories.

sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c is removed rather than moved.
It was not in fact used previously - the ldbl-128 version of
e_ilogbl.c was used instead - and moving it into sysdeps/sparc/sparc64
results in it being used, but causing a build failure because of
FP_DECL_EX declaring an unused variable (as I noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00457.html> that file
doesn't appear to use FP_DECL_EX).  Given that the file was previously
unused and so presumably not tested recently, removing it is the safe
way to avoid this patch changing what actually gets built into glibc
(if this file should turn out more efficient than the ldbl-128
e_ilogbl.c, it can always be added back in future with the build
failure fixed).

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

	* sysdeps/sparc/sparc64/Implies: Remove sparc/sparc64/soft-fp.
	* sysdeps/sparc/sparc64/Makefile [$(subdir) = soft-fp]
	(sparc64-quad-routines): New variable.  Moved from ....
	[$(subdir) = soft-fp] (sysdep_routines): Add
	$(sparc64-quad-routines).  Moved from ....
	[$(subdir) = math] (CPPFLAGS): Add -I../soft-fp/.  Moved from ....
	* sysdeps/sparc/sparc64/soft-fp/Makefile: ... here.  Remove file.
	* sysdeps/sparc/sparc64/Versions (libc): Add GLIBC_2.2 symbols
	moved from ....
	* sysdeps/sparc/sparc64/soft-fp/Versions: ... here.  Remove file.
	* sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c: Remove file.
	* sysdeps/sparc/sparc64/soft-fp/qp_add.c: Move to ....
	* sysdeps/sparc/sparc64/qp_add.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_cmp.c: Move to ....
	* sysdeps/sparc/sparc64/qp_cmp.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c: Move to ....
	* sysdeps/sparc/sparc64/qp_cmpe.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_div.c: Move to ....
	* sysdeps/sparc/sparc64/qp_div.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_dtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_feq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_feq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fge.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fge.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fgt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fgt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fle.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fle.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_flt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_flt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_fne.c: Move to ....
	* sysdeps/sparc/sparc64/qp_fne.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_itoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_itoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_mul.c: Move to ....
	* sysdeps/sparc/sparc64/qp_mul.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_neg.S: Move to ....
	* sysdeps/sparc/sparc64/qp_neg.S: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtod.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtod.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoi.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtos.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtos.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoui.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtoux.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_qtox.c: Move to ....
	* sysdeps/sparc/sparc64/qp_qtox.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c: Move to ....
	* sysdeps/sparc/sparc64/qp_sqrt.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_stoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_stoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_sub.c: Move to ....
	* sysdeps/sparc/sparc64/qp_sub.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_uitoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_util.c: Move to ....
	* sysdeps/sparc/sparc64/qp_util.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_uxtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c: Move to ....
	* sysdeps/sparc/sparc64/qp_xtoq.c: ... here.
	* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/sparc/sparc64/sfp-machine.h: ... here.
2018-05-25 20:00:51 +00:00
Joseph Myers 2c753f3e84 Remove sysdeps/sparc/sparc32/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the
sysdeps/sparc/sparc32/soft-fp directory accordingly, merging its
contents into sysdeps/sparc/sparc32.

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

	* sysdeps/sparc/sparc32/Implies: Remove sparc/sparc32/soft-fp.
	* sysdeps/sparc/sparc32/Makefile [$(subdir) = soft-fp]
	(sparc32-quad-routines): New variable.  Moved from ....
	[$(subdir) = soft-fp] (sysdep_routines): Add
	$(sparc32-quad-routines).  Moved from ....
	* sysdeps/sparc/sparc32/soft-fp/Makefile: ... here.  Remove file.
	* sysdeps/sparc/sparc32/Versions (libc): Add GLIBC_2.4 symbols
	moved from ....
	* sysdeps/sparc/sparc32/soft-fp/Versions: ... here.  Remove file.
	* sysdeps/sparc/sparc32/soft-fp/q_add.c: Move to ....
	* sysdeps/sparc/sparc32/q_add.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_cmp.c: Move to ....
	* sysdeps/sparc/sparc32/q_cmp.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_cmpe.c: Move to ....
	* sysdeps/sparc/sparc32/q_cmpe.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_div.c: Move to ....
	* sysdeps/sparc/sparc32/q_div.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_dtoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_dtoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_feq.c: Move to ....
	* sysdeps/sparc/sparc32/q_feq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_fge.c: Move to ....
	* sysdeps/sparc/sparc32/q_fge.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_fgt.c: Move to ....
	* sysdeps/sparc/sparc32/q_fgt.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_fle.c: Move to ....
	* sysdeps/sparc/sparc32/q_fle.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_flt.c: Move to ....
	* sysdeps/sparc/sparc32/q_flt.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_fne.c: Move to ....
	* sysdeps/sparc/sparc32/q_fne.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_itoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_lltoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_mul.c: Move to ....
	* sysdeps/sparc/sparc32/q_mul.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_neg.c: Move to ....
	* sysdeps/sparc/sparc32/q_neg.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtod.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtod.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtoi.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtoi.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtoll.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtoll.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtos.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtos.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtou.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtou.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_qtoull.c: Move to ....
	* sysdeps/sparc/sparc32/q_qtoull.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_sqrt.c: Move to ....
	* sysdeps/sparc/sparc32/q_sqrt.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_stoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_stoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_sub.c: Move to ....
	* sysdeps/sparc/sparc32/q_sub.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_ulltoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_util.c: Move to ....
	* sysdeps/sparc/sparc32/q_util.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Move to ....
	* sysdeps/sparc/sparc32/q_utoq.c: ... here.
	* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/sparc/sparc32/sfp-machine.h: ... here.
2018-05-25 16:51:15 +00:00
Tulio Magno Quites Machado Filho c1dc1e1b34 powerpc: Move around math-related Implies
Currently, powerpc, powerpc64, and powerpc64le imply the same set of
subdirectories from sysdeps/ieee754: flt-32, dbl-64, ldbl-128ibm, and
ldbl-opt.  In preparation for the transition of the long double format -
from IBM Extended Precision to IEEE 754 128-bits floating-point - on
powerpc64le, this patch splits the shared Implies file into three
separate files (one for each of the powerpc architectures), without
changing their contents.  Future patches will modify powerpc64le.

	* sysdeps/powerpc/Implies: Removed.  Previous contents copied to...
	* sysdeps/powerpc/powerpc32/Implies-after: ... here.
	* sysdeps/powerpc/powerpc64/be/Implies-after: ... here.
	* sysdeps/powerpc/powerpc64/le/Implies-before: ... and here.
2018-05-24 22:49:10 -03:00
Joseph Myers 14186e8d1f Remove sysdeps/powerpc/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.

sysdeps/powerpc/soft-fp isn't quite such a case, as the Implies files
pointing to it are
sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies and
sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies (and
indeed there is a different sfp-machine.h used for powerpc64le).
However, the same principle applies: there is no need for this
directory because sfp-machine.h, the only file in it, can most
naturally go in sysdeps/powerpc/nofpu, which is used by exactly the
same configurations (and there is a close dependence between the files
there and the sfp-machine.h implementation).  This patch eliminates
the sysdeps/powerpc/soft-fp directory accordingly.

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

	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/Implies: Remove
	powerpc/soft-fp.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu/Implies:
	Likewise.
	* sysdeps/powerpc/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/powerpc/nofpu/sfp-machine.h: ... here.
2018-05-24 22:02:32 +00:00
Gabriel F. T. Gomes fb0e10b8eb Fix parameter type in C++ version of iseqsig (bug 23171)
The commit

  commit c85e54ac6c
  Author: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
  Date:   Fri Nov 3 10:44:36 2017 -0200

      Provide a C++ version of iseqsig (bug 22377)

mistakenly used double parameters in the long double version of iseqsig,
thus causing spurious conversions to double, as reported on bug 23171.

Tested for powerpc64le and x86_64.
2018-05-24 13:12:39 -03:00
Florian Weimer 43d4f3d5ad Add references to CVE-2017-18269, CVE-2018-11236, CVE-2018-11237 2018-05-24 12:19:11 +02:00
Joseph Myers 1dfeb17e67 Remove sysdeps/sh/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the sysdeps/sh/soft-fp
directory accordingly, merging its contents into sysdeps/sh.

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

	* sysdeps/sh/Implies: Remove sh/soft-fp.
	* sysdeps/sh/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/sh/sfp-machine.h: ... here.
2018-05-23 20:05:31 +00:00
H.J. Lu 727b38df05 x86-64: Skip zero length in __mem[pcpy|move|set]_erms
This patch skips zero length in __mempcpy_erms, __memmove_erms and
__memset_erms.

Tested on x86-64.

	* sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
	(__mempcpy_erms): Skip zero length.
	(__memmove_erms): Likewise.
	* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
	(__memset_erms): Likewise.
2018-05-23 11:25:42 -07:00
Joseph Myers 2834fb4610 Remove sysdeps/alpha/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the
sysdeps/alpha/soft-fp directory accordingly, merging its contents
into sysdeps/alpha.

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

	* sysdeps/alpha/Implies: Remove alpha/soft-fp.
	* sysdeps/alpha/Makefile [$(subdir) = soft-fp] (sysdep_routines):
	Add functions moved from ....
	[$(subdir) = math] (CPPFLAGS): Add -I../soft-fp.  Moved from ....
	* sysdeps/alpha/soft-fp/Makefile: ... here.  Remove file.
	* sysdeps/alpha/Versions (libc): Add GLIBC_2.3.4 symbols moved
	from ....
	* sysdeps/alpha/soft-fp/Versions: ... here.  Remove file.
	* sysdeps/alpha/soft-fp/e_sqrtl.c: Move to ....
	* sysdeps/alpha/e_sqrtl.c: ... here.
	* sysdeps/alpha/soft-fp/local-soft-fp.h: Move to ....
	* sysdeps/alpha/local-soft-fp.h: ... here.
	* sysdeps/alpha/soft-fp/ots_add.c: Move to ....
	* sysdeps/alpha/ots_add.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cmp.c: Move to ....
	* sysdeps/alpha/ots_cmp.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cmpe.c: Move to ....
	* sysdeps/alpha/ots_cmpe.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cvtqux.c: Move to ....
	* sysdeps/alpha/ots_cvtqux.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cvtqx.c: Move to ....
	* sysdeps/alpha/ots_cvtqx.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cvttx.c: Move to ....
	* sysdeps/alpha/ots_cvttx.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cvtxq.c: Move to ....
	* sysdeps/alpha/ots_cvtxq.c: ... here.
	* sysdeps/alpha/soft-fp/ots_cvtxt.c: Move to ....
	* sysdeps/alpha/ots_cvtxt.c: ... here.
	* sysdeps/alpha/soft-fp/ots_div.c: Move to ....
	* sysdeps/alpha/ots_div.c: ... here.
	* sysdeps/alpha/soft-fp/ots_mul.c: Move to ....
	* sysdeps/alpha/ots_mul.c: ... here.
	* sysdeps/alpha/soft-fp/ots_nintxq.c: Move to ....
	* sysdeps/alpha/ots_nintxq.c: ... here.
	* sysdeps/alpha/soft-fp/ots_sub.c: Move to ....
	* sysdeps/alpha/ots_sub.c: ... here.
	* sysdeps/alpha/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/alpha/sfp-machine.h: ... here.
2018-05-23 17:29:20 +00:00
Florian Weimer 7f9f1ecb71 Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247]
This provides an implementation of the IDNA2008 standard and fixes
CVE-2016-6261, CVE-2016-6263, CVE-2017-14062.
2018-05-23 15:27:24 +02:00
Florian Weimer 5f7b841d3a Implement allocate_once for atomic initialization with allocation 2018-05-23 15:27:01 +02:00
H.J. Lu ed983107bb Add a test case for [BZ #23196]
[BZ #23196]
	* string/test-memcpy.c (do_test1): New function.
	(test_main): Call it.
2018-05-23 04:00:11 -07:00
Andreas Schwab 9aaaab7c6e Don't write beyond destination in __mempcpy_avx512_no_vzeroupper (bug 23196)
When compiled as mempcpy, the return value is the end of the destination
buffer, thus it cannot be used to refer to the start of it.
2018-05-23 09:50:57 +02:00
Joseph Myers 8f145c7712 Remove sysdeps/aarch64/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>,
there should not be separate sysdeps/<arch>/soft-fp directories when
those are used by all configurations that use sysdeps/<arch>, and,
more generally, should not be sysdeps/foo/Implies files pointing to a
subdirectory foo/bar.  This patch eliminates the
sysdeps/aarch64/soft-fp directory accordingly, merging its contents
into sysdeps/aarch64.

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

	* sysdeps/aarch64/Implies: Remove aarch64/soft-fp.
	* sysdeps/aarch64/Makefile [$(subdir) = math] (CPPFLAGS): Add
	-I../soft-fp.  Moved from ....
	* sysdeps/aarch64/soft-fp/Makefile: ... here.  Remove file.
	* sysdeps/aarch64/soft-fp/e_sqrtl.c: Move to ....
	* sysdeps/aarch64/e_sqrtl.c: ... here.
	* sysdeps/aarch64/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/aarch64/sfp-machine.h: ... here.
2018-05-22 17:23:34 +00:00
Joseph Myers 3d6302a546 Fix i686-linux-gnu build with GCC mainline.
Building with recent GCC mainline for i686-linux-gnu is failing with:

../sysdeps/ieee754/flt-32/k_rem_pio2f.c: In function '__kernel_rem_pio2f':
../sysdeps/ieee754/flt-32/k_rem_pio2f.c:186:28: error: 'fq[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   fv = math_narrow_eval (fq[0]-fv);
                            ^

and

../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function '__kernel_rem_pio2':
../sysdeps/ieee754/dbl-64/k_rem_pio2.c:333:32: error: 'fq[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       fv = math_narrow_eval (fq[0] - fv);
                                ^

These are similar to -Warray-bounds cases for which the DIAG_* macros
are already used in those files: the array element is in fact always
initialized, but the reasoning that it is depends on another array not
having been all zero at an earlier point, which depends on the
functions not being called with zero arguments.  Thus, this patch uses
DIAG_* to disable -Wmaybe-uninitialized for this code.

(The warning may be i686-specific because of math_narrow_eval somehow
perturbing what the compiler does with this code enough to cause the
warning.  I don't know why it doesn't appear for i686-gnu.)

Tested with build-many-glibcs.py that this fixes the i686 build in
this configuration.

	* sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2): Ignore
	-Wmaybe-uninitialized around access to fq[0].
	* sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
	Likewise.
2018-05-22 16:55:04 +00:00
Joseph Myers 5c5c0dd747 Make llseek a compat symbol (bug 18471).
The llseek function name is an obsolete, Linux-specific, unprototyped
name for lseek64 with a link-time warning.  This patch completes the
obsoletion of this function name by making it into a compat symbol,
not available for newly linked programs and not included in the ABI
for new ports.

When a compat symbol is defined in syscalls.list, the code for that
function is not built at all for static linking unless some non-compat
symbol for that function is also defined with an explicit symbol
version, so an explicit symbol version for lseek64 is added to the
MIPS n32 syscalls.list.  The case in make-syscalls.sh that handles
such explicit non-compat symbol versions then needs to be changed to
use weak_alias instead of strong_alias when the syscall is built
outside of libc, to avoid linknamespace failures from a strong lseek64
symbol in static libpthread.

The x32 llseek.S was as far as I could tell already unused (nothing
builds an llseek.* source file, at least since the lseek / lseek64 /
llseek consolidation), so is removed in this patch as well.

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

	[BZ #18471]
	* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Use weak
	aliases for non-libc case of versioned symbols.
	* sysdeps/unix/sysv/linux/lseek64.c: Include <shlib-compat.h>.
	(llseek): Define as compat symbol if
	[SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_28)], not as weak alias
	with link warning.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (llseek):
	Make into a compat symbol, disabled for minimum symbol version
	GLIBC_2.28 and later.
	* sysdeps/unix/sysv/linux/x86_64/x32/llseek.S: Remove file.
2018-05-22 15:44:01 +00:00
Florian Weimer ed0d698870 i386: Drop -mpreferred-stack-boundary=4
The flag was a left-over from when the -mpreferred-stack-boundary=2 flag
was removed in commit db290cf592.
2018-05-22 14:44:14 +02:00
H.J. Lu e28e9b1ec4 x86-64: Check Prefer_FSRM in ifunc-memmove.h
Although the REP MOVSB implementations of memmove, memcpy and mempcpy
aren't used by the current processors, this patch adds Prefer_FSRM
check in ifunc-memmove.h so that they can be used in the future.

	* sysdeps/x86/cpu-features.h (bit_arch_Prefer_FSRM): New.
	(index_arch_Prefer_FSRM): Likewise.
	* sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)):
	Also check Prefer_FSRM.
	* sysdeps/x86_64/multiarch/ifunc-memmove.h (IFUNC_SELECTOR):
	Also return OPTIMIZE (erms) for Prefer_FSRM.
2018-05-21 16:54:59 -07:00
H.J. Lu 1af30adcd5 Initial Fast Short REP MOVSB (FSRM) support
The newer Intel processors support Fast Short REP MOVSB which has a
feature bit in CPUID.  This patch adds the Fast Short REP MOVSB (FSRM)
bit to x86 cpu-features.

	* sysdeps/x86/cpu-features.h (bit_cpu_FSRM): New.
	(index_cpu_FSRM): Likewise.
	(reg_FSRM): Likewise.
2018-05-21 10:54:32 -07:00
Joseph Myers 7c67e6e8b9 Split test-tgmath3 by function.
It has been noted that test-tgmath3 is slow to compile, and to link on
some systems
<https://sourceware.org/ml/libc-alpha/2018-02/msg00477.html>, because
of the size of the test.

I'm working on tgmath.h support for the TS 18661-1 / 18661-3 functions
that round their results to a narrower type.  For the functions
already present in glibc, this wouldn't make test-tgmath3 much bigger,
because those functions only have two arguments.  For the narrowing
versions of fma (for which I've not yet added the functions to glibc),
however, it would result in many configurations building tests of the
type-generic macros f32fma, f64fma, f32xfma, f64xfma, each with 21
possible types for each of three arguments (float, double, long double
aren't valid argument types for these macros when they return a
_FloatN / _FloatNx type), so substantially increasing the size of the
testcase.

To avoid further increasing the size of a single test when adding the
type-generic narrowing fma macros, this patch arranges for the
test-tgmath3 tests to be run separately for each function tested.  The
fma tests are still by far the largest (next is pow, as that has two
arguments that can be real or complex; after that, the two-argument
real-only functions), but each type-generic fma macro for a different
return type would end up with its tests being run separately, rather
than increasing the size of a single test.

To avoid accidentally missing testing a macro because
gen-tgmath-tests.py supports testing it but the makefile fails to call
it for that function, a test is also added that verifies that the
lists of macros in the makefile and gen-tgmath-tests.py agree.

Tested for x86_64.

	* math/gen-tgmath-tests.py: Import sys.
	(Tests.__init__): Initialize macros_seen.
	(Tests.add_tests): Add macro to macros_seen.  Only generate tests
	if requested to do so for this macro.
	(Tests.add_all_tests): Take argument for macro for which to
	generate tests.
	(Tests.check_macro_list): New function.
	(main): Handle check-list argument and argument specifying macro
	for which to generate tests.
	* math/Makefile [PYTHON] (tgmath3-macros): New variable.
	[PYTHON] (tgmath3-macro-tests): Likewise.
	[PYTHON] (tests): Add $(tgmath3-macro-tests) not test-tgmath3.
	[PYTHON] (generated): Add $(addsuffix .c,$(tgmath3-macro-tests))
	not test-tgmath3.c.
	[PYTHON] (CFLAGS-test-tgmath3.c): Remove.
	[PYTHON] ($(tgmath3-macro-tests:%=$(objpfx)%.o): Add -fno-builtin
	to CFLAGS.
	[PYTHON] ($(objpfx)test-tgmath3.c): Replace rule by....
	[PYTHON] ($(foreach
	m,$(tgmath3-macros),$(objpfx)test-tgmath3-$(m).c): ... this.  New
	rule.
	[PYTHON] (tests-special): Add
	$(objpfx)test-tgmath3-macro-list.out.
	[PYTHON] ($(objpfx)test-tgmath3-macro-list.out): New rule.
2018-05-18 17:30:18 +00:00
Joseph Myers ebc129fd17 Obsolete nfsservctl.
The Linux nfsservctl syscall was removed in Linux 3.1.  Since the
minimum kernel version for use with glibc is 3.2, the glibc wrapper
for this syscall can no longer usefully be called.  This patch makes
it into a compat symbol, not provided at all for static linking or new
ports.  (It was already the case that there was no header declaration
of this function.)

Tested for x86_64.

	* sysdeps/unix/sysv/linux/syscalls.list (nfsservctl): Make into a
	compat symbol, disabled for minimum symbol version GLIBC_2.28 and
	later.
2018-05-18 16:50:44 +00:00
Joseph Myers 78274dc8ce Fix year 2039 bug for localtime with 64-bit time_t (bug 22639).
Bug 22639 reports localtime failing to handle time offset transitions
correctly in 2039 and later on platforms with 64-bit time_t.

The problem is the use of SECSPERDAY (constant 86400) in calculations
such as

    t = ((year - 1970) * 365
	 + /* Compute the number of leapdays between 1970 and YEAR
	      (exclusive).  There is a leapday every 4th year ...  */
	 + ((year - 1) / 4 - 1970 / 4)
	 /* ... except every 100th year ... */
	 - ((year - 1) / 100 - 1970 / 100)
	 /* ... but still every 400th year.  */
	 + ((year - 1) / 400 - 1970 / 400)) * SECSPERDAY;

where t is of type time_t and year is of type int.  Before my commit
92bd70fb85 (an update from tzcode,
included in 2.26 and later releases), SECSPERDAY was obtained from a
file imported from tzcode, where the value included a cast to
int_fast32_t.  On 64-bit platforms, glibc defines int_fast32_t to be
long int, so 64-bit, but my patch resulted in it changing to int.
(The bug would probably have existed even before my patch for x32,
which has 64-bit time_t but 32-bit int_fast32_t, but I haven't
verified that.)

This patch fixes the problem by including a cast to time_t in the
definition of SECSPERDAY.  (64-bit time support for 32-bit systems
should move such code that isn't a public interface to using the
internal 64-bit version of time_t throughout.)

Tested for x86_64 and x86.

	[BZ #22639]
	* time/tzset.c (SECSPERDAY): Cast to time_t.
	* time/tst-y2039.c: New file.
	* time/Makefile (tests): Add tst-y2039.
2018-05-18 11:57:15 +00:00
Leonardo Sandoval 6f7fdeeb69 Add missing changelog from previous commit 2018-05-17 10:31:11 -05:00
Florian Weimer e363a91c21 math: Reverse include order in <math-type-macros-*.h>
_Float128 is defined for certain compilers indirectly from
<libm-alias-double.h>, and <ieee754_float128.h> (included from
<math-nan-payload-float128.h>) needs this definition.
2018-05-17 15:48:42 +02:00
Andreas Schwab dae6c43c33 Remove unneeded setting of errno after malloc failure
The errno value has alread been set by malloc.
2018-05-17 15:47:25 +02:00
H.J. Lu 0068c08588 nptl: Remove __ASSUME_PRIVATE_FUTEX
Since __ASSUME_PRIVATE_FUTEX is always defined, this patch removes the
!__ASSUME_PRIVATE_FUTEX paths.

Tested with build-many-glibcs.py.

	* nptl/allocatestack.c (allocate_stack): Remove the
	!__ASSUME_PRIVATE_FUTEX paths.
	* nptl/descr.h (header): Remove the !__ASSUME_PRIVATE_FUTEX path.
	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
	Likewise.
	* sysdeps/i386/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Removed.
	* sysdeps/powerpc/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
	* sysdeps/sh/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
	* sysdeps/x86_64/nptl/tcb-offsets.sym (PRIVATE_FUTEX): Likewise.
	* sysdeps/i386/nptl/tls.h: (tcbhead_t): Remve the
	!__ASSUME_PRIVATE_FUTEX path.
	* sysdeps/s390/nptl/tls.h (tcbhead_t): Likewise.
	* sysdeps/sparc/nptl/tls.h (tcbhead_t): Likewise.
	* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Likewise.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Remove the
	!__ASSUME_PRIVATE_FUTEX macros.
	* sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_PRIVATE_FUTEX): Removed.
2018-05-17 04:25:10 -07:00
Joseph Myers 632a6cbe44 Add narrowing divide functions.
This patch adds the narrowing divide functions from TS 18661-1 to
glibc's libm: fdiv, fdivl, ddivl, f32divf64, f32divf32x, f32xdivf64
for all configurations; f32divf64x, f32divf128, f64divf64x,
f64divf128, f32xdivf64x, f32xdivf128, f64xdivf128 for configurations
with _Float64x and _Float128; __nldbl_ddivl for ldbl-opt.

The changes are mostly essentially the same as for the other narrowing
functions, so the description of those generally applies to this patch
as well.

Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft
float) and powerpc, and with build-many-glibcs.py.

	* math/Makefile (libm-narrow-fns): Add div.
	(libm-test-funcs-narrow): Likewise.
	* math/Versions (GLIBC_2.28): Add narrowing divide functions.
	* math/bits/mathcalls-narrow.h (div): Use __MATHCALL_NARROW.
	* math/gen-auto-libm-tests.c (test_functions): Add div.
	* math/math-narrow.h (CHECK_NARROW_DIV): New macro.
	(NARROW_DIV_ROUND_TO_ODD): Likewise.
	(NARROW_DIV_TRIVIAL): Likewise.
	* sysdeps/ieee754/float128/float128_private.h (__fdivl): New
	macro.
	(__ddivl): Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fdiv and
	ddiv.
	(CFLAGS-nldbl-ddiv.c): New variable.
	(CFLAGS-nldbl-fdiv.c): Likewise.
	* sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add
	__nldbl_ddivl.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_ddivl): New
	prototype.
	* manual/arith.texi (Misc FP Arithmetic): Document fdiv, fdivl,
	ddivl, fMdivfN, fMdivfNx, fMxdivfN and fMxdivfNx.
	* math/auto-libm-test-in: Add tests of div.
	* math/auto-libm-test-out-narrow-div: New generated file.
	* math/libm-test-narrow-div.inc: New file.
	* sysdeps/i386/fpu/s_f32xdivf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_f32xdivf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fdiv.c: Likewise.
	* sysdeps/ieee754/float128/s_f32divf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64divf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64xdivf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_ddivl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_f64xdivf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fdivl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_ddivl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fdivl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_ddivl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fdivl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-ddiv.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-fdiv.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_ddivl.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fdiv.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fdivl.c: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
	* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
	* 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/riscv/rv64/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/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2018-05-17 00:40:52 +00:00
Adhemerval Zanella 8c78faa9ef Fix concurrent changes on nscd aware files (BZ #23178)
As indicated by BZ#23178, concurrent access on some files read by nscd
may result non expected data send through service requisition.  This is
due 'sendfile' Linux implementation where for sockets with zero-copy
support, callers must ensure the transferred portions of the the file
reffered by input file descriptor remain unmodified until the reader
on the other end of socket has consumed the transferred data.

I could not find any explicit documentation stating this behaviour on
Linux kernel documentation.  However man-pages sendfile entry [1] states
in NOTES the aforementioned remark.  It was initially pushed on man-pages
with an explicit testcase [2] that shows changing the file used in
'sendfile' call prior the socket input data consumption results in
previous data being lost.

From commit message it stated on tested Linux version (3.15) only TCP
socket showed this issues, however on recent kernels (4.4) I noticed the
same behaviour for local sockets as well.

Since sendfile on HURD is a read/write operation and the underlying
issue on Linux, the straightforward fix is just remove sendfile use
altogether.  I am really skeptical it is hitting some hotstop (there
are indication over internet that sendfile is helpfull only for large
files, more than 10kb) here to justify that extra code complexity or
to pursuit other possible fix (through memory or file locks for
instance, which I am not sure it is doable).

Checked on x86_64-linux-gnu.

	[BZ #23178]
	* nscd/nscd-client.h (sendfileall): Remove prototype.
	* nscd/connections.c [HAVE_SENDFILE] (sendfileall): Remove function.
	(handle_request): Use writeall instead of sendfileall.
	* nscd/aicache.c (addhstaiX): Likewise.
	* nscd/grpcache.c (cache_addgr): Likewise.
	* nscd/hstcache.c (cache_addhst): Likewise.
	* nscd/initgrcache.c (addinitgroupsX): Likewise.
	* nscd/netgroupcache.c (addgetnetgrentX, addinnetgrX): Likewise.
	* nscd/pwdcache.c (cache_addpw): Likewise.
	* nscd/servicescache.c (cache_addserv): Likewise.
	* sysdeps/unix/sysv/linux/Makefile [$(subdir) == nscd]
	(sysdep-CFLAGS): Remove -DHAVE_SENDFILE.
	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDFILE):
	Remove define.

[1] http://man7.org/linux/man-pages/man2/sendfile.2.html
[2] 7b6a329977 (diff-efd6af3a70f0f07c578e85b51e83b3c3)
2018-05-16 13:44:53 -03:00
H.J. Lu 04958880e0 x86-64: Use IFUNC strncat inside libc.so
Unlike i386, we can call hidden IFUNC functions inside libc.so since
x86-64 PLT is always PIC.

Tested on x86-64.

	* sysdeps/x86_64/multiarch/strncat-c.c (STRNCAT_PRIMARY): Removed.
	Include <string/strncat.c>.
	* sysdeps/x86_64/multiarch/strncat.c (__strncat): New strong
	alias.
	(__GI___strncat): New hidden alias.
2018-05-16 09:04:35 -07:00
Joseph Myers c9992d13c4 Update MIPS libm-test-ulps.
* sysdeps/mips/mips32/libm-test-ulps: Update.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
2018-05-16 15:35:26 +00:00
Florian Weimer 2afece36f6 support: Add TEST_COMPARE_BLOB, support_quote_blob
The declaration of support_test_compare_blob uses unsigned long int,
to avoid including <stddef.h>.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-05-16 17:00:36 +02:00
Florian Weimer 9761bf4dfa math: Merge strtod_nan_*.h into math-type-macros-*.h
This change will eventually make it possible to compile
stdlib/strtod_nan_main.c as part of math/s_nan_template.c.
2018-05-16 06:03:08 +02:00
Joseph Myers 69a01461ee Add narrowing multiply functions.
This patch adds the narrowing multiply functions from TS 18661-1 to
glibc's libm: fmul, fmull, dmull, f32mulf64, f32mulf32x, f32xmulf64
for all configurations; f32mulf64x, f32mulf128, f64mulf64x,
f64mulf128, f32xmulf64x, f32xmulf128, f64xmulf128 for configurations
with _Float64x and _Float128; __nldbl_dmull for ldbl-opt.

The changes are mostly essentially the same as for the narrowing add
functions, so the description of those generally applies to this patch
as well.  f32xmulf64 for i386 cannot use precision control as used for
add and subtract, because that would result in double rounding for
subnormal results, so that uses round-to-odd with long double
intermediate result instead.  The soft-fp support involves adding a
new FP_TRUNC_COOKED since soft-fp multiplication uses cooked inputs
and outputs.

Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft
float) and powerpc, and with build-many-glibcs.py.

	* math/Makefile (libm-narrow-fns): Add mul.
	(libm-test-funcs-narrow): Likewise.
	* math/Versions (GLIBC_2.28): Add narrowing multiply functions.
	* math/bits/mathcalls-narrow.h (mul): Use __MATHCALL_NARROW.
	* math/gen-auto-libm-tests.c (test_functions): Add mul.
	* math/math-narrow.h (CHECK_NARROW_MUL): New macro.
	(NARROW_MUL_ROUND_TO_ODD): Likewise.
	(NARROW_MUL_TRIVIAL): Likewise.
	* soft-fp/op-common.h (FP_TRUNC_COOKED): Likewise.
	* sysdeps/ieee754/float128/float128_private.h (__fmull): New
	macro.
	(__dmull): Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmul and
	dmul.
	(CFLAGS-nldbl-dmul.c): New variable.
	(CFLAGS-nldbl-fmul.c): Likewise.
	* sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add
	__nldbl_dmull.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dmull): New
	prototype.
	* manual/arith.texi (Misc FP Arithmetic): Document fmul, fmull,
	dmull, fMmulfN, fMmulfNx, fMxmulfN and fMxmulfNx.
	* math/auto-libm-test-in: Add tests of mul.
	* math/auto-libm-test-out-narrow-mul: New generated file.
	* math/libm-test-narrow-mul.inc: New file.
	* sysdeps/i386/fpu/s_f32xmulf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_f32xmulf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fmul.c: Likewise.
	* sysdeps/ieee754/float128/s_f32mulf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64mulf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64xmulf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_dmull.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_f64xmulf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmull.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_dmull.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmull.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_dmull.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmull.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-dmul.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-fmul.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_dmull.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fmul.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fmull.c: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
	* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
	* 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/riscv/rv64/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/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2018-05-16 00:05:28 +00:00
H.J. Lu a15529fda8 i386: Replace PREINIT_FUNCTION@PLT with *%eax in call
Since we have loaded address of PREINIT_FUNCTION into %eax, we can
avoid extra branch to PLT slot.

	* sysdeps/i386/crti.S (_init): Replace PREINIT_FUNCTION@PLT
	with *%eax in call.

Acked-by: Christian Brauner (Ubuntu) <christian@brauner.io>
2018-05-14 09:24:06 -07:00
H.J. Lu 98ee36c7a4 x86: Add sysdeps/x86/ldsodefs.h
Merge sysdeps/i386/ldsodefs.h and sysdeps/x86_64/ldsodefs.h into
sysdeps/x86/ldsodefs.h.

Tested on i686 and x86-64.

	* sysdeps/i386/ldsodefs.h: Removed.
	* sysdeps/x86_64/ldsodefs.h: Moved to ...
	* sysdeps/x86/ldsodefs.h: This.
	(La_i86_regs): New.
	(La_i86_retval): Likewise.
	(ARCH_PLTENTER_MEMBERS): Add i86_gnu_pltenter.
	(ARCH_PLTEXIT_MEMBERS): i86_gnu_pltexit.

Acked-by: Christian Brauner (Ubuntu) christian@brauner.io
2018-05-14 09:19:41 -07:00
H.J. Lu e322ec3282 x86-64: Remove the unnecessary testl in strlen-avx2.S
Since the result of testl is never used, this patch removes it.

Tested on 64-bit AVX2 machine.

	* sysdeps/x86_64/multiarch/strlen-avx2.S (STRLEN): Remove the
	unnecessary testl.
2018-05-14 03:41:35 -07:00
Alan Modra 0937e209a7 R_PARISC_TLS_DTPOFF32 reloc handling
* sysdeps/hppa/dl-machine.h (elf_machine_rela): Add
	R_PARISC_TLS_DTPOFF32 reloc addend.
2018-05-13 08:32:28 +09:30
Tulio Magno Quites Machado Filho 5db7d705db powerpc: Fix the compiler type used with C++ when -mabi=ieeelongdouble
When compiling C++ code with -mabi=ieeelongdouble, KCtype is
unavailable and the long double type should be used instead.

This is also providing macro __HAVE_FLOAT128_UNLIKE_LDBL in order to
identify the kind of long double type is being used in the current
compilation unit.
Notice that bits/floatn.h cannot benefit from the new macro due to order
of header inclusion.

	* bits/floatn-common.h: Define __HAVE_FLOAT128_UNLIKE_LDBL.
	* math/math.h: Restrict the prototype definition for the functions
	issignaling(_Float128) and iszero(_Float128); and template
	__iseqsig_type<_Float128>, from __HAVE_DISTINCT_FLOAT128 to
	__HAVE_FLOAT128_UNLIKE_LDBL.
	* sysdeps/powerpc/bits/floatn.h [__HAVE_FLOAT128
	&& (!__GNUC_PREREQ (7, 0) || defined __cplusplus)
	&& __LDBL_MANT_DIG__ == 113]: Use long double suffix for
	__f128() constants; define the type _Float128 as long double;
	and reuse long double in __CFLOAT128.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-05-11 18:05:03 -03:00
Joseph Myers b4d5b8b021 Do not include math-barriers.h in math_private.h.
This patch continues the math_private.h cleanup by stopping
math_private.h from including math-barriers.h and making the users of
the barrier macros include the latter header directly.  No attempt is
made to remove any math_private.h includes that are now unused, except
in strtod_l.c where that is done to avoid line number changes in
assertions, so that installed stripped shared libraries can be
compared before and after the patch.  (I think the floating-point
environment support in math_private.h should also move out - some
architectures already have fenv_private.h as an architecture-internal
header included from their math_private.h - and after moving that out
might be a better time to identify unused math_private.h includes.)

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/math_private.h: Do not include
	<math-barriers.h>.
	* stdlib/strtod_l.c: Include <math-barriers.h> instead of
	<math_private.h>.
	* math/fromfp.h: Include <math-barriers.h>.
	* math/math-narrow.h: Likewise.
	* math/s_nextafter.c: Likewise.
	* math/s_nexttowardf.c: Likewise.
	* sysdeps/aarch64/fpu/s_llrint.c: Likewise.
	* sysdeps/aarch64/fpu/s_llrintf.c: Likewise.
	* sysdeps/aarch64/fpu/s_lrint.c: Likewise.
	* sysdeps/aarch64/fpu/s_lrintf.c: Likewise.
	* sysdeps/i386/fpu/s_nextafterl.c: Likewise.
	* sysdeps/i386/fpu/s_nexttoward.c: Likewise.
	* sysdeps/i386/fpu/s_nexttowardf.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atanh.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_j0.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_expm1.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fma.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fmaf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_log1p.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/flt-32/e_atanhf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j0f.c: Likewise.
	* sysdeps/ieee754/flt-32/s_expm1f.c: Likewise.
	* sysdeps/ieee754/flt-32/s_log1pf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_nextafterf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_powl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nextafterl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttoward.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_atanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_j0l.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttoward.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nextafterl.c: Likewise.
2018-05-11 15:11:38 +00:00
Florian Weimer fc79706a32 time: Use 64-bit time values for time zone parsing 2018-05-11 16:30:30 +02:00
Florian Weimer 89aacb513e sunrpc: Remove stray exports without --enable-obsolete-rpc [BZ #23166]
This is needed to avoid a warning when linking against libtirpc:

/lib64/libc.so.6: warning: common of `rpc_createerr@@TIRPC_0.3.0' overridden by definition
/usr/lib64/libtirpc.so: warning: defined here

This ld warning is not enabled by default; -Wl,--warn-common enables it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-05-11 15:36:50 +02:00
Rafal Luzynski bb066cb806 gd_GB: Fix typo in abbreviated "May" (bug 23152).
[BZ #23152]
	* localedata/locales/gd_GB (abmon): Fix typo in May:
	"Mhàrt" -> "Cèit".  Adjust the comment according to the change.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-05-11 00:00:10 +02:00
Siddhesh Poyarekar db725a458e aarch64,falkor: Ignore prefetcher tagging for smaller copies
For smaller and medium sized copies, the effect of hardware
prefetching are not as dominant as instruction level parallelism.
Hence it makes more sense to load data into multiple registers than to
try and route them to the same prefetch unit.  This is also the case
for the loop exit where we are unable to latch on to the same prefetch
unit anyway so it makes more sense to have data loaded in parallel.

The performance results are a bit mixed with memcpy-random, with
numbers jumping between -1% and +3%, i.e. the numbers don't seem
repeatable.  memcpy-walk sees a 70% improvement (i.e. > 2x) for 128
bytes and that improvement reduces down as the impact of the tail copy
decreases in comparison to the loop.

	* sysdeps/aarch64/multiarch/memcpy_falkor.S (__memcpy_falkor):
	Use multiple registers to copy data in loop tail.
2018-05-11 00:11:52 +05:30
Siddhesh Poyarekar 70c97f8493 aarch64,falkor: Ignore prefetcher hints for memmove tail
The tail of the copy loops are unable to train the falkor hardware
prefetcher because they load from a different base compared to the hot
loop.  In this case avoid serializing the instructions by loading them
into different registers.  Also peel the last iteration of the loop
into the tail (and have them use different registers) since it gives
better performance for medium sizes.

This results in performance improvements of between 3% and 20% over
the current falkor implementation for sizes between 128 bytes and 1K
on the memmove-walk benchmark, thus mostly covering the regressions
seen against the generic memmove.

	* sysdeps/aarch64/multiarch/memmove_falkor.S
	(__memmove_falkor): Use multiple registers to move data in
	loop tail.
2018-05-11 00:08:02 +05:30
Joseph Myers 8f5b00d375 Move math_check_force_underflow macros to separate math-underflow.h.
This patch continues cleaning up math_private.h by moving the
math_check_force_underflow set of macros to a separate header
math-underflow.h.

This header is included by the files that need it rather than from
math_private.h.  Moving these macros to a separate file removes the
math_private.h uses of macros from float.h, so the inclusion of
float.h in math_private.h is also removed; files that were depending
on that inclusion are fixed to include float.h directly.  The
inclusion of math-barriers.h from math_private.h will be removed in a
separate patch.

Tested for x86_64 and x86.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* math/math-underflow.h: New file.
	* sysdeps/generic/math_private.h: Do not include <float.h>.
	(fabs_tg): Remove macro.  Moved to math-underflow.h.
	(min_of_type_f): Likewise.
	(min_of_type_): Likewise.
	(min_of_type_l): Likewise.
	(min_of_type_f128): Likewise.
	(min_of_type): Likewise.
	(math_check_force_underflow): Likewise.
	(math_check_force_underflow_nonneg): Likewise.
	(math_check_force_underflow_complex): Likewise.
	* math/e_exp2_template.c: Include <math-underflow.h>.
	* math/k_casinh_template.c: Likewise.
	* math/s_catan_template.c: Likewise.
	* math/s_catanh_template.c: Likewise.
	* math/s_ccosh_template.c: Likewise.
	* math/s_cexp_template.c: Likewise.
	* math/s_clog10_template.c: Likewise.
	* math/s_clog_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_csqrt_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_asin.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atanh.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_hypot.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_asinh.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_expm1.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_log1p.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_tanh.c: Likewise.
	* sysdeps/ieee754/flt-32/e_asinf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_atanhf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_sinhf.c: Likewise.
	* sysdeps/ieee754/flt-32/k_sinf.c: Likewise.
	* sysdeps/ieee754/flt-32/k_tanf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_asinhf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_atanf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_erff.c: Likewise.
	* sysdeps/ieee754/flt-32/s_expm1f.c: Likewise.
	* sysdeps/ieee754/flt-32/s_log1pf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_tanhf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_asinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_atanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_hypotl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_sinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/k_sincosl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/k_sinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/k_tanl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_asinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_atanl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_erfl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_expm1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_log1pl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_tanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_powl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_sinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_tanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_asinl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_atanhl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_hypotl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_sinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/k_sinl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/k_tanl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_asinhl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_erfl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_tanhl.c: Likewise.
	* sysdeps/powerpc/fpu/e_hypot.c: Likewise.
	* sysdeps/x86/fpu/powl_helper.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_nextup.c: Include <float.h>.
	* sysdeps/ieee754/flt-32/s_nextupf.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nextupl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_nextupl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_nextupl.c: Likewise.
2018-05-10 00:53:04 +00:00
Joseph Myers 9ed2e15ff4 Move math_opt_barrier, math_force_eval to separate math-barriers.h.
This patch continues cleaning up math_private.h by moving the
math_opt_barrier and math_force_eval macros to a separate header
math-barriers.h.

At present, those macros are inside a "#ifndef math_opt_barrier" in
math_private.h to allow architectures to override them and then use
a separate math-barriers.h header, no such #ifndef or #include_next is
needed; architectures just have their own alternative version of
math-barriers.h when providing their own optimized versions that avoid
going through memory unnecessarily.  The generic math-barriers.h has a
comment added to document these two macros.

In this patch, math_private.h is made to #include <math-barriers.h>,
so files using these macros do not need updating yet.  That is because
of uses of math_force_eval in math_check_force_underflow and
math_check_force_underflow_nonneg, which are still defined in
math_private.h.  Once those are moved out to a separate header, that
separate header can be made to include <math-barriers.h>, as can the
other files directly using these barrier macros, and then the include
of <math-barriers.h> from math_private.h can be removed.

Tested for x86_64 and x86.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/generic/math-barriers.h: New file.
	* sysdeps/generic/math_private.h [!math_opt_barrier]
	(math_opt_barrier): Move to math-barriers.h.
	[!math_opt_barrier] (math_force_eval): Likewise.
	* sysdeps/aarch64/fpu/math-barriers.h: New file.
	* sysdeps/aarch64/fpu/math_private.h (math_opt_barrier): Move to
	math-barriers.h.
	(math_force_eval): Likewise.
	* sysdeps/alpha/fpu/math-barriers.h: New file.
	* sysdeps/alpha/fpu/math_private.h (math_opt_barrier): Move to
	math-barriers.h.
	(math_force_eval): Likewise.
	* sysdeps/x86/fpu/math-barriers.h: New file.
	* sysdeps/i386/fpu/fenv_private.h (math_opt_barrier): Move to
	math-barriers.h.
	(math_force_eval): Likewise.
	* sysdeps/m68k/m680x0/fpu/math_private.h: Move to....
	* sysdeps/m68k/m680x0/fpu/math-barriers.h: ... here.  Adjust
	multiple-include guard for rename.
	* sysdeps/powerpc/fpu/math-barriers.h: New file.
	* sysdeps/powerpc/fpu/math_private.h (math_opt_barrier): Move to
	math-barriers.h.
	(math_force_eval): Likewise.
2018-05-09 19:45:47 +00:00
Paul Pluzhnikov 5460617d15 Fix BZ 22786: integer addition overflow may cause stack buffer overflow
when realpath() input length is close to SSIZE_MAX.

2018-05-09  Paul Pluzhnikov  <ppluzhnikov@google.com>

	[BZ #22786]
	* stdlib/canonicalize.c (__realpath): Fix overflow in path length
	computation.
	* stdlib/Makefile (test-bz22786): New test.
	* stdlib/test-bz22786.c: New test.
2018-05-08 18:12:41 -07:00
Joseph Myers aaee3cd88e Move math_narrow_eval to separate math-narrow-eval.h.
This patch continues cleaning up the math_private.h header, which
contains lots of different definitions many of which are only needed
by a limited subset of files using that header (and some of which are
overridden by architectures that only want to override selected parts
of the header), by moving the math_narrow_eval macro out to a separate
math-narrow-eval.h header, only included by those files that need it.
That header is placed in include/ (since it's used in stdlib/, not
just files built in math/, but no sysdeps variants are needed at
present).

Tested for x86_64, and with build-many-glibcs.py.  (Installed stripped
shared libraries change because of line numbers in assertions in
strtod_l.c.)

	* include/math-narrow-eval.h: New file.  Contents moved from ....
	* sysdeps/generic/math_private.h: ... here.
	(math_narrow_eval): Remove macro.  Moved to math-narrow-eval.h.
	[FLT_EVAL_METHOD != 0] (excess_precision): Likewise.
	* math/s_fdim_template.c: Include <math-narrow-eval.h>.
	* stdlib/strtod_l.c: Likewise.
	* sysdeps/i386/fpu/s_f32xaddf64.c: Likewise.
	* sysdeps/i386/fpu/s_f32xsubf64.c: Likewise.
	* sysdeps/i386/fpu/s_fdim.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_cosh.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_lgamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sinh.c: Likewise.
	* sysdeps/ieee754/dbl-64/gamma_productf.c: Likewise.
	* sysdeps/ieee754/dbl-64/k_rem_pio2.c: Likewise.
	* sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_erf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/flt-32/e_coshf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_exp2f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_expf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_sinhf.c: Likewise.
	* sysdeps/ieee754/flt-32/k_rem_pio2f.c: Likewise.
	* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_erff.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/ldbl-96/gamma_product.c: Likewise.
2018-05-09 00:15:10 +00:00
Andreas Schwab 0555c47719 Fix comment typo 2018-05-08 14:59:13 +02:00
H.J. Lu 50d7d351b5 x86-64/memset: Mark the debugger symbol as hidden
When MEMSET_SYMBOL (__memset, erms) is provided for debugger, mark it
as hidden so that it will be local to the library.

	* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
	(MEMSET_SYMBOL (__memset, erms)): Mark the debugger symbol as
	hidden.
2018-05-07 11:01:48 -07:00
Siddhesh Poyarekar 543477f78b benchtests: Move iterator declaration into loop header
This is a minor style change to move the definition of I to its usage
scope instead of at the top of the function.  This is consistent with
glibc style guidelines and more importantly it was getting in the way
of my testing.

	* benchtests/bench-memcpy-walk.c (do_test): Move declaration
	of I into loop header.
	* benchtests/bench-memmove-walk.c (do_test): Likewise.
2018-05-07 20:54:31 +05:30
Alexandre Oliva ffa81c22a3 Revert:
2018-04-30  Raymond Nicholson <rain1@airmail.cc>
* manual/startup.texi (Aborting a Program): Remove inappropriate joke.

This complies with the decision of the project leader and primary and
ultimate maintainer, who partially delegated maintainership to myself
and others under certain constraints.

This is also in line with the community-agreed procedures.

It is obvious that we didn't have consensus on a decision to install
that patch, since both sides are still arguing over it.

As for the decision to reverse the deletion, if we even need one to
counter a move that did not have consensus, although nobody else offered
to install the reversal and restore the status prior to the fait
accompli, and some explicitly refused to do so themselves, nobody
objected when I offered to do so.  Therefore, by the same reasoning that
led to the mistaken installation of the patch, and after a much longer
wait for objections, I understand there is consensus on my reverting it.
2018-05-07 01:40:30 -03:00
Paul Pluzhnikov 0065aaaaae Fix BZ 20419. A PT_NOTE in a binary could be arbitratily large, so using
alloca for it may cause stack overflow.  If the note is larger than
__MAX_ALLOCA_CUTOFF, use dynamically allocated memory to read it in.

2018-05-05  Paul Pluzhnikov  <ppluzhnikov@google.com>

	[BZ #20419]
	* elf/dl-load.c (open_verify): Fix stack overflow.
	* elf/Makefile (tst-big-note): New test.
	* elf/tst-big-note-lib.S: New.
	* elf/tst-big-note.c: New.
2018-05-05 18:08:27 -07:00
Joseph Myers b289cd9db8 Ignore absolute symbols in ABI tests.
A recent binutils patch
<https://sourceware.org/ml/binutils/2018-04/msg00336.html> stops the
MIPS linker including the _gp_disp absolute symbol in dynamic symbol
tables.

With older binutils, it is included for MIPS o32 (despite the use of
symbol versioning), and this means that all the ABI test baselines for
MIPS o32 include "_gp_disp _gp_disp A".  This symbol is not
meaningfully part of the ABI for shared libraries, since it always has
to be resolved at static link time to the local definition for the
linked object.

All the other absolute symbols in ABI test baselines are the names of
symbol versions.  I don't think the mere existence of a symbol version
with a given name - as opposed to the contents of that version if
nonempty - is part of the ABI either.  Thus, this patch allows the ABI
tests to pass both before and after the binutils change by changing
abilist.awk not to include absolute symbols in its output, and
changing the baselines accordingly.

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

	* scripts/abilist.awk: Ignore absolute symbols.
	* sysdeps/mach/hurd/i386/ld.abilist: Remove absolute symbols.
	* sysdeps/mach/hurd/i386/libBrokenLocale.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libanl.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libc.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libcrypt.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libdl.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libnsl.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libpthread.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libresolv.abilist: Likewise.
	* sysdeps/mach/hurd/i386/librt.abilist: Likewise.
	* sysdeps/mach/hurd/i386/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libcidn.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_compat.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_dns.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_files.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_hesiod.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_nis.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libnss_nisplus.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libresolv.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libthread_db.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libBrokenLocale-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libanl-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libcrypt-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libdl-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libdl.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/powerpc/powerpc64/libnsl-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libpthread.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libresolv-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libresolv.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/librt-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libthread_db-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libthread_db.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libutil-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/riscv/rv64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/libmvec.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libBrokenLocale.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libutil.abilist: Likewise.
2018-05-04 15:46:32 +00:00
Stefan Liebler 1660901840 Fix blocking pthread_join. [BZ #23137]
On s390 (31bit) if glibc is build with -Os, pthread_join sometimes
blocks indefinitely. This is e.g. observable with
testcase intl/tst-gettext6.

pthread_join is calling lll_wait_tid(tid), which performs the futex-wait
syscall in a loop as long as tid != 0 (thread is alive).

On s390 (and build with -Os), tid is loaded from memory before
comparing against zero and then the tid is loaded a second time
in order to pass it to the futex-wait-syscall.
If the thread exits in between, then the futex-wait-syscall is
called with the value zero and it waits until a futex-wake occurs.
As the thread is already exited, there won't be a futex-wake.

In lll_wait_tid, the tid is stored to the local variable __tid,
which is then used as argument for the futex-wait-syscall.
But unfortunately the compiler is allowed to reload the value
from memory.

With this patch, the tid is loaded with atomic_load_acquire.
Then the compiler is not allowed to reload the value for __tid from memory.

ChangeLog:

	[BZ #23137]
	* sysdeps/nptl/lowlevellock.h (lll_wait_tid):
	Use atomic_load_acquire to load __tid.
2018-05-04 10:00:59 +02:00
H.J. Lu 556f5c46c7 cl 2018-05-02 06:26:19 -07:00
H.J. Lu 8b8f32b280 x86-64/setcontext: Pop the pointer into %rdx after syscall
To prepare for shadow stack support, pop the pointer into %rdx after
syscall and use %rdx, instead of %rsi, to restore context.  There is
no functional change.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* sysdeps/unix/sysv/linux/x86_64/setcontext.S (__setcontext):
	Pop the pointer into %rdx after syscall and use %rdx, instead
	of %rsi, to restore context.
2018-05-02 06:21:24 -07:00
H.J. Lu d6cc1829aa x86: Use pad in pthread_unwind_buf to preserve shadow stack register
The pad array in struct pthread_unwind_buf is used by setjmp to save
shadow stack register.  We assert that size of struct pthread_unwind_buf
is no less than offset of shadow stack pointer + shadow stack pointer
size.

Since functions, like LIBC_START_MAIN, START_THREAD_DEFN as well as
these with thread cancellation, call setjmp, but never return after
__libc_unwind_longjmp, __libc_unwind_longjmp, which is defined as
__libc_longjmp on x86, doesn't need to restore shadow stack register.
__libc_longjmp, which is a private interface for thread cancellation
implementation in libpthread, is changed to call __longjmp_cancel,
instead of __longjmp.  __longjmp_cancel is a new internal function
in libc, which is similar to __longjmp, but doesn't restore shadow
stack register.

The compatibility longjmp and siglongjmp in libpthread.so are changed
to call __libc_siglongjmp, instead of __libc_longjmp, so that they will
restore shadow stack register.

Tested with build-many-glibcs.py.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	* nptl/pthread_create.c (START_THREAD_DEFN): Clear previous
	handlers after setjmp.
	* setjmp/longjmp.c (__libc_longjmp): Don't define alias if
	defined.
	* sysdeps/unix/sysv/linux/x86/setjmpP.h: Include
	<libc-pointer-arith.h>.
	(_JUMP_BUF_SIGSET_BITS_PER_WORD): New.
	(_JUMP_BUF_SIGSET_NSIG): Changed to 96.
	(_JUMP_BUF_SIGSET_NWORDS): Changed to use ALIGN_UP and
	_JUMP_BUF_SIGSET_BITS_PER_WORD.
	* sysdeps/x86/Makefile (sysdep_routines): Add __longjmp_cancel.
	* sysdeps/x86/__longjmp_cancel.S: New file.
	* sysdeps/x86/longjmp.c: Likewise.
	* sysdeps/x86/nptl/pt-longjmp.c: Likewise.
2018-05-02 06:17:41 -07:00
Adhemerval Zanella b109fbfe4d Fix ChangeLog from cf2478d53a commit 2018-05-02 09:06:34 -03:00
Adhemerval Zanella cf2478d53a Deprecate ustat syscall interface
As for sysctl, ustat has been deprecated in favor of {f}statfs.  Also
some newer ports which uses generic interface builds a stub version that
returns ENOSYS.

This patch deprecates ustat interface by removing ustat.h related headers,
adding a compatibility symbol, and avoiding new ports to build and provide
the symbol.

Checked on x86_64-linux-gnu and i686-linux-gnu.  Also checked with a
check-abi on all affected ABIs.

	* NEWS: Add ustat.h deprecation entry.
	* bits/ustat.h: Remove file.
	* misc/sys/ustat.h: Likewise.
	* misc/ustat.h: Likewise.
	* sysdeps/unix/sysv/linux/generic/ustat.c: Likewise.
	* misc/Makefile (headers): Remove ustat.h and sys/ustat.h.
	* misc/ustat.c (__ustat): Rename to __old_ustat and export only in
	compatibility mode.
	* sysdeps/unix/sysv/linux/ustat.c (__ustat): Likewise.
	* sysdeps/unix/sysv/linux/mips/ustat.c: Define DEV_TO_KDEV and use
	generic Linux implementation.
2018-05-02 08:43:31 -03:00
Tulio Magno Quites Machado Filho dc115e1cdc Replace hidden_def with libm_hidden_def in math
libm_hidden_def expand the parameters and do not require an extra layer
of macros.
These were the last 3 files in math/ still using hidden_def().

	* math/w_exp_compat.c: Replace hidden_def with libm_hidden_def..
	* math/w_expl_compat.c: Likewise.
	* math/w_exp_template.c: Likewise.  Remove hidden_def_x.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-04-30 11:45:54 -03:00
Raymond Nicholson 340d9652b9 manual/startup.texi (Aborting a Program): Remove inappropriate joke. 2018-04-30 10:41:44 -04:00
Adhemerval Zanella c57bf7c15b Consolidate Linux readahead implementation
This patch consolidate Linux readahead implementation on generic
sysdeps/unix/sysv/linux/readahead.c one.  The changes are:

  - Assume __NR_readahead existence with current minimum kernel of 3.2
    for all architectures.

  - Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG, and SYSCALL_LL64 to pass
    the 64 bit offset.  This allows architectures with different abis
    to use the same implementation.

  - Remove arch-specific readahead implementations.

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

	* sysdeps/unix/sysv/linux/arm/readahead.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/mips32/readahead.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (readahead):
	Remove.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/readahead.c (__readahead): Assume
	__NR_readahead existence, and use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG,
	and SYSCALL_LL64.
2018-04-27 17:38:43 -03:00
Tulio Magno Quites Machado Filho 3392791442 Replace M_SUF (M_LN2) with M_MLIT (M_LN2)
According to math-type-macros.h, M_SUF should be used to paste the
suffix used by functions, while M_MLIT is used with macro constants.

	* math/e_exp2_template.c: Replace M_SUF (M_LN2) with M_MLIT (M_LN2).

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-04-27 17:13:10 -03:00
Tulio Magno Quites Machado Filho 06135c33b7 Replace M_SUF (fabs) with M_FABS
math-type-macros.h provides the macro M_FABS in order to reference
the correct fabs function for a specific type.
In most of the cases, M_FABS is identical to M_SUF (fabs), but that
may change in the future.

	* math/w_acos_template.c: Replace M_SUF (fabs) with M_FABS.
	* math/w_asin_template.c: Likewise.
	* math/w_atanh_template.c: Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-04-27 17:11:29 -03:00
Gabriel F. T. Gomes 3a33b06969 powerpc64*: fix the order of implied sysdeps directories
The creation of the divergent sysdeps directory for powerpc64le

commit 2f7f3cd8cd
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Fri Jul 15 18:04:40 2016 -0500

    powerpc64le: Create divergent sysdep directory for powerpc64le.

allowed float128 to be enabled for powerpc64le (little-endian) and not
for powerpc64 (big-endian).  Since the only intended difference between
them was the presence or absence of the float128 interface, the sysdeps
directory for powerpc64le explicitly reused the files from powerpc64
(through the use of Implies files).

Although this works, it also means that files under the powerpc64
directory might be preferred over files under powerpc64le.  For
instance, on a build for powerpc64le with target set to power9, a file
from powerpc64/power5 might get built, even though a file with the same
name exists in powerpc64le/power8.  That happens because the processor
hierarchy was only defined in the sysdeps directory for powerpc64 (and
borrowed by powerpc64le).

This patch fixes this behavior, by creating new subdirectories under
powerpc64 (i.e.: powerpc64/be and powerpc64/le) and creating new Implies
files to provide the hierarchy of processors for powerpc64 and
powerpc64le separately.  These changes have no effect on installed,
stripped binaries (which remain unchanged).

Tested that installed stripped binaries are unchanged and that there are
no regressions on powerpc64 and powerpc64le.
2018-04-27 16:32:01 -03:00
Joseph Myers a3fb6b6bc3 Remove tilegx port.
Since tile support has been removed from the Linux kernel for 4.17,
this patch removes the (unmaintained) port to tilegx from glibc (the
tilepro support having been previously removed).  This reflects the
general principle that a glibc port needs upstream support for the
architecture in all the components it build-depends on (so binutils,
GCC and the Linux kernel, for the normal case of a port supporting the
Linux kernel but no other OS), in order to be maintainable.

Apart from removal of sysdeps/tile and sysdeps/unix/sysv/linux/tile,
there are updates to various comments referencing tile for which
removal of those references seemed appropriate.  The configuration is
removed from README and from build-many-glibcs.py.  contrib.texi keeps
mention of removed contributions, but I updated Chris Metcalf's entry
to reflect that he also contributed the non-removed support for the
generic Linux kernel syscall interface.
__ASSUME_FADVISE64_64_NO_ALIGN support is removed, as it was only used
by tile.

	* sysdeps/tile: Remove.
	* sysdeps/unix/sysv/linux/tile: Likewise.
	* README (tilegx-*-linux-gnu): Remove from list of supported
	configurations.
	* manual/contrib.texi (Contributors): Mention Chris Metcalf's
	contribution of support for generic Linux kernel syscall
	interface.
	* scripts/build-many-glibcs.py (Context.add_all_configs): Remove
	tilegx configurations.
	(Config.install_linux_headers): Do not handle tile.
	* sysdeps/unix/sysv/linux/aarch64/ldsodefs.h: Do not mention Tile
	in comment.
	* sysdeps/unix/sysv/linux/nios2/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/posix_fadvise.c: Likewise.
	[__ASSUME_FADVISE64_64_NO_ALIGN] (__ALIGNMENT_ARG): Remove
	conditional undefine and redefine.
	* sysdeps/unix/sysv/linux/posix_fadvise64.c: Do not mention Tile
	in comment.
	[__ASSUME_FADVISE64_64_NO_ALIGN] (__ALIGNMENT_ARG): Remove
	conditional undefine and redefine.
2018-04-27 19:11:24 +00:00
Aurelien Jarno 7a6f747871 Add tst-sigaction.c to test BZ #23069
This simple test uses sigaction to define a signal handler. It then
uses sigaction again to fetch the information about the same signal
handler, and check that they are consistent. This is enough to detect
mismatches between struct kernel_sigaction and the kernel version of
struct sigaction, like in BZ #23069.

Changelog:
       * signal/tst-sigaction.c: New file to test BZ #23069.
       * signal/Makefile (tests): Fix indentation. Add tst-sigaction.
2018-04-26 22:21:13 +02:00
Tulio Magno Quites Machado Filho 81b49e9692 Increase robustness of internal dlopen() by using RTLD_NOW [BZ #22766]
Prevent random runtime crashes due to missing symbols caused by mixed
libnss_* versions.

	[BZ #22766]
	* include/dlfcn.h [__libc_dl_open]: Replace RTLD_LAZY with RTLD_NOW.
	* sysdeps/gnu/unwind-resume.c (__lib_gcc_s_init): Replace
	__libc_dlopen_mode() using RTLD_NOW with __libc_dlopen.
	* sysdeps/nptl/unwind-forcedunwind.c: Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-04-26 10:41:43 -03:00
Adhemerval Zanella 7d80f48e93 Consolidate getdirentries{64} implementation
This patch consolidates Linux getdirentries{64} implementation on just
the default sysdeps/unix/sysv/linux/getdirentries{64} ones.  The default
implementation handles the Linux requirements:

  * getdirentries is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * getdirentries64 is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

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

	* sysdeps/unix/sysv/linux/getdirentries.c (getdirentries): Build iff
	_DIRENT_MATCHES_DIRENT64 is not defined.
	* sysdeps/unix/sysv/linux/getdirentries64.c (getdirentries64): Open
	implementation and alias to getdirentries if _DIRENT_MATCHES_DIRENT64
	is defined.
	* sysdeps/unix/sysv/linux/wordsize-64/getdirentries.c: Remove file.
	* sysdeps/unix/sysv/linux/wordsize-64/getdirentries64.c: Remove file.
2018-04-25 17:55:33 -03:00
Joseph Myers 42a2bf58ff Use GCC 8 in build-many-glibcs.py by default.
Now that GCC 8 has branched, this patch makes build-many-glibcs.py
default to using GCC 8 branch instead of GCC 7.  The effect should be
that all builds complete cleanly and the compilation parts of the
glibc testsuite complete cleanly except for on i686-gnu (with GCC 7
there were testsuite failures for some other configurations as well).

I've replaced my bot building using GCC 6 branch with one using GCC 8
branch.  (Of course glibc should continue building with GCC 6 - and
for that matter GCC 5 and 4.9, which are no longer maintained, are
supported versions as well - but building with GCC 6 will no longer be
included in my bot testing.)

	* scripts/build-many-glibcs.py (Context.checkout): Default GCC
	version to GCC 8 branch.
2018-04-25 15:05:01 +00:00
Joseph Myers 5e14bb9793 Fix Hurd glibc build with GCC 8.
The build of glibc for Hurd has been failing with GCC mainline because
of the checks that aliases have the same type as the symbol aliased;
the Hurd dl-sysdep.c has a macro that defines aliases without using
the proper type.  When GCC 8 branches (soon), I intend to make it the
default version in build-many-glibcs.py, so these failures would mean
the default build-many-glibcs.py build fails for Hurd again.

This patch fixes the Hurd build with GCC 8 by changing the macro that
defines the problem aliases to use the correct type for them.  An
include of <not-errno.h> is needed to avoid this use of typeof
resulting in an error for __access_noerrno not being declared.

Tested compilation for i686-gnu with build-many-glibcs.py.

	* sysdeps/mach/hurd/dl-sysdep.c: Include <not-errno.h>.
	(check_no_hidden): Use type of original function when declaring
	alias.
2018-04-24 16:33:47 +00:00
Joseph Myers 9320ca88a1 Add PTRACE_SECCOMP_GET_METADATA from Linux 4.16 to sys/ptrace.h.
This patch adds the PTRACE_SECCOMP_GET_METADATA constant from Linux
4.16 to all relevant sys/ptrace.h files.  A type struct
__ptrace_seccomp_metadata, analogous to other such types, is also
added.

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

	* sysdeps/unix/sysv/linux/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): New enum value and macro.
	* sysdeps/unix/sysv/linux/bits/ptrace-shared.h
	(struct __ptrace_seccomp_metadata): New type.
	* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/arm/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
	* sysdeps/unix/sysv/linux/x86/sys/ptrace.h
	(PTRACE_SECCOMP_GET_METADATA): Likewise.
2018-04-24 12:11:35 +00:00
Adhemerval Zanella af7e376b00 Consolidate alphasort{64} and versionsort{64} implementation
This patch consolidates both alphasort{64} and versionsort{64}
implementation on just the default dirent/alphasort{64}c and
dirent/versionsort{64} respectively.  It changes the logic
to follow the conventions used on other code consolidation:

  * the non-LFS variant is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * the LFS variant is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

Also on Linux the compat symbol for old non-LFS dirent64 definition
requires a platform-specific scandir64.c.  For powerpc32 and sparcv9
it requires to add specific arch-implementation to override the
generic Linux one because neither ABI exports an compat symbol for
non-LFS alphasort64 and versionsort64 variant.  It is most likely a
bug and it is also not one that can be fixed (in that there would be
existing binaries expecting both meanings of that symbol at its single
existing version, with binaries expecting the new meaning probably much
more common than those expecting the original meaning of that symbol at
that version).

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

	* dirent/alphasort.c (alphasort): Build iff _DIRENT_MATCHES_DIRENT64 is
	defined.
	* dirent/versionsort.c (versionsort): Likewise.
	* dirent/alphasort64.c (alphasort64): Build regardless and alias to
	alphasort if _DIRENT_MATCHES_DIRENT64 is defined.
	* dirent/versionsort64.c (versionsort64): Likewise.
	* sysdeps/unix/sysv/linux/i386/alphasort64.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/alphasort64.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/alphasort64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/alphasort64.c: New file.
	* sysdeps/unix/sysv/linux/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/alphasort64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/versionsort64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/alphasort64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/versionsort64.c: Likewise.
2018-04-23 17:35:16 -03:00
Joseph Myers da5e0361d9 Add NT_PPC_PKEY from Linux 4.16 to elf.h.
This patch adds the NT_PPC_PKEY macro from Linux 4.16 to elf.h.

Tested for x86_64.

	* elf/elf.h (NT_PPC_PKEY): New macro.
2018-04-23 19:41:09 +00:00
Dragan Stanojevic - Nevidljivi ea76691a75 hr_HR locale: fix thousands_sep and mon_thousands_sep
[BZ #23094]
	* localedata/locales/hr_HR: fix thousands_sep and
	mon_thousands_sep
2018-04-23 17:00:26 +02:00
Joseph Myers 573963e32f Define XTABS to TAB3 on alpha to match Linux 4.16.
This patch makes the alpha bits/termios.h define XTABS to TAB3, so
matching a change made in Linux 4.16 as well as matching other
architectures where the values are already equal.

Tested with build-many-glibcs.py for alpha-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_MISC]
	(XTABS): Define to TAB3.
2018-04-20 19:52:02 +00:00
Adhemerval Zanella 0900a84959 Update hppa libm-test-ulps
* sysdeps/hppa/fpu/libm-test-ulps: Update.
2018-04-20 15:36:41 -03:00
Adhemerval Zanella c0123b3b11 Consolidate scandir{at}{64} implementation
This patch consolidates scandir{at}{64} implementation on just
the default dirent/scandir{at}{64}{_r}.c ones.  It changes the logic
to follow the conventions used on other code consolidation:

  * scandir{at} is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * scandir{at}{64} is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

Also on Linux the compat symbol for old non-LFS dirent64 definition
requires a platform-specific scandir64.c.

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

	* dirent/scandir-tail-common.c: New file.
	* dirent/scandir-tail.c: Use scandir-tail-common.c.
	(__scandir_tail): Build iff _DIRENT_MATCHES_DIRENT64 is not defined.
	* dirent/scandir.c: Use scandir-tail-common.c.
	* dirent/scandirat.c: Likewise.
	* dirent/scandir64-tail.c: Use scandir-tail-common.c.
	* dirent/scandir64.c (scandir64): Always build and alias to scandir
	if _DIRENT_MATCHES_DIRENT64 is defined.
	* dirent/scandirat64.c (scandirat64): Likewise.
	* include/dirent.h (__scandir_tail): Only define iff
	_DIRENT_MATCHES_DIRENT64 is not defined.
	(__scandir64_tail): Define regardless.
	(__scandirat, scandirat64): Remove libc_hidden_proto.
	* sysdeps/unix/sysv/linux/arm/scandir64.c: Remove file.
	* sysdeps/unix/sysv/linux/m68k/scandir64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/scandir64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/scandir64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/scandir64.c: Likewise.
	* sysdeps/unix/sysv/linux/scandir64.c: New file.
2018-04-20 13:57:12 -03:00
Joseph Myers 458b94f63e Update aarch64 bits/hwcap.h, dl-procinfo.c for Linux 4.16 HWCAP_ASIMDFHM.
This patch updates the aarch64 bits/hwcap.h and dl-procinfo.c for the
new HWCAP_ASIMDFHM value in Linux 4.16.

Tested with build-many-glibcs.py for aarch64-linux-gnu.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_ASIMDFHM):
	New macro.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c (_DL_HWCAP_COUNT):
	Increase to 24.
	(_dl_aarch64_cap_flags): Add asimdfhm.
2018-04-20 16:36:00 +00:00
Samuel Thibault cbc256b1dc hurd: XFAIL tests for signal features not implemented yet
* conform/data/signal.h-data (SA_SIGINFO, SA_NOCLDWAIT): XFAIL on
	i386-gnu.
	* conform/data/sys/wait.h-data (WIFCONTINUED, WEXITED, WSTOPPED,
	WCONTINUED, WNOWAIT): XFAIL on i386-gnu.
2018-04-20 02:27:54 +02:00
Samuel Thibault f00b62ec89 hurd: XFAIL appearance of sched_param and sched_priority from <sys/types.h>
Reported at BZ #23088.

	* sysdeps/mach/hurd/i386/Makefile
	(test-xfail-POSIX/fcntl.h/conform): Add.
	(test-xfail-POSIX/signal.h/conform): Add.
	(test-xfail-POSIX/semaphore.h/conform): Add.
	(test-xfail-POSIX/regex.h/conform): Add.
	(test-xfail-POSIX/aio.h/conform): Add.
	(test-xfail-POSIX/mqueue.h/conform): Add.
	(test-xfail-POSIX/sys/types.h/conform): Add.
	(test-xfail-UNIX98/fcntl.h/conform): Add.
	(test-xfail-UNIX98/netdb.h/conform): Add.
	(test-xfail-UNIX98/signal.h/conform): Add.
	(test-xfail-UNIX98/semaphore.h/conform): Add.
	(test-xfail-UNIX98/regex.h/conform): Add.
	(test-xfail-UNIX98/aio.h/conform): Add.
	(test-xfail-UNIX98/ftw.h/conform): Add.
	(test-xfail-UNIX98/mqueue.h/conform): Add.
	(test-xfail-UNIX98/netinet/in.h/conform): Add.
	(test-xfail-UNIX98/sys/wait.h/conform): Add.
	(test-xfail-UNIX98/sys/sem.h/conform): Add.
	(test-xfail-UNIX98/sys/uio.h/conform): Add.
	(test-xfail-UNIX98/sys/socket.h/conform): Add.
	(test-xfail-UNIX98/sys/types.h/conform): Add.
	(test-xfail-UNIX98/stdlib.h/conform): Add.
	(test-xfail-UNIX98/arpa/inet.h/conform): Add.
	(test-xfail-POSIX2008/fcntl.h/conform): Add.
	(test-xfail-POSIX2008/netdb.h/conform): Add.
	(test-xfail-POSIX2008/signal.h/conform): Add.
	(test-xfail-POSIX2008/semaphore.h/conform): Add.
	(test-xfail-POSIX2008/regex.h/conform): Add.
	(test-xfail-POSIX2008/aio.h/conform): Add.
	(test-xfail-POSIX2008/mqueue.h/conform): Add.
	(test-xfail-POSIX2008/netinet/in.h/conform): Add.
	(test-xfail-POSIX2008/sys/wait.h/conform): Add.
	(test-xfail-POSIX2008/sys/socket.h/conform): Add.
	(test-xfail-POSIX2008/sys/types.h/conform): Add.
	(test-xfail-POSIX2008/arpa/inet.h/conform): Add.
	(test-xfail-XOPEN2K/fcntl.h/conform): Add.
	(test-xfail-XOPEN2K/netdb.h/conform): Add.
	(test-xfail-XOPEN2K/signal.h/conform): Add.
	(test-xfail-XOPEN2K/semaphore.h/conform): Add.
	(test-xfail-XOPEN2K/regex.h/conform): Add.
	(test-xfail-XOPEN2K/aio.h/conform): Add.
	(test-xfail-XOPEN2K/ftw.h/conform): Add.
	(test-xfail-XOPEN2K/mqueue.h/conform): Add.
	(test-xfail-XOPEN2K/netinet/in.h/conform): Add.
	(test-xfail-XOPEN2K/sys/wait.h/conform): Add.
	(test-xfail-XOPEN2K/sys/sem.h/conform): Add.
	(test-xfail-XOPEN2K/sys/uio.h/conform): Add.
	(test-xfail-XOPEN2K/sys/socket.h/conform): Add.
	(test-xfail-XOPEN2K/sys/types.h/conform): Add.
	(test-xfail-XOPEN2K/stdlib.h/conform): Add.
	(test-xfail-XOPEN2K/arpa/inet.h/conform): Add.
	(test-xfail-XOPEN2K8/fcntl.h/conform): Add.
	(test-xfail-XOPEN2K8/netdb.h/conform): Add.
	(test-xfail-XOPEN2K8/signal.h/conform): Add.
	(test-xfail-XOPEN2K8/semaphore.h/conform): Add.
	(test-xfail-XOPEN2K8/regex.h/conform): Add.
	(test-xfail-XOPEN2K8/aio.h/conform): Add.
	(test-xfail-XOPEN2K8/ftw.h/conform): Add.
	(test-xfail-XOPEN2K8/mqueue.h/conform): Add.
	(test-xfail-XOPEN2K8/netinet/in.h/conform): Add.
	(test-xfail-XOPEN2K8/sys/wait.h/conform): Add.
	(test-xfail-XOPEN2K8/sys/sem.h/conform): Add.
	(test-xfail-XOPEN2K8/sys/uio.h/conform): Add.
	(test-xfail-XOPEN2K8/sys/socket.h/conform): Add.
	(test-xfail-XOPEN2K8/sys/types.h/conform): Add.
	(test-xfail-XOPEN2K8/stdlib.h/conform): Add.
	(test-xfail-XOPEN2K8/arpa/inet.h/conform): Add.
2018-04-20 01:56:57 +02:00
Samuel Thibault c5896a4595 Revert "hurd: Fix mach installed headers test"
This reverts commit d4379e0216d01fd1395b1f3b37255e3486760135: the proper
headers are actually already getting installed.
2018-04-20 01:27:13 +02:00
Samuel Thibault 81b032c833 Drop fpregset unused symbol exposition
* sysdeps/arm/sys/ucontext.h: Remove fpregset struct name, unused and
	non-compliant.
	* sysdeps/i386/sys/ucontext.h: Likewise.
	* sysdeps/m68k/sys/ucontext.h: Likewise.
	* sysdeps/mips/sys/ucontext.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.
2018-04-20 01:27:13 +02:00
Samuel Thibault 5dbfe13b35 hurd: Fix hurd installed headers test
* sysdeps/hurd/include/hurd.h [!_ISOMAC]: Do not declare libc hidden
	prototypes.
	* sysdeps/hurd/include/hurd/fd.h [!_ISOMAC]: Likewise.
	* sysdeps/hurd/include/hurd/signal.h [!_ISOMAC]: Likewise.
2018-04-20 00:16:40 +02:00
Samuel Thibault a279b8ed9b hurd: Add missing RLIM_SAVED_MAX/CUR
* bits/resource.h (RLIM_SAVED_MAX, RLIM_SAVED_CUR): New macros.
2018-04-19 23:55:13 +02:00
Samuel Thibault a564872d2d hurd: Fix termios.h symbols
* bits/termios.h [__USE_XOPEN || __USE_XOPEN2K8] (IXANY): Define.
	[__USE_XOPEN && !__USE_XOPEN2K] (IUCLC, OLCUC): Define.
	[__USE_XOPEN] (OFDEL): New macro.
	[__USE_XOPEN && !__USE_XOPEN2K] (XCASE): New macro.
2018-04-19 23:50:12 +02:00
Samuel Thibault ed37092475 hurd: remove non-standard siginfo symbol
* bits/types/siginfo_t.h: Remove siginfo struct name, unused and
	non-compliant.
2018-04-19 21:43:44 +02:00
Samuel Thibault 5cd2931ab8 hurd: fix sigevent's sigev_notify_attributes field type
* sysdeps/pthread/bits/types/sigevent_t.h: New file, based on the
	generic version but include <bits/pthreadtypes.h> to make struct
	sigevent's sigev_notify_attributes field a pthread_attr_t*.
2018-04-19 21:43:44 +02:00
Chung-Lin Tang 9f0437e862 Update sysdeps/nios2/libm-test-ulps 2018-04-19 12:00:58 -07:00
Samuel Thibault e60c3f2bb7 hurd: Avoid exposing all <sched.h> symbols from sys/types.h
* bits/sched.h: Include <bits/types/struct_sched_param.h> and move struct
	sched_param definition to it.
	* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.
	* bits/types/struct_sched_param.h: New file.
	* sysdeps/htl/bits/types/struct___pthread_attr.h: Include
	<bits/types/struct_sched_param.h> instead of <sched.h>.
	* posix/Makefile (headers): Add bits/types/struct_sched_param.h.
2018-04-19 20:24:36 +02:00
Adhemerval Zanella 50511ca466 Fix mips64n32 getdents alias
Fix commit 298d0e3 for mips64n32, checked on a mips64n32-linux-gnu build.

	* sysdeps/unix/sysv/linux/mips/mips64/getdents64.c (__getdents64):
	Only alias to __getdents for _DIRENT_MATCHES_DIRENT64.
2018-04-19 15:21:07 -03:00
Samuel Thibault 77b9339028 hurd: Fix symbols exposition
* bits/in.h [!__USE_MISC]: Do not define struct ip_opts.
	* conform/data/netinet/in.h-data: Allow sin_ and sin6_ prefix.
	* sysdeps/gnu/bits/msq.h (struct msqid_ds): Use __wait_queue struct
	instead of wait_queue.
	* sysdeps/gnu/bits/shm.h (struct shmid_ds): Use __vm_area_struct
	instead of vm_area_struct.
2018-04-19 20:14:45 +02:00
Adhemerval Zanella 298d0e3129 Consolidate Linux getdents{64} implementation
This patch consolidates Linux getdents{64} implementation on just
the default sysdeps/unix/sysv/linux/getdents{64}{_r}.c ones.

Although this symbol is used only internally, the non-LFS version
still need to be build due the non-LFS getdirentries which requires
its semantic.

The non-LFS default implementation now uses the wordsize-32 as base
which uses getdents64 syscall plus adjustment for overflow (it allows
to use the same code for architectures that does not support non-LFS
getdents syscall).  It has two main differences to wordsize-32 one:

  - DIRENT_SET_DP_INO is added to handle alpha requirement to zero
    the padding.

  - alloca is removed by allocating a bounded temporary buffer (it
    increases stack usage by roughly 276 bytes).

The default implementation handle the Linux requirements:

  * getdents is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * getdents64 is always built and aliased to getdents for ABIs
    that define _DIRENT_MATCHES_DIRENT64 to 1.

  * A compat symbol is added for getdents64 for ABI that used to
    export the old non-LFS version.

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

	* sysdeps/unix/sysv/linux/alpha/getdents.c: Add comments with alpha
	requirements.
	 (_DIRENT_MATCHES_DIRENT64): Undef
	* sysdeps/unix/sysv/linux/alpha/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/getdents64.c: Remove file.
	* sysdeps/unix/sysv/linux/generic/getdents.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/getdents.c: Likewise.
	* sysdeps/unix/sysv/linux/getdents.c: Simplify implementation by
	use getdents64 syscalls as base.
	* sysdeps/unix/sysv/linux/getdents64.c: Likewise and add compatibility
	symbol if required.
	* sysdeps/unix/sysv/linux/hppa/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/getdents.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/getdents64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c
	(__get_clockfreq_via_proc_openprom): Use __getdents64.
	* sysdeps/unix/sysv/linux/mips/mips64/getdents64.c: New file.
2018-04-19 08:49:52 -03:00
Stefan Liebler 0085be1415 Disable lock elision for mutex pretty printer tests.
If e.g. the testcase nptl/test-mutex-printers is run
with enabled lock-elision, it fails on s390x with:
Error: Response does not match the expected pattern.
Command: print *mutex
Expected pattern: pthread_mutex_t
Response:  No symbol "mutex" in current context.
(gdb)

See https://www.sourceware.org/ml/libc-alpha/2018-03/msg00583.html
for more details.

In fact the mutex pretty printer tests rely on looking at the
internal details of the lock, thus we disable it by setting up
the GLIB_TUNABLES environment variable inside gdb.

ChangeLog:

	* scripts/test_printers_common.py (init_test): Disable lock elision.
2018-04-19 12:45:11 +02:00
Stefan Liebler da796524f8 Use volatile global counters in test-tgmath.c.
If build with -Os on s390x, the test-tgmath fails with:
float functions not called often enough (-10000)

Within compile_testf(), the counter (count_float) is saved
before the complex functions are called.
Afterwards the saved counter differs to the current-counter.

But the tests with the complex functions do not increment count_float!
Instead count_float is saved to a register before calling totalorder
and totalordermag which both increment count_float.
The compiler is allowed to do that as totalorderf and totalordermagf
is declared with __attribute__ ((__const__)) in math/bits/mathcalls.h.

Thus this patch adjusts the global counters to be volatile.
Then count_float is saved after totalordermag.

ChangeLog:

	* math/test-tgmath.c (count_double, count_float,
	count_ldouble, count_cdouble, count_cfloat,
	count_cldouble): Use volatile int.
2018-04-19 12:32:50 +02:00
Samuel Thibault f55a4fdefb hurd: Update struct statfs according to struct statvfs
* sysdeps/mach/hurd/bits/statfs.h (struct statfs): Make f_bsize,
	f_namemax, f_frsize, and f_flag fields unsigned long int instead of
	unsigned int.
	(struct statfs64): Likewise.
2018-04-19 02:25:03 +02:00
Samuel Thibault 9d9f8f03af hurd: Fix standard compliance of some statvfs fields
Standards require that the f_bsize, f_frsize, f_flag and f_namemax fields be
unsigned long.  They used to be only unsigned on hurd, which happens to be
compatible with unsigned long on the only existing, 32bit, port.  We can
thus merely fix the type.

	* sysdeps/mach/hurd/bits/statvfs.h (struct statvfs): Make f_bsize,
	f_namemax, f_frsize, and f_flag fields unsigned long int instead of
	unsigned int.
	(struct statvfs64): Likewise.
2018-04-19 02:05:54 +02:00
Samuel Thibault 0dd25301f6 hurd: xfail some structure fields ABI incompatibility with standards
* sysdeps/mach/hurd/i386/Makefile [$(subdir) = conform]
	(conformtest-xfail-conds): Add i386-gnu.
	* conform/data/fcntl.h-data (flock.l_type, flock.l_whence): XFAIL for
	i386-gnu.
	* conform/data/sys/ipc.h-data (ipc_perm.uid, ipc_perm.gid,
	ipc_perm.cuid, ipc_perm.cgid): Likewise.
	* conform/data/sys/msg.h-data (msqid_ds.msg_lspid,
	msqid_ds.msg_lrpid): Likewise.
	* conform/data/sys/shm.h-data (shmid_ds.shm_lpid, shmid_ds.shm_cpid):
	Likewise.
	* conform/data/sys/stat.h-data (stat.st_dev): Likewise.
	* conform/data/sys/statvfs.h-data (statvfs.f_fsid): Likewise.
2018-04-19 01:52:51 +02:00
Samuel Thibault d4379e0216 hurd: Fix mach installed headers test
* include/lock-intern.h [!_ISOMAC]: Do not declare libc hidden
	prototypes.
	* include/mach.h [!_ISOMAC]: Likewise.
	* include/mach/mig_support.h [!_ISOMAC]: Likewise.
	* include/mach_error.h [!_ISOMAC]: Likewise.
2018-04-19 00:42:14 +02:00
Samuel Thibault 3dc0814cba conform sys/un.h: Allow sun_ prefix, not only sun_len
* conform/data/sys/un.h-data: Allow sun_ prefix.
2018-04-18 21:07:44 +02:00
Joseph Myers d6397de369 Make build-many-glibcs.py build GCC for powerpcspe with --enable-obsolete.
The powerpcspe GCC port has been obsoleted in GCC 8 for not having had
the removal of code for non-SPE processors completed.  This patch
accordingly arranges for build-many-glibcs.py to configure GCC with
--enable-obsolete for affected configurations.  This is temporary;
either the port gets cleaned up and unobsoleted in GCC and the
configure option can be removed, or the port gets removed in GCC and
we should remove the corresponding glibc support.

Tested with build-many-glibcs.py for the affected configurations.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Use
	--enable-obsolete for powerpc-linux-gnuspe.
2018-04-18 16:07:19 +00:00
Samuel Thibault c4375964db hurd: Fix spurious installation of headers defining hidden prototypes
* sysdeps/mach/include/lock-intern.h: Move to include/.
	* sysdeps/mach/include/mach.h: Move to include/.
	* sysdeps/mach/include/mach/mig_support.h: Move to include/mach/.
	* sysdeps/mach/include/mach_error.h: Move to include/.
2018-04-18 02:07:17 +02:00
Samuel Thibault 8323a9022e hurd: fix conformity test for sys/un.h
sun_len is used by BSD systems, and conformant.

	* conform/data/sys/un.h-data (struct sockaddr_un): Allow sun_len
	member.
2018-04-18 01:10:23 +02:00
Adhemerval Zanella 743b9c2a98 arm: Remove ununsed ARM code in optimized implementation
This patch removes the ununsed ARM code path for armv6t2 memchr and
strlen and armv7 memch and strcmp.  In all implementation, the ARM
code is not used in any possible build (unless glibc is explicit
build with the non-documented NO_THUMB compiler flag) and for armv7
the resulting code either produces wrong results (memchr) and throw
build error (strcmp).

Checked on arm-linux-gnueabihf built targeting both armv6 and
armv7.

	* sysdeps/arm/armv6t2/memchr.S (memchr): Remove ARM code path.
	* sysdeps/arm/armv6t2/strlen.S (memchr): Likewise.
	* sysdeps/arm/armv7/multiarch/memchr_neon.S (memchr): Likewise.
	* sysdeps/arm/armv7/strcmp.S (strcmp): Likewise.
2018-04-16 17:24:31 -03:00
Andreas Schwab 326e74e7c1 Add aliases to recognize normalized charset names (bug 19527) 2018-04-16 17:30:56 +02:00
Patrick McGehearty a14d8acd32 Improves __ieee754_exp(x) performance by 18-37% when |x| < 1.0397
Adds a fast path to e_exp.c when |x| < 1.03972053527832.
When values are tested in isolation, reduction in execution
time is: aarch 30%, sparc 18%, x86 37%.
When comparing benchtests/bench.out which includes values
outside that range, the gains are:
aarch 8%, sparc 5%, x86 9%.

make check is clean (no increase in ulp for any math test).
Testing 20M values for each rounding mode in that range shows
approximately one in 200 values is off by 1 ulp. No value tested
for exp(x) changed by 2 or more ulp.

No observed change in performance or accuracy for x outside
fast path range.

These changes will be active for all platforms that don't provide
their own exp() routines. They will also be active for ieee754
versions of ccos, ccosh, cosh, csin, csinh, sinh, exp10, gamma, and
erf.
2018-04-15 18:46:37 -04:00
DJ Delorie a700e7cb37 Update kernel version in syscall-names.list to 4.16.
Linux 4.16 does not add any new syscalls; this patch updates the
version number in syscall-names.list to reflect that it's still
current for 4.16.

Tested for x86_64 (compilation with build-many-glibcs.py, using Linux
4.16).

	* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
	version to 4.16.
2018-04-12 15:25:50 -04:00
Stefan Liebler d8abfab7d4 S390: Fix struct sigaction for 31bit in kernel_sigaction.h.
The recent commit b4a5d26d88
"linux: Consolidate sigaction implementation" changed the definition
of struct sigaction for s390 (31bit). Unfortunately the order of the
fields were wrong.

This leads to blocking testcases e.g. nptl/tst-sem11.
A thread which blocks due to sem_wait() is cancelled via pthread_cancel()
and the signal-handler sigcancel_handler (see <glibc-src>/nptl/nptl-init.c
is called.
But it just returns as the siginfo_t argument is not setup by the kernel.
Then the main-thread is blocking due to pthread_join().

The flag SA_SIGINFO is set in sa_flags in struct sigaction and
is copied to the "kernel_sigaction.h" struct by the sigaction() call,
but due to the wrong ordering of the struct fields,
the kernel does not recognize it.
2018-04-12 09:37:26 +02:00
Florian Weimer 583a27d525 resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037] 2018-04-09 10:08:16 +02:00
Adhemerval Zanella 942de61a89 Consolidate Linux readdir{64}{_r} implementation
This patch consolidates Linux readdir{64}{_r} implementation on just
the default sysdeps/unix/sysv/linux/readdir{64}{_r}.c ones.  The
default implementation handle the Linux requirements:

  * readdir{_r} is only built for _DIRENT_MATCHES_DIRENT64 being 0.

  * readdir64{_r} is always built and aliased to readdir{_r} for
    ABI that define _DIRENT_MATCHES_DIRENT64.

  * A compat symbol is added for readdir64{_r} for ABI that used to
    export the old non-LFS version.

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

	* sysdeps/posix/readdir.c (__READDIR, __GETDENTS, DIRENTY_TYPE,
	__READDIR_ALIAS): Undefine after usage.
	* sysdeps/posix/readdir_r.c (__READDIR_R, __GETDENTS, DIRENT_TYPE,
	__READDIR_R_ALIAS): Likewise.
	* sysdeps/unix/sysv/linux/arm/readdir64.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir64_r.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Likewise.
	* sysdeps/unix/sysv/linux/readdir.c: New file.
	* sysdeps/unix/sysv/linux/readdir_r.c: Likewise.
	* sysdeps/unix/sysv/linux/readdir64.c: Add compat symbol if required.
	* sysdeps/unix/sysv/linux/readdir64_r.c: Likewise.
2018-04-06 17:49:02 -03:00
Adhemerval Zanella 243f59e5aa Update i386 libm-test-ulps.
Updated ulps after recent commit "[PATCH 1/7] sin/cos slow paths:
avoid slow paths for small inputs"
(19a8b9a300).

	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Update.
2018-04-06 17:24:15 -03:00
Andreas Schwab 690c3475f1 Fix missing @ before texinfo command 2018-04-06 08:56:24 +02:00
Adhemerval Zanella bbc2062a75 Update SPARC libm-test-ulps.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2018-04-05 17:10:03 -03:00
Adhemerval Zanella fa7c619978 Update ARM libm-test-ulps.
* sysdeps/arm/libm-test-ulps: Update.
2018-04-05 17:10:03 -03:00
Adhemerval Zanella b4a5d26d88 linux: Consolidate sigaction implementation
This patch consolidates all Linux sigaction implementations on the default
sysdeps/unix/sysv/linux/sigaction.c.  The idea is remove redundant code
and simplify new ports addition by following the current generic
Linux User API (UAPI).

The UAPI for new ports defines a generic extensible sigaction struct as:

  struct sigaction
  {
    __sighandler_t sa_handler;
    unsigned long sa_flags;
  #ifdef SA_RESTORER
    void (*sa_restorer) (void);
  #endif
    sigset_t sa_mask;
  };

Where SA_RESTORER is just placed for compatibility reasons (news ports
should not add it).  A similar definition is used on generic
kernel_sigaction.h.

The user exported sigaction definition is not changed, so for most
architectures it requires an adjustment to kernel expected one for the
syscall.

The main changes are:

  - All architectures now define and use a kernel_sigaction struct meant
    for the syscall, even for the architectures where the user sigaction
    has the same layout of the kernel expected one (s390-64 and ia64).
    Although it requires more work for these architectures, it simplifies
    the generic implementation. Also, sigaction is hardly a hotspot where
    micro optimization would play an important role.

  - The generic kernel_sigaction definition is now aligned with expected
    UAPI one for newer ports, where SA_RESTORER and sa_restorer are not
    expected to be defined.  This means adding kernel_sigaction for
    current architectures that does define it (m68k, nios2, powerpc, s390,
    sh, sparc, and tile) and which rely on previous generic definition.

  - Remove old MIPS usage of sa_restorer.  This was removed since 2.6.27
    (2957c9e61ee9c - "[MIPS] IRIX: Goodbye and thanks for all the fish").

  - The remaining arch-specific sigaction.c are to handle ABI idiosyncrasies
    (like SPARC kernel ABI for rt_sigaction that requires an additional
    stub argument).

So for new ports the generic implementation should work if its uses
Linux UAPI.  If SA_RESTORER is still required (due some architecture
limitation), it should define its own kernel_sigaction.h, define it and
include generic header (assuming it still uses the default generic kernel
layout).

Checked on x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabihf,
aarch64-linux-gnu, sparc64-linux-gnu, sparcv9-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, ia64-linux-gnu and alpha-linux-gnu.  I also checked the
build on all remaining affected ABIs.

	* sysdeps/unix/sysv/linux/aarch64/sigaction.c: Use default Linux version
	as base implementation.
	* sysdeps/unix/sysv/linux/arm/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Add include guards,
	remove unrequired definitions and update comments.
	* sysdeps/unix/sysv/linux/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel_sigaction.h: New file.
	* sysdeps/unix/sysv/linux/m68k/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel_sigaction: Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel_sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/ia64/sigaction.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/sigaction.c: Add STUB, SET_SA_RESTORER,
	and RESET_SA_RESTORER hooks.
2018-04-05 17:09:50 -03:00
Stefan Liebler db9e55ff36 S390: Regenerate ULPs.
Updated ulps after recent commit
"[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs"
(19a8b9a300).

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2018-04-05 16:24:06 +02:00
Florian Weimer cf138b0c83 manual: Various fixes to the mbstouwcs example, and mbrtowc update
The example did not work because the null byte was not converted, and
mbrtowc was called with a zero-length input string.  This results in a
(size_t) -2 return value, so the function always returns NULL.

The size computation for the heap allocation of the result was
incorrect because it did not deal with integer overflow.

Error checking was missing, and the allocated memory was not freed on
error paths.  All error returns now set errno.  (Note that there is an
assumption that free does not clobber errno.)

The slightly unportable comparision against (size_t) -2 to catch both
(size_t) -1 and (size_t) -2 return values is gone as well.

A null wide character needs to be stored in the result explicitly, to
terminate it.

The description in the manual is updated to deal with these finer
points.  The (size_t) -2 behavior (consuming the input bytes) matches
what is specified in ISO C11.
2018-04-05 12:52:19 +02:00
Florian Weimer 0f33925269 manual: Move mbstouwcs to an example C file 2018-04-05 12:50:58 +02:00
Samuel Thibault 08e92e2443 Revert "hurd: Avoid PLTs for longjmp & siglongjmp"
This reverts commit e5f9508a32.
2018-04-05 09:38:58 +02:00
Samuel Thibault c120981d72 hurd: Avoid PLT for dirfd
* include/dirent.h (dirfd): Add hidden proto.
	* dirent/dirfd.c (dirfd): Add hidden def.
	* sysdeps/mach/hurd/dirfd.c (dirfd): Add hidden def.
	* sysdeps/posix/dirfd.c (dirfd): Add hidden def.
2018-04-05 01:52:29 +02:00
Samuel Thibault e5f9508a32 hurd: Avoid PLTs for longjmp & siglongjmp
* include/setjmp.h (longjmp, siglongjmp): Add hidden protos.
	* setjmp/longjmp.c (longjmp, siglongjmp): Add hidden defs.
	* sysdeps/s390/longjmp.c (longjmp, siglongjmp): Add hidden defs.
2018-04-04 23:19:18 +00:00
Tulio Magno Quites Machado Filho b2fd61ca9b powerpc: Update sin, cos and sincos ULPs
* sysdeps/powerpc/fpu/libm-test-ulps: Increase double-precision
	sin, cos and sincos to 1 ULP.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2018-04-04 19:17:13 -03:00
Maciej W. Rozycki e7feec374c elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]
Do not relocate absolute symbols by the base address.  Such symbols have
SHN_ABS as the section index and their value is not supposed to be
affected by relocation as per the ELF gABI[1]:

"SHN_ABS
    The symbol has an absolute value that will not change because of
    relocation."

The reason for our non-conformance here seems to be an old SysV linker
bug causing symbols like _DYNAMIC to be incorrectly emitted as absolute
symbols[2].  However in a previous discussion it was pointed that this
is seriously flawed by preventing the lone purpose of the existence of
absolute symbols from being used[3]:

"On the contrary, the only interpretation that makes sense to me is that
it will not change because of relocation at link time or at load time.
Absolute symbols, from the days of the earliest linking loaders, have
been used to represent addresses that are outside the address space of
the module (e.g., memory-mapped addresses or kernel gateway pages).
They've even been used to represent true symbolic constants (e.g.,
system entry point numbers, sizes, version numbers).  There's no other
way to represent a true absolute symbol, while the meaning you seek is
easily represented by giving the symbol a non-negative st_shndx value."

and we ought to stop supporting our current broken interpretation.

Update processing for dladdr(3) and dladdr1(3) so that SHN_ABS symbols
are ignored, because under the corrected interpretation they do not
represent addresses within a mapped file and therefore are not supposed
to be considered.

References:

[1] "System V Application Binary Interface - DRAFT - 19 October 2010",
    The SCO Group, Section "Symbol Table",
    <http://www.sco.com/developers/gabi/2012-12-31/ch4.symtab.html>

[2] Alan Modra, "Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00019.html>

[3] Cary Coutant, "Re: Absolute symbols"
    <https://sourceware.org/ml/binutils/2012-05/msg00020.html>

	[BZ #19818]
	* sysdeps/generic/ldsodefs.h (SYMBOL_ADDRESS): Handle SHN_ABS
	symbols.
	* elf/dl-addr.c (determine_info): Ignore SHN_ABS symbols.
	* elf/tst-absolute-sym.c: New file.
	* elf/tst-absolute-sym-lib.c: New file.
	* elf/tst-absolute-sym-lib.lds: New file.
	* elf/Makefile (tests): Add `tst-absolute-sym'.
	(modules-names): Add `tst-absolute-sym-lib'.
	(LDLIBS-tst-absolute-sym-lib.so): New variable.
	($(objpfx)tst-absolute-sym-lib.so): New dependency.
	($(objpfx)tst-absolute-sym): New dependency.
2018-04-04 23:09:37 +01:00
Maciej W. Rozycki 10a446ddcc elf: Unify symbol address run-time calculation [BZ #19818]
Wrap symbol address run-time calculation into a macro and use it
throughout, replacing inline calculations.

There are a couple of variants, most of them different in a functionally
insignificant way.  Most calculations are right following RESOLVE_MAP,
at which point either the map or the symbol returned can be checked for
validity as the macro sets either both or neither.  In some places both
the symbol and the map has to be checked however.

My initial implementation therefore always checked both, however that
resulted in code larger by as much as 0.3%, as many places know from
elsewhere that no check is needed.  I have decided the size growth was
unacceptable.

Having looked closer I realized that it's the map that is the culprit.
Therefore I have modified LOOKUP_VALUE_ADDRESS to accept an additional
boolean argument telling it to access the map without checking it for
validity.  This in turn has brought quite nice results, with new code
actually being smaller for i686, and MIPS o32, n32 and little-endian n64
targets, unchanged in size for x86-64 and, unusually, marginally larger
for big-endian MIPS n64, as follows:

i686:
   text    data     bss     dec     hex filename
 152255    4052     192  156499   26353 ld-2.27.9000-base.so
 152159    4052     192  156403   262f3 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/el:
   text    data     bss     dec     hex filename
 142906    4396     260  147562   2406a ld-2.27.9000-base.so
 142890    4396     260  147546   2405a ld-2.27.9000-elf-symbol-value.so
MIPS/n32/el:
   text    data     bss     dec     hex filename
 142267    4404     260  146931   23df3 ld-2.27.9000-base.so
 142171    4404     260  146835   23d93 ld-2.27.9000-elf-symbol-value.so
MIPS/n64/el:
   text    data     bss     dec     hex filename
 149835    7376     408  157619   267b3 ld-2.27.9000-base.so
 149787    7376     408  157571   26783 ld-2.27.9000-elf-symbol-value.so
MIPS/o32/eb:
   text    data     bss     dec     hex filename
 142870    4396     260  147526   24046 ld-2.27.9000-base.so
 142854    4396     260  147510   24036 ld-2.27.9000-elf-symbol-value.so
MIPS/n32/eb:
   text    data     bss     dec     hex filename
 142019    4404     260  146683   23cfb ld-2.27.9000-base.so
 141923    4404     260  146587   23c9b ld-2.27.9000-elf-symbol-value.so
MIPS/n64/eb:
   text    data     bss     dec     hex filename
 149763    7376     408  157547   2676b ld-2.27.9000-base.so
 149779    7376     408  157563   2677b ld-2.27.9000-elf-symbol-value.so
x86-64:
   text    data     bss     dec     hex filename
 148462    6452     400  155314   25eb2 ld-2.27.9000-base.so
 148462    6452     400  155314   25eb2 ld-2.27.9000-elf-symbol-value.so

	[BZ #19818]
	* sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set'
	parameter.
	(SYMBOL_ADDRESS): New macro.
	[!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use
	SYMBOL_ADDRESS for symbol address calculation.
	* elf/dl-runtime.c (_dl_fixup): Likewise.
	(_dl_profile_fixup): Likewise.
	* elf/dl-symaddr.c (_dl_symbol_address): Likewise.
	* elf/rtld.c (dl_main): Likewise.
	* sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise.
	* sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise.
	(elf_machine_rela): Likewise.
	* sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC):
	Likewise.
	(elf_machine_reloc): Likewise.
	(elf_machine_got_rel): Likewise.
	* sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise.
	* sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/riscv/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela):
	Likewise.
	* sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise.
	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2018-04-04 23:09:37 +01:00
Zack Weinberg 9185f86d8f Make sysdeps/generic/internal-signals.h less stubby.
Three of the functions defined by internal-signals.h were not actually
fulfilling their contracts when the sysdeps/generic version of that
file was used.  Also, the Linux version included several more headers
than the generic version, which is the root cause of a build failure
on Hurd (already addressed in another way, but I think it is proper to
make the headers match).

	* sysdeps/generic/internal-signals.h: Include signal.h,
	sigsetops.h, and stdbool.h.
	(__libc_signal_block_all): Actually block all signals.
	(__libc_signal_block_app): Likewise.
	(__libc_signal_restore_set): Actually restore the signal mask.
2018-04-04 12:37:23 -04:00
Florian Weimer b07367bcf8 inet: Actually build and run tst-deadline 2018-04-04 16:08:18 +02:00
Samuel Thibault d8440a2147 hurd: fix build
* signal/sigaddset.c: Include <sigsetopts.h>.
	* signal/sigdelset.c: Likewise.
2018-04-04 02:28:20 +02:00
Samuel Thibault ff297b70b5 hurd: Add missing symbols
* sysdeps/mach/hurd/i386/exc2signal.c (_hurd_exception2signal): Add
	hidden def.
	* mach/spin-lock.c (__mutex_unlock): Add hidden def.
2018-04-04 02:17:49 +02:00
Samuel Thibault e8ef51b171 hurd: Silence warning
* hurd/hurdsig.c (interrupted_reply_port_location): Use
	DIAG_IGNORE_NEEDS_COMMENT to silence warning with GCC 6 and before.
2018-04-04 02:06:16 +02:00
Samuel Thibault 92846492dc hurd: Make __if_nametoindex return ENODEV if ifname is too long
rather than truncating it.

	* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Return ENODEV if
	ifname is too long.
2018-04-03 23:14:11 +02:00
Samuel Thibault 5e17a480f8 Revert parts of "hurd: Avoid more libc.so local PLTs"
This reverts parts of commit 82dbf555a4.
2018-04-03 23:06:00 +02:00
Samuel Thibault 51722f4dc7 Revert "s390x: Fix hidden aliases"
This reverts commit 811836a411.
2018-04-03 22:59:25 +02:00
H.J. Lu f2652643d7 Update RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]
Add RWF_APPEND to RWF_SUPPORTED to support Linux kernel 4.16.

	[BZ #22947]
	* bits/uio-ext.h (RWF_APPEND): New.
	* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_APPEND): Likewise.
	* manual/llio.texi: Document RWF_APPEND.
	* misc/tst-preadvwritev2-common.c (RWF_APPEND): New.
	(RWF_SUPPORTED): Add RWF_APPEND.
2018-04-03 12:19:29 -07:00
Adhemerval Zanella d2dc5467c6 Filter out NPTL internal signals (BZ #22391)
This patch filters out the internal NPTL signals (SIGCANCEL/SIGTIMER and
SIGSETXID) from signal functions.  GLIBC on Linux requires both signals to
proper implement pthread cancellation, posix timers, and set*id posix
thread synchronization.

And not filtering out the internal signal is troublesome:

  - A conformant program on a architecture that does not filter out the
    signals might inadvertently disable pthread asynchronous cancellation,
    set*id synchronization or posix timers.

  - It might also to security issues if SIGSETXID is masked and set*id
    functions are called (some threads might have effective user or group
    id different from the rest).

The changes are basically:

  - Change __is_internal_signal to bool and used on all signal function
    that has a signal number as input.  Also for signal function which accepts
    signals sets (sigset_t) it assumes that canonical function were used to
    add/remove signals which lead to some input simplification.

  - Fix tst-sigset.c to avoid check for SIGCANCEL/SIGTIMER and SIGSETXID.
    It is rewritten to check each signal indidually and to check realtime
    signals using canonical macros.

  - Add generic __clear_internal_signals and __is_internal_signal
    version since both symbols are used on generic implementations.

  - Remove superflous sysdeps/nptl/sigfillset.c.

  - Remove superflous SIGTIMER handling on Linux __is_internal_signal
    since it is the same of SIGCANCEL.

  - Remove dangling define and obvious comment on nptl/sigaction.c.

Checked on x86_64-linux-gnu.

	[BZ #22391]
	* nptl/sigaction.c (__sigaction): Use __is_internal_signal to
	check for internal nptl signals.
	* nptl/sigaction.c (__sigaction): Likewise.
	* signal/sigaddset.c (sigaddset): Likewise.
	* signal/sigdelset.c (sigdelset): Likewise.
	* sysdeps/posix/signal.c (__bsd_signal): Likewise.
	* sysdeps/posix/sigset.c (sigset): Call and check sigaddset return
	value.
	* signal/sigfillset.c (sigfillset): User __clear_internal_signals
	to filter out internal nptl signals.
	* signal/tst-sigset.c (do_test): Check ech signal indidually and
	also check realtime signals using standard macros.
	* sysdeps/generic/internal-signals.h (__clear_internal_signals,
	__is_internal_signal, __libc_signal_block_all,
	__libc_signal_block_app, __libc_signal_restore_set): New functions.
	* sysdeps/nptl/sigfillset.c: Remove file.
	* sysdeps/unix/sysv/linux/internal-signals.h (__is_internal_signal):
	Change return to bool.
	(__clear_internal_signals): Remove SIGTIMER clean since it is
	equal to SIGCANEL on Linux.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Assume
	signal set was constructed using standard functions.

Reported-by: Yury Norov <ynorov@caviumnetworks.com>
2018-04-03 13:30:49 -03:00
Samuel Thibault 511ed56f2e hurd: Fix buffer overrun in __if_nametoindex
and building with mainline GCC which reports it.

	* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Always end
	ifr.fr_name with a NUL caracter.
2018-04-03 18:06:15 +02:00
Wilco Dijkstra e88ecbbfe8 [PATCH 7/7] sin/cos slow paths: refactor sincos implementation
Refactor the sincos implementation - rather than rely on odd partial inlining
of preprocessed portions from sin and cos, explicitly write out the cases.
This makes sincos much easier to maintain and provides an additional 16-20%
speedup between 0 and 2^27.  The overall speedup of sincos is 48% over this range.
Between 0 and PI it is 66% faster.

	* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Cleanup ifdefs.
	(__cos): Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c (__sincos): Refactor using the same
	logic as sin and cos.
2018-04-03 16:52:18 +01:00
Wilco Dijkstra aef3e2558a [PATCH 6/7] sin/cos slow paths: refactor duplicated code into dosin
Refactor duplicated code into do_sin.  Since all calls to do_sin use copysign to
set the sign of the result, move it inside do_sin.  Small inputs use a separate
polynomial, so move this into do_sin as well (the check is based on the more
conservative case when doing large range reduction, but could be relaxed).

	* sysdeps/ieee754/dbl-64/s_sin.c (do_sin): Use TAYLOR_SIN for small
	inputs.  Return correct sign.
	(do_sincos): Remove small input check before do_sin, let do_sin set
	the sign.
	(__sin): Likewise.
	(__cos): Likewise.
2018-04-03 16:52:17 +01:00
Wilco Dijkstra 72f6e9a3e3 [PATCH 5/7] sin/cos slow paths: remove unused slowpath functions
Remove all unused slowpath functions.

	* sysdeps/ieee754/dbl-64/s_sin.c (TAYLOR_SLOW): Remove.
	(do_cos_slow): Likewise.
	(do_sin_slow): Likewise.
	(reduce_and_compute): Likewise.
	(slow): Likewise.
	(slow1): Likewise.
	(slow2): Likewise.
	(sloww): Likewise.
	(sloww1): Likewise.
	(sloww2): Likewise.
	(bslow): Likewise.
	(bslow1): Likewise.
	(bslow2): Likewise.
	(cslow2): Likewise.
2018-04-03 16:52:17 +01:00
Wilco Dijkstra 649095838b [PATCH 4/7] sin/cos slow paths: remove slow paths from huge range reduction
For huge inputs use the improved do_sincos function as well.  Now no cases use
the correction factor returned by do_sin, do_cos and TAYLOR_SIN, so remove it.

	* sysdeps/ieee754/dbl-64/s_sin.c (TAYLOR_SIN): Remove cor parameter.
	(do_cos): Remove corp parameter and calculations.
	(do_sin): Likewise.
	(do_sincos): Remove cor variable.
	(__sin): Use do_sincos for huge inputs.
	(__cos): Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Likewise.
	(reduce_and_compute_sincos): Remove unused function.
2018-04-03 16:52:17 +01:00
Wilco Dijkstra d9469deb14 [PATCH 3/7] sin/cos slow paths: remove slow paths from small range reduction
This patch improves the accuracy of the range reduction.  When the input is
large (2^27) and very close to a multiple of PI/2, using 110 bits of PI is not
enough.  Improve range reduction accuracy to 136 bits.  As a result the special
checks for results close to zero can be removed.  The ULP of the polynomials is
at worst 0.55ULP, so there is no reason for the slow functions, and they can be
removed.

	* sysdeps/ieee754/dbl-64/s_sin.c (reduce_sincos_1): Rename to
	reduce_sincos, improve accuracy to 136 bits.
	(do_sincos_1): Rename to do_sincos, remove fallbacks to slow functions.
	(__sin): Use improved reduction and simplified do_sincos calculation.
	(__cos): Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Likewise.
2018-04-03 16:52:17 +01:00
Wilco Dijkstra 7a5640f23a [PATCH 2/7] sin/cos slow paths: remove large range reduction
This patch removes the large range reduction code and defers to the huge range
reduction code.  The first level range reducer supports inputs up to 2^27,
which is way too large given that inputs for sin/cos are typically small
(< 10), and optimizing for a smaller range would give a significant speedup.

Input values above 2^27 are practically never used, so there is no reason for
supporting range reduction between 2^27 and 2^48.  Removing it significantly
simplifies code and enables further speedups.  There is about a 2.3x slowdown
in this range due to __branred being extremely slow  (a better algorithm could
easily more than double performance).

	* sysdeps/ieee754/dbl-64/s_sin.c (reduce_sincos_2): Remove function.
	(do_sincos_2): Likewise.
	(__sin): Remove middle range reduction case.
	(__cos): Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c (__sincos): Remove middle range
	reduction case.
2018-04-03 16:52:17 +01:00
Wilco Dijkstra 19a8b9a300 [PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs
This series of patches removes the slow patchs from sin, cos and sincos.
Besides greatly simplifying the implementation, the new version is also much
faster for inputs up to PI (41% faster) and for large inputs needing range
reduction (27% faster).

ULP is ~0.55 with no errors found after testing 1.6 billion inputs across most
of the range with mpsin and mpcos.  The number of incorrectly rounded results
(ie. ULP >0.5) is at most ~2750 per million inputs between 0.125 and 0.5,
the average is ~850 per million between 0 and PI.

Tested on AArch64 and x86_64 with no regressions.

The first patch removes the slow paths for the cases where the input is small
and doesn't require range reduction.  Update ULP tables for sin, cos and sincos
on AArch64 and x86_64.

	* sysdeps/aarch64/libm-test-ulps: Update ULP for sin, cos, sincos.
	* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Remove slow paths for small
	inputs.
	(__cos): Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update ULP for sin, cos, sincos.
2018-04-03 16:52:16 +01:00
Joseph Myers f72aa11d7e Use Linux 4.16 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	version to 4.16.
2018-04-03 15:41:08 +00:00
Adhemerval Zanella 8e4754ed7e Assume O_DIRECTORY for opendir
This patch assumes O_DIRECTORY works as defined by POSIX on opendir
implementation (aligning with other glibc code, for instance pwd).  This
allows remove both the fallback code to handle system with missing or
broken O_DIRECTORY along with the Linux specific opendir.c which just
advertise the working flag.

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

	* sysdeps/posix/opendir.c (o_directory_works, tryopen_o_directory):
	Remove definitions.
	(opendir_oflags): Use O_DIRECTORY regardless.
	(__opendir, __opendirat): Remove need_isdir_precheck usage.
	* sysdeps/unix/sysv/linux/opendir.c: Remove file.
2018-04-03 08:57:17 -03:00
Adhemerval Zanella 57408435ad Add Changelog reference to BZ#23024 2018-04-03 08:54:32 -03:00
Samuel Thibault 811836a411 s390x: Fix hidden aliases
* sysdeps/s390/longjmp.c (__libc_longjmp, __libc_siglongjmp): New
	hidden defs.
2018-04-03 13:52:29 +02:00
Samuel Thibault fe9748cca3 hurd: Avoid local PLT in libpthread
* htl/pt-exit.c: Include <pthreadP.h>.
	(__pthread_exit): Call ___pthread_get_cleanup_stack instead of
	__pthread_get_cleanup_stack.
2018-04-03 02:56:35 +02:00
Samuel Thibault 82dbf555a4 hurd: Avoid more libc.so local PLTs
* hurd/catch-signal.c (__hurd_catch_signal): Call __libc_siglongjmp
	instead if siglongjmp.
	(hurd_safe_memmove): Call __libc_longjmp instead of longjmp.
	* hurd/hurdfault.c (faulted): Call __libc_longjmp instead of longjmp.
	* include/setjmp.h (__libc_siglongjmp, __libc_longjmp): New hidden
	prototypes.
	* libio/iolibio.h (_IO_puts): New hidden prototype.
	* libio/ioputs.c (_IO_puts): New hidden def.
	* setjmp/longjmp.c (__libc_longjmp, __libc_siglongjmp): New hidden
	defs.
	* sysdeps/mach/hurd/sigwait.c (__sigwait): Call __libc_longjmp instead
	of longjmp.
2018-04-03 00:36:33 +00:00
Samuel Thibault a758c29399 hurd: Avoid more libc.so PLTs
* sysdeps/hurd/include/hurd/signal.h (_hurd_raise_signal): Add hidden
	prototype.
	* hurd/hurd-raise.c (_hurd_raise_signal): Add hidden def.
	* hurd/Makefile ($(inlines:%=$(objpfx)%.c): Define
	_HEADER_H_HIDDEN_DEF macro.
	* sysdeps/hurd/include/hurd/fd.h (_hurd_fd_error,
	_hurd_fd_error_signal): Add hidden prototype.
	[_HURD_FD_H_HIDDEN_DEF] (_hurd_fd_error, _hurd_fd_error_signal): Add
	hidden def.
2018-04-02 23:40:26 +00:00
Samuel Thibault 7a8f45e302 hurd: Avoid some libc.so PLTs
* hurd/catch-signal.c (hurd_catch_signal): Rename to
	__hurd_catch_signal.
	(hurd_catch_signal): New strong alias.
	(hurd_safe_memset, hurd_safe_copyout, hurd_safe_copyin): Call
	__hurd_catch_signal instead of hurd_catch_signal.
	* hurd/exc2signal.c (_hurd_exception2signal): Add hidden def.
	* hurd/hurdexec.c (_hurd_init): Add hidden def.
	* hurd/hurdinit.c (_hurd_init): Add hidden def.
	* hurd/hurdsig.c: Include <mach/mig_support.h>.
	(_hurd_thread_sigstate): Add hidden def.
	(_hurd_internal_post_signal): Use __mutex_unlock instead of
	mutex_unlock.
	* hurd/intern-fd.c (_hurd_intern_fd): Add hidden def.
	* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Add hidden def.
	* hurd/path-lookup.c (hurd_file_name_path_lookup): Rename to
	__hurd_file_name_path_lookup.
	(hurd_file_name_path_lookup): New strong alias.
	(file_name_path_lookup): Call __hurd_file_name_path_lookup instead of
	hurd_file_name_path_lookup.
	* mach/errstring.c (mach_error_type): Add hidden def.
	* mach/msg-destroy.c (__mach_msg_destroy): Add hidden def.
	* mach/mutex-init.c (__mutex_init): Add hidden def.
	* mach/spin-lock.c (__spin_lock_locked, __spin_lock, __spin_unlock,
	__spin_try_lock, __mutex_lock, __mutex_trylock): Add hidden defs.
	* mach/spin-solid.c (__spin_lock_solid): Add hidden def.
	* sysdeps/mach/hurd/getcwd.c
	(_hurd_canonicalize_directory_name_internal): Rename to
	__hurd_canonicalize_directory_name_internal.
	(_hurd_canonicalize_directory_name_internal): New strong alias.
	(__canonicalize_directory_name_internal, __getcwd): Call
	__hurd_canonicalize_directory_name_internal instead of
	_hurd_canonicalize_directory_name_internal.
	* sysdeps/mach/hurd/mig-reply.c: Include <mach/mig_support.h>.
	(__mig_get_reply_port, __mig_dealloc_reply_port, __mig_init): Add
	hidden defs.
	* sysdeps/hurd/include/hurd.h: New file.
	* sysdeps/hurd/include/hurd/fd.h: New file.
	* sysdeps/hurd/include/hurd/signal.h: New file.
	* sysdeps/mach/include/lock-intern.h: New file.
	* sysdeps/mach/include/mach.h: New file.
	* sysdeps/mach/include/mach/mig_support.h: New file.
	* sysdeps/mach/include/mach_error.h: New file.
2018-04-02 22:08:55 +00:00
Samuel Thibault 171488a2de hurd: whitelist rtld symbols expected to be overridable
* sysdeps/mach/hurd/localplt.data: New file.
2018-04-02 23:02:02 +02:00
Samuel Thibault 97c7a6a68b Revert __dirfd PLT avoidance for now
* io/fts.c (fts_build): Call dirfd instead of __dirfd.
2018-04-02 21:45:38 +02:00
Samuel Thibault dba2bdbe75 hurd: Avoid some PLTs in libc and librt
* hurd/hurdauth.c (_S_msg_add_auth): Call __vm_allocate and
	__vm_deallocate instead of vm_allocate and vm_deallocate.
	* hurd/hurdmsg.c (_S_msg_set_env_variable): Call __setenv instead of
	setenv.
	* hurd/hurdprio.c (_hurd_priority_which_map): Call __geteuid instead
	of geteuid.
	* hurd/path-lookup.c (file_name_path_scan): Call __strdup instead of
	strdup.
	* hurd/siginfo.c: Include <libioP.h>.
	(_hurd_siginfo_handler): Call _IO_puts instead of puts.
	* hurd/xattr.c (_hurd_xattr_get, _hurd_xattr_set): Call __munmap instead of
	munmap.
	* io/fts.c (fts_build): Call __dirfd instead of dirfd.
	* mach/devstream.c: Include <libioP.h>.
	(dealloc_ref): Call __mach_port_deallocate instead of
	mach_port_deallocate.
	(mach_open_devstream): Call _IO_fopencookie instead of fopencookie.
	Call __mach_port_deallocate instead of mach_port_deallocate.
	* stdlib/canonicalize.c (__realpath): Call __pathconf instead of
	pathconf.
	* sysdeps/mach/hurd/ifreq.c (__ifreq): Call __munmap instead of
	munmap.
	* sysdeps/mach/hurd/ifreq.h (__if_freereq): Likewise.
	* sysdeps/mach/hurd/ptrace.c (ptrace): Call __kill instead of kill.
	* sysdeps/mach/hurd/sendfile64.c (sendfile64): Call __munmap instead
	of munmap.
	* sysdeps/mach/hurd/socketpair.c (__socketpair): Call __close instead
	of close.
	* sysdeps/posix/clock_getres.c (realtime_getres): Call __sysconf
	instead of sysconf.
	* sysdeps/pthread/timer_gettime.c (timer_gettime): Call
	__clock_gettime instead of clock_gettime.
	* sysdeps/pthread/timer_routines.c (thread_func): Likewise.
	* sysdeps/pthread/timer_settime.c (timer_settime): Likewise.
	* sysdeps/unix/bsd/gtty.c (gtty): Call __ioctl instead of ioctl.
	* sysdeps/unix/bsd/stty.c (stty): Likewise.
	* sysdeps/unix/bsd/tcflow.c (tcflow): Call __tcgetattr instead of
	tcgetattr.
	* sysdeps/unix/clock_nanosleep.c (__clock_nanosleep): Call
	__clock_gettime and __nanosleep instead of clock_gettime and
	nanosleep.
2018-04-02 19:07:52 +00:00
Samuel Thibault f6fb29d22e hurd: Avoid local PLTs in libpthread.
* htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach
	instead of pthread_detach.
	(__cthread_fork): Call __pthread_create instead of pthread_create.
	(__cthread_keycreate): Call __pthread_key_create instead of
	pthread_key_create.
	(__cthread_getspecific): Call __pthread_getspecific instead of
	pthread_getspecific.
	(__cthread_setspecific): Call __pthread_setspecific instead of
	pthread_setspecific.
	* htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and
	__pthread_mutex_unlock instead of pthread_mutex_lock and
	pthread_mutex_unlock.
	* htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to
	___pthread_get_cleanup_stack.
	(__pthread_get_cleanup_stack): New strong alias.
	* htl/pt-create.c: Include <pthreadP.h>.
	(entry_point): Call __pthread_exit instead of pthread_exit.
	(pthread_create): Rename to __pthread_create.
	(pthread_create): New strong alias.
	* htl/pt-detach.c (pthread_detach): Rename to __pthread_detach.
	(pthread_detach): New strong alias.
	(__pthread_detach): Call __pthread_cond_broadcast instead of
	pthread_cond_broadcast.
	* htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate
	instead of pthread_setcancelstate.
	* htl/pt-testcancel.c: Include <pthreadP.h>.
	(pthread_testcancel): Call __pthread_exit instead of pthread_exit.
	* sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h>
	(__pthread_attr_getstack): Call __pthread_attr_getstackaddr and
	__pthread_attr_getstacksize instead of pthread_attr_getstackaddr and
	pthread_attr_getstacksize.
	* sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr):
	Rename to __pthread_attr_getstackaddr.
	(pthread_attr_getstackaddr): New strong alias.
	* sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize):
	Rename to __pthread_attr_getstacksize.
	(pthread_attr_getstacksize): New strong alias.
	* sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>.
	(pthread_attr_setstack): Rename to __pthread_attr_setstack.
	(pthread_attr_setstack): New strong alias.
	(__pthread_attr_setstack): Call __pthread_attr_getstacksize,
	__pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of
	pthread_attr_getstacksize, pthread_attr_setstacksize and
	pthread_attr_setstackaddr.
	* sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr):
	Rename to __pthread_attr_setstackaddr.
	(pthread_attr_setstackaddr): New strong alias.
	* sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize):
	Rename to __pthread_attr_setstacksize.
	(pthread_attr_setstacksize): New strong alias.
	* sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>.
	(__pthread_cond_timedwait_internal): Use __pthread_exit instead of
	pthread_exit.
	* sysdeps/htl/pt-key-create.c: Include <pthreadP.h>.
	(__pthread_key_create): New hidden def.
	* sysdeps/htl/pt-key.h: Include <pthreadP.h>.
	* sysdeps/htl/pthreadP.h (_pthread_mutex_init,
	__pthread_cond_broadcast, __pthread_create, __pthread_detach,
	__pthread_exit, __pthread_key_create, __pthread_getspecific,
	__pthread_setspecific, __pthread_setcancelstate,
	__pthread_attr_getstackaddr, __pthread_attr_setstackaddr,
	__pthread_attr_getstacksize, __pthread_attr_setstacksize,
	__pthread_attr_setstack, ___pthread_get_cleanup_stack): New
	declarations.
	(__pthread_key_create, _pthread_mutex_init): New hidden declarations.
	* sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c
	(pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr.
	(pthread_attr_setstackaddr): New strong alias.
	* sysdeps/mach/hurd/htl/pt-attr-setstacksize.c
	(pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize.
	(pthread_attr_setstacksize): New strong alias.
	* sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>.
	(call_exit): Call __pthread_exit instead of pthread_exit.
	* sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>.
	(_pthread_mutex_init): New hidden definition.
	* sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>.
	(_init_routine): Call __pthread_attr_init and __pthread_attr_setstack
	instead of pthread_attr_init and pthread_attr_setstack.
2018-04-02 18:08:37 +00:00
Samuel Thibault fa9e15558d hurd: Fix exposition of UTIME_NOW, UTIME_OMIT
* sysdeps/mach/hurd/bits/stat.h [!__USE_MISC && __USE_ATFILE]
	(UTIME_NOW, UTIME_OMIT): Define macros.
2018-04-02 17:07:11 +02:00
Samuel Thibault fb03b04b7f hurd: Announce that glibc now builds unpatched
* NEWS: Announce that glibc now builds unpatched on GNU/Hurd.
	* README: Remove the mention of out-of-tree patches needed for
	GNU/Hurd.
2018-04-02 16:45:44 +02:00
Samuel Thibault ad2b41bfd8 hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+
* htl/Makefile: Bump licence to LGPL 2.1+.
	* htl/alloca_cutoff.c: Likewise.
	* htl/cthreads-compat.c: Likewise.
	* htl/lockfile.c: Likewise.
	* htl/pt-alloc.c: Likewise.
	* htl/pt-cancel.c: Likewise.
	* htl/pt-cleanup.c: Likewise.
	* htl/pt-create.c: Likewise.
	* htl/pt-dealloc.c: Likewise.
	* htl/pt-detach.c: Likewise.
	* htl/pt-exit.c: Likewise.
	* htl/pt-getattr.c: Likewise.
	* htl/pt-initialize.c: Likewise.
	* htl/pt-internal.h: Likewise.
	* htl/pt-join.c: Likewise.
	* htl/pt-self.c: Likewise.
	* htl/pt-setcancelstate.c: Likewise.
	* htl/pt-setcanceltype.c: Likewise.
	* htl/pt-sigmask.c: Likewise.
	* htl/pt-spin-inlines.c: Likewise.
	* htl/pt-testcancel.c: Likewise.
	* htl/pt-yield.c: Likewise.
	* htl/tests/test-1.c: Likewise.
	* htl/tests/test-10.c: Likewise.
	* htl/tests/test-11.c: Likewise.
	* htl/tests/test-12.c: Likewise.
	* htl/tests/test-13.c: Likewise.
	* htl/tests/test-14.c: Likewise.
	* htl/tests/test-15.c: Likewise.
	* htl/tests/test-16.c: Likewise.
	* htl/tests/test-17.c: Likewise.
	* htl/tests/test-2.c: Likewise.
	* htl/tests/test-3.c: Likewise.
	* htl/tests/test-4.c: Likewise.
	* htl/tests/test-5.c: Likewise.
	* htl/tests/test-6.c: Likewise.
	* htl/tests/test-7.c: Likewise.
	* htl/tests/test-8.c: Likewise.
	* htl/tests/test-9.c: Likewise.
	* htl/tests/test-__pthread_destroy_specific-skip.c: Likewise.
	* sysdeps/htl/bits/cancelation.h: Likewise.
	* sysdeps/htl/bits/pthread-np.h: Likewise.
	* sysdeps/htl/bits/pthread.h: Likewise.
	* sysdeps/htl/bits/pthreadtypes.h: Likewise.
	* sysdeps/htl/bits/semaphore.h: Likewise.
	* sysdeps/htl/bits/types/__pthread_key.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_attr.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_barrier.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_barrierattr.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_cond.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_condattr.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_mutex.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_mutexattr.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_once.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_rwlock.h: Likewise.
	* sysdeps/htl/bits/types/struct___pthread_rwlockattr.h: Likewise.
	* sysdeps/htl/old_pt-atfork.c: Likewise.
	* sysdeps/htl/pt-atfork.c: Likewise.
	* sysdeps/htl/pt-attr-destroy.c: Likewise.
	* sysdeps/htl/pt-attr-getdetachstate.c: Likewise.
	* sysdeps/htl/pt-attr-getguardsize.c: Likewise.
	* sysdeps/htl/pt-attr-getinheritsched.c: Likewise.
	* sysdeps/htl/pt-attr-getschedparam.c: Likewise.
	* sysdeps/htl/pt-attr-getschedpolicy.c: Likewise.
	* sysdeps/htl/pt-attr-getscope.c: Likewise.
	* sysdeps/htl/pt-attr-getstack.c: Likewise.
	* sysdeps/htl/pt-attr-getstackaddr.c: Likewise.
	* sysdeps/htl/pt-attr-getstacksize.c: Likewise.
	* sysdeps/htl/pt-attr-init.c: Likewise.
	* sysdeps/htl/pt-attr-setdetachstate.c: Likewise.
	* sysdeps/htl/pt-attr-setguardsize.c: Likewise.
	* sysdeps/htl/pt-attr-setinheritsched.c: Likewise.
	* sysdeps/htl/pt-attr-setschedparam.c: Likewise.
	* sysdeps/htl/pt-attr-setschedpolicy.c: Likewise.
	* sysdeps/htl/pt-attr-setscope.c: Likewise.
	* sysdeps/htl/pt-attr-setstack.c: Likewise.
	* sysdeps/htl/pt-attr-setstackaddr.c: Likewise.
	* sysdeps/htl/pt-attr-setstacksize.c: Likewise.
	* sysdeps/htl/pt-attr.c: Likewise.
	* sysdeps/htl/pt-barrier-destroy.c: Likewise.
	* sysdeps/htl/pt-barrier-init.c: Likewise.
	* sysdeps/htl/pt-barrier-wait.c: Likewise.
	* sysdeps/htl/pt-barrier.c: Likewise.
	* sysdeps/htl/pt-barrierattr-destroy.c: Likewise.
	* sysdeps/htl/pt-barrierattr-getpshared.c: Likewise.
	* sysdeps/htl/pt-barrierattr-init.c: Likewise.
	* sysdeps/htl/pt-barrierattr-setpshared.c: Likewise.
	* sysdeps/htl/pt-cond-brdcast.c: Likewise.
	* sysdeps/htl/pt-cond-destroy.c: Likewise.
	* sysdeps/htl/pt-cond-init.c: Likewise.
	* sysdeps/htl/pt-cond-signal.c: Likewise.
	* sysdeps/htl/pt-cond-timedwait.c: Likewise.
	* sysdeps/htl/pt-cond-wait.c: Likewise.
	* sysdeps/htl/pt-cond.c: Likewise.
	* sysdeps/htl/pt-condattr-destroy.c: Likewise.
	* sysdeps/htl/pt-condattr-getclock.c: Likewise.
	* sysdeps/htl/pt-condattr-getpshared.c: Likewise.
	* sysdeps/htl/pt-condattr-init.c: Likewise.
	* sysdeps/htl/pt-condattr-setclock.c: Likewise.
	* sysdeps/htl/pt-condattr-setpshared.c: Likewise.
	* sysdeps/htl/pt-destroy-specific.c: Likewise.
	* sysdeps/htl/pt-equal.c: Likewise.
	* sysdeps/htl/pt-getconcurrency.c: Likewise.
	* sysdeps/htl/pt-getcpuclockid.c: Likewise.
	* sysdeps/htl/pt-getschedparam.c: Likewise.
	* sysdeps/htl/pt-getspecific.c: Likewise.
	* sysdeps/htl/pt-init-specific.c: Likewise.
	* sysdeps/htl/pt-key-create.c: Likewise.
	* sysdeps/htl/pt-key-delete.c: Likewise.
	* sysdeps/htl/pt-key.h: Likewise.
	* sysdeps/htl/pt-mutex-destroy.c: Likewise.
	* sysdeps/htl/pt-mutex-getprioceiling.c: Likewise.
	* sysdeps/htl/pt-mutex-init.c: Likewise.
	* sysdeps/htl/pt-mutex-lock.c: Likewise.
	* sysdeps/htl/pt-mutex-setprioceiling.c: Likewise.
	* sysdeps/htl/pt-mutex-timedlock.c: Likewise.
	* sysdeps/htl/pt-mutex-trylock.c: Likewise.
	* sysdeps/htl/pt-mutex-unlock.c: Likewise.
	* sysdeps/htl/pt-mutexattr-destroy.c: Likewise.
	* sysdeps/htl/pt-mutexattr-getprioceiling.c: Likewise.
	* sysdeps/htl/pt-mutexattr-getprotocol.c: Likewise.
	* sysdeps/htl/pt-mutexattr-getpshared.c: Likewise.
	* sysdeps/htl/pt-mutexattr-gettype.c: Likewise.
	* sysdeps/htl/pt-mutexattr-init.c: Likewise.
	* sysdeps/htl/pt-mutexattr-setprioceiling.c: Likewise.
	* sysdeps/htl/pt-mutexattr-setprotocol.c: Likewise.
	* sysdeps/htl/pt-mutexattr-setpshared.c: Likewise.
	* sysdeps/htl/pt-mutexattr-settype.c: Likewise.
	* sysdeps/htl/pt-mutexattr.c: Likewise.
	* sysdeps/htl/pt-once.c: Likewise.
	* sysdeps/htl/pt-rwlock-attr.c: Likewise.
	* sysdeps/htl/pt-rwlock-destroy.c: Likewise.
	* sysdeps/htl/pt-rwlock-init.c: Likewise.
	* sysdeps/htl/pt-rwlock-rdlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-timedrdlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-timedwrlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-tryrdlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-trywrlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-unlock.c: Likewise.
	* sysdeps/htl/pt-rwlock-wrlock.c: Likewise.
	* sysdeps/htl/pt-rwlockattr-destroy.c: Likewise.
	* sysdeps/htl/pt-rwlockattr-getpshared.c: Likewise.
	* sysdeps/htl/pt-rwlockattr-init.c: Likewise.
	* sysdeps/htl/pt-rwlockattr-setpshared.c: Likewise.
	* sysdeps/htl/pt-setconcurrency.c: Likewise.
	* sysdeps/htl/pt-setschedparam.c: Likewise.
	* sysdeps/htl/pt-setschedprio.c: Likewise.
	* sysdeps/htl/pt-setspecific.c: Likewise.
	* sysdeps/htl/pt-spin.c: Likewise.
	* sysdeps/htl/pt-startup.c: Likewise.
	* sysdeps/htl/pthread.h: Likewise.
	* sysdeps/htl/sem-close.c: Likewise.
	* sysdeps/htl/sem-destroy.c: Likewise.
	* sysdeps/htl/sem-getvalue.c: Likewise.
	* sysdeps/htl/sem-init.c: Likewise.
	* sysdeps/htl/sem-open.c: Likewise.
	* sysdeps/htl/sem-post.c: Likewise.
	* sysdeps/htl/sem-timedwait.c: Likewise.
	* sysdeps/htl/sem-trywait.c: Likewise.
	* sysdeps/htl/sem-unlink.c: Likewise.
	* sysdeps/htl/sem-wait.c: Likewise.
	* sysdeps/hurd/htl/pt-kill.c: Likewise.
	* sysdeps/i386/htl/pt-machdep.h: Likewise.
	* sysdeps/mach/htl/pt-block.c: Likewise.
	* sysdeps/mach/htl/pt-spin.c: Likewise.
	* sysdeps/mach/htl/pt-stack-alloc.c: Likewise.
	* sysdeps/mach/htl/pt-thread-alloc.c: Likewise.
	* sysdeps/mach/htl/pt-thread-start.c: Likewise.
	* sysdeps/mach/htl/pt-thread-terminate.c: Likewise.
	* sysdeps/mach/htl/pt-timedblock.c: Likewise.
	* sysdeps/mach/htl/pt-wakeup.c: Likewise.
	* sysdeps/mach/hurd/htl/bits/pthread-np.h: Likewise.
	* sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h: Likewise.
	* sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-attr-setstacksize.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-docancel.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-hurd-cond-wait.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-consistent.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-destroy.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-getprioceiling.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-init.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-lock.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-setprioceiling.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-timedlock.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-trylock.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex-unlock.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutex.h: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-destroy.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getprioceiling.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getprotocol.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getpshared.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-gettype.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-init.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setprioceiling.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-setrobust.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-mutexattr-settype.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-sigstate-destroy.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-sigstate-init.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-sigstate.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-sysdep.c: Likewise.
	* sysdeps/mach/hurd/htl/pt-sysdep.h: Likewise.
	* sysdeps/mach/hurd/i386/htl/pt-machdep.c: Likewise.
	* sysdeps/mach/hurd/i386/htl/pt-setup.c: Likewise.
2018-04-02 16:37:36 +02:00
Samuel Thibault deed72f6b0 hurd: Remove bogus net/if_ppp.h
It was not even compilable anyway.

	* sysdeps/mach/hurd/net/if_ppp.h: Remove file.
	* sysdeps/mach/hurd/Makefile (sysdep_headers): Remove net/if_ppp.h.
2018-04-02 02:07:33 +02:00
Samuel Thibault 8e2666ea9a hurd: Advertise libpthread
* sysdeps/mach/hurd/bits/local_lim.h (_POSIX_THREAD_KEYS_MAX,
_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_THREADS_MAX): Define
macros.
* sysdeps/mach/hurd/bits/posix_opt.h (_POSIX_THREADS,
_POSIX_THREAD_ATTR_STACKSIZE, _POSIX_THREAD_ATTR_STACKADDR,
_POSIX_SEMAPHORES, _POSIX_READER_WRITER_LOCKS, _POSIX_TIMEOUTS,
_POSIX_SPIN_LOCKS, _POSIX_BARRIERS): Define macros to 200809L.
2018-04-02 01:57:47 +02:00
Samuel Thibault 33574c17ee hurd: Add hurd thread library
Contributed by

Agustina Arzille <avarzille@riseup.net>
Amos Jeffries <squid3@treenet.co.nz>
David Michael <fedora.dm0@gmail.com>
Marco Gerards <marco@gnu.org>
Marcus Brinkmann <marcus@gnu.org>
Neal H. Walfield <neal@gnu.org>
Pino Toscano <toscano.pino@tiscali.it>
Richard Braun <rbraun@sceen.net>
Roland McGrath <roland@gnu.org>
Samuel Thibault <samuel.thibault@ens-lyon.org>
Thomas DiModica <ricinwich@yahoo.com>
Thomas Schwinge <tschwinge@gnu.org>

	* htl: New directory.
	* sysdeps/htl: New directory.
	* sysdeps/hurd/htl: New directory.
	* sysdeps/i386/htl: New directory.
	* sysdeps/mach/htl: New directory.
	* sysdeps/mach/hurd/htl: New directory.
	* sysdeps/mach/hurd/i386/htl: New directory.
	* nscd/Depend, resolv/Depend, rt/Depend: Add htl dependency.
	* sysdeps/mach/hurd/i386/Implies: Add mach/hurd/i386/htl imply.
	* sysdeps/mach/hurd/i386/libpthread.abilist: New file.
2018-04-02 01:44:14 +02:00
Samuel Thibault 03e2aa50fd hurd: avoid letting signals go to thread created by timer_create
* sysdeps/pthread/timer_routines.c (__timer_thread_start): Block all
signals in thread created for runing timers.
2018-04-02 01:32:11 +02:00
Florian Weimer 1aa52ced5d support_format_addrinfo: Include unknown error number in result 2018-04-01 19:41:01 +02:00
Florian Weimer 4d76d3e59d Linux i386: tst-bz21269 triggers SIGBUS on some kernels
In addition to SIGSEGV and SIGILL, SIGBUS is also a possible signal
generated by the kernel.
2018-03-29 11:42:24 +02:00
Adhemerval Zanella d39c0a459e sparc: Fix arch_fork definition
This patch fixes 3dc214977 for sparc.  Different than other architectures
SPARC kernel Kconfig does not define CONFIG_CLONE_BACKWARDS, however it
has the same ABI as if it did, implemented by sparc-specific code
(sparc_do_fork).

It also has a unique return value convention for clone:

   Parent -->  %o0 == child's  pid, %o1 == 0
   Child  -->  %o0 == parent's pid, %o1 == 1

Which required a special macro to correct issue the syscall
(INLINE_CLONE_SYSCALL).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/unix/sysv/linux/arch-fork.h [__ASSUME_CLONE_BACKWARDS]
	(arch_fork): Issue INLINE_CLONE_SYSCALL if defined.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_CLONE_BACKWARDS): Define.
2018-03-27 21:28:58 -03:00
Jesse Hathaway cc8a1620eb getlogin_r: return early when linux sentinel value is set
When there is no login uid Linux sets /proc/self/loginid to the sentinel
value of, (uid_t) -1. If this is set we can return early and avoid
needlessly looking up the sentinel value in any configured nss
databases.

Checked on aarch64-linux-gnu.

	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid): Return
	early when linux sentinel value is set.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2018-03-27 21:28:36 -03:00
Samuel Thibault 8bfd94d0dc hurd: advertise process memory locking option
mlock/unlockall were already implemented.

* sysdeps/mach/hurd/bits/posix_opt.h (_POSIX_MEMLOCK): Define.
2018-03-27 23:20:07 +02:00
Andreas Schwab f178e59fa5 Fix crash in resolver on memory allocation failure (bug 23005) 2018-03-27 17:26:32 +02:00
Joseph Myers 5f45f96ad0 Unify umount function implementations (bug 16552).
Linux kernel architectures have various arrangements for umount
syscalls.  There is a syscall that takes flags, and an older one that
does not.  Newer architectures have only the one taking flags, under
the name umount2 (or under the name umount, in the ia64 case).  Older
architectures may have both, under the names umount2 and umount (or
under the names umount and oldumount, in the alpha case).  glibc then
has several similar implementations of the umount function (no flags)
in terms of either the __umount2 function, or the corresponding
syscall, or in terms of the old syscall under either of its names.

This patch simplifies the implementations in glibc by always using the
__umount2 function to implement the umount function on all systems
using the Linux kernel.  The linux/generic implementation is moved to
sysdeps/unix/sysv/linux (without any changes to code or comments) and
all the other variants are removed.  (This will have the effect of
causing the new syscall to be used in some cases that previously used
the old one, but as discussed for previous changes, such a change to
the underlying syscalls used is OK.)

There remain two variants of how the __umount2 function is
implemented, either in umount2.S, or, for ia64, in syscalls.list.

Tested with build-many-glibcs.py.

	[BZ #16552]
	* sysdeps/unix/sysv/linux/generic/umount.c: Move to ....
	* sysdeps/unix/sysv/linux/umount.c: ... here.
	* sysdeps/unix/sysv/linux/arm/umount.c: Remove file.
	* sysdeps/unix/sysv/linux/hppa/umount.c: Likewise.
	* sysdeps/unix/sysv/linux/ia64/umount.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/umount.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c: Likewise.
	* sysdeps/unix/sysv/linux/umount.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/umount.c: Likewise.
2018-03-26 21:18:28 +00:00
Andreas Schwab 3dfd23eb4b RISC-V: add remaining relocations 2018-03-26 12:08:21 +02:00
Samuel Thibault 2d813d7b77 hurd: Regenerate errno.h header
* sysdeps/mach/hurd/bits/errno.h: Regenerate.
2018-03-25 20:17:35 +00:00
Samuel Thibault 978a6803e2 hurd: Fix calling __pthread_initialize_minimal in shared case
* sysdeps/generic/ldsodefs.h [SHARED] (__pthread_initialize_minimal):
	Declare function.
2018-03-25 00:59:18 +01:00
Samuel Thibault 37be82a03f Add missing changelog from previous commit 2018-03-25 00:54:55 +01:00
Samuel Thibault fa97d2ab5b hurd: Fix accessing errno from rtld
Letting rtld access errno through TLS can not work at early stages since
TLS will not be initialized yet.  When a private errno is not possible,
we thus have no other way than going through __errno_location.

	* include/errno.h [IS_IN(rtld) && !RTLD_PRIVATE_ERRNO]: Do not use the
	TLS declaration of errno.
2018-03-25 00:48:01 +01:00
H.J. Lu b8114edd3c Add $(tests-execstack-$(have-z-execstack)) after defined [BZ #22998]
When $(tests-execstack-$(have-z-execstack)) is added to tests before
it is defined, it is empty.  This patch adds it to tests after it is
defined.

	[BZ #22998]
	* elf/Makefile (tests): Add $(tests-execstack-$(have-z-execstack))
	after it is defined.
2018-03-24 08:25:55 -07:00
Andrew Senkevich cd66c0e584 Fix i386 memmove issue (bug 22644).
[BZ #22644]
	* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
	branch conditions.
	* string/test-memmove.c (do_test2): New testcase.
2018-03-23 16:19:45 +01:00
Joseph Myers a44061398c Remove unused frame.h header, sigcontextinfo.h macros.
The glibc-internal header frame.h was used in the old
debug/backtrace.c but is now unused.  Similarly, there are some
sigcontextinfo.h macros that are used nowhere in glibc -
ADVANCE_STACK_FRAME and FIRST_FRAME_POINTER were used in the old
debug/backtrace.c, while SIGCONTEXT_EXTRA_ARGS, GET_FRAME, GET_STACK
and CALL_SIGHANDLER were unused even before the removal of that old
implementation (beyond uses of SIGCONTEXT_EXTRA_ARGS in definitions of
CALL_SIGHANDLER).  This patch removes all the unused frame.h headers
and definitions of those macros.

Tested with build-many-glibcs.py.

	* sysdeps/generic/frame.h: Remove file.
	* sysdeps/arm/frame.h: Likewise.
	* sysdeps/hppa/frame.h: Likewise.
	* sysdeps/generic/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS): Remove
	macro.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/mach/hurd/i386/sigcontextinfo.h (SIGCONTEXT_EXTRA_ARGS):
	Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(ADVANCE_STACK_FRAME): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/i386/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/s390/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/sh/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(FIRST_FRAME_POINTER): Likewise.
	(ADVANCE_STACK_FRAME): Likewise.
	(GET_STACK): Likewise.
	(GET_FRAME): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(ADVANCE_STACK_FRAME): Likewise.
	(GET_STACK): Likewise.
	(GET_FRAME): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/tile/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
	(SIGCONTEXT_EXTRA_ARGS): Likewise.
	(GET_FRAME): Likewise.
	(GET_STACK): Likewise.
	(CALL_SIGHANDLER): Likewise.
2018-03-22 16:40:51 +00:00
Joseph Myers ffec7b2740 Use x86_64 backtrace as generic version.
No glibc configuration uses the present debug/backtrace.c, whereas
several #include the x86_64 version.  The x86_64 version is
effectively a generic one (using _Unwind_Backtrace from libgcc, which
works much more reliably than the built-in functions used by
debug/backtrace.c).  This patch moves it to debug/backtrace.c and
removes all the #includes of the x86_64 version from other
architectures which are no longer required.

I do not know whether all the other architecture-specific backtrace
implementations that are based on _Unwind_Backtrace are required, or
whether, where their differences from the generic version do something
useful, suitable hooks could be added to the generic version to reduce
the duplication involved.

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

	* sysdeps/x86_64/backtrace.c: Move to ....
	* debug/backtrace.c: ... here.
	* sysdeps/aarch64/backtrace.c: Remove file.
	* sysdeps/alpha/backtrace.c: Likewise.
	* sysdeps/hppa/backtrace.c: Likewise.
	* sysdeps/ia64/backtrace.c: Likewise.
	* sysdeps/mips/backtrace.c: Likewise.
	* sysdeps/nios2/backtrace.c: Likewise.
	* sysdeps/riscv/backtrace.c: Likewise.
	* sysdeps/sh/backtrace.c: Likewise.
	* sysdeps/tile/backtrace.c: Likewise.
2018-03-21 17:25:30 +00:00
Joseph Myers d0c5d731af Remove powerpc, sparc fdim inlines (bug 22987).
The powerpc and sparc bits/mathinline.h include inlines of fdim and
fdimf.  These are not restricted to -fno-math-errno, but do not set
errno, and wrongly use ordered <= comparisons instead of the required
islessequal comparisons (this latter issue is latent on powerpc
because GCC wrongly uses unordered comparison instructions for
operations that should use ordered comparison instructions).

Since we wish to avoid such header inlines anyway, leaving it to the
compiler to inline such standard functions under appropriate
conditions, this patch fixes those issues by removing the inlines in
question (and thus removing the sparc bits/mathinline.h header which
had no other inlines left in it).  I've filed
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85003> for adding
correct fdim inlines to GCC, since the function is simple enough that
a correct inline is a perfectly reasonable architecture-independent
optimization with -fno-math-errno and in the absence of implicit
excess precision.

Tested with build-many-glibcs.py for all its powerpc and sparc
configurations.

	[BZ #22987]
	* sysdeps/powerpc/bits/mathinline.h (fdim): Remove inline
	function.
	(fdimf): Likewise.
	* sysdeps/sparc/fpu/bits/mathinline.h: Remove file.
2018-03-20 18:35:50 +00:00
Joseph Myers 8a07b0c43c Fix signed integer overflow in random_r (bug 17343).
Bug 17343 reports that stdlib/random_r.c has code with undefined
behavior because of signed integer overflow on int32_t.  This patch
changes the code so that the possibly overflowing computations use
unsigned arithmetic instead.

Note that the bug report refers to "Most code" in that file.  The
places changed in this patch are the only ones I found where I think
such overflow can occur.

Tested for x86_64 and x86.

	[BZ #17343]
	* stdlib/random_r.c (__random_r): Use unsigned arithmetic for
	possibly overflowing computations.
2018-03-20 18:25:24 +00:00
Samuel Thibault ceb54b9b4f Fix errno values
* manual/errno.texi (EOWNERDEAD, ENOTRECOVERABLE): Remove errno
	values from Linux-specific section now that it is in the GNU section.
	* sysdeps/gnu/errlist.c: Regenerate.
2018-03-20 03:10:57 +01:00
Joseph Myers 8d3f9e85cf Add narrowing subtract functions.
This patch adds the narrowing subtract functions from TS 18661-1 to
glibc's libm: fsub, fsubl, dsubl, f32subf64, f32subf32x, f32xsubf64
for all configurations; f32subf64x, f32subf128, f64subf64x,
f64subf128, f32xsubf64x, f32xsubf128, f64xsubf128 for configurations
with _Float64x and _Float128; __nldbl_dsubl for ldbl-opt.

The changes are essentially the same as for the narrowing add
functions, so the description of those generally applies to this patch
as well.

Tested for x86_64, x86, mips64 (all three ABIs, both hard and soft
float) and powerpc, and with build-many-glibcs.py.

	* math/Makefile (libm-narrow-fns): Add sub.
	(libm-test-funcs-narrow): Likewise.
	* math/Versions (GLIBC_2.28): Add narrowing subtract functions.
	* math/bits/mathcalls-narrow.h (sub): Use __MATHCALL_NARROW.
	* math/gen-auto-libm-tests.c (test_functions): Add sub.
	* math/math-narrow.h (CHECK_NARROW_SUB): New macro.
	(NARROW_SUB_ROUND_TO_ODD): Likewise.
	(NARROW_SUB_TRIVIAL): Likewise.
	* sysdeps/ieee754/float128/float128_private.h (__fsubl): New
	macro.
	(__dsubl): Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fsub and
	dsub.
	(CFLAGS-nldbl-dsub.c): New variable.
	(CFLAGS-nldbl-fsub.c): Likewise.
	* sysdeps/ieee754/ldbl-opt/Versions (GLIBC_2.28): Add
	__nldbl_dsubl.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (__nldbl_dsubl): New
	prototype.
	* manual/arith.texi (Misc FP Arithmetic): Document fsub, fsubl,
	dsubl, fMsubfN, fMsubfNx, fMxsubfN and fMxsubfNx.
	* math/auto-libm-test-in: Add tests of sub.
	* math/auto-libm-test-out-narrow-sub: New generated file.
	* math/libm-test-narrow-sub.inc: New file.
	* sysdeps/i386/fpu/s_f32xsubf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_f32xsubf64.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fsub.c: Likewise.
	* sysdeps/ieee754/float128/s_f32subf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64subf128.c: Likewise.
	* sysdeps/ieee754/float128/s_f64xsubf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_dsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_f64xsubf128.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_dsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_dsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fsubl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-dsub.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/nldbl-fsub.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_dsubl.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fsub.c: Likewise.
	* sysdeps/ieee754/soft-fp/s_fsubl.c: Likewise.
	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
	* sysdeps/mach/hurd/i386/libm.abilist: Likewise.
	* 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/riscv/rv64/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/tilegx32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2018-03-20 00:34:52 +00:00
Joseph Myers d473f01520 Add SHT_X86_64_UNWIND to elf.h (bug 20079).
As requested in bug 20079, this patch adds SHT_X86_64_UNWIND (a
standard value from the x86_64 ABI) to elf.h.

Tested for x86_64.

	[BZ #20079]
	* elf/elf.h (SHT_X86_64_UNWIND): New macro.
2018-03-19 18:08:48 +00:00
Wilco Dijkstra fbce6f7260 Undefine attribute_hidden to fix benchtests
Add an undefine of attribute_hidden since it may be defined in some cases
(it must be defined since it is used by some hp-timing configurations).

	* benchtests/bench-timing.h (attribute_hidden): Undefine.
2018-03-19 10:53:14 +00:00
Richard Braun 72e7ffc37f Hurd: fix port leak in TLS
* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Use a temporary
	thread reference.
2018-03-18 20:43:59 +01:00
Samuel Thibault 20bc801b3d hurd: Add mlockall support
* sysdeps/mach/hurd/mlockall.c: New file.
	* sysdeps/mach/hurd/munlockall.c: New file.
2018-03-18 20:38:48 +01:00
Samuel Thibault aa2189295e hurd: Fix boot with statically-linked exec server
* sysdeps/mach/hurd/i386/init-first.c (init): Also find ELF headers by
	oneself when the pointer given in D is nul (as set by ext2fs).
2018-03-18 20:38:26 +01:00
Samuel Thibault 72103e73c9 hurd: Fix O_DIRECTORY | O_NOFOLLOW
Appending / to the path to be looked up would make us always follow a final
symlink, even with O_NOTRANS (since the final resolution is after the
'/').  In the O_DIRECTORY | O_NOFOLLOW case, we thus have to really open
the node and stat it, which we already do anyway, and check for
directory type.

	* hurd/hurdlookup.c (__hurd_file_name_lookup): Do not append '/' to
	path when flags contains O_NOFOLLOW.
	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ENOTDIR
	if flags contains O_DIRECTORY and the result is a directory.
2018-03-18 19:43:04 +01:00
Samuel Thibault 489999cc9c hurd: Fix O_NOFOLLOW
The error code documented by POSIX for opening a symlink with O_NOFOLLOW
is ELOOP.

Also, if the translator does not expose symlink as a symlink translator but
as a S_IFLNK file, O_NOFOLLOW needs to return ELOOP too.

	* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Return ELOOP
	when opening a symlink with O_NOFOLLOW.
2018-03-18 19:42:17 +01:00
Agustina Arzille fb4cc8a0c2 hurd: Reimplement libc locks using mach's gsync
* hurd/Makefile (routines): Add hurdlock.
	* hurd/Versions (GLIBC_PRIVATE): Added new entry to export the above
	interface.
	(HURD_CTHREADS_0.3): Remove __libc_getspecific.
	* hurd/hurdpid.c: Include <lowlevellock.h>
	(_S_msg_proc_newids): Use lll_wait to synchronize.
	* hurd/hurdsig.c: (reauth_proc): Use __mutex_lock and __mutex_unlock.
	* hurd/setauth.c: Include <hurdlock.h>, use integer for synchronization.
	* mach/Makefile (lock-headers): Remove machine-lock.h.
	* mach/lock-intern.h: Include <lowlevellock.h> instead of
	<machine-lock.h>.
	(__spin_lock_t): New type.
	(__SPIN_LOCK_INITIALIZER): New macro.
	(__spin_lock, __spin_unlock, __spin_try_lock, __spin_lock_locked,
	__mutex_init, __mutex_lock_solid, __mutex_unlock_solid, __mutex_lock,
	__mutex_unlock, __mutex_trylock): Use lll to implement locks.
	* mach/mutex-init.c: Include <lowlevellock.h> instead of <cthreads.h>.
	(__mutex_init): Initialize with lll.
	* manual/errno.texi (EOWNERDEAD, ENOTRECOVERABLE): New errno values.
	* sysdeps/mach/Makefile: Add libmachuser as dependencies for libs
	needing lll.
	* sysdeps/mach/hurd/bits/errno.h: Regenerate.
	* sysdeps/mach/hurd/cthreads.c (__libc_getspecific): Remove function.
	* sysdeps/mach/hurd/bits/libc-lock.h: Remove file.
	* sysdeps/mach/hurd/setpgid.c: Include <lowlevellock.h>.
	(__setpgid): Use lll for synchronization.
	* sysdeps/mach/hurd/setsid.c: Likewise with __setsid.
	* sysdeps/mach/bits/libc-lock.h: Include <tls.h> and <lowlevellock.h>
	instead of <cthreads.h>.
	(_IO_lock_inexpensive): New macro
	(__libc_lock_recursive_t, __rtld_lock_recursive_t): New structures.
	(__libc_lock_self0): New declaration.
	(__libc_lock_owner_self): New macro.
	(__libc_key_t): Remove type.
	(_LIBC_LOCK_INITIALIZER): New macro.
	(__libc_lock_define_initialized, __libc_lock_init, __libc_lock_fini,
	__libc_lock_fini_recursive, __rtld_lock_fini_recursive,
	__libc_lock_lock, __libc_lock_trylock, __libc_lock_unlock,
	__libc_lock_define_initialized_recursive,
	__rtld_lock_define_initialized_recursive,
	__libc_lock_init_recursive, __libc_lock_trylock_recursive,
	__libc_lock_lock_recursive, __libc_lock_unlock_recursive,
	__rtld_lock_initialize, __rtld_lock_trylock_recursive,
	__rtld_lock_lock_recursive, __rtld_lock_unlock_recursive
	__libc_once_define, __libc_mutex_unlock): Reimplement with lll.
	(__libc_lock_define_recursive, __rtld_lock_define_recursive,
	_LIBC_LOCK_RECURSIVE_INITIALIZER, _RTLD_LOCK_RECURSIVE_INITIALIZER):
	New macros.
	Include <libc-lockP.h> to reimplement libc_key* with pthread_key*.
	* hurd/hurdlock.c: New file.
	* hurd/hurdlock.h: New file.
	* mach/lowlevellock.h: New file
2018-03-18 18:23:45 +01:00
Agustina Arzille 542c20a171 hurd: Rewrite __libc_cleanup_*
This makes it notably safe against 'return' and such, and used for
__libc_cleanup_push/pop.

	* sysdeps/mach/libc-lock.h (__libc_cleanup_frame): Define structure.
	(__libc_cleanup_fct): Define function.
	(__libc_cleanup_region_start, __libc_cleanup_region_end,
	__libc_cleanup_end): Rewrite implementation using
	__attribute__ ((__cleanup__)).
	(__libc_cleanup_push, __libc_cleanup_pop): New macros.
2018-03-18 17:27:00 +01:00
Samuel Thibault 9a37922ee0 hurd: Add missing include
* sysdeps/mach/hurd/cthreads.c: Include <cthreads.h>.
2018-03-18 16:38:26 +01:00
Samuel Thibault dd28d4ba97 x86_64: Fix build with RTLD_PRIVATE_ERRNO defined to 1
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Always include
	<dl-sysdep.h>.  Test for value of RTLD_PRIVATE_ERRNO instead of
	testing whether it is defined.
2018-03-18 02:11:56 +01:00
Samuel Thibault c2fb08c78a hurd: Fix link cthread/pthread symbol exposition.
* hurd/Versions (HURD_CTHREADS_0.3): Rename weak refs cthread_fork,
	cthread_detach, pthread_getattr_np, pthread_attr_getstack,
	cthread_keycreate, cthread_getspecific, cthread_setspecific to
	__cthread_fork, __cthread_detach, __pthread_getattr_np,
	__pthread_attr_getstack, __cthread_keycreate, __cthread_getspecific,
	__cthread_setspecific.
	* hurd/hurdsig.c (_hurdsig_init): Use __cthread_fork,
	__cthread_detach, __pthread_getattr_np, __pthread_attr_getstack,
	__cthread_t instead of cthread_fork, cthread_detach,
	pthread_getattr_np, pthread_attr_getstack.
	* sysdeps/mach/hurd/cthreads.c (cthread_keycreate): Rename to
	__cthread_keycreate.
	(cthread_getspecific): Rename to __cthread_getspecific.
	(cthread_setspecific): Rename to __cthread_setspecific.
	(__libc_getspecific): Use __cthread_getspecific instead of
	cthread_getspecific.
	* sysdeps/mach/hurd/libc-lock.h (__libc_key_create): Use
	__cthread_keycreate instead of cthread_keycreate.
	(__libc_setspecific): Use __cthread_setspecific instead of
	cthread_setspecific.
	* sysdeps/mach/libc-lock.h (__libc_key_create, __libc_setspecific):
	Likewise.
2018-03-17 23:53:39 +01:00
Samuel Thibault dc33bef307 hurd: Replace threadvars with TLS
This gets rid of a lot of kludge and gets closer to other ports.

	* hurd/Makefile (headers): Remove threadvar.h.
	(inline-headers): Remove threadvar.h.
	* hurd/Versions (GLIBC_2.0: Remove __hurd_sigthread_stack_base,
	__hurd_sigthread_stack_end, __hurd_sigthread_variables,
	__hurd_threadvar_max, __hurd_errno_location.
	(HURD_CTHREADS_0.3): Add pthread_getattr_np, pthread_attr_getstack.
	* hurd/hurd/signal.h: Do not include <hurd/threadvar.h>.
	(_hurd_self_sigstate): Use THREAD_SELF to get _hurd_sigstate.
	(_HURD_SIGNAL_H_EXTERN_INLINE): Use THREAD_SELF to get _hurd_sigstate,
	unless TLS is not initialized yet, in which case we do not need a
	critical section yet anyway.
	* hurd/hurd/threadvar.h: Include <tls.h>, do not include
	<machine-sp.h>.
	(__hurd_sigthread_variables, __hurd_threadvar_max): Remove variables
	declarations.
	(__hurd_threadvar_index): Remove enum.
	(_HURD_THREADVAR_H_EXTERN_INLINE): Remove macro.
	(__hurd_threadvar_location_from_sp,__hurd_threadvar_location): Remove
	inlines.
	(__hurd_reply_port0): New variable declaration.
	(__hurd_local_reply_port): New macro.
	* hurd/hurdsig.c (__hurd_sigthread_variables): Remove variable.
	(interrupted_reply_port_location): Add thread_t parameter.  Use it
	with THREAD_TCB to access thread-local variables.
	(_hurdsig_abort_rpcs): Pass ss->thread to
	interrupted_reply_port_location.
	(_hurd_internal_post_signal): Likewise.
	(_hurdsig_init): Use presence of cthread_fork instead of
	__hurd_threadvar_stack_mask to start signal thread by hand.
	Remove signal thread threadvar initialization.
	* hurd/hurdstartup.c: Do not include <hurd/threadvar.h>
	* hurd/sigunwind.c: Include <hurd/threadvar.h>
	(_hurdsig_longjmp_from_handler): Use __hurd_local_reply_port instead
	of threadvar.
	* sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE): Add
	__libc_lock_self0.
	(ld.GLIBC_2.0): Remove __hurd_sigthread_stack_base,
	__hurd_sigthread_stack_end, __hurd_sigthread_variables.
	(ld.GLIBC_PRIVATE): Add __libc_lock_self0.
	* sysdeps/mach/hurd/cthreads.c: Add __libc_lock_self0.
	* sysdeps/mach/hurd/dl-sysdep.c (errno, __hurd_sigthread_stack_base,
	__hurd_sigthread_stack_end, __hurd_sigthread_variables, threadvars,
	__hurd_threadvar_stack_offset, __hurd_threadvar_stack_mask): Do not
	define variables.
	* sysdeps/mach/hurd/errno-loc.c: Do not include <errno.h> and
	<hurd/threadvar.h>.
	[IS_IN(rtld)] (rtld_errno): New variable.
	[IS_IN(rtld)] (__errno_location): New weak function.
	[!IS_IN(rtld)]: Include "../../../csu/errno-loc.c".
	* sysdeps/mach/hurd/errno.c: Remove file.
	* sysdeps/mach/hurd/fork.c: Include <hurd/threadvar.h>
	(__fork): Remove THREADVAR_SPACE macro and its use.
	* sysdeps/mach/hurd/i386/init-first.c (__hurd_threadvar_max): Remove
	variable.
	(init): Do not initialize threadvar.
	* sysdeps/mach/hurd/i386/libc.abilist (__hurd_threadvar_max): Remove
	symbol.
	* sysdeps/mach/hurd/i386/sigreturn.c (__sigreturn): Use
	__hurd_local_reply_port instead of threadvar.
	* sysdeps/mach/hurd/i386/tls.h (tcbhead_t): Add reply_port and
	_hurd_sigstate fields.
	(HURD_DESC_TLS, __LIBC_NO_TLS, THREAD_TCB): New macro.
	* sysdeps/mach/hurd/i386/trampoline.c: Remove outdated comment.
	* sysdeps/mach/hurd/libc-lock.h: Do not include <hurd/threadvar.h>.
	(__libc_lock_owner_self): Use &__libc_lock_self0 and THREAD_SELF
	instead of threadvar.
	* sysdeps/mach/hurd/libc-tsd.h: Remove file.
	* sysdeps/mach/hurd/mig-reply.c (GETPORT, reply_port): Remove macros.
	(use_threadvar, global_reply_port): Remove variables.
	(__hurd_reply_port0): New variable.
	(__mig_get_reply_port): Use __hurd_local_reply_port and
	__hurd_reply_port0 instead of threadvar.
	(__mig_dealloc_reply_port): Likewise.
	(__mig_init): Do not initialize threadvar.
	* sysdeps/mach/hurd/profil.c: Fix comment.
2018-03-17 23:29:57 +01:00
Samuel Thibault 34e6a8694d hurd: Fix getting signal thread stack layout for fork
* hurd/hurdsig.c: Include <pthread.h>.
(_hurdsig_init): Call pthread_getattr_np and pthread_attr_getstack to
get the signal thread stack layout.
2018-03-17 22:53:01 +01:00
Samuel Thibault f8baf2a224 hurd: add TLS support
* sysdeps/generic/thread_state.h (MACHINE_NEW_THREAD_STATE_FLAVOR):
	Define macro.
	* sysdeps/mach/thread_state.h (MACHINE_THREAD_STATE_FIX_NEW): New macro.
	* sysdeps/mach/i386/thread_state.h
	(MACHINE_NEW_THREAD_STATE_FLAVOR): New macro, defined to
	i386_THREAD_STATE.
	(MACHINE_THREAD_STATE_FLAVOR): Define to i386_REGS_SEGS_STATE instead of
	i386_THREAD_STATE.
	(MACHINE_THREAD_STATE_FIX_NEW): New macro, reads segments.

	* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Use
	i386_REGS_SEGS_STATE instead of i386_THREAD_STATE.

	* sysdeps/mach/hurd/i386/tls.h (TCB_ALIGNMENT, HURD_SEL_LDT): New
	macros.
	(_hurd_tls_fork): Add original thread parameter, Duplicate existing LDT
	descriptor instead of creating a new one.
	(_hurd_tls_new): New function, creates a new descriptor and updates tcb.

	* mach/setup-thread.c: Include <ldsodefs.h>.
	(__mach_setup_thread): Call _dl_allocate_tls, pass
	MACHINE_NEW_THREAD_STATE_FLAVOR to __thread_set_state instead of
	MACHINE_THREAD_STATE_FLAVOR, before getting
	MACHINE_THREAD_STATE_FLAVOR, calling _hurd_tls_new, and setting
	MACHINE_THREAD_STATE_FLAVOR with the result.
	* hurd/hurdfault.c (_hurdsig_fault_init): Call
	MACHINE_THREAD_STATE_FIX_NEW.
	* sysdeps/mach/hurd/fork.c (__fork): Call _hurd_tls_fork for sigthread
	too.  Add original thread parameter.
2018-03-17 03:17:36 +01:00
Joseph Myers 5d75b75fb7 Remove sysdeps/x86/fpu/bits/mathinline.h __finite inline.
Continuing the removals of inline functions from the x86
bits/mathinline.h, this patch removes an inline of __finite (which was
not actually architecture-specific at all beyond its
endianness-dependence).

This inline is not normally used with GCC 4.4 or later, because
isfinite now uses __builtin_isfinite except for -fsignaling-nans.
Allowing __builtin_isfinite etc. to work properly even for
-fsignaling-nans, by implementing versions of those built-in functions
that use integer arithmetic in GCC, is
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66462> (a patch was
committed but had to be reverted because it caused problems, and that
patch didn't address all formats for all architectures, only some, so
by itself would not have been sufficient to allow glibc to use
__builtin_isfinite unconditionally for new-enough GCC).

Tested for x86_64 and x86.

	* sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC] (__finite):
	Remove inline function.
2018-03-16 18:36:53 +00:00
Joseph Myers 34ba96b89c Update i386 libm-test-ulps.
I found the i386 libm-test-ulps files needed updating (probably the
sqrt changes perturbed exactly when excess precision was used by the
compiler).

	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
2018-03-16 17:43:38 +00:00