glibc:fw/tst-mallocfork2

Last commit made on 2019-05-03
Get this branch:
git clone -b fw/tst-mallocfork2 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
fw/tst-mallocfork2
Repository:
lp:glibc

Recent commits

334b9d8... by Florian Weimer

malloc/tst-mallocfork2: Use process-shared barriers

This synchronization method has a lower overhead and makes
it more likely that the signal arrives during one of the critical
functions.

Also test for fork deadlocks explicitly.

ac3da35... by Florian Weimer

misc/tst-tsearch: Additional explicit error checking

This avoids an undefined variable warning with certain GCC versions.

7dfde28... by Adhemerval Zanella

Add missing bug number on CL entry for BZ#24506 (b2af6fb2ed239)

b2af6fb... by Adhemerval Zanella

elf: Fix elf/tst-pldd with --enable-hardcoded-path-in-tests (BZ#24506)

The elf/tst-pldd (added by 1a4c27355e146 to fix BZ#18035) test does
not expect the hardcoded paths that are output by pldd when the test
is built with --enable-hardcoded-path-in-tests. Instead of showing
the ABI installed library names for loader and libc (such as
ld-linux-x86-64.so.2 and libc.so.6 for x86_64), pldd shows the default
built ld.so and libc.so.

It makes the tests fail with an invalid expected loader/libc name.

This patch fixes the elf-pldd test by adding the canonical ld.so and
libc.so names in the expected list of possible outputs when parsing
the result output from pldd. The test now handles both default
build and --enable-hardcoded-path-in-tests option.

Checked on x86_64-linux-gnu (built with and without
--enable-hardcoded-path-in-tests) and i686-linux-gnu.

 * elf/tst-pldd.c (in_str_list): New function.
 (do_test): Add default names for ld and libc as one option.

Reviewed-by: Carlos O'Donell <email address hidden>

7b807a3... by Florian Weimer

misc: Add twalk_r function

The twalk function is very difficult to use in a multi-threaded
program because there is no way to pass external state to the
iterator function.

Reviewed-by: Carlos O'Donell <email address hidden>
Reviewed-by: Adhemerval Zanella <email address hidden>

20aa581... by Paul Eggert

Make mktime etc. compatible with __time64_t

Keep these functions compatible with Gnulib while adding
__time64_t support. The basic idea is to move private API
declarations from include/time.h to time/mktime-internal.h, since
the former file cannot easily be shared with Gnulib whereas the
latter can.
Also, do some other minor cleanup while in the neighborhood.
* include/time.h: Include stdbool.h, time/mktime-internal.h.
(__mktime_internal): Move this prototype to time/mktime-internal.h,
since Gnulib needs it.
(__localtime64_r, __gmtime64_r) [__TIMESIZE == 64]:
Move these macros to time/mktime-internal.h, since Gnulib needs them.
(__mktime64, __timegm64) [__TIMESIZE != 64]: New prototypes.
(in_time_t_range): New static function.
* posix/bits/types.h (__time64_t) [__TIMESIZE == 64 && !defined __LIBC]:
Do not define as a macro in this case, so that portable code is
less tempted to use __time64_t.
* time/mktime-internal.h: Rewrite so that it does both glibc
and Gnulib work. Include time.h if not _LIBC.
(mktime_offset_t) [!_LIBC]: Define for gnulib.
(__time64_t, __gmtime64_r, __localtime64_r, __mktime64, __timegm64)
[!_LIBC || __TIMESIZE == 64]: New macros, mostly moved here
from include/time.h.
(__gmtime_r, __localtime_r, __mktime_internal) [!_LIBC]:
New macros, taken from GNulib.
(__mktime_internal): New prototype, moved here from include/time.h.
* time/mktime.c (mktime_min, mktime_max, convert_time)
(ranged_convert, __mktime_internal, __mktime64):
* time/timegm.c (__timegm64):
Use __time64_t, not time_t.
* time/mktime.c: Stop worrying about whether time_t is floating-point.
(__mktime64) [! (_LIBC && __TIMESIZE != 64)]:
Rename from mktime.
(mktime) [_LIBC && __TIMESIZE != 64]: New function.
* time/timegm.c [!_LIBC]: Include libc-config.h, not config.h,
for libc_hidden_def.
Include errno.h.
(__timegm64) [! (_LIBC && __TIMESIZE != 64)]:
Rename from timegm.
(timegm) [_LIBC && __TIMESIZE != 64]: New function.

First cut at publicizing __time64_t

87c266d... by "Maciej W. Rozycki" <email address hidden>

Fix -O1 compilation errors with `__ddivl' and `__fdivl' [BZ #19444]

Complementing commit 4a06ceea33ec ("sysdeps/ieee754/soft-fp: ignore
maybe-uninitialized with -O [BZ #19444]") and commit 27c5e756a2a8
("sysdeps/ieee754: prevent maybe-uninitialized errors with -O [BZ
#19444]") also fix compilation errors observed at -O1 in `__ddivl' and
`__fdivl' with GCC 9 and RISC-V targets:

In file included from ../soft-fp/soft-fp.h:318,
                 from ../sysdeps/ieee754/soft-fp/s_fdivl.c:27:
../sysdeps/ieee754/soft-fp/s_fdivl.c: In function '__fdivl':
../soft-fp/op-2.h:108:9: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  108 | : (X##_f1 << (2*_FP_W_TYPE_SIZE - (N)))) \
      | ^
../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f1' was declared here
   37 | FP_DECL_Q (R);
      | ^
../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2'
   39 | _FP_FRAC_DECL_##wc (X)
      | ^~~~~~~~~~~~~~
../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL'
  226 | # define FP_DECL_Q(X) _FP_DECL (2, X)
      | ^~~~~~~~
../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q'
   37 | FP_DECL_Q (R);
      | ^~~~~~~~~
../soft-fp/op-2.h:109:8: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  109 | | X##_f0) != 0)); \
      | ^
../sysdeps/ieee754/soft-fp/s_fdivl.c:37:14: note: 'R_f0' was declared here
   37 | FP_DECL_Q (R);
      | ^
../soft-fp/op-common.h:39:3: note: in expansion of macro '_FP_FRAC_DECL_2'
   39 | _FP_FRAC_DECL_##wc (X)
      | ^~~~~~~~~~~~~~
../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL'
  226 | # define FP_DECL_Q(X) _FP_DECL (2, X)
      | ^~~~~~~~
../sysdeps/ieee754/soft-fp/s_fdivl.c:37:3: note: in expansion of macro 'FP_DECL_Q'
   37 | FP_DECL_Q (R);
      | ^~~~~~~~~
In file included from ../soft-fp/soft-fp.h:318,
                 from ../sysdeps/ieee754/soft-fp/s_ddivl.c:31:
../sysdeps/ieee754/soft-fp/s_ddivl.c: In function '__ddivl':
../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   98 | X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \
      | ^~
../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f1' was declared here
   41 | FP_DECL_Q (R);
      | ^
../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2'
   37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
      | ^
../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL'
  226 | # define FP_DECL_Q(X) _FP_DECL (2, X)
      | ^~~~~~~~
../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q'
   41 | FP_DECL_Q (R);
      | ^~~~~~~~~
../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  101 | : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
      | ^~
../sysdeps/ieee754/soft-fp/s_ddivl.c:41:14: note: 'R_f0' was declared here
   41 | FP_DECL_Q (R);
      | ^
../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2'
   37 | _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
      | ^
../soft-fp/quad.h:226:24: note: in expansion of macro '_FP_DECL'
  226 | # define FP_DECL_Q(X) _FP_DECL (2, X)
      | ^~~~~~~~
../sysdeps/ieee754/soft-fp/s_ddivl.c:41:3: note: in expansion of macro 'FP_DECL_Q'
   41 | FP_DECL_Q (R);
      | ^~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [.../sysd-rules:587: .../math/s_fdivl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[2]: *** [.../sysd-rules:587: .../math/s_ddivl.o] Error 1

This comes from cases in _FP_DIV that return a result described as
FP_CLS_ZERO or FP_CLS_INF and do not initialize the fractional part,
which is then operated on unconditionally in FP_TRUNC_COOKED before
being ignored by _FP_PACK_CANONICAL.

Clearly at this optimization level GCC cannot guarantee to be able to
determine that the fractional part is ultimately unused, so ignore the
error as with the earlier commits referred, letting compilation proceed.

 [BZ #19444]
 * sysdeps/ieee754/soft-fp/s_ddivl.c (__ddivl): Ignore errors
 from `-Wmaybe-uninitialized'.
 * sysdeps/ieee754/soft-fp/s_fdivl.c (__fdivl): Likewise.

6cac323... by Adhemerval Zanella

powerpc: ceil/ceilf refactor

This patches consolidates all the powerpc ceil{f} implementations on
the generic sysdeps/powerpc/fpu/s_ceil{f}. The generic implementation
uses either the compiler builts for ISA 2.03+ (which generates the frip
instruction) or a generic implementation which uses FP only operations.

It adds a generic implementation (round_to_integer.h) which is shared
with other rounding to integer routines. The resulting code should be
similar in term os performance to previous assembly one.

The IFUNC organization for powerpc64 is also change to be enabled only
for powerpc64 and not for powerpc64le (since minium ISA of 2.08 does not
require the fallback generic implementation).

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/fenv_libc.h (__fesetround_inline_nocheck): New
 function.
 * sysdeps/powerpc/fpu/round_to_integer.h: New file.
 * sysdeps/powerpc/fpu/s_ceil.c: Likewise.
 * sysdeps/powerpc/fpu/s_ceilf.c: Likewise.
 * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Remove file.
 * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
 (CFLAGS-s_ceil-power5+.c, CFLAGS-s_ceilf-power5+.c): New rule.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.S:
 Remove file.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.S:
 Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.S:
 Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.S:
 Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-power5+.c:
 New file.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil-ppc32.c:
 Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-power5+.c:
 Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf-ppc32.c:
 Likewise.
 * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Remove file.
 * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Likewise.
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile: New file.
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-power5+.c:
 Likewise.
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil-ppc64.c:
 Likewise.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Move to ...
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceil.c: ... here.
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-power5+.c: New
 file.
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf-ppc64.c:
 Likewise.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Move to ...
 * sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_ceilf.c: ...
 * here.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
 (libm-sysdep_routines): Remove s_ceil-power5+, s_ceil-ppc64,
 s_ceilf-power5+, and s_ceilf-ppc64.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-power5+.S: Remove
 file.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil-ppc64.S: Likewise.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-power5+.S: Likewise.
 * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf-ppc64.S: Likewise.
 * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise.
 * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise.
 * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise.
 * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise.

Reviewed-by: Gabriel F. T. Gomes <email address hidden>

c4c0848... by Adhemerval Zanella

powerpc: Remove power4 mpa optimization

This patch removes the POWER4 optimized mpa optimization used currently
on all powerpc targets. In fact for newer chips, GCC generates *worse*
code than generic implementation as below. One possibilty would to
add ifunc variants for the mpa routines (as x86_64), but it will add
complexity only for older chips (and one would need to check if
power5, power5+, and power6 do benefict from this optimization),
and only for specific implementation (since most used one such
as sin, cos, exp, pow where optimized to avoid calling the slow
multiprecision path).

* POWER9 patched
$ ./testrun.sh benchtests/bench-atan
  "atan": {
   "": {
    "duration": 5.12565e+09,
    "iterations": 1.552e+08,
    "max": 100.552,
    "min": 7.799,
    "mean": 33.0261
   },
   "144bits": {
    "duration": 5.12745e+09,
    "iterations": 825000,
    "max": 7517.17,
    "min": 6186.3,
    "mean": 6215.09
   }
  }
$ ./testrun.sh benchtests/bench-acos
  "acos": {
   "": {
    "duration": 5.21741e+09,
    "iterations": 1.269e+08,
    "max": 191.738,
    "min": 7.931,
    "mean": 41.1144
   },
   "slow": {
    "duration": 5.25999e+09,
    "iterations": 198000,
    "max": 26681.7,
    "min": 26463.6,
    "mean": 26565.6
   }
  }

* POWER9 master
$ ./testrun.sh benchtests/bench-atan
  "atan": {
   "": {
    "duration": 5.12815e+09,
    "iterations": 1.552e+08,
    "max": 134.788,
    "min": 7.803,
    "mean": 33.0422
   },
   "144bits": {
    "duration": 5.1209e+09,
    "iterations": 447000,
    "max": 11615.8,
    "min": 11301.8,
    "mean": 11456.2
   }
  }
$ ./testrun.sh benchtests/bench-acos
  "acos": {
   "": {
    "duration": 5.22272e+09,
    "iterations": 1.269e+08,
    "max": 115.981,
    "min": 7.931,
    "mean": 41.1562
   },
   "slow": {
    "duration": 5.28723e+09,
    "iterations": 96000,
    "max": 55434.1,
    "min": 54820.6,
    "mean": 55075.3
   }
  }

* POWER8 patched
$ taskset -c 16 ./testrun.sh benchtests/bench-acos
  "acos": {
   "": {
    "duration": 5.16398e+09,
    "iterations": 9.99e+07,
    "max": 174.408,
    "min": 8.645,
    "mean": 51.6915
   },
   "slow": {
    "duration": 5.16982e+09,
    "iterations": 96000,
    "max": 54830.5,
    "min": 53703.8,
    "mean": 53852.3
   }
  }
* POWER8 master
$ taskset -c 16 ./testrun.sh benchtests/bench-acos
  "acos": {
   "": {
    "duration": 5.17019e+09,
    "iterations": 9.99e+07,
    "max": 186.127,
    "min": 8.633,
    "mean": 51.7537
   },
   "slow": {
    "duration": 5.34225e+09,
    "iterations": 90000,
    "max": 60353.2,
    "min": 59155.3,
    "mean": 59358.4
   }
  }

* POWER7 patched
$ taskset -c 16 benchtests/bench-asin
  "asin": {
   "": {
    "duration": 5.15559e+09,
    "iterations": 6.5e+07,
    "max": 193.335,
    "min": 12.227,
    "mean": 79.3168
   },
   "slow": {
    "duration": 5.20538e+09,
    "iterations": 80000,
    "max": 65705.2,
    "min": 64299.4,
    "mean": 65067.3
   }
  }
* POWER7 master
$ taskset -c 16 benchtests/bench-asin
  "asin": {
   "": {
    "duration": 5.15446e+09,
    "iterations": 6.5e+07,
    "max": 184.575,
    "min": 12.226,
    "mean": 79.2994
   },
   "slow": {
    "duration": 5.20616e+09,
    "iterations": 80000,
    "max": 65705.1,
    "min": 64336.6,
    "mean": 65076.9
   }
  }

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/power4/fpu/Makefile: Remove file.
 * sysdeps/powerpc/power4/fpu/mpa-arch.h: Likewise.
 * sysdeps/powerpc/power4/fpu/mpa.c: Likewise.

Reviewed-by: Gabriel F. T. Gomes <email address hidden>

f492fc9... by Yann Droneaud

<semaphore.h>: Add nonnull attributes

Except the following functions, NPTL implementation assume sem_t
argument (or other arguments) are not NULL, so they would benefit
from having the nonnull attribute.

- sem_close(): can cope with a NULL sem_t and return -1 with error EINVAL;
- sem_destroy(): does nothing at all

 * sysdeps/pthread/semaphore.h (sem_init): Add __nonnull attribute.
 (sem_destroy, sem_open, sem_close, sem_unlink): Likewise.
 (sem_wait, sem_timedwait, sem_trywait, sem_post): Likewise.
 (sem_getvalue): Likewise.