platform/upstream/glibc.git
5 years agodl-vdso: Add LINUX_4 HASH CODE to support nds32 vdso mechanism
Vincent Chen [Mon, 8 Jul 2019 18:56:43 +0000 (15:56 -0300)]
dl-vdso: Add LINUX_4 HASH CODE to support nds32 vdso mechanism

* sysdeps/unix/sysv/linux/dl-vdso.h: Add LINUX_4
HASH code to support nds32 vdso mechanism.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoriscv: restore ABI compatibility (bug 24484)
Andreas Schwab [Wed, 3 Jul 2019 11:52:49 +0000 (13:52 +0200)]
riscv: restore ABI compatibility (bug 24484)

The contents of the dynamic section are part of the ABI, thus
DL_RO_DYN_SECTION cannot be changed.

5 years agoaarch64: new ifunc resolver ABI
Szabolcs Nagy [Tue, 23 Apr 2019 14:59:34 +0000 (15:59 +0100)]
aarch64: new ifunc resolver ABI

Passing a second argument to the ifunc resolver allows accessing
AT_HWCAP2 values from the resolver. AArch64 will start using AT_HWCAP2
on linux because for ilp32 to remain compatible with lp64 ABI no more
than 32bit hwcap flags can be in AT_HWCAP which is already used up.

Currently the relocation ordering logic does not guarantee that ifunc
resolvers can call libc apis or access libc objects, so only the
resolver arguments and runtime environment dependent instructions can
be used to do the dispatch (this affects ifunc resolvers outside of
the libc).

Since ifunc resolver is target specific and only supposed to be
called by the dynamic linker, the call ABI can be changed in a
backward compatible way:

Old call ABI passed hwcap as uint64_t, new abi sets the
_IFUNC_ARG_HWCAP flag in the hwcap and passes a second argument
that's a pointer to an extendible struct. A resolver has to check
the _IFUNC_ARG_HWCAP flag before accessing the second argument.

The new sys/ifunc.h installed header has the definitions for the
new ABI, everything is in the implementation reserved namespace.

An alternative approach is to try to support extern calls from ifunc
resolvers such as getauxval, but that seems non-trivial
https://sourceware.org/ml/libc-alpha/2017-01/msg00468.html

* sysdeps/aarch64/Makefile: Install sys/ifunc.h and add tests.
* sysdeps/aarch64/dl-irel.h (elf_ifunc_invoke): Update to new ABI.
* sysdeps/aarch64/sys/ifunc.h: New file.
* sysdeps/aarch64/tst-ifunc-arg-1.c: New file.
* sysdeps/aarch64/tst-ifunc-arg-2.c: New file.

5 years agonptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]
Florian Weimer [Tue, 2 Jul 2019 13:12:20 +0000 (15:12 +0200)]
nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]

With commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so:
Support moving versioned symbols between sonames [BZ #24741]"), the
dynamic linker will find the definition of vfork in libc and binds
a vfork reference to that symbol, even if the soname in the version
reference says that the symbol should be located in libpthread.

As a result, the forwarder (whether it's IFUNC-based or a duplicate
of the libc implementation) is no longer necessary.

On older architectures, a placeholder symbol is required, to make sure
that the GLIBC_2.1.2 symbol version does not go away, or is turned in
to a weak symbol definition by the link editor.  (The symbol version
needs to preserved so that the symbol coverage check in
elf/dl-version.c does not fail for old binaries.)

mips32 is an outlier: It defined __vfork@@GLIBC_2.2, but the
baseline is GLIBC_2.0.  Since there are other @@GLIBC_2.2 symbols,
the placeholder symbol is not needed there.

5 years agomalloc: Add nptl, htl dependency for the subdirectory [BZ #24757]
Florian Weimer [Tue, 2 Jul 2019 14:45:52 +0000 (16:45 +0200)]
malloc: Add nptl, htl dependency for the subdirectory [BZ #24757]

memusagestat may indirectly link against libpthread.  The built
libpthread should be used, but that is only possible if it has been
built before the malloc programs.

5 years agoFix build warnings in resolv/res_send.c
Stefan Liebler [Tue, 2 Jul 2019 12:07:44 +0000 (14:07 +0200)]
Fix build warnings in resolv/res_send.c

This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
res_send.c: In function ‘__res_context_send’:
res_send.c:498:7: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  498 |    if (n == 0 && (buf2 == NULL || *resplen2 == 0))
      |       ^

In this case send_vc is inlined into __res_context_send
and the maybe uninitialized resplen belongs to the one in send_vc.

In send_vc there is already a DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized")
and a comment which explains that this is a false-positive.
Note that resplen is used as return value.

This patch adds a further DIAG_IGNORE_NEEDS_COMMENT around the declaration of n
in __res_context_send and the comparison after n was set to the return value of send_vc.

ChangeLog:

* resolv/res_send.c (__res_context_send): Disable maybe-uninitialized
warning.

5 years agobuild-many-glibcs.py: Add v4t variant for arm-linux-gnueabi
Florian Weimer [Tue, 2 Jul 2019 11:14:58 +0000 (13:14 +0200)]
build-many-glibcs.py: Add v4t variant for arm-linux-gnueabi

5 years agoCall _dl_open_check after relocation [BZ #24259]
H.J. Lu [Mon, 1 Jul 2019 19:23:10 +0000 (12:23 -0700)]
Call _dl_open_check after relocation [BZ #24259]

This is a workaround for [BZ #20839] which doesn't remove the NODELETE
object when _dl_open_check throws an exception.  Move it after relocation
in dl_open_worker to avoid leaving the NODELETE object mapped without
relocation.

[BZ #24259]
* elf/dl-open.c (dl_open_worker): Call _dl_open_check after
relocation.
* sysdeps/x86/Makefile (tests): Add tst-cet-legacy-5a,
tst-cet-legacy-5b, tst-cet-legacy-6a and tst-cet-legacy-6b.
(modules-names): Add tst-cet-legacy-mod-5a, tst-cet-legacy-mod-5b,
tst-cet-legacy-mod-5c, tst-cet-legacy-mod-6a, tst-cet-legacy-mod-6b
and tst-cet-legacy-mod-6c.
(CFLAGS-tst-cet-legacy-5a.c): New.
(CFLAGS-tst-cet-legacy-5b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5a.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-5c.c): Likewise.
(CFLAGS-tst-cet-legacy-6a.c): Likewise.
(CFLAGS-tst-cet-legacy-6b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6a.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6b.c): Likewise.
(CFLAGS-tst-cet-legacy-mod-6c.c): Likewise.
($(objpfx)tst-cet-legacy-5a): Likewise.
($(objpfx)tst-cet-legacy-5a.out): Likewise.
($(objpfx)tst-cet-legacy-mod-5a.so): Likewise.
($(objpfx)tst-cet-legacy-mod-5b.so): Likewise.
($(objpfx)tst-cet-legacy-5b): Likewise.
($(objpfx)tst-cet-legacy-5b.out): Likewise.
(tst-cet-legacy-5b-ENV): Likewise.
($(objpfx)tst-cet-legacy-6a): Likewise.
($(objpfx)tst-cet-legacy-6a.out): Likewise.
($(objpfx)tst-cet-legacy-mod-6a.so): Likewise.
($(objpfx)tst-cet-legacy-mod-6b.so): Likewise.
($(objpfx)tst-cet-legacy-6b): Likewise.
($(objpfx)tst-cet-legacy-6b.out): Likewise.
(tst-cet-legacy-6b-ENV): Likewise.
* sysdeps/x86/tst-cet-legacy-5.c: New file.
* sysdeps/x86/tst-cet-legacy-5a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-5b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-6b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-5c.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6a.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6b.c: Likewise.
* sysdeps/x86/tst-cet-legacy-mod-6c.c: Likewise.

5 years agopowerpc: Use faster means to access FPSCR when possible in some cases
Paul A. Clarke [Thu, 20 Jun 2019 16:57:18 +0000 (11:57 -0500)]
powerpc: Use faster means to access FPSCR when possible in some cases

Using 'mffs' instruction to read the Floating Point Status Control Register
(FPSCR) can force a processor flush in some cases, with undesirable
performance impact.  If the values of the bits in the FPSCR which force the
flush are not needed, an instruction that is new to POWER9 (ISA version 3.0),
'mffsl' can be used instead.

Cases included:  get_rounding_mode, fegetround, fegetmode, fegetexcept.

* sysdeps/powerpc/bits/fenvinline.h (__fegetround): Use
__fegetround_ISA300() or __fegetround_ISA2() as appropriate.
(__fegetround_ISA300) New.
(__fegetround_ISA2) New.
* sysdeps/powerpc/fpu_control.h (IS_ISA300): New.
(_FPU_MFFS): Move implementation...
(_FPU_GETCW): Here.
(_FPU_MFFSL): Move implementation....
(_FPU_GET_RC_ISA300): Here. New.
(_FPU_GET_RC): Use _FPU_GET_RC_ISA300() or _FPU_GETCW() as appropriate.
* sysdeps/powerpc/fpu/fenv_libc.h (fegetenv_status_ISA300): New.
(fegetenv_status): New.
* sysdeps/powerpc/fpu/fegetmode.c (fegetmode): Use fegetenv_status()
instead of fegetenv_register().
* sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Likewise.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoFurther improve string bench timing
Wilco Dijkstra [Fri, 28 Jun 2019 12:42:36 +0000 (13:42 +0100)]
Further improve string bench timing

Further improve the timings of the string benchmarks.  Ensure most take
between 1 and 4 seconds to improve accuracy.  Overall time taken increases
by 35%.  Tested on AArch64.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* benchtests/bench-math-inlines.c: Increase iterations.
* benchtests/bench-memcmp.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcmp.c: Likewise.
* benchtests/bench-strcpy_chk.c: Likewise.
* benchtests/bench-string.h (INNER_LOOP_ITERS8): Add define.
(INNER_LOOP_ITERS_MEDIUM): Increase iterations.
(INNER_LOOP_ITERS_SMALL): Likewise.
* benchtests/bench-strncat.c: Increase iterations.
* benchtests/bench-strncmp.c: Increase iterations.
* benchtests/bench-strncpy.c: Reduce iterations for wide strings.
* benchtests/bench-strrchr.c: Increase iterations.
* benchtests/bench-strstr.c: Keep iterations unchanged.
* benchtests/bench-strtod.c: Increase iterations.

5 years agoBump up the runtime for "short" benchmarks
Anton Youdkevitch [Fri, 28 Jun 2019 12:38:07 +0000 (13:38 +0100)]
Bump up the runtime for "short" benchmarks

Some benchmarks with a very short runtime show significantly
different results across runs on Aarch64 - up to tens of percents.
Increasing the runtime to 100ms+ makes the deviation under 5%.

Tested on Aarch64 and x86-64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* benchtests/bench-memccpy.c: Replace INNER_LOOP_ITERS
with INNER_LOOP_ITERS_LARGE.
* benchtests/bench-memchr.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcat.c: Likewise.
* benchtests/bench-strchr.c: Likewise.
* benchtests/bench-string.h: Likewise.
* benchtests/bench-strlen.c: Likewise.
* benchtests/bench-strncpy.c: Likewise.
* benchtests/bench-strnlen.c: Likewise.

5 years agoLinux: Use mmap instead of malloc in dirent/tst-getdents64
Florian Weimer [Fri, 28 Jun 2019 08:48:48 +0000 (10:48 +0200)]
Linux: Use mmap instead of malloc in dirent/tst-getdents64

malloc dirties the entire allocated memory region due to M_PERTURB
in the test harness.

5 years agoReplace PREPARE_VERSION macro with inline function
Tobias Klauser [Fri, 28 Jun 2019 11:46:00 +0000 (08:46 -0300)]
Replace PREPARE_VERSION macro with inline function

* sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION): Remove macro.
(prepare_version_base): New helper inline function.
(prepare_version): New macro replacing PREPARE_VERSION.
(PREPARE_VERSION_KNOWN): Use prepare_version instead of PREPARE_VERSION.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agold.so: Support moving versioned symbols between sonames [BZ #24741]
Florian Weimer [Fri, 28 Jun 2019 08:12:50 +0000 (10:12 +0200)]
ld.so: Support moving versioned symbols between sonames [BZ #24741]

This change should be fully backwards-compatible because the old
code aborted the load if a soname mismatch was encountered
(instead of searching further for a matching symbol).  This means
that no different symbols are found.

The soname check was explicitly disabled for the skip_map != NULL
case.  However, this only happens with dl(v)sym and RTLD_NEXT,
and those lookups do not come with a verneed entry that could be used
for the check.

The error check was already explicitly disabled for the skip_map !=
NULL case, that is, when dl(v)sym was called with RTLD_NEXT.  But
_dl_vsym always sets filename in the struct r_found_version argument
to NULL, so the check was not active anyway.  This means that
symbol lookup results for the skip_map != NULL case do not change,
either.

5 years agosupport: Add xdlvsym function
Florian Weimer [Fri, 28 Jun 2019 08:15:30 +0000 (10:15 +0200)]
support: Add xdlvsym function

5 years agoio: Remove copy_file_range emulation [BZ #24744]
Florian Weimer [Fri, 28 Jun 2019 07:39:21 +0000 (09:39 +0200)]
io: Remove copy_file_range emulation [BZ #24744]

The kernel is evolving this interface (e.g., removal of the
restriction on cross-device copies), and keeping up with that
is difficult.  Applications which need the function should
run kernels which support the system call instead of relying on
the imperfect glibc emulation.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoPrepare vfprintf to use __printf_fp/__printf_fphex with float128 arg
Gabriel F. T. Gomes [Thu, 27 Jun 2019 20:43:44 +0000 (17:43 -0300)]
Prepare vfprintf to use __printf_fp/__printf_fphex with float128 arg

On powerpc64le, long double can currently take two formats: the same as
double (-mlong-double-64) or IBM Extended Precision (default with
-mlong-double-128 or explicitly with -mabi=ibmlongdouble).  The internal
implementation of printf-like functions is aware of these possibilities
and properly parses floating-point values from the variable arguments,
before making calls to __printf_fp and __printf_fphex.  These functions
are also aware of the format possibilities and know how to convert both
formats to string.

When library support for TS 18661-3 was added to glibc, __printf_fp and
__printf_fphex were extended with support for an additional type
(__float128/_Float128) with a different format (binary128).  Now that
powerpc64le is getting support for its third long double format, and
taking into account that this format is the same as the format of
__float128/_Float128, this patch extends __vfprintf_internal to properly
call __printf_fp and __printf_fphex with this new format.

Tested for powerpc64le (with additional patches to actually enable the
use of these preparations) and for x86_64.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agoLinux: Adjust gedents64 buffer size to int range [BZ #24740]
Florian Weimer [Thu, 27 Jun 2019 13:08:40 +0000 (15:08 +0200)]
Linux: Adjust gedents64 buffer size to int range [BZ #24740]

The kernel interface uses type unsigned int, but there is an
internal conversion to int, so INT_MAX is the correct limit.
Part of the buffer will always be unused, but this is not a
problem.  Such huge buffers do not occur in practice anyway.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agox86: Add sysdeps/x86/dl-lookupcfg.h
H.J. Lu [Wed, 26 Jun 2019 22:07:18 +0000 (15:07 -0700)]
x86: Add sysdeps/x86/dl-lookupcfg.h

Since sysdeps/i386/dl-lookupcfg.h and sysdeps/x86_64/dl-lookupcfg.h are
identical, we can replace them with sysdeps/x86/dl-lookupcfg.h.

* sysdeps/i386/dl-lookupcfg.h: Moved to ...
* sysdeps/x86/dl-lookupcfg.h: Here.
* sysdeps/x86_64/dl-lookupcfg.h: Removed.

5 years agopowerpc: Use generic e_expf
Adhemerval Zanella [Wed, 13 Mar 2019 17:55:03 +0000 (17:55 +0000)]
powerpc: Use generic e_expf

Generic implementation is faster on both power8 and power9:

POWER9:
- sysdeps/ieee754/flt-32/e_expf.c
  "expf": {
   "workload-spec2017.wrf": {
    "duration": 5.1236e+09,
    "iterations": 7.53344e+08,
    "reciprocal-throughput": 5.9436,
    "latency": 7.65869,
    "max-throughput": 1.68248e+08,
    "min-throughput": 1.30571e+08
   }
  }

- sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S
  "expf": {
   "workload-spec2017.wrf": {
    "duration": 5.14429e+09,
    "iterations": 5.29248e+08,
    "reciprocal-throughput": 8.05372,
    "latency": 11.3863,
    "max-throughput": 1.24166e+08,
    "min-throughput": 8.78249e+07
   }
  }

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Remove e_expf-power8 and expf-ppc64.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-power8.S: Remove
file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/w_expf.c: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/w_expf.c: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
5 years agopowerpc: Refactor powerpc32 lround/lroundf/llround/llroundf
Adhemerval Zanella [Fri, 22 Mar 2019 16:47:34 +0000 (16:47 +0000)]
powerpc: Refactor powerpc32 lround/lroundf/llround/llroundf

This patches consolidates all the powerpc llround{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llround{f}.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc32/fpu/Makefile
[$(subdir) == math] (CFLAGS-s_lround.c): New rule.
* sysdeps/powerpc/powerpc32/fpu/s_llround.c (__llround): Add power5+
and fctidz optimization.
* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_lround.c: New file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(CFLAGS-s_llround-power6.c, CFLAGS-s_llround-power5+.c,
CFLAGS-s_llround-ppc32.c, CFLAGS-s_lround-ppc32.c,
CFLAGS-s_lround-power5+.c): New rule.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.c:
New file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power5+.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-power6.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-power5+.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llroundf.S: Likewise.
* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc32/power5+/fpu/s_llroundf.S: Likewise.
* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llroundf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
5 years agoLinux: Add nds32 specific syscalls to syscall-names.list
Vincent Chen [Wed, 26 Jun 2019 09:30:11 +0000 (17:30 +0800)]
Linux: Add nds32 specific syscalls to syscall-names.list

The nds32 creates two specific syscalls, udftrap and fp_udfiex_crtl, in
kernel v5.0 and v5.2, respectively. Add these two syscalls to
syscall-names.list.

5 years agoFix build warnings in nptl/tst-eintr1.c
Stefan Liebler [Wed, 26 Jun 2019 10:29:50 +0000 (12:29 +0200)]
Fix build warnings in nptl/tst-eintr1.c

This patch fixes the gcc warnings seen with gcc 9.1 -O3 on s390x:
tst-eintr1.c: In function ‘tf1’:
tst-eintr1.c:46:1: error: no return statement in function returning non-void [-Werror=return-type]
   46 | }
      | ^
tst-eintr1.c: In function ‘do_test’:
tst-eintr1.c:57:17: error: unused variable ‘th’ [-Werror=unused-variable]
   57 |       pthread_t th = xpthread_create (NULL, tf1, NULL);
      |                 ^~

ChangeLog:

* nptl/tst-eintr1.c (tf1): Add return statement.
(do_test): Remove unused th variable.

5 years agoFix build warnings in locale/programs/ld-ctype.c
Stefan Liebler [Wed, 26 Jun 2019 06:34:25 +0000 (08:34 +0200)]
Fix build warnings in locale/programs/ld-ctype.c

This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
programs/ld-ctype.c: In function ‘ctype_read’:
programs/ld-ctype.c:1392:13: error: ‘wch’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1392 |    uint32_t wch;
      |             ^~~
programs/ld-ctype.c:1401:7: error: ‘seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1401 |    if (seq != NULL && seq->nbytes == 1)
      |       ^
programs/ld-ctype.c:1391:20: note: ‘seq’ was declared here
 1391 |    struct charseq *seq;
      |                    ^~~

Both seq and wch are uninitialized if get_character fails.
Thus we are now returning with an error.

ChangeLog:

* locale/programs/ld-ctype.c (charclass_symbolic_ellipsis):
Return error if get_character fails.

5 years agoS390: Regenerate ULPs.
Stefan Liebler [Tue, 25 Jun 2019 13:14:17 +0000 (15:14 +0200)]
S390: Regenerate ULPs.

The update is needed for builds with -O3 and -march>=z13.

ChangeLog:

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

5 years agoszl_PL locale: Fix a typo in the previous commit (bug 24652).
Rafal Luzynski [Mon, 24 Jun 2019 20:04:41 +0000 (22:04 +0200)]
szl_PL locale: Fix a typo in the previous commit (bug 24652).

The Unicode sequences in the format <Uxxxx> should be used instead of
non-ASCII characters.

Reported by Piotr Drąg:
https://sourceware.org/bugzilla/show_bug.cgi?id=24652#c8

[BZ #24652]
* localedata/locales/szl_PL (day): Use the correct Unicode
sequences instead of non-ASCII characters.

5 years agoszl_PL locale: Spelling corrections (bug 24652).
Grzegorz Kulik [Tue, 18 Jun 2019 16:41:19 +0000 (18:41 +0200)]
szl_PL locale: Spelling corrections (bug 24652).

This commit also provides the correct month names in both nominative
and genitive case for Silesian language, as required by the fix for
the bug 10871.

[BZ #24652]
* localedata/locales/szl_PL (abday): Spelling corrections.
(day): Likewise.
(abmon): Likewise.
(mon): Rename to...
(alt_mon): This, then apply spelling corrections.
(mon): New entry, month names in the genitive case.

5 years agonl_{AW,NL}: Correct the thousands separator and grouping (bug 23831).
Rafal Luzynski [Fri, 21 Jun 2019 18:18:48 +0000 (20:18 +0200)]
nl_{AW,NL}: Correct the thousands separator and grouping (bug 23831).

According to CLDR 35.1 and the bug report the thousands grouping
separator should be always "." (a single dot) and digits should be
grouped by 3.

[BZ #23831]
* localedata/locales/nl_AW (mon_thousands_sep): Set to ".".
* localedata/locales/nl_NL (mon_thousands_sep): Likewise.
(thousands_sep): Likewise.
(grouping): Set to 3;3.

5 years agoAdd missing VDSO_{NAME,HASH}_* macros and use them for PREPARE_VERSION_KNOWN
Tobias Klauser [Fri, 21 Jun 2019 13:36:52 +0000 (10:36 -0300)]
Add missing VDSO_{NAME,HASH}_* macros and use them for PREPARE_VERSION_KNOWN

Define all currently used Linux versions used for
PREPARE_VERSION{,_KNOWN} in sysdeps/unix/sysv/linux/dl-vdso.h and use
them instead of duplicating the versions and precomputed hashes across
architecture specific files.

* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (INIT_ARCH): Use
PREPARE_VERSION_KNOWN.
* sysdeps/unix/sysv/linux/aarch64/init-first.c: Likewise.
* sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME_LINUX_2_6_39): New
define.
(VDSO_HASH_LINUX_2_6_39): Likewise.
(VDSO_NAME_LINUX_4_9): Likewise.
(VDSO_HASH_LINUX_4_9): Likewise.
* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (INIT_ARCH): Likewise.
* sysdeps/unix/sysv/linux/powerpc/init-first.c
(_libc_vdso_platform_setup): Likewise.
* sysdeps/unix/sysv/linux/powerpc/time.c (INIT_ARCH): Likewise.
* sysdeps/unix/sysv/linux/s390/init-first.c (_libc_vdso_platform_setup):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_platform_setup):
Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agonptl: Convert various tests to use libsupport
Mike Crowe [Wed, 19 Jun 2019 21:07:58 +0000 (18:07 -0300)]
nptl: Convert various tests to use libsupport

* nptl/eintr.c: Use libsupport.
* nptl/tst-eintr1.c: Likewise.
* nptl/tst-eintr2.c: Likewise.
* nptl/tst-eintr3.c: Likewise.
* nptl/tst-eintr4.c: Likewise.
* nptl/tst-eintr5.c: Likewise.
* nptl/tst-mutex-errorcheck.c: Likewise.
* nptl/tst-mutex5.c: Likewise.

5 years agosupport: Invent verbose_printf macro
Mike Crowe [Wed, 19 Jun 2019 21:06:14 +0000 (18:06 -0300)]
support: Invent verbose_printf macro

Make it easier for tests to emit progress messages only when --verbose is
specified.

* support/test-driver.h: Add verbose_printf macro.

5 years agosupport: Add xclock_now helper function.
Mike Crowe [Wed, 19 Jun 2019 21:05:12 +0000 (18:05 -0300)]
support: Add xclock_now helper function.

It's easier to read and write tests with:

 const struct timespec ts = xclock_now(CLOCK_REALTIME);

than

 struct timespec ts;
 xclock_gettime(CLOCK_REALTIME, &ts);

* support/xtime.h: Add xclock_now() helper function.

5 years agolibio: do not attempt to free wide buffers of legacy streams [BZ #24228]
Dmitry V. Levin [Wed, 13 Feb 2019 01:20:51 +0000 (01:20 +0000)]
libio: do not attempt to free wide buffers of legacy streams [BZ #24228]

Commit a601b74d31ca086de38441d316a3dee24c866305 aka glibc-2.23~693
("In preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
when _G_HAVE_MMAP is turned off.") introduced a regression:
_IO_unbuffer_all now invokes _IO_wsetb to free wide buffers of all
files, including legacy standard files which are small statically
allocated objects that do not have wide buffers and the _mode member,
causing memory corruption.

Another memory corruption in _IO_unbuffer_all happens when -1
is assigned to the _mode member of legacy standard files that
do not have it.

[BZ #24228]
* libio/genops.c (_IO_unbuffer_all)
[SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)]: Do not attempt to free wide
buffers and access _IO_FILE_complete members of legacy libio streams.
* libio/tst-bz24228.c: New file.
* libio/tst-bz24228.map: Likewise.
* libio/Makefile [build-shared] (tests): Add tst-bz24228.
[build-shared] (generated): Add tst-bz24228.mtrace and
tst-bz24228.check.
[run-built-tests && build-shared] (tests-special): Add
$(objpfx)tst-bz24228-mem.out.
(LDFLAGS-tst-bz24228, tst-bz24228-ENV): New variables.
($(objpfx)tst-bz24228-mem.out): New rule.

5 years ago[powerpc] add 'volatile' to asm
Paul A. Clarke [Tue, 11 Jun 2019 19:37:37 +0000 (14:37 -0500)]
[powerpc] add 'volatile' to asm

Add 'volatile' keyword to a few asm statements, to force the compiler
to generate the instructions therein.

Some instances were implicitly volatile, but adding keyword for consistency.

2019-06-19  Paul A. Clarke  <pc@us.ibm.com>

* sysdeps/powerpc/fpu/fenv_libc.h (relax_fenv_state): Add 'volatile'.
* sysdeps/powerpc/fpu/fpu_control.h (__FPU_MFFS): Likewise.
(__FPU_MFFSL): Likewise.
(_FPU_SETCW): Likewise.

5 years agopowerpc: Fix static-linked version of __ppc_get_timebase_freq [BZ #24640]
Stan Shebs [Wed, 19 Jun 2019 20:15:35 +0000 (17:15 -0300)]
powerpc: Fix static-linked version of __ppc_get_timebase_freq [BZ #24640]

__ppc_get_timebase_freq() always return 0 when using static linked
glibc.

This is a minimal example.c to reproduce:

    /******************************/
    #include <inttypes.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <sys/platform/ppc.h>

    int main() {
        uint64_t freq = __ppc_get_timebase_freq();
        printf("Time Base frequency = %"PRIu64" Hz\n", freq);
        if (freq == 0)
            return -1;
        return 0;
    }
    /******************************/

Compile command: gcc -static example.c

This bug has been reproduced, fixed and tested on all powerpc platforms
(ppc32, ppc64 and ppc64le).

The underlying code of __ppc_get_timebase_freq uses __get_timebase_freq
that has a different implementation for shared and static version of
glibc.  In the static version, there is an incorrect sense in the if
check for the fd returned when opening /proc/cpuinfo.

This solution is mostly a cherry-pick from:

  commit 4791e4f773d060c1a37b27aac5b03cdfa9327afc
  Author: Stan Shebs <stanshebs@google.com>
  Date:   Fri May 17 12:25:19 2019 -0700
  Subject: Fix sense of a test in the static-linking version of ppc get_clockfreq

That is in branch glibc/google/grte/v5-2.27/master and was mentioned for
inclusion on master here:

  https://www.sourceware.org/ml/libc-alpha/2019-05/msg00409.html

Adapted from original fix for get_clockfreq. That code was moved to
get_timebase_freq.

Also added a static-build testcase for __ppc_get_timebase_freq since the
underlying function has different implementations for shared and static
build.

[BZ #24640]
* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
[!SHARED] (__get_timebase_freq): Fix sense of a test in the
static-linking version.
* sysdeps/unix/sysv/linux/powerpc/Makefile
(tests-static): Add test-gettimebasefreq-static.
(tests): Likewise.
* sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq-static.c:
New file.

5 years agonl_AW locale: Correct the negative monetary format (bug 24614).
Rafal Luzynski [Mon, 17 Jun 2019 23:20:11 +0000 (01:20 +0200)]
nl_AW locale: Correct the negative monetary format (bug 24614).

Follow the same changes as made in the commit 02d8b5ab1c because the
respective entries in nl_NL and nl_AW had been the same before the change
so they should be the same after.  CLDR does not provide complete data
for nl_AW, it says it is missing and displays a copy of nl_NL.

[BZ #24614]
* localedata/locales/nl_AW (n_sep_by_space): Set to 2 (a space
between the currency symbol and the minus sign).
(n_sign_posn): Set to 4 (the minus sign after the currency symbol).

5 years agoFix gcc 9 build errors for make xcheck. [BZ #24556]
Stefan Liebler [Wed, 19 Jun 2019 10:32:04 +0000 (12:32 +0200)]
Fix gcc 9 build errors for make xcheck. [BZ #24556]

This patch fixes the following gcc 9 warnings for "make xcheck" / "make bench":
-string/tst-strcasestr.c:
../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

-argp/argp-test.c:
argp-test.c:130:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=]
argp-test.c:130:19: note: directive argument in the range [-2147483648, 122]
argp-test.c:130:5: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10

-nss/tst-field.c:
tst-field.c:52:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

-benchtests/bench-strstr.c:
../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

-benchtests/bench-malloc-simple.c:
bench-malloc-simple.c:93:16: error: iteration 3 invokes undefined behavior [-Werror=aggressive-loop-optimizations]

ChangeLog:

[BZ #24556]
* string/test-strcasestr.c (check_result): Add NULL check.
* nss/tst-field.c (check_rewrite): Likewise.
* benchtests/bench-strstr.c (do_one_test): Likewise.
* string/test-strstr.c (check_result): Likewise.
* argp/argp-test.c (popt): Increase size of buf to 12.
* benchtests/bench-malloc-simple.c (bench):
Do not initialize tests array out of bounds.

5 years agodlfcn: Avoid one-element flexible array in Dl_serinfo [BZ #24166]
Florian Weimer [Wed, 19 Jun 2019 08:13:50 +0000 (10:13 +0200)]
dlfcn: Avoid one-element flexible array in Dl_serinfo [BZ #24166]

The dls_serpath path field, as an array of length 1, introduces
unexpected array subscript checks with some compilers.

GCC versions before 3.0 treat the nested anonymous union as a
declaration of an unnamed type, and not as a member declaration,
so this construct cannot be used for these compilers.

5 years agoelf: Refuse to dlopen PIE objects [BZ #24323]
Florian Weimer [Tue, 18 Jun 2019 14:42:10 +0000 (16:42 +0200)]
elf: Refuse to dlopen PIE objects [BZ #24323]

Another executable has already been mapped, so the dynamic linker
cannot perform relocations correctly for the second executable.

5 years agonl_NL locale: Correct the negative monetary format (bug 24614).
Rafal Luzynski [Wed, 5 Jun 2019 22:22:54 +0000 (00:22 +0200)]
nl_NL locale: Correct the negative monetary format (bug 24614).

According to CLDR 35.1 and the bug report the correct monetary format
for negative amounts should be "EUR -1 234,56" while previously it was
"EUR 1 234,56-".

This patch does not change the thousands (grouping) separator.

[BZ #24614]
* localedata/Makefile (LOCALES): Add nl_NL.UTF-8.
* localedata/locales/nl_NL (n_sep_by_space): Set to 2 (a space
between the currency symbol and the minus sign).
(n_sign_posn): Set to 4 (the minus sign after the currency symbol).
* localedata/tst-strfmon1.c (tests): Add test data for nl_NL.UTF-8.

5 years agom68k: Remove vDSO support
Adhemerval Zanella [Wed, 29 May 2019 21:39:06 +0000 (18:39 -0300)]
m68k: Remove vDSO support

Although defined in initial TLS/NPTL ABI for m68k and ColdFire [1], kernel
support was never pushed upstream.  This patch removes the unused m68k
vDSO support.

Checked with a build against m68k and m68k-coldfire and some basic
tests on ARAnyM.

* sysdeps/unix/sysv/linux/m68k/Makefile (sysdep_routines,
sysdep-rtld-routines): Remove rules.
* sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_PRIVATE]:
Remove __vdso_atomic_cmpxchg_32 and __vdso_atomic_barrier.
(ld) [GLIBC_PRIVATE]: __rtld___vdso_read_tp,
__rtld___vdso_atomic_cmpxchg_32, and __rtld___vdso_atomic_barrier.
* sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h
(atomic_compare_and_exchange_val_acq, atomic_full_barrier): Remove
vDSO path for SHARED.
* sysdeps/unix/sysv/linux/m68k/init-first.c: Remove file.
* sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/m68k-helpers.c: New file.

[1] https://lists.debian.org/debian-68k/2007/11/msg00071.html

5 years agopowerpc: Refactor powerpc64 lround/lroundf/llround/llroundf
Adhemerval Zanella [Mon, 18 Mar 2019 11:28:13 +0000 (11:28 +0000)]
powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf

This patches consolidates all the powerpc {l}lround{f} implementations
on the generic sysdeps/powerpc/fpu/s_{l}lround{f}.c.

The IFUNC support is also moved only to powerpc64 only, since for
powerpc64le generic implementation resulting in optimized code.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_llround-power8, s_llround-power6x,
s_llround-power5+, s_llround-ppc64, and s_llroundf-ppc64.
(CFLAGS-s_llround-power8.c, CFLAGS-s_llround-power6x.c,
CFLAGS-s_llround-power5+.c): New rule.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power5+.c:
New file.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power6x.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-power8.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround-ppc64.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf-ppc64.c:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llround.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llroundf.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_lround.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lround.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/Makefile
[$(subdir) == math] (CFLAGS-s_llround.c): New rule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Remove s_llround-* objects.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power5+.S: Remove
file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power6x.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-power8.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround-ppc64.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf-ppc64.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lround.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lroundf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llround.c: New file.
* sysdeps/powerpc/powerpc64/fpu/s_llroundf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lround.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lroundf.c: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power5+/fpu/s_llroundf.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llroundf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llroundf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf
Adhemerval Zanella [Mon, 18 Mar 2019 02:01:03 +0000 (02:01 +0000)]
powerpc: Refactor powerpc32 lrint/lrintf/llrint/llrintf

This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llrint{f}.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cpu and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/fpu/s_lrintf.S: Remove file.
* sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Move to ...
* sysdeps/powerpc/fpu/s_lrintf.c: ... here.
* sysdeps/powerpc/powerpc32/fpu/Makefile
[$(subdir) == math] (CFLAGS-s_lrint.c): New rule.
* sysdeps/powerpc/powerpc32/fpu/s_llrint.c (__llrint): Add power4
optimization.
* sysdeps/powerpc/powerpc32/fpu/s_llrintf.c (__llrintf): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_lrint.c: New file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(CFLAGS-s_llrintf-power6.c, CFLAGS-s_llrintf-ppc32.c,
CFLAGS-s_llrint-power6.c, CFLAGS-s_llrint-ppc32.c,
CFLAGS-s_lrint-ppc32.c): New rule.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-power6.c:
New file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-power6.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint-ppc32.c:
Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf
Adhemerval Zanella [Sun, 17 Mar 2019 16:46:01 +0000 (16:46 +0000)]
powerpc: refactor powerpc64 lrint/lrintf/llrint/llrintf

This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/fpu/s_llrint{f}.

The IFUNC support is also moved only to powerpc64 only, since for
powerpc64le generic implementation resulting in optimized code.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_llrint-power8, s_llrint-power6x, and
s_llrint-ppc64.
(CFLAGS-s_llrint-power8.c, CFLAGS-s_llrint-power6x.c): New rule.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power6x.c: New
file.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-power8.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint-ppc64.c:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c: ... here.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c: New file.
* sysdeps/powerpc/powerpc64/fpu/Makefile: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
(libm-sysdep_routines): Remove s_llrint-* objects.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power6x.S: Remove
file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrint.c: New file.
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lrint.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lrintf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Remove file.
* sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_lrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agoLinux: Fix __glibc_has_include use for <sys/stat.h> and statx
Florian Weimer [Fri, 14 Jun 2019 14:28:41 +0000 (16:28 +0200)]
Linux: Fix __glibc_has_include use for <sys/stat.h> and statx

The identifier linux is used as a predefined macro, so the actually
used path is 1/stat.h or 1/stat64.h.  Using the quote-based version
triggers a file lookup for /usr/include/bits/linux/stat.h (or whatever
directory is used to store bits/statx.h), but since bits/ is pretty
much reserved by glibc, this appears to be acceptable.

This is related to GCC PR 80005: incorrect macro expansion of the
argument of __has_include.

Suggested by Zack Weinberg.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years ago<sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include
Florian Weimer [Fri, 14 Jun 2019 13:46:02 +0000 (15:46 +0200)]
<sys/cdefs.h>: Inhibit macro expansion for __glibc_has_include

This is currently ineffective with GCC because of GCC PR 80005, but
it makes sense to anticipate a fix for this defect.

Suggested by Zack Weinberg.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoAdd IPV6_ROUTER_ALERT_ISOLATE from Linux 5.1 to bits/in.h.
Joseph Myers [Thu, 13 Jun 2019 16:08:20 +0000 (16:08 +0000)]
Add IPV6_ROUTER_ALERT_ISOLATE from Linux 5.1 to bits/in.h.

This patch adds the new constant IPV6_ROUTER_ALERT_ISOLATE from Linux
5.1 to sysdeps/unix/sysv/linux/bits/in.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/in.h (IPV6_ROUTER_ALERT_ISOLATE):
New macro.

5 years agoAllow memset local PLT reference for powerpc soft-float.
Joseph Myers [Thu, 13 Jun 2019 12:21:50 +0000 (12:21 +0000)]
Allow memset local PLT reference for powerpc soft-float.

Some recent change on GCC mainline resulted in the localplt test
failing for powerpc soft-float (not sure exactly when, as the failure
appeared when there were other build test failures as well;
<https://sourceware.org/ml/libc-testresults/2019-q2/msg00261.html>
shows it remaining when other failures went away).  The problem is a
call to memset that GCC now generates in the libgcc long double code.

Since memset is documented as a function GCC may always implicitly
generate calls to, it seems reasonable to allow that local PLT
reference (just like those for libgcc functions that GCC implicitly
generates calls to and that are also exported from libc.so), which
this patch does.

Tested for powerpc soft-float with build-many-glibcs.py.

* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data:
Allow memset in libc.so.

5 years agoaarch64: handle STO_AARCH64_VARIANT_PCS
Szabolcs Nagy [Thu, 25 Apr 2019 14:35:35 +0000 (15:35 +0100)]
aarch64: handle STO_AARCH64_VARIANT_PCS

Avoid lazy binding of symbols that may follow a variant PCS with different
register usage convention from the base PCS.

Currently the lazy binding entry code does not preserve all the registers
required for AdvSIMD and SVE vector calls.  Saving and restoring all
registers unconditionally may break existing binaries, even if they never
use vector calls, because of the larger stack requirement for lazy
resolution, which can be significant on an SVE system.

The solution is to mark all symbols in the symbol table that may follow
a variant PCS so the dynamic linker can handle them specially.  In this
patch such symbols are always resolved at load time, not lazily.

So currently LD_AUDIT for variant PCS symbols are not supported, for that
the _dl_runtime_profile entry needs to be changed e.g. to unconditionally
save/restore all registers (but pass down arg and retval registers to
pltentry/exit callbacks according to the base PCS).

This patch also removes a __builtin_expect from the modified code because
the branch prediction hint did not seem useful.

* sysdeps/aarch64/dl-dtprocnum.h: New file.
* sysdeps/aarch64/dl-machine.h (DT_AARCH64): Define.
(elf_machine_runtime_setup): Handle DT_AARCH64_VARIANT_PCS.
(elf_machine_lazy_rel): Check STO_AARCH64_VARIANT_PCS and bind such
symbols at load time.
* sysdeps/aarch64/linkmap.h (struct link_map_machine): Add variant_pcs.

5 years agoaarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS
Szabolcs Nagy [Thu, 25 Apr 2019 14:35:35 +0000 (15:35 +0100)]
aarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS

STO_AARCH64_VARIANT_PCS is a non-visibility st_other flag for marking
symbols that reference functions that may follow a variant PCS with
different register usage convention from the base PCS.

DT_AARCH64_VARIANT_PCS is a dynamic tag that marks ELF modules that
have R_*_JUMP_SLOT relocations for symbols marked with
STO_AARCH64_VARIANT_PCS (i.e. have variant PCS calls via a PLT).

* elf/elf.h (STO_AARCH64_VARIANT_PCS): Define.
(DT_AARCH64_VARIANT_PCS): Define.

5 years agopowerpc: Remove optimized finite
Adhemerval Zanella [Mon, 11 Mar 2019 03:29:37 +0000 (03:29 +0000)]
powerpc: Remove optimized finite

The powerpc finite optimization do not show much gain:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power7 uses ftdiv to optimize for some input patterns, but at
    cost of others.  Comparing against generic C implementation built
    for powerpc64-linux-gnu-power7 (--with-cpu=power7):

    - Generic sysdeps/ieee754 implementation:
       "isfinite": {
        "": {
         "duration": 5.0082e+09,
         "iterations": 2.45299e+09,
         "max": 43.824,
         "min": 2.008,
         "mean": 2.04167
        },
        "INF": {
         "duration": 4.66554e+09,
         "iterations": 2.28288e+09,
         "max": 35.73,
         "min": 2.008,
         "mean": 2.04371
        },
        "NAN": {
         "duration": 4.66274e+09,
         "iterations": 2.28716e+09,
         "max": 34.161,
         "min": 2.009,
         "mean": 2.03866
        }
       }

    - power7 optimized one:
       "isfinite": {
        "": {
         "duration": 4.99111e+09,
         "iterations": 2.65566e+09,
         "max": 25.015,
         "min": 1.716,
         "mean": 1.87942
        },
        "INF": {
         "duration": 4.6783e+09,
         "iterations": 2.0999e+09,
         "max": 35.264,
         "min": 1.868,
         "mean": 2.22787
        },
        "NAN": {
         "duration": 4.67915e+09,
         "iterations": 2.08678e+09,
         "max": 38.099,
         "min": 1.869,
         "mean": 2.24228
        }
       }

     So it basically optimizes marginally for normal numbers while
     increasing the latency for other kind of FP.

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation is the best option for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(sysdeps_routines, libm-sysdep_routines): Remove s_finite*
objects.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-power7.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_finitef.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_call):
Remove s_finite* objects.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power7.S: Remove file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_finitef.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_finitef.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agomath: Use wordsize-64 version for finite
Adhemerval Zanella [Tue, 26 Mar 2019 17:47:54 +0000 (17:47 +0000)]
math: Use wordsize-64 version for finite

  - math.h will use compiler builtin for gcc 4.4 when built without
    -fsignaling-nans and the builtin is expanded inline for all
    support architectures.  As an example, there is no intra finite
    call on libm for the architecture I checked, x86, arm, aarch64,
    and powerpc.

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Move to ...
* sysdeps/ieee754/dbl-64/s_finite.c: ... here and format code.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: Remove optimized isinf
Adhemerval Zanella [Fri, 8 Mar 2019 20:26:00 +0000 (20:26 +0000)]
powerpc: Remove optimized isinf

The powerpc isinf optimizations onyl adds complexity:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power7 uses ftdiv to optimize for some input pattern and branch
    implementation for INF and denormal that does:

    return (ix & UINT64_C (0x7fffffffffffffff)) == UINT64_C (0x7ff0000000000000)

    Although it does show slight better latency than generic algorithm
    (as below), it is only for power7 and requires it to override it
    for power8.

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation is the best option for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(sysdeps_routines, libm-sysdep_routines): Remove s_isinf* and s_isinf*
objects.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-power7.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff-ppc32.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isinff.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_call):
Remove s_isinf* and s_isinf* objects.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isinff.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isinff.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agomath: Use wordsize-64 version for isinf
Adhemerval Zanella [Tue, 26 Mar 2019 17:32:26 +0000 (17:32 +0000)]
math: Use wordsize-64 version for isinf

  - math.h will use compiler builtin for gcc 4.4 when built without
    -fsignaling-nans and the builtin is expanded inline for all
    support architectures.  As an example, there is no intra isinf
    call on libm for the architecture I checked, x86, arm, aarch64,
    and powerpc.

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

        * sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Move to ...
        * sysdeps/ieee754/dbl-64/s_isinf.c: ... here and format code.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: Remove optimized isnan
Adhemerval Zanella [Fri, 8 Mar 2019 19:32:15 +0000 (19:32 +0000)]
powerpc: Remove optimized isnan

The powerpc isnan optimizations are not really a gain:

  - GCC will call libm iff -fsignaling-nans is used. This usage pattern
    is usually not performance oriented and for such calls PLT overhead
    should dominate execution time.

  - The power5, power6, and power6x are just micro-optimization to
    improve the Load-Hit-Store hazards from floating-point to general
    register transfer, and current GCC already has support to minimize
    it by inserting either extra nops or group dispatch instructions.

  - The power7 uses ftdiv to optimize for some input patterns, but at
    cost of others.  Comparing against generic C implementation built
    for powerpc-linux-gnu-power4 (which uses the hp-timing support on
    benchtests):

    - Generic sysdeps/ieee754 implementation:
      "isnan": {
       "": {
        "duration": 4.98415e+09,
        "iterations": 2.34516e+09,
        "max": 45.925,
        "min": 2.052,
        "mean": 2.12529
       },
       "INF": {
        "duration": 4.74057e+09,
        "iterations": 1.69761e+09,
        "max": 91.01,
        "min": 2.052,
        "mean": 2.79249
       },
       "NAN": {
        "duration": 4.74071e+09,
        "iterations": 1.68768e+09,
        "max": 282.343,
        "min": 2.052,
        "mean": 2.809
       }
      }

    - power7 optimized one:
    $ ./testrun.sh benchtests/bench-isnan
      "isnan": {
       "": {
        "duration": 4.96842e+09,
        "iterations": 2.56297e+09,
        "max": 50.048,
        "min": 1.872,
        "mean": 1.93854
       },
       "INF": {
        "duration": 4.76648e+09,
        "iterations": 1.54213e+09,
        "max": 373.408,
        "min": 2.661,
        "mean": 3.09084
       },
       "NAN": {
        "duration": 4.76845e+09,
        "iterations": 1.54515e+09,
        "max": 51.016,
        "min": 2.736,
        "mean": 3.08607
       }
      }

    So it basically optimizes marginally for normal numbers while
    increasing the latency for other kind of FP.

  - The generic implementation requires getting the floating point
    status, disable the invalid operation bit, and restore the
    floating-point status.  Each operation is costly and requires
    flushing the FP pipeline.

    Using the same scenarion for the previous analysis:

      "isnan": {
       "": {
        "duration": 5.08284e+09,
        "iterations": 6.2898e+08,
        "max": 41.844,
        "min": 8.057,
        "mean": 8.08108
       },
       "INF": {
        "duration": 4.97904e+09,
        "iterations": 6.16176e+08,
        "max": 39.661,
        "min": 8.057,
        "mean": 8.08055
       },
       "NAN": {
        "duration": 4.98695e+09,
        "iterations": 5.95866e+08,
        "max": 29.728,
        "min": 8.345,
        "mean": 8.36925
       }
      }

  - The power8 implementation is just the generic implementation using
    ISA 2.07 mfvsrd instruction (which GCC uses for generic implementation).
    So generic implementation is the best option for powerpc64le.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/fpu/s_isnan.c: Remove file.
* sysdeps/powerpc/fpu/s_isnanf.S: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(sysdeps_routines, libm-sysdep_routines): Remove s_isnan-* and
s_isnanf-* objects.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power5.S:
Remove file
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power6.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-power7.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power5.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf-power6.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power5/fpu/s_isnanf.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc32/power7/fpu/s_isnanf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdep_calls):
Remove s_isnan-* and s_isnanf-* objects.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power5.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power6x.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power7.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-power8.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan-ppc64.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_isnanf.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agomath: Use wordsize-64 version for isnan
Adhemerval Zanella [Tue, 26 Mar 2019 13:32:19 +0000 (13:32 +0000)]
math: Use wordsize-64 version for isnan

  - math.h will use compiler builtin for gcc 4.4 when built without
    -fsignaling-nans and the builtin is expanded inline for all
    support architectures.  As an example, there is no intra isnan
    call on libm for the architecture I checked, x86, arm, aarch64,
    and powerpc.

  - The resulting binary difference on 32 bits architecture is minimum
    for the non hotspot symbol.

  - It helps wordsize-64 architectures that use ldbl-opt.

  - It add some code simplification with reduction of duplicated
    implementations.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Move to ...
* sysdeps/ieee754/dbl-64/s_isnan.c: ... here and format code.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agobenchtests: Add isnan/isinf/isfinite benchmark
Adhemerval Zanella [Wed, 27 Mar 2019 14:10:13 +0000 (14:10 +0000)]
benchtests: Add isnan/isinf/isfinite benchmark

* benchtests/Makefile (bench-math): Add isnan, isinf, and isfinite.
(CFLAGS-bench-isnan.c, CFLAGS-bench-isinf.c,
CFLAGS-bench-isfinite.c): New rule.
* benchtests/isnan-input: New file.
* benchtests/isinf-input: New file.
* benchtests/isfinite-input: New file.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: copysign cleanup
Adhemerval Zanella [Fri, 8 Mar 2019 16:55:52 +0000 (16:55 +0000)]
powerpc: copysign cleanup

GCC always expand copysign{f} for all possible cpus, so calling the libm
is only done if user explicitly states to disable the builtin (which is
done usually not for performance reason).  So to provide ifunc variant
for copysign is just unrequired complexity, since libm will be called
on non-performance critical code.

This patch removes both powerpc32 and powerpc64 ifunc variants and
consolidates the powerpc implementation on
sysdeps/powerpc/fpu/s_copysign{f}.c using compiler builtins.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/fpu/s_copysign.c: New file.
* sysdeps/powerpc/fpu/s_copysignf.c: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(sysdep_routines, libm-sysdep_routines): Remove s_copysign-power6 and
s_copysign-ppc32.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdeps_calls):
Remove s_copysign-power6 s_copysign-ppc64.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S:
Remove file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agopowerpc: consolidate rint
Adhemerval Zanella [Fri, 8 Mar 2019 20:26:36 +0000 (20:26 +0000)]
powerpc: consolidate rint

This patches consolidates all the powerpc rint{f} implementations on
the generic sysdeps/powerpc/fpu/s_rint{f}.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

* sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode,
round_to_integer_float, round_mode): Add RINT handling.
(reset_fenv_mode): New symbol.
* sysdeps/powerpc/fpu/s_rint.c (__rint): Use generic implementation.
* sysdeps/powerpc/fpu/s_rintf.c (__rintf): Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
5 years agolibio: freopen of default streams crashes in old programs [BZ #24632]
Florian Weimer [Wed, 12 Jun 2019 12:48:33 +0000 (14:48 +0200)]
libio: freopen of default streams crashes in old programs [BZ #24632]

As seen with very old i386 GCC binaries.

5 years agoLinux: Deprecate <sys/sysctl.h> and sysctl
Florian Weimer [Wed, 12 Jun 2019 12:32:08 +0000 (14:32 +0200)]
Linux: Deprecate <sys/sysctl.h> and sysctl

Now that there are no internal users of __sysctl left, it is possible
to add an unconditional deprecation warning to <sys/sysctl.h>.

To avoid a test failure due this warning in check-install-headers,
skip the test for sys/sysctl.h.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years ago<sys/stat.h>: Use Linux UAPI header for statx if available and useful
Florian Weimer [Wed, 12 Jun 2019 10:04:09 +0000 (12:04 +0200)]
<sys/stat.h>: Use Linux UAPI header for statx if available and useful

This will automatically import new STATX_* constants.  It also avoids
a conflict between <sys/stat.h> and <linux/stat.h>.

5 years ago<sys/cdefs.h>: Add __glibc_has_include macro
Florian Weimer [Wed, 12 Jun 2019 08:41:19 +0000 (10:41 +0200)]
<sys/cdefs.h>: Add __glibc_has_include macro

5 years agoImprove performance of memmem
Wilco Dijkstra [Wed, 12 Jun 2019 10:42:34 +0000 (11:42 +0100)]
Improve performance of memmem

This patch significantly improves performance of memmem using a novel
modified Horspool algorithm.  Needles up to size 256 use a bad-character
table indexed by hashed pairs of characters to quickly skip past mismatches.
Long needles use a self-adapting filtering step to avoid comparing the whole
needle repeatedly.

By limiting the needle length to 256, the shift table only requires 8 bits
per entry, lowering preprocessing overhead and minimizing cache effects.
This limit also implies worst-case performance is linear.

Small needles up to size 2 use a dedicated linear search.  Very long needles
use the Two-Way algorithm (to avoid increasing stack size or slowing down
the common case, inlining is disabled).

The performance gain is 6.6 times on English text on AArch64 using random
needles with average size 8.

Tested against GLIBC testsuite and randomized tests.

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* string/memmem.c (__memmem): Rewrite to improve performance.

5 years agoImprove performance of strstr
Wilco Dijkstra [Wed, 12 Jun 2019 10:38:52 +0000 (11:38 +0100)]
Improve performance of strstr

This patch significantly improves performance of strstr using a novel
modified Horspool algorithm.  Needles up to size 256 use a bad-character
table indexed by hashed pairs of characters to quickly skip past mismatches.
Long needles use a self-adapting filtering step to avoid comparing the whole
needle repeatedly.

By limiting the needle length to 256, the shift table only requires 8 bits
per entry, lowering preprocessing overhead and minimizing cache effects.
This limit also implies worst-case performance is linear.

Small needles up to size 3 use a dedicated linear search.  Very long needles
use the Two-Way algorithm.

The performance gain using the improved bench-strstr on Cortex-A72 is 5.8
times basic_strstr and 3.7 times twoway_strstr.

Tested against GLIBC testsuite, randomized tests and the GNULIB strstr test
(https://git.savannah.gnu.org/cgit/gnulib.git/tree/tests/test-strstr.c).

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* string/str-two-way.h (two_way_short_needle): Add inline to avoid
warning.
(two_way_long_needle): Block inlining.
* string/strstr.c (strstr2): Add new function.
(strstr3): Likewise.
(STRSTR): Completely rewrite strstr to improve performance.

5 years agoBenchmark strstr hard needles
Wilco Dijkstra [Tue, 11 Jun 2019 14:52:21 +0000 (15:52 +0100)]
Benchmark strstr hard needles

Benchmark needles which exhibit worst-case performance.  This shows that
basic_strstr is quadratic and thus unsuitable for large needles.
On the other hand the Two-way and new strstr implementations are linear with
increasing needle sizes.  The slowest cases of the two implementations are
within a factor of 2 on several different microarchitectures.  Two-way is
slowest on inputs which cause a branch mispredict on almost every character.
The new strstr is slowest on inputs which almost match and result in many
calls to memcmp.  Thanks to Szabolcs for providing various hard needles.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* benchtests/bench-strstr.c (test_hard_needle): New function.

5 years agoFix malloc tests build with GCC 10.
Joseph Myers [Mon, 10 Jun 2019 22:12:08 +0000 (22:12 +0000)]
Fix malloc tests build with GCC 10.

GCC mainline has recently added warn_unused_result attributes to some
malloc-like built-in functions, where glibc previously had them in its
headers only for __USE_FORTIFY_LEVEL > 0.  This results in those
attributes being newly in effect for building the glibc testsuite, so
resulting in new warnings that break the build where tests
deliberately call such functions and ignore the result.  Thus patch
duly adds calls to DIAG_* macros around those calls to disable the
warning.

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

* malloc/tst-calloc.c: Include <libc-diag.h>.
(null_test): Ignore -Wunused-result around calls to calloc.
* malloc/tst-mallocfork.c: Include <libc-diag.h>.
(do_test): Ignore -Wunused-result around call to malloc.

5 years agoLinux: Add getdents64 system call
Florian Weimer [Fri, 7 Jun 2019 07:27:01 +0000 (09:27 +0200)]
Linux: Add getdents64 system call

No 32-bit system call wrapper is added because the interface
is problematic because it cannot deal with 64-bit inode numbers
and 64-bit directory hashes.

A future commit will deprecate the undocumented getdirentries
and getdirentries64 functions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years ago[powerpc] get_rounding_mode: utilize faster method to get rounding mode
Paul A. Clarke [Fri, 15 Mar 2019 23:04:24 +0000 (19:04 -0400)]
[powerpc] get_rounding_mode: utilize faster method to get rounding mode

Add support to use 'mffsl' instruction if compiled for POWER9 (or later).

Also, mask the result to avoid bleeding unrelated bits into the result of
_FPU_GET_RC().

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoriscv: Do not use __has_include__
Florian Weimer [Thu, 6 Jun 2019 09:24:32 +0000 (11:24 +0200)]
riscv: Do not use __has_include__

The user-visible preprocessor construct is called __has_include.

5 years ago[powerpc] fegetexcept: utilize function instead of duplicating code
Paul A. Clarke [Wed, 5 Jun 2019 13:50:37 +0000 (08:50 -0500)]
[powerpc] fegetexcept: utilize function instead of duplicating code

fegetexcept() included code which exactly duplicates the code in
fenv_reg_to_exceptions().  Replace with a call to that function.

2019-06-05  Paul A. Clarke  <pc@us.ibm.com>

* sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Replace code
with call to equivalent function.

5 years agoiconv: Use __twalk_r in __gconv_release_shlib
Florian Weimer [Tue, 4 Jun 2019 12:05:44 +0000 (14:05 +0200)]
iconv: Use __twalk_r in __gconv_release_shlib

5 years agoFix iconv buffer handling with IGNORE error handler (bug #18830)
Andreas Schwab [Mon, 17 Aug 2015 12:05:01 +0000 (14:05 +0200)]
Fix iconv buffer handling with IGNORE error handler (bug #18830)

5 years agoAdd INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to netinet/in.h.
Joseph Myers [Mon, 3 Jun 2019 11:16:02 +0000 (11:16 +0000)]
Add INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to netinet/in.h.

This patch adds INADDR_ALLSNOOPERS_GROUP from Linux 5.1 to
netinet/in.h.

Tested for x86_64.

* inet/netinet/in.h (INADDR_ALLSNOOPERS_GROUP): New macro.

5 years agoFix data of ChangeLog entry
Florian Weimer [Sat, 1 Jun 2019 12:41:37 +0000 (14:41 +0200)]
Fix data of ChangeLog entry

5 years agoarm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support
Florian Weimer [Wed, 29 May 2019 14:53:09 +0000 (16:53 +0200)]
arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support

Linux only supports the required ISA sysctls on StrongARM devices,
which are armv4 and no longer tested during glibc development
and probably bit-rotted by this point.  (No reported test results,
and the last discussion of armv4 support was in the glibc 2.19
release notes.)

5 years agoLinux: Add oddly-named arm syscalls to syscall-names.list
Florian Weimer [Fri, 31 May 2019 11:52:16 +0000 (13:52 +0200)]
Linux: Add oddly-named arm syscalls to syscall-names.list

<asm/unistd.h> on arm defines the following macros:

#define __ARM_NR_breakpoint             (__ARM_NR_BASE+1)
#define __ARM_NR_cacheflush             (__ARM_NR_BASE+2)
#define __ARM_NR_usr26                  (__ARM_NR_BASE+3)
#define __ARM_NR_usr32                  (__ARM_NR_BASE+4)
#define __ARM_NR_set_tls                (__ARM_NR_BASE+5)
#define __ARM_NR_get_tls                (__ARM_NR_BASE+6)

These do not follow the regular __NR_* naming convention and
have so far been ignored by the syscall-names.list consistency
checks.  This commit adds these names to the file, preparing
for the availability of these names in the regular __NR_*
namespace.

5 years agopowerpc: Fix build failures with current GCC
Gabriel F. T. Gomes [Mon, 27 May 2019 18:21:22 +0000 (15:21 -0300)]
powerpc: Fix build failures with current GCC

Since GCC commit 271500 (svn), also known as the following commit on the
git mirror:

commit 61edec870f9fdfb5df3fa4e40f28cbaede28a5b1
Author: amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed May 22 04:34:26 2019 +0000

    [RS6000] Don't pass -many to the assembler

glibc builds are failing when an assembly implementation does not
declare the correct '.machine' directive, or when no such directive is
declared at all.  For example, when a POWER6 instruction is used, but
'.machine power6' is not declared, the assembler will fail with an error
similar to the following:

    ../sysdeps/powerpc/powerpc64/power8/strcmp.S: Assembler messages:
     24 ../sysdeps/powerpc/powerpc64/power8/strcmp.S:55: Error: unrecognized opcode: `cmpb'

This patch adds '.machine powerN' directives where none existed, as well
as it updates '.machine power7' directives on POWER8 files, because the
minimum binutils version required to build glibc (binutils 2.25) now
provides this machine version.  It also adds '-many' to the assembler
command used to build tst-set_ppr.c.

Tested for powerpc, powerpc64, and powerpc64le, as well as with
build-many-glibcs.py for powerpc targets.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
5 years agoRemove unused get_clockfreq files
Adhemerval Zanella [Wed, 29 May 2019 13:26:30 +0000 (10:26 -0300)]
Remove unused get_clockfreq files

The patch 6e8ba7fd574f meant to remove the all get_clockfreq.c.  This
patch removes the missing files for sparcv9 and x86_64.

Checked against a build to x86_64-linux-gnu and sparcv9-linux-gnu.

* sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9/get_clockfreq.c:
Remove file.
* sysdeps/unix/sysv/linux/x86_64/get_clockfreq.c: Likewise.

5 years agopowerpc: generic nearbyint/nearbyintf
Adhemerval Zanella [Fri, 15 Mar 2019 20:40:51 +0000 (20:40 +0000)]
powerpc: generic nearbyint/nearbyintf

This patches consolidates all the powerpc nearbyint{f} implementations
on the generic sysdeps/powerpc/fpu/s_nearbyint{f}.

* sysdeps/powerpc/fpu/round_to_integer.h (set_fenv_mode): Add
NEARBYINT handling.
* sysdeps/powerpc/fpu/s_nearbyint.c: New file.
* sysdeps/powerpc/fpu/s_nearbyintf.c: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise.

5 years agott_RU: Add lang_name [BZ #24370]
mansayk [Sat, 16 Mar 2019 08:46:39 +0000 (11:46 +0300)]
tt_RU: Add lang_name [BZ #24370]

This commit adds a lang_name according to CLDR-35.1.

[BZ #24370]
* localedata/locales/tt_RU (lang_name): Add from CLDR-35.1.

5 years agott_RU: Fix orthographic mistakes in mon and abmon sections [BZ #24369]
mansayk [Sat, 16 Mar 2019 08:33:30 +0000 (11:33 +0300)]
tt_RU: Fix orthographic mistakes in mon and abmon sections [BZ #24369]

This commit fixes some errors and converts all month names to lowercase.
The content is synchronized with CLDR-35.1 now but trailing dots are
removed from abmon values in order to maintain consistency with the
previous values and with many other locales which do the same.

[BZ #24369]
* localedata/locales/tt_RU (mon): Update from CLDR-35.1, fix errors.
(abmon): Likewise, but remove the trailing dots.

5 years agoAdd IGMP_MRDISC_ADV from Linux 5.1 to netinet/igmp.h.
Joseph Myers [Tue, 28 May 2019 12:01:12 +0000 (12:01 +0000)]
Add IGMP_MRDISC_ADV from Linux 5.1 to netinet/igmp.h.

This patch adds the IGMP_MRDISC_ADV macro from Linux 5.1 to
netinet/igmp.h.

Tested for x86_64.

* inet/netinet/igmp.h (IGMP_MRDISC_ADV): New macro.

5 years agonptl: Add comment to __pthread_get_minstack about external users
Florian Weimer [Mon, 27 May 2019 10:57:45 +0000 (12:57 +0200)]
nptl: Add comment to __pthread_get_minstack about external users

5 years agonss_dns: Check for proper A/AAAA address alignment
Florian Weimer [Fri, 24 May 2019 20:14:04 +0000 (22:14 +0200)]
nss_dns: Check for proper A/AAAA address alignment

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoAdd F_SEAL_FUTURE_WRITE from Linux 5.1 to bits/fcntl-linux.h.
Joseph Myers [Thu, 23 May 2019 13:20:48 +0000 (13:20 +0000)]
Add F_SEAL_FUTURE_WRITE from Linux 5.1 to bits/fcntl-linux.h.

This patch adds the new F_SEAL_FUTURE_WRITE constant from Linux 5.1 to
bits/fcntl-linux.h.

Tested for x86_64.

* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_GNU]
(F_SEAL_FUTURE_WRITE): New macro.

5 years agoelf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]
Alexandra Hájková [Thu, 9 May 2019 11:51:40 +0000 (13:51 +0200)]
elf: Add tst-ldconfig-bad-aux-cache test [BZ #18093]

This test corrupts /var/cache/ldconfig/aux-cache and executes ldconfig
to check it will not segfault using the corrupted aux_cache. The test
uses the test-in-container framework. Verified no regressions on
x86_64.

5 years agoAdd ChangeLog entry for previous commit.
Zack Weinberg [Wed, 22 May 2019 19:09:32 +0000 (15:09 -0400)]
Add ChangeLog entry for previous commit.

5 years agoRemove support for PowerPC SPE extension (powerpc*-*-*gnuspe*).
Zack Weinberg [Thu, 16 May 2019 17:34:27 +0000 (13:34 -0400)]
Remove support for PowerPC SPE extension (powerpc*-*-*gnuspe*).

GCC 9 dropped support for the SPE extensions to PowerPC, which means
powerpc*-*-*gnuspe* configurations are no longer buildable with that
compiler.  This ISA extension was peculiar to the “e500” line of
embedded PowerPC chips, which, as far as I can tell, are no longer
being manufactured, so I think we should follow suit.

This patch was developed by grepping for “e500”, “__SPE__”, and
“__NO_FPRS__”, and may not eliminate every vestige of SPE support.
Most uses of __NO_FPRS__ are left alone, as they are relevant to
normal embedded PowerPC with soft-float.

        * sysdeps/powerpc/preconfigure: Error out on powerpc-*-*gnuspe*
        host type.
        * scripts/build-many-glibcs.py: Remove powerpc-*-linux-gnuspe
        and powerpc-*-linux-gnuspe-e500v1 from list of build configurations.

        * sysdeps/powerpc/powerpc32/e500: Recursively delete.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500: Recursively delete.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/context-e500.h:
        Delete.

        * sysdeps/powerpc/fpu_control.h: Remove SPE variant.
        Issue an #error if used with a compiler in SPE-float mode.
        * sysdeps/powerpc/powerpc32/__longjmp_common.S
        * sysdeps/powerpc/powerpc32/setjmp_common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/getcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/setcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/swapcontext.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
        Remove code to preserve SPE register state.

        * sysdeps/unix/sysv/linux/powerpc/elision-lock.c
        * sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
        * sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
        Remove __SPE__ ifndefs.

5 years agoImprove string benchtest timing
Wilco Dijkstra [Tue, 21 May 2019 14:19:06 +0000 (15:19 +0100)]
Improve string benchtest timing

Improve string benchtest timing.  Many tests run for 0.01s which is way too
short to give accurate results.  Other tests take over 40 seconds which is
way too long.  Significantly increase the iterations of the short running
tests.  Reduce number of alignment variations in the long running memcpy walk
tests so they take less than 5 seconds.

As a result most tests take at least 0.1s and all finish within 5 seconds.

* benchtests/bench-memcpy-random.c (do_one_test): Use medium iterations.
* benchtests/bench-memcpy-walk.c (test_main): Reduce alignment tests.
* benchtests/bench-memmem.c (do_one_test): Use small iterations.
* benchtests/bench-memmove-walk.c (test_main): Reduce alignment tests.
* benchtests/bench-memset-walk.c (test_main): Reduce alignment tests.
* benchtests/bench-strcasestr.c (do_one_test): Use small iterations.
* benchtests/bench-string.h (INNER_LOOP_ITERS): Increase iterations.
(INNER_LOOP_ITERS_MEDIUM): New define.
(INNER_LOOP_ITERS_SMALL): New define.
* benchtests/bench-strpbrk.c (do_one_test): Use medium iterations.
* benchtests/bench-strsep.c (do_one_test): Use small iterations.
* benchtests/bench-strspn.c (do_one_test): Use medium iterations.
* benchtests/bench-strstr.c (do_one_test): Use small iterations.
* benchtests/bench-strtok.c (do_one_test): Use small iterations.

5 years agosysvipc: Add missing bit of semtimedop s390 consolidation
Adhemerval Zanella [Tue, 21 May 2019 13:40:31 +0000 (10:40 -0300)]
sysvipc: Add missing bit of semtimedop s390 consolidation

This patch add the missing SEMTIMEDOP_IPC_ARGS definions on powerpc
and sparc ipc_priv.h.

Checked on powerpc64le-linux-gnu and with a build for sparc64-linux-gnu.

* sysdeps/unix/sysv/linux/powerpc/ipc_priv.h (SEMTIMEDOP_IPC_ARGS):
New define.
* sysdeps/unix/sysv/linux/sparc/sparc64/ipc_priv.h
(SEMTIMEDOP_IPC_ARGS): Likewise.

5 years agowcsmbs: Fix data race in __wcsmbs_clone_conv [BZ #24584]
Florian Weimer [Tue, 21 May 2019 08:19:46 +0000 (10:19 +0200)]
wcsmbs: Fix data race in __wcsmbs_clone_conv [BZ #24584]

This also adds an overflow check and documents the synchronization
requirement in <gconv.h>.

5 years agolibio: Fix gconv-related memory leak [BZ #24583]
Florian Weimer [Tue, 21 May 2019 08:34:21 +0000 (10:34 +0200)]
libio: Fix gconv-related memory leak [BZ #24583]

struct gconv_fcts for the C locale is statically allocated,
and __gconv_close_transform deallocates the steps object.
Therefore this commit introduces __wcsmbs_close_conv to avoid
freeing the statically allocated steps objects.

5 years agolibio: Remove codecvt vtable [BZ #24588]
Florian Weimer [Mon, 20 May 2019 19:54:57 +0000 (21:54 +0200)]
libio: Remove codecvt vtable [BZ #24588]

The codecvt vtable is not a real vtable because it also contains the
conversion state data.  Furthermore, wide stream support was added to
GCC 3.0, after a C++ ABI bump, so there is no compatibility
requirement with libstdc++.

This change removes several unmangled function pointers which could
be used with a corrupted FILE object to redirect execution.  (libio
vtable verification did not cover the codecvt vtable.)

Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agosupport: Expose sbindir as support_sbindir_prefix
Florian Weimer [Mon, 20 May 2019 19:08:40 +0000 (21:08 +0200)]
support: Expose sbindir as support_sbindir_prefix

5 years agosupport: Add missing EOL terminators on timespec
Mike Crowe [Mon, 20 May 2019 17:56:48 +0000 (14:56 -0300)]
support: Add missing EOL terminators on timespec

The original implementations of test_timespec_before_impl and
test_timespec_equal_or_after in 519839965197291924895a3988804e325035beee
were missing the backslash required for a newline.

Checked on x86_64-linux-gnu.

* support/timespec.c: Add backslash to correct newline in failure
message.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agosupport: Correct confusing comment
Mike Crowe [Mon, 20 May 2019 17:55:33 +0000 (14:55 -0300)]
support: Correct confusing comment

* support/timespec.h: Correct confusing comment.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 years agosysvipc: Consolidate semtimedop s390
Adhemerval Zanella [Wed, 15 May 2019 13:23:49 +0000 (10:23 -0300)]
sysvipc: Consolidate semtimedop s390

This patch consolidates the s390-32 semtimedop implementation by defining
a arch-specific SEMTIMEDOP_IPC_ARGS to rearrange the arguments expected
by s390 Linux kABI.  The idea is to avoid have multiples semtimedop
implementation changes for Linux v5.1 change to enable wire-up sysvipc
support.

Checked with a s390-linux-gnu and s390x-linux-gnu and checking that
resulting semtimedop objects did not change.

* sysdeps/unix/sysv/linux/ipc_priv.h (SEMTIMEDOP_IPC_ARGS): New
define.
* sysdpes/unix/sysv/linux/s390/ipc_priv.h: New file.
* sysdeps/unix/sysv/linux/s390/semtimedop.c: Remove file.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Use
SEMTIMEDOP_IPC_ARGS for calls with __NR_ipc.

5 years agosysvipc: Fix compat msgctl (BZ#24570)
Adhemerval Zanella [Tue, 14 May 2019 18:01:32 +0000 (15:01 -0300)]
sysvipc: Fix compat msgctl (BZ#24570)

The __IPC64 flags is meant to be used to enable the new sysv struct
format when the architectures supports it (ARCH_WANT_IPC_PARSE_VERSION
config flag on Linux kernel).

This currently issue only affects alpha.

[BZ #24570]
* sysdeps/unix/sysv/linux/msgctl.c (__old_msgctl): Remove __IPC_64
usage.

5 years agoAdd NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from Linux 5.1 to elf.h.
Joseph Myers [Mon, 20 May 2019 11:51:58 +0000 (11:51 +0000)]
Add NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from Linux 5.1 to elf.h.

This patch adds the new NT_ARM_PACA_KEYS and NT_ARM_PACG_KEYS from
Linux 5.1 to glibc's elf.h.

Tested for x86_64.

* elf/elf.h (NT_ARM_PACA_KEYS): New macro.
(NT_ARM_PACG_KEYS): Likewise.