platform/upstream/glibc.git
6 years agoinet: Actually build and run tst-deadline
Florian Weimer [Wed, 4 Apr 2018 14:08:18 +0000 (16:08 +0200)]
inet: Actually build and run tst-deadline

6 years agohurd: Fix typo
Samuel Thibault [Wed, 4 Apr 2018 00:31:23 +0000 (02:31 +0200)]
hurd: Fix typo

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Fix typo in IFNAMSIZ.

6 years agohurd: fix build
Samuel Thibault [Wed, 4 Apr 2018 00:28:20 +0000 (02:28 +0200)]
hurd: fix build

* signal/sigaddset.c: Include <sigsetopts.h>.
* signal/sigdelset.c: Likewise.

6 years agohurd: Add missing symbols
Samuel Thibault [Wed, 4 Apr 2018 00:17:49 +0000 (02:17 +0200)]
hurd: Add missing symbols

* sysdeps/mach/hurd/i386/exc2signal.c (_hurd_exception2signal): Add
hidden def.
* mach/spin-lock.c (__mutex_unlock): Add hidden def.

6 years agohurd: Silence warning
Samuel Thibault [Wed, 4 Apr 2018 00:06:16 +0000 (02:06 +0200)]
hurd: Silence warning

* hurd/hurdsig.c (interrupted_reply_port_location): Use
DIAG_IGNORE_NEEDS_COMMENT to silence warning with GCC 6 and before.

6 years agohurd: Fix missing trailing NUL in __if_nametoindex
Samuel Thibault [Tue, 3 Apr 2018 22:01:19 +0000 (00:01 +0200)]
hurd: Fix missing trailing NUL in __if_nametoindex

* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer
size to strncpy.

6 years agohurd: Make __if_nametoindex return ENODEV if ifname is too long
Samuel Thibault [Tue, 3 Apr 2018 21:13:13 +0000 (23:13 +0200)]
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.

6 years agoRevert parts of "hurd: Avoid more libc.so local PLTs"
Samuel Thibault [Tue, 3 Apr 2018 21:00:14 +0000 (23:00 +0200)]
Revert parts of "hurd: Avoid more libc.so local PLTs"

This reverts parts of commit 82dbf555a4d41690f63b94ccb4db4bf43d873aa0.

6 years agoRevert "s390x: Fix hidden aliases"
Samuel Thibault [Tue, 3 Apr 2018 20:59:17 +0000 (22:59 +0200)]
Revert "s390x: Fix hidden aliases"

This reverts commit 811836a411a1c97a0e70e7f096e57f316dc19c72.

6 years agoUpdate RWF_SUPPORTED for Linux kernel 4.16 [BZ #22947]
H.J. Lu [Tue, 3 Apr 2018 19:19:20 +0000 (12:19 -0700)]
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.

6 years agoFilter out NPTL internal signals (BZ #22391)
Adhemerval Zanella [Wed, 1 Nov 2017 01:10:37 +0000 (23:10 -0200)]
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>
6 years agohurd: Fix buffer overrun in __if_nametoindex
Samuel Thibault [Tue, 3 Apr 2018 16:06:15 +0000 (18:06 +0200)]
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.

6 years ago[PATCH 7/7] sin/cos slow paths: refactor sincos implementation
Wilco Dijkstra [Tue, 3 Apr 2018 15:49:33 +0000 (16:49 +0100)]
[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.

6 years ago[PATCH 6/7] sin/cos slow paths: refactor duplicated code into dosin
Wilco Dijkstra [Tue, 3 Apr 2018 15:46:10 +0000 (16:46 +0100)]
[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.

6 years ago[PATCH 5/7] sin/cos slow paths: remove unused slowpath functions
Wilco Dijkstra [Tue, 3 Apr 2018 15:43:34 +0000 (16:43 +0100)]
[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.

6 years ago[PATCH 4/7] sin/cos slow paths: remove slow paths from huge range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:41:36 +0000 (16:41 +0100)]
[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.

6 years ago[PATCH 3/7] sin/cos slow paths: remove slow paths from small range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:33:13 +0000 (16:33 +0100)]
[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.

6 years ago[PATCH 2/7] sin/cos slow paths: remove large range reduction
Wilco Dijkstra [Tue, 3 Apr 2018 15:28:03 +0000 (16:28 +0100)]
[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.

6 years ago[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs
Wilco Dijkstra [Tue, 3 Apr 2018 15:24:29 +0000 (16:24 +0100)]
[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.

6 years agoUse Linux 4.16 in build-many-glibcs.py.
Joseph Myers [Tue, 3 Apr 2018 15:41:08 +0000 (15:41 +0000)]
Use Linux 4.16 in build-many-glibcs.py.

* scripts/build-many-glibcs.py (Context.checkout): Default Linux
version to 4.16.

6 years agoAssume O_DIRECTORY for opendir
Adhemerval Zanella [Thu, 1 Mar 2018 18:55:25 +0000 (15:55 -0300)]
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.

6 years agoAdd Changelog reference to BZ#23024
Adhemerval Zanella [Tue, 3 Apr 2018 11:54:32 +0000 (08:54 -0300)]
Add Changelog reference to BZ#23024

6 years agos390x: Fix hidden aliases
Samuel Thibault [Tue, 3 Apr 2018 11:52:29 +0000 (13:52 +0200)]
s390x: Fix hidden aliases

* sysdeps/s390/longjmp.c (__libc_longjmp, __libc_siglongjmp): New
hidden defs.

6 years agohurd: Avoid local PLT in libpthread
Samuel Thibault [Tue, 3 Apr 2018 00:56:35 +0000 (02:56 +0200)]
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.

6 years agohurd: Avoid more libc.so local PLTs
Samuel Thibault [Tue, 3 Apr 2018 00:34:31 +0000 (00:34 +0000)]
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.

6 years agohurd: Fix typo
Samuel Thibault [Tue, 3 Apr 2018 00:29:50 +0000 (02:29 +0200)]
hurd: Fix typo

* htl/pt-cleanup.c: Define __pthread_get_cleanup_stack alias instead of
__pthread_cleanup_stack.

6 years agohurd: Avoid more libc.so PLTs
Samuel Thibault [Mon, 2 Apr 2018 23:40:26 +0000 (23:40 +0000)]
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.

6 years agohurd: Avoid some libc.so PLTs
Samuel Thibault [Mon, 2 Apr 2018 22:07:28 +0000 (22:07 +0000)]
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.

6 years agohurd: whitelist ld.so PLTs supposed to be avoided by rtld_hidden
Samuel Thibault [Mon, 2 Apr 2018 21:47:56 +0000 (23:47 +0200)]
hurd: whitelist ld.so PLTs supposed to be avoided by rtld_hidden

* sysdeps/mach/hurd/localplt.data (ld.so): Add _dl_allocate_tls,
_dl_allocate_tls_init, _dl_exception_create, _dl_exception_create_format,
_dl_exception_free, _dl_find_dso_for_object, _dl_init_first, _dl_mcount,
___tls_get_addr, __tunable_get_val.

6 years agohurd: Update localplt.data
Samuel Thibault [Mon, 2 Apr 2018 21:43:33 +0000 (23:43 +0200)]
hurd: Update localplt.data

* sysdeps/mach/hurd/localplt.data: Inherit sysdeps/generic/localplt.data
and comment functions currently unused.

6 years agohurd: Add __errno_location to overridable ld.so symbols
Samuel Thibault [Mon, 2 Apr 2018 21:32:48 +0000 (23:32 +0200)]
hurd: Add __errno_location to overridable ld.so symbols

* sysdeps/mach/hurd/localplt.data (ld.so): Add __errno_location.

6 years agohurd: whitelist rtld symbols expected to be overridable
Samuel Thibault [Mon, 2 Apr 2018 21:02:02 +0000 (23:02 +0200)]
hurd: whitelist rtld symbols expected to be overridable

* sysdeps/mach/hurd/localplt.data: New file.

6 years agoRevert __dirfd PLT avoidance for now
Samuel Thibault [Mon, 2 Apr 2018 19:45:38 +0000 (21:45 +0200)]
Revert __dirfd PLT avoidance for now

* io/fts.c (fts_build): Call dirfd instead of __dirfd.

6 years agohurd: Avoid some PLTs in libc and librt
Samuel Thibault [Mon, 2 Apr 2018 19:07:52 +0000 (19:07 +0000)]
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.

6 years agohurd: Avoid local PLTs in libpthread.
Samuel Thibault [Mon, 2 Apr 2018 18:08:37 +0000 (18:08 +0000)]
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.

6 years agohurd: Fix exposition of UTIME_NOW, UTIME_OMIT
Samuel Thibault [Mon, 2 Apr 2018 15:07:11 +0000 (17:07 +0200)]
hurd: Fix exposition of UTIME_NOW, UTIME_OMIT

* sysdeps/mach/hurd/bits/stat.h [!__USE_MISC && __USE_ATFILE]
(UTIME_NOW, UTIME_OMIT): Define macros.

6 years agohurd: Announce that glibc now builds unpatched
Samuel Thibault [Mon, 2 Apr 2018 14:45:44 +0000 (16:45 +0200)]
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.

6 years agohurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+
Samuel Thibault [Mon, 2 Apr 2018 14:37:36 +0000 (16:37 +0200)]
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.

6 years agohurd: Remove bogus net/if_ppp.h
Samuel Thibault [Mon, 2 Apr 2018 00:07:11 +0000 (02:07 +0200)]
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.

6 years agohurd: Advertise libpthread
Samuel Thibault [Sun, 1 Apr 2018 23:56:12 +0000 (01:56 +0200)]
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.

6 years agohurd libpthread: add function missing in ABI list
Samuel Thibault [Sun, 1 Apr 2018 23:53:46 +0000 (01:53 +0200)]
hurd libpthread: add function missing in ABI list

* sysdeps/mach/hurd/i386/libpthread.abilist (__pthread_self): Add.

6 years agohurd: Add hurd thread library
Samuel Thibault [Sun, 1 Apr 2018 23:43:22 +0000 (01:43 +0200)]
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.

6 years agohurd: avoid letting signals go to thread created by timer_create
Samuel Thibault [Fri, 30 Mar 2018 00:45:01 +0000 (02:45 +0200)]
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.

6 years agosupport_format_addrinfo: Include unknown error number in result
Florian Weimer [Sun, 1 Apr 2018 17:39:53 +0000 (19:39 +0200)]
support_format_addrinfo: Include unknown error number in result

6 years agoLinux i386: tst-bz21269 triggers SIGBUS on some kernels
Florian Weimer [Thu, 29 Mar 2018 09:42:24 +0000 (11:42 +0200)]
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.

6 years agosparc: Fix arch_fork definition
Adhemerval Zanella [Wed, 28 Mar 2018 00:23:52 +0000 (21:23 -0300)]
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.

6 years agogetlogin_r: return early when linux sentinel value is set
Jesse Hathaway [Tue, 27 Mar 2018 21:17:59 +0000 (21:17 +0000)]
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>
6 years agohurd: advertise process memory locking option
Samuel Thibault [Tue, 27 Mar 2018 21:20:07 +0000 (23:20 +0200)]
hurd: advertise process memory locking option

mlock/unlockall were already implemented.

* sysdeps/mach/hurd/bits/posix_opt.h (_POSIX_MEMLOCK): Define.

6 years agoFix crash in resolver on memory allocation failure (bug 23005)
Andreas Schwab [Tue, 27 Mar 2018 10:16:11 +0000 (12:16 +0200)]
Fix crash in resolver on memory allocation failure (bug 23005)

6 years agoUnify umount function implementations (bug 16552).
Joseph Myers [Mon, 26 Mar 2018 21:18:28 +0000 (21:18 +0000)]
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.

6 years agoRISC-V: add remaining relocations
Andreas Schwab [Thu, 22 Mar 2018 11:15:45 +0000 (12:15 +0100)]
RISC-V: add remaining relocations

6 years agohurd: Regenerate errno.h header
Samuel Thibault [Sun, 25 Mar 2018 09:27:39 +0000 (09:27 +0000)]
hurd: Regenerate errno.h header

* sysdeps/mach/hurd/bits/errno.h: Regenerate.

6 years agohurd: Fix calling __pthread_initialize_minimal in shared case
Samuel Thibault [Sat, 24 Mar 2018 23:59:18 +0000 (00:59 +0100)]
hurd: Fix calling __pthread_initialize_minimal in shared case

* sysdeps/generic/ldsodefs.h [SHARED] (__pthread_initialize_minimal):
Declare function.

6 years agoAdd missing changelog from previous commit
Samuel Thibault [Sat, 24 Mar 2018 23:54:55 +0000 (00:54 +0100)]
Add missing changelog from previous commit

6 years agohurd: Initialize TLS and libpthread before signal thread start
Samuel Thibault [Sat, 17 Mar 2018 00:28:41 +0000 (01:28 +0100)]
hurd: Initialize TLS and libpthread before signal thread start

* sysdeps/generic/libc-start.h [!SHARED] (ARCH_SETUP_TLS): Define to
__libc_setup_tls.
* sysdeps/unix/sysv/linux/powerpc/libc-start.h [!SHARED]
(ARCH_SETUP_TLS): Likewise.
* sysdeps/mach/hurd/libc-start.h: New file copied from
sysdeps/generic/libc-start.h, but define ARCH_SETUP_TLS to empty.
* csu/libc-start.c [!SHARED] (LIBC_START_MAIN): Call ARCH_SETUP_TLS instead
of __libc_setup_tls.
* sysdeps/mach/hurd/i386/init-first.c [!SHARED] (init1): Call
__libc_setup_tls before initializing libpthread and running _hurd_init which
starts the signal thread.

6 years agohurd: Fix accessing errno from rtld
Samuel Thibault [Sat, 24 Mar 2018 23:48:01 +0000 (00:48 +0100)]
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.

6 years agoAdd $(tests-execstack-$(have-z-execstack)) after defined [BZ #22998]
H.J. Lu [Sat, 24 Mar 2018 15:25:43 +0000 (08:25 -0700)]
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.

6 years agoFix i386 memmove issue (bug 22644).
Andrew Senkevich [Fri, 23 Mar 2018 15:19:45 +0000 (16:19 +0100)]
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.

6 years agoRemove unused frame.h header, sigcontextinfo.h macros.
Joseph Myers [Thu, 22 Mar 2018 16:40:51 +0000 (16:40 +0000)]
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.

6 years agoUse x86_64 backtrace as generic version.
Joseph Myers [Wed, 21 Mar 2018 17:25:30 +0000 (17:25 +0000)]
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.

6 years agoRemove powerpc, sparc fdim inlines (bug 22987).
Joseph Myers [Tue, 20 Mar 2018 18:35:50 +0000 (18:35 +0000)]
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.

6 years agoFix signed integer overflow in random_r (bug 17343).
Joseph Myers [Tue, 20 Mar 2018 18:25:24 +0000 (18:25 +0000)]
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.

6 years agoFix errno values
Samuel Thibault [Tue, 20 Mar 2018 02:10:57 +0000 (03:10 +0100)]
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.

6 years agohurd: Code style fixes
Samuel Thibault [Tue, 20 Mar 2018 02:00:15 +0000 (03:00 +0100)]
hurd: Code style fixes

No code change.

6 years agoAdd narrowing subtract functions.
Joseph Myers [Tue, 20 Mar 2018 00:34:52 +0000 (00:34 +0000)]
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.

6 years agoAdd SHT_X86_64_UNWIND to elf.h (bug 20079).
Joseph Myers [Mon, 19 Mar 2018 18:08:48 +0000 (18:08 +0000)]
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.

6 years agoUndefine attribute_hidden to fix benchtests
Wilco Dijkstra [Mon, 19 Mar 2018 10:53:14 +0000 (10:53 +0000)]
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.

6 years agohurd: Fix build with latest htl
Samuel Thibault [Mon, 19 Mar 2018 00:32:39 +0000 (01:32 +0100)]
hurd: Fix build with latest htl

* hurd/hurdsig.c: Include <pthreadP.h> instead of <pthread.h>.

6 years agohurd: fix build
Samuel Thibault [Sun, 18 Mar 2018 19:49:26 +0000 (20:49 +0100)]
hurd: fix build

* sysdeps/mach/hurd/i386/init-first.c: Compare d->phdr with 0 instead of
NULL.

6 years agoHurd: fix port leak in TLS
Richard Braun [Sun, 18 Mar 2018 19:27:16 +0000 (20:27 +0100)]
Hurd: fix port leak in TLS

* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Use a temporary
thread reference.

6 years agohurd: Add mlockall support
Samuel Thibault [Sun, 18 Mar 2018 19:14:12 +0000 (20:14 +0100)]
hurd: Add mlockall support

* sysdeps/mach/hurd/mlockall.c: New file.
* sysdeps/mach/hurd/munlockall.c: New file.

6 years agohurd: Fix boot with statically-linked exec server
Samuel Thibault [Sun, 18 Mar 2018 18:52:39 +0000 (19:52 +0100)]
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).

6 years agohurd: Fix O_DIRECTORY | O_NOFOLLOW
Samuel Thibault [Sun, 18 Mar 2018 18:43:04 +0000 (19:43 +0100)]
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.

6 years agohurd: Fix O_NOFOLLOW
Samuel Thibault [Sun, 18 Mar 2018 18:39:29 +0000 (19:39 +0100)]
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.

6 years agohurd: Fix copyright years
Samuel Thibault [Sun, 18 Mar 2018 17:33:37 +0000 (18:33 +0100)]
hurd: Fix copyright years

6 years agohurd: Reimplement libc locks using mach's gsync
Agustina Arzille [Sun, 18 Mar 2018 17:22:55 +0000 (18:22 +0100)]
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

6 years agohurd: Rewrite __libc_cleanup_*
Agustina Arzille [Sun, 18 Mar 2018 16:27:00 +0000 (17:27 +0100)]
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.

6 years agohurd: Add missing include
Samuel Thibault [Sun, 18 Mar 2018 15:38:26 +0000 (16:38 +0100)]
hurd: Add missing include

* sysdeps/mach/hurd/cthreads.c: Include <cthreads.h>.

6 years agox86_64: Fix build with RTLD_PRIVATE_ERRNO defined to 1
Samuel Thibault [Sun, 18 Mar 2018 01:11:56 +0000 (02:11 +0100)]
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.

6 years agohurd: Fix coding style
Samuel Thibault [Sat, 17 Mar 2018 23:06:19 +0000 (00:06 +0100)]
hurd: Fix coding style

6 years agohurd: Fix link cthread/pthread symbol exposition.
Samuel Thibault [Sat, 17 Mar 2018 22:53:39 +0000 (23:53 +0100)]
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.

6 years agohurd: Replace threadvars with TLS
Samuel Thibault [Sat, 17 Mar 2018 22:27:34 +0000 (23:27 +0100)]
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.

6 years agohurd: Fix getting signal thread stack layout for fork
Samuel Thibault [Sat, 17 Mar 2018 21:50:09 +0000 (22:50 +0100)]
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.

6 years agohurd: add TLS support
Samuel Thibault [Sat, 17 Mar 2018 02:17:36 +0000 (03:17 +0100)]
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.

6 years agoNEWS: Mention the locale data changes (bug 22848, 22937, 22963).
Rafal Luzynski [Fri, 16 Mar 2018 21:55:11 +0000 (22:55 +0100)]
NEWS: Mention the locale data changes (bug 22848, 22937, 22963).

Alternative (nominative/genitive) month names have been added to the
Catalan and Czech locale data and the abbreviated alternative names to
Catalan and Greek.

6 years agoRemove sysdeps/x86/fpu/bits/mathinline.h __finite inline.
Joseph Myers [Fri, 16 Mar 2018 18:36:53 +0000 (18:36 +0000)]
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.

6 years agoUpdate i386 libm-test-ulps.
Joseph Myers [Fri, 16 Mar 2018 17:43:38 +0000 (17:43 +0000)]
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.

6 years agoRevert m68k __ieee754_sqrt change
Wilco Dijkstra [Fri, 16 Mar 2018 14:25:41 +0000 (14:25 +0000)]
Revert m68k __ieee754_sqrt change

Revert m68k __ieee754_sqrt change as it causes a build failure in one
m68k configuration.  m68k-linux-gnu now passes again.

* sysdeps/m68k/m680x0/fpu/mathimpl.h (__ieee754_sqrt): Revert previous
commit.

6 years agoRemove all target specific __ieee754_sqrt(f/l) inlines
Wilco Dijkstra [Thu, 15 Mar 2018 18:21:58 +0000 (18:21 +0000)]
Remove all target specific __ieee754_sqrt(f/l) inlines

Remove the now unused target specific__ieee754_sqrt(f/l) inlines.
Also remove inlines of sqrt which are for really old GCC versions.
Removing these is desirable, under the general principle of leaving
such inlining to the compiler rather than trying to do it in installed
headers, especially when only very old compilers are affected.

Note that removing inlines for __ieee754_sqrt disables inlining in the
sqrt wrapper functions.  Given the sqrt function will typically only be
called for negative arguments, it doesn't matter whether the inlining
happens or not.

* sysdeps/aarch64/fpu/math_private.h (__ieee754_sqrt): Remove.
(__ieee754_sqrtf): Remove.
* sysdeps/alpha/fpu/math_private.h (__ieee754_sqrt): Remove.
(__ieee754_sqrtf): Remove.
* sysdeps/generic/math-type-macros.h (M_SQRT): Use sqrt.
* sysdeps/m68k/m680x0/fpu/mathimpl.h (__ieee754_sqrt): Remove.
* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrt): Remove.
(__ieee754_sqrtf): Remove.
* sysdeps/s390/fpu/bits/mathinline.h: Remove file.
* sysdeps/sparc/fpu/bits/mathinline.h (sqrt) Remove.
(sqrtf): Remove.
(sqrtl): Remove.
(__ieee754_sqrt): Remove.
(__ieee754_sqrtf): Remove.
(__ieee754_sqrtl): Remove.
* sysdeps/m68k/m680x0/fpu/mathimpl.h (__ieee754_sqrt): Remove.
* sysdeps/x86/fpu/math_private.h (__ieee754_sqrt): Remove.
* sysdeps/x86_64/fpu/math_private.h (__ieee754_sqrt): Remove.
(__ieee754_sqrtf): Remove.
(__ieee754_sqrtl): Remove.

6 years agoRename all __ieee754_sqrt(f/l) calls to sqrt(f/l)
Wilco Dijkstra [Thu, 15 Mar 2018 18:05:03 +0000 (18:05 +0000)]
Rename all __ieee754_sqrt(f/l) calls to sqrt(f/l)

Use sqrt(f/l) to enable inlining by GCC - if inlining doesn't happen,
the asm redirect ensures we will still call __ieee754_sqrt(f/l).

* sysdeps/ieee754/dbl-64/e_acosh.c (__ieee754_acosh): Use sqrt.
* sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Likewise.
* sysdeps/ieee754/dbl-64/e_hypot.c (__ieee754_hypot): Likewise.
* sysdeps/ieee754/dbl-64/e_j0.c (__ieee754_j0): Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c (__ieee754_j1): Likewise.
* sysdeps/ieee754/dbl-64/e_jn.c (__ieee754_jn): Likewise.
* sysdeps/ieee754/dbl-64/s_asinh.c (__asinh): Likewise.
* sysdeps/ieee754/dbl-64/wordsize-64/e_acosh.c (__ieee754_acosh): Likewise.
* sysdeps/ieee754/flt-32/e_acosf.c (__ieee754_acosf): Likewise.
* sysdeps/ieee754/flt-32/e_acoshf.c (__ieee754_acoshf): Likewise.
* sysdeps/ieee754/flt-32/e_asinf.c (__ieee754_asinf): Likewise.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Likewise.
* sysdeps/ieee754/flt-32/e_hypotf.c (__ieee754_hypotf): Likewise.
* sysdeps/ieee754/flt-32/e_j0f.c (__ieee754_j0f): Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c (__ieee754_j1f): Likewise.
* sysdeps/ieee754/flt-32/e_powf.c (__ieee754_powf): Likewise.
* sysdeps/ieee754/flt-32/s_asinhf.c (__asinhf): Likewise.
* sysdeps/ieee754/ldbl-128/e_acoshl.c (__ieee754_acoshl): Use sqrtl.
* sysdeps/ieee754/ldbl-128/e_acosl.c (__ieee754_acosl): Likewise.
* sysdeps/ieee754/ldbl-128/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive): Likewise.
* sysdeps/ieee754/ldbl-128/e_hypotl.c (__ieee754_hypotl): Likewise.
* sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128/e_powl.c (__ieee754_powl): Likewise.
* sysdeps/ieee754/ldbl-128/s_asinhl.c (__ieee754_asinhl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_j0l.c (__ieee754_j0l): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_j1l.c (__ieee754_j1l): Likewise
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_powl.c (__ieee754_powl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__ieee754_asinhl): Likewise.
* sysdeps/ieee754/ldbl-96/e_acoshl.c (__ieee754_acoshl): Use sqrtl.
* sysdeps/ieee754/ldbl-96/e_asinl.c (__ieee754_asinl): Likewise.
* sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive): Likewise.
* sysdeps/ieee754/ldbl-96/e_hypotl.c (__ieee754_hypotl): Likewise.
* sysdeps/ieee754/ldbl-96/e_j0l.c (__ieee754_j0l): Likewise.
* sysdeps/ieee754/ldbl-96/e_j1l.c (__ieee754_j1l): Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_jnl): Likewise.
* sysdeps/ieee754/ldbl-96/s_asinhl.c (__ieee754_asinhl): Likewise.
* sysdeps/m68k/m680x0/fpu/e_pow.c (__ieee754_pow): Likewise.
* sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Likewise.
* sysdeps/powerpc/fpu/e_hypotf.c (__ieee754_hypotf): Likewise.

6 years agoAdd support for sqrt asm redirects
Wilco Dijkstra [Thu, 15 Mar 2018 17:57:03 +0000 (17:57 +0000)]
Add support for sqrt asm redirects

This patch series cleans up the many uses of  __ieee754_sqrt(f/l) in GLIBC.
The goal is to enable GCC to do the inlining, and if this fails call the
__ieee754_sqrt function.  This is done by internally declaring sqrt with asm
redirects.  The compat symbols and sqrt wrappers need to disable the redirect.
The redirect is also disabled if there are already redirects defined when
using -ffinite-math-only.

All math functions (but not math tests, non-library code and libnldbl) are
built with -fno-math-errno which means GCC will typically inline sqrt as a
single instruction.  This means targets are no longer forced to add a special
inline for sqrt.

* include/math.h (sqrt): Declare with asm redirect.
(sqrtf): Likewise.
(sqrtl): Likewise.
(sqrtf128): Likewise.
* Makeconfig: Add -fno-math-errno for libc/libm, but build testsuite,
nonlib and libnldbl with -fmath-errno.
* math/w_sqrt_compat.c: Define NO_MATH_REDIRECT.
* math/w_sqrt_template.c: Likewise.
* math/w_sqrtf_compat.c: Likewise.
* math/w_sqrtl_compat.c: Likewise.
* sysdeps/i386/fpu/w_sqrt.c: Likewise.
* sysdeps/i386/fpu/w_sqrt_compat.c: Likewise.
* sysdeps/generic/math-type-macros-float128.h: Remove math.h and
complex.h.

6 years agoRemove more old-compilers parts of sysdeps/x86/fpu/bits/mathinline.h.
Joseph Myers [Thu, 15 Mar 2018 18:26:35 +0000 (18:26 +0000)]
Remove more old-compilers parts of sysdeps/x86/fpu/bits/mathinline.h.

This patch removes further parts of sysdeps/x86/fpu/bits/mathinline.h
that are only of value for optimization with older compiler versions,
in accordance with general principles of preferring the let the
compiler deal with such inlining through built-in functions.

In general, GCC supports inlining all these functions as of version
4.3 or earlier.  However, some inlines in GCC may have had excessively
restrictive conditions in past GCC versions (e.g. requiring
-ffast-math when the inline is valid under broader conditions).  (In
particular, GCC had, before GCC 7, unnecessarily restrictive
conditions on when it could apply floor and ceil inlines corresponding
to the ones removed here.  The same was true for rint, but
bits/mathinline.h *also* was excessively restrictive there.)

The removed sincos inlines are for __sincos etc. functions (not a
public interface and not currently used in this header either; not in
a part of the header ever used for building glibc itself).  Likewise,
the atan2 inlines included one for __atan2l, also not a public
interface and not used for building glibc itself (calls inside glibc
generally use __ieee754_atan2l, for which there is a separate
__LIBC_INTERNAL_MATH_INLINES case in this header).

Tested for x86_64 and x86.

* sysdeps/x86/fpu/bits/mathinline.h [__FAST_MATH__]
(__sincos_code): Remove define and undefine.
[__FAST_MATH__] (__sincos): Remove inline function.
[__FAST_MATH__] (__sincosf): Remove inline function.
[__FAST_MATH__] (__sincosl): Remove inline function.
(__atan2l): Remove inline functions.
[!__GNUC_PREREQ (3, 4)] (__atan2_code): Remove macro.
[!__GNUC_PREREQ (3, 4) && __FAST_MATH__] (atan2): Remove inline
function.
(floor): Remove inline function.
(ceil): Likewise.
[__FAST_MATH__] (__ldexp_code): Remove macro.
[__FAST_MATH__] (ldexp): Remove inline function.
[__FAST_MATH__ && __USE_ISOC99] (ldexpf): Likewise.
[__FAST_MATH__ && __USE_ISOC99] (ldexpl): Likewise.
[__FAST_MATH__ && __USE_ISOC99] (rint): Likewise.
[__USE_ISOC99] (__lrint_code): Remove macro.
[__USE_ISOC99] (__llrint_code): Likewise.
[__USE_ISOC99] (lrintf): Remove inline function.
[__USE_ISOC99] (lrint): Likewise.
[__USE_ISOC99] (lrintl): Likewise.
[__USE_ISOC99] (llrint): Likewise.
[__USE_ISOC99] (llrintf): Likewise.
[__USE_ISOC99] (llrintl): Likewise.

6 years agoUse correct includes in benchtests
Wilco Dijkstra [Thu, 15 Mar 2018 15:44:58 +0000 (15:44 +0000)]
Use correct includes in benchtests

Currently the benchtests are run with internal GLIBC headers, which is incorrect.
Defining _ISOMAC in the makefile ensures the internal headers are bypassed.
Fix all tests which were relying on internal defines or includes.

* benchtests/Makefile: Define _ISOMAC.
* benchtests/bench-strcoll.c: Add missing sys/stat.h include.
* benchtests/bench-string.h: Define inhibit_loop_to_libcall macro.
* benchtests/bench-strstr.c: Define empty libc_hidden_builtin_def.
* benchtests/bench-strtok.c (oldstrtok): Use rawmemchr.
* benchtests/bench-timing.h: Define attribute_hidden.

6 years agoaarch64/strncmp: Use lsr instead of mov+lsr
Siddhesh Poyarekar [Thu, 15 Mar 2018 02:36:21 +0000 (08:06 +0530)]
aarch64/strncmp: Use lsr instead of mov+lsr

A lsr can do what the mov and lsr did.

6 years agocs_CZ locale: Add alternative month names (bug 22963).
Rafal Luzynski [Mon, 17 Oct 2016 20:06:11 +0000 (22:06 +0200)]
cs_CZ locale: Add alternative month names (bug 22963).

Add alternative month names, primary month names are genitive now.

[BZ #22963]
* localedata/locales/cs_CZ (mon): Rename to...
(alt_mon): This.
(mon): Import from CLDR (genitive case).

6 years agoGreek (el_CY, el_GR) locales: Introduce ab_alt_mon (bug 22937).
Rafal Luzynski [Wed, 7 Mar 2018 23:45:04 +0000 (00:45 +0100)]
Greek (el_CY, el_GR) locales: Introduce ab_alt_mon (bug 22937).

As spotted by GNOME translation team, Greek language has the actually
visible difference between the abbreviated nominative and the abbreviated
genitive case for some month names.  Examples:

May:

abbreviated nominative: "Μάι" -> abbreviated genitive: "Μαΐ"

July:

abbreviated nominative: "Ιούν" -> abbreviated genitive: "Ιουλ"

and more month names with similar differences.

Original discussion: https://bugzilla.gnome.org/show_bug.cgi?id=793645#c21

[BZ #22937]
* localedata/locales/el_CY (abmon): Rename to...
(ab_alt_mon): This.
(abmon): Import from CLDR (abbreviated genitive case).
* localedata/locales/el_GR (abmon): Rename to...
(ab_alt_mon): This.
(abmon): Import from CLDR (abbreviated genitive case).

6 years agolt_LT locale: Update abbreviated month names (bug 22932).
Rafal Luzynski [Wed, 7 Mar 2018 23:38:18 +0000 (00:38 +0100)]
lt_LT locale: Update abbreviated month names (bug 22932).

A GNOME translator asked to use the same abbreviated month names
as provided by CLDR.  This sounds reasonable.  See the discussion:
https://bugzilla.gnome.org/show_bug.cgi?id=793645#c27

[BZ #22932]
* localedata/locales/lt_LT (abmon): Synchronize with CLDR.

6 years agoca_ES locale: Update LC_TIME (bug 22848).
Robert Buj [Tue, 6 Mar 2018 21:51:29 +0000 (22:51 +0100)]
ca_ES locale: Update LC_TIME (bug 22848).

Add/fix alternative month names, long & short formats, am_pm,
abday settings, and improve indentation for Catalan.

[BZ #22848]
* localedata/locales/ca_ES (abmon): Rename to...
(ab_alt_mon): This, then synchronize with CLDR (nominative case).
(mon): Rename to...
(alt_mon): This.
(abmon): Import from CLDR (genitive case, month names preceded by
"de" or "d’").
(mon): Likewise.
(abday): Synchronize with CLDR.
(d_t_fmt): Likewise.
(d_fmt): Likewise.
(am_pm): Likewise.

(LC_TIME): Improve indentation.
(LC_TELEPHONE): Likewise.
(LC_NAME): Likewise.
(LC_ADDRESS): Likewise.

6 years agomalloc: harden removal from unsorted list
Francois Goichon [Wed, 14 Mar 2018 20:25:57 +0000 (16:25 -0400)]
malloc: harden removal from unsorted list

* malloc/malloc.c (_int_malloc): Added check before removing from
unsorted list.

6 years agoRemove old-GCC parts of x86 bits/mathinline.h.
Joseph Myers [Wed, 14 Mar 2018 18:26:03 +0000 (18:26 +0000)]
Remove old-GCC parts of x86 bits/mathinline.h.

In accordance with the general principle of preferring to let the
compiler optimize function calls based on their standard semantics
rather than putting inline definitions of such functions in installed
headers, this patch removes various such inline definitions in the x86
bits/mathinline.h that were already disabled for GCC 3.5 or later and
so were only used with very old compilers (for which good optimization
is particularly unimportant); along with those inlines, a definition
of __M_SQRT2, which was only used in such inline functions, is also
removed.  This is similar to an early step in removing the string.h
inlines; I intend to follow up with further removals of
bits/mathinline.h inline definitions in appropriate logical groups
(with GCC bugs filed in cases where GCC doesn't already support
corresponding optimizations).

Tested for x86_64 and x86.

* sysdeps/x86/fpu/bits/mathinline.h [!__GNUC_PREREQ (3, 4)]
(lrintf): Remove definitions used only with old GCC.
[!__GNUC_PREREQ (3, 4)] (lrint): Likewise.
[!__GNUC_PREREQ (3, 4)] (llrintf): Likewise.
[!__GNUC_PREREQ (3, 4)] (llrint): Likewise.
[!__GNUC_PREREQ (3, 4)] (fmaxf): Likewise.
[!__GNUC_PREREQ (3, 4)] (fmax): Likewise.
[!__GNUC_PREREQ (3, 4)] (fminf): Likewise.
[!__GNUC_PREREQ (3, 4)] (fmin): Likewise.
[!__GNUC_PREREQ (3, 4)] (rint): Likewise.
[!__GNUC_PREREQ (3, 4)] (rintf): Likewise.
[!__GNUC_PREREQ (3, 4)] (nearbyint): Likewise.
[!__GNUC_PREREQ (3, 4)] (nearbyintf): Likewise.
[!__GNUC_PREREQ (3, 4)] (ceil): Likewise.
[!__GNUC_PREREQ (3, 4)] (ceilf): Likewise.
[!__GNUC_PREREQ (3, 4)] (floor): Likewise.
[!__GNUC_PREREQ (3, 4)] (floorf): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (tan): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (fmod): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 4)] (sin): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 4)] (cos): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (log10): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (asin): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (acos): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 4)] (atan): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (log1p): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (logb): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (log2): Likewise.
[__FAST_MATH__ && !__GNUC_PREREQ (3, 5)] (drem): Likewise.
[__FAST_MATH__] (__M_SQRT2): Remove macro.