]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 years agohurd: Avoid exposing all <sched.h> symbols from sys/types.h
Samuel Thibault [Thu, 19 Apr 2018 18:21:33 +0000 (20:21 +0200)] 
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.

6 years agoFix mips64n32 getdents alias
Adhemerval Zanella [Thu, 19 Apr 2018 18:19:19 +0000 (15:19 -0300)] 
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.

6 years agohurd: Fix symbols exposition
Samuel Thibault [Thu, 19 Apr 2018 18:14:45 +0000 (20:14 +0200)] 
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.

6 years agoConsolidate Linux getdents{64} implementation
Adhemerval Zanella [Wed, 28 Feb 2018 18:37:17 +0000 (15:37 -0300)] 
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.

6 years agoDisable lock elision for mutex pretty printer tests.
Stefan Liebler [Thu, 19 Apr 2018 10:38:37 +0000 (12:38 +0200)] 
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.

6 years agoUse volatile global counters in test-tgmath.c.
Stefan Liebler [Thu, 19 Apr 2018 10:32:50 +0000 (12:32 +0200)] 
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.

6 years agohurd: Update struct statfs according to struct statvfs
Samuel Thibault [Thu, 19 Apr 2018 00:25:03 +0000 (02:25 +0200)] 
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.

6 years agohurd: Fix standard compliance of some statvfs fields
Samuel Thibault [Thu, 19 Apr 2018 00:05:54 +0000 (02:05 +0200)] 
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.

6 years agohurd: xfail some structure fields ABI incompatibility with standards
Samuel Thibault [Wed, 18 Apr 2018 23:51:45 +0000 (01:51 +0200)] 
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.

6 years agohurd: Fix mach installed headers test
Samuel Thibault [Wed, 18 Apr 2018 22:42:14 +0000 (00:42 +0200)] 
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.

6 years agoRevert "Fix sched_param"
Samuel Thibault [Wed, 18 Apr 2018 22:09:58 +0000 (00:09 +0200)] 
Revert "Fix sched_param"

This reverts commit 783c4820303fb6b031d401564f8089ecaf154b62 which
accidentaly flew out.

6 years agoconform sys/un.h: Allow sun_ prefix, not only sun_len
Samuel Thibault [Wed, 18 Apr 2018 19:07:04 +0000 (21:07 +0200)] 
conform sys/un.h: Allow sun_ prefix, not only sun_len

* conform/data/sys/un.h-data: Allow sun_ prefix.

6 years agoFix sched_param
Samuel Thibault [Tue, 17 Apr 2018 22:27:31 +0000 (00:27 +0200)] 
Fix sched_param

6 years agoMake build-many-glibcs.py build GCC for powerpcspe with --enable-obsolete.
Joseph Myers [Wed, 18 Apr 2018 16:07:19 +0000 (16:07 +0000)] 
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.

6 years agohurd: Fix spurious installation of headers defining hidden prototypes
Samuel Thibault [Wed, 18 Apr 2018 00:07:17 +0000 (02:07 +0200)] 
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/.

6 years agohurd: fix conformity test for sys/un.h
Samuel Thibault [Tue, 17 Apr 2018 22:34:18 +0000 (00:34 +0200)] 
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.

6 years agoarm: Remove ununsed ARM code in optimized implementation
Adhemerval Zanella [Mon, 16 Apr 2018 11:18:23 +0000 (08:18 -0300)] 
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.

6 years agoAdd aliases to recognize normalized charset names (bug 19527)
Andreas Schwab [Thu, 28 Jan 2016 13:19:39 +0000 (14:19 +0100)] 
Add aliases to recognize normalized charset names (bug 19527)

6 years agoImproves __ieee754_exp(x) performance by 18-37% when |x| < 1.0397
Patrick McGehearty [Sun, 15 Apr 2018 22:46:37 +0000 (18:46 -0400)] 
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.

6 years agoUpdate kernel version in syscall-names.list to 4.16.
DJ Delorie [Thu, 12 Apr 2018 19:25:50 +0000 (15:25 -0400)] 
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.

6 years agoS390: Fix struct sigaction for 31bit in kernel_sigaction.h.
Stefan Liebler [Thu, 12 Apr 2018 07:37:26 +0000 (09:37 +0200)] 
S390: Fix struct sigaction for 31bit in kernel_sigaction.h.

The recent commit b4a5d26d8835d972995f0a0a2f805a8845bafa0b
"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.

6 years agoresolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
Florian Weimer [Mon, 9 Apr 2018 08:08:07 +0000 (10:08 +0200)] 
resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]

6 years agoConsolidate Linux readdir{64}{_r} implementation
Adhemerval Zanella [Wed, 28 Feb 2018 12:25:58 +0000 (09:25 -0300)] 
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.

6 years agoUpdate i386 libm-test-ulps.
Adhemerval Zanella [Fri, 6 Apr 2018 20:24:15 +0000 (17:24 -0300)] 
Update i386 libm-test-ulps.

Updated ulps after recent commit "[PATCH 1/7] sin/cos slow paths:
avoid slow paths for small inputs"
(19a8b9a300f2f1f0012aff0f2b70b09430f50d9e).

* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Update.

6 years agoFix missing @ before texinfo command
Andreas Schwab [Fri, 6 Apr 2018 06:44:07 +0000 (08:44 +0200)] 
Fix missing @ before texinfo command

6 years agoUpdate SPARC libm-test-ulps.
Adhemerval Zanella [Thu, 5 Apr 2018 19:31:37 +0000 (16:31 -0300)] 
Update SPARC libm-test-ulps.

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

6 years agoUpdate ARM libm-test-ulps.
Adhemerval Zanella [Thu, 5 Apr 2018 19:31:27 +0000 (16:31 -0300)] 
Update ARM libm-test-ulps.

* sysdeps/arm/libm-test-ulps: Update.

6 years agolinux: Consolidate sigaction implementation
Adhemerval Zanella [Thu, 2 Nov 2017 13:04:18 +0000 (11:04 -0200)] 
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.

6 years agoS390: Regenerate ULPs.
Stefan Liebler [Thu, 5 Apr 2018 14:20:03 +0000 (16:20 +0200)] 
S390: Regenerate ULPs.

Updated ulps after recent commit
"[PATCH 1/7] sin/cos slow paths: avoid slow paths for small inputs"
(19a8b9a300f2f1f0012aff0f2b70b09430f50d9e).

ChangeLog:

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

6 years agomanual: Various fixes to the mbstouwcs example, and mbrtowc update
Florian Weimer [Thu, 5 Apr 2018 10:52:19 +0000 (12:52 +0200)] 
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.

6 years agomanual: Move mbstouwcs to an example C file
Florian Weimer [Thu, 5 Apr 2018 10:50:58 +0000 (12:50 +0200)] 
manual: Move mbstouwcs to an example C file

6 years agoRevert "hurd: Avoid PLTs for longjmp & siglongjmp"
Samuel Thibault [Thu, 5 Apr 2018 07:38:58 +0000 (09:38 +0200)] 
Revert "hurd: Avoid PLTs for longjmp & siglongjmp"

This reverts commit e5f9508a32426b7c3948dc741d84355071ed9539.

6 years agohurd: Avoid PLT for dirfd
Samuel Thibault [Wed, 4 Apr 2018 23:52:29 +0000 (01:52 +0200)] 
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.

6 years agohurd: Avoid PLTs for longjmp & siglongjmp
Samuel Thibault [Wed, 4 Apr 2018 23:19:18 +0000 (23:19 +0000)] 
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.

6 years agopowerpc: Update sin, cos and sincos ULPs
Tulio Magno Quites Machado Filho [Wed, 4 Apr 2018 22:17:13 +0000 (19:17 -0300)] 
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>
6 years agoelf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]
Maciej W. Rozycki [Wed, 4 Apr 2018 22:09:37 +0000 (23:09 +0100)] 
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.

6 years agoelf: Unify symbol address run-time calculation [BZ #19818]
Maciej W. Rozycki [Wed, 4 Apr 2018 22:09:37 +0000 (23:09 +0100)] 
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>
6 years agoMake sysdeps/generic/internal-signals.h less stubby.
Zack Weinberg [Wed, 4 Apr 2018 16:37:23 +0000 (12:37 -0400)] 
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.

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.