glibc:hjl/gmp

Last commit made on 2017-08-22
Get this branch:
git clone -b hjl/gmp https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
hjl/gmp
Repository:
lp:glibc

Recent commits

3478fe3... by "H.J. Lu" <email address hidden>

rshift.c: Replace assert with DEBUG and abort

assert in stdlib/rshift.c should be for debug purpose only and there is
no such check in any rshift assembly implementations nor in lshift.c.
This patch replaces assert with DEBUG and abort, similar to lshift.c
so that generic GMP codes from libc.a can be linked with libc.so in
atest-exp, atest-exp2 and atest-sincos, which depend on the GMP
implementation in glibc.

 * stdlib/rshift.c (mpn_rshift): Replace ssert with DEBUG and
 abort.

ea99fcd... by Joseph Myers <email address hidden>

Fix GCC 7 build of k_standard.c.

This patch adds a default case to k_standard.c that calls
__builtin_unreachable, to avoid an uninitialized variable error from
GCC 7 (reported in
<https://sourceware.org/ml/libc-alpha/2017-08/msg01012.html>).

Tested for x86_64 (with GCC 7).

 * sysdeps/ieee754/k_standard.c (__kernel_standard): Add default
 case calling __builtin_unreachable.

a8410a5... by Adhemerval Zanella

Consolidate non cancellable waitpid call

This patch consolidates all the non cancellable waitpid calls to use
the __waitpid_nocancel identifier. For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

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

 * libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
 __waitpid_nocancel.
 * sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
 (__waitpid_nocancel): New macro.
 * sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
 macro.
 (__waitpid_nocancel): Replace macro with a function.
 * sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
 function.

7369800... by Adhemerval Zanella

Consolidate non cancellable fcntl call

This patch consolidates all the non cancellable fcntl calls to use
the __fcntl_nocancel identifier. For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Since its prototype is already defined at internal fcntl.h header, it
is removed from not-cancel.h one.

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

 * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with
 __fcntl_nocancel.
 * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro.
 * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise.

19926de... by Adhemerval Zanella

Consolidate non cancellable writev call

This patch consolidates all the non cancellable writev calls to use
the __writev_nocancel identifier. For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

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

 * gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with
 __writev_nocancel_nostatus.
 (write_call_graph): Likewise.
 (write_bb_counts): Likewise.
 * resolv/herror.c (herror): Likewise.
 * sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove
 macro.
 (__writev_nocancel_nostatus): New macro.
 * sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status):
 Remove macro.
 (__writev_nocancel_nostatus): New function.

df1deda... by Joseph Myers <email address hidden>

Revert "Add hidden visibility to internal function prototypes".

The commit

commit 568ff4296c72534e49c8d9c83c33f3a0069cccc7
Author: H.J. Lu <email address hidden>
Date: Mon Aug 21 05:50:38 2017 -0700

    Add hidden visibility to internal function prototypes

breaks the build of the testsuite for many platforms:

https://sourceware.org/ml/libc-testresults/2017-q3/msg00300.html

The errors are of the following form, building math/atest-exp:

[...]
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/stdlib/rshift.o: In function `__mpn_rshift':
/scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc-src/stdlib/rshift.c:45: undefined reference to `__assert_fail'
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: /scratch/jmyers/glibc-bot/build/glibcs/aarch64-linux-gnu/glibc/math/atest-exp: hidden symbol `__assert_fail' isn't defined
/scratch/jmyers/glibc-bot/install/compilers/aarch64-linux-gnu/lib/gcc/aarch64-glibc-linux-gnu/7.2.1/../../../../aarch64-glibc-linux-gnu/bin/ld: final link failed: Bad value

This test is using various objects from the build of libc. Some of
those objects contain references to __assert_fail. Because those
references are hidden, they cannot refer to __assert_fail from
libc.so. Given the tests using internal objects those symbols in
libc.a can't safely be made hidden, so this patch reverts the problem
commit until any alternative approach that doesn't break the build can
be found.

831bbd5... by Joseph Myers <email address hidden>

Remove SPARC sqrt wrappers (bug 21973).

This patch removes the SPARC-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling. They also do not serve a useful optimization purpose. GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time). Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those). This disappeared,
probably with:

commit 8847f0377003fbfe9cbe951ce9f8717d74f26247
Author: David S. Miller <email address hidden>
Date: Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there. This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

 [BZ #21973]
 * sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
 * sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
 GLIBC_2.0 sqrtl symbol.

813378e... by Joseph Myers <email address hidden>

Obsolete matherr, _LIB_VERSION, libieee.a.

This patch obsoletes support for SVID libm error handling (the system
where a user-defined function matherr is called on a libm function
error; only enabled if you also set _LIB_VERSION = _SVID_ or
_LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global
variable to control libm error handling. matherr and _LIB_VERSION are
made into compat symbols, not supported for new ports or for static
linking. The libieee.a object file (which sets _LIB_VERSION = _IEEE_,
so disabling errno setting for some functions) is also removed, and
all the related definitions are removed from math.h.

The manual already recommends against using matherr, and it's already
not supported for _Float128 functions (those use new wrappers that
don't support matherr, only errno) - this patch means that it becomes
possible to e.g. add sinf32 as an alias to sinf without that resulting
in undesired matherr support in sinf32 for existing glibc ports.
matherr support is not part of any standard supported by glibc (it was
removed in XPG4).

Because matherr is a function to be defined by the user, of course
user programs defining such a function will still continue to link; it
just quietly won't be used. If they try to write to the library's
copy of _LIB_VERSION to enable SVID error handling, however, they will
get a link error (but if they define their own _LIB_VERSION variable,
they won't).

I expect the most likely case of build failures from this patch to be
programs with unconditional cargo-culted uses of -lieee (based on a
notion of "I want IEEE floating point", not any actual requirement for
that library).

Ideally, the new-port-or-static-linking case would use the new
wrappers used for _Float128. This is not implemented in this patch,
because of the complication of architecture-specific (powerpc32 and
sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard
directly. Thus, the old wrappers and __kernel_standard are still
built unconditionally, and _LIB_VERSION still exists in static libm.
But when the old wrappers and __kernel_standard are built in the
non-compat case, _LIB_VERSION and matherr are defined as macros so
code to support those features isn't actually built into static libm
or new ports' shared libm after this patch.

I intend to move to the new wrappers for static libm and new ports in
followup patches. I believe the sqrt wrappers for powerpc32 and sparc
can reasonably be removed. GCC already optimizes the normal case of
sqrt by generating code that uses a hardware instruction and only
calls the sqrt function if the argument was negative (if
-fno-math-errno, of course, it just uses the hardware instruction
without any check for negative argument being needed). Thus those
wrappers will only actually get called in the case of negative
arguments, which is not a case it makes sense to optimize for. But
even without removing the powerpc32 and sparc wrappers it should still
be possible to move to the new wrappers for static libm and new ports,
just without having those dubious architecture-specific optimizations
in static libm.

Everything said about matherr equally applies to matherrf and matherrl
(IA64-specific, undocumented), except that the structure of IA64 libm
means it won't be converted to using the new wrappers (it doesn't use
the old ones either, but its own error-handling code instead).

As with other tests of compat symbols, I expect test-matherr and
test-matherr-2 to need to become appropriately conditional once we
have a system for disabling such tests for ports too new to have the
relevant symbols.

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

 * math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove.
 [__USE_MISC] (_LIB_VERSION): Likewise.
 [__USE_MISC] (struct exception): Likewise.
 [__USE_MISC] (matherr): Likewise.
 [__USE_MISC] (DOMAIN): Likewise.
 [__USE_MISC] (SING): Likewise.
 [__USE_MISC] (OVERFLOW): Likewise.
 [__USE_MISC] (UNDERFLOW): Likewise.
 [__USE_MISC] (TLOSS): Likewise.
 [__USE_MISC] (PLOSS): Likewise.
 [__USE_MISC] (HUGE): Likewise.
 [__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC].
 * math/math-svid-compat.h: New file.
 * conform/linknamespace.pl (@whitelist): Remove matherr, matherrf
 and matherrl.
 * include/math.h [!_ISOMAC] (__matherr): Remove.
 * manual/arith.texi (FP Exceptions): Do not document matherr.
 * math/Makefile (tests): Change test-matherr to test-matherr-3.
 (tests-internal): New variable.
 (install-lib): Do not add libieee.a.
 (non-lib.a): Likewise.
 (extra-objs): Do not add libieee.a and ieee-math.o.
 (CPPFLAGS-s_lib_version.c): Remove variable.
 ($(objpfx)libieee.a): Remove rule.
 ($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm).
 * math/ieee-math.c: Remove.
 * math/libm-test-support.c (matherr): Remove.
 * math/test-matherr.c: Use <support/test-driver.c>. Add copyright
 and license notices. Include <math-svid-compat.h> and
 <shlib-compat.h>.
 (matherr): Undefine as macro. Use compat_symbol_reference.
 (_LIB_VERSION): Likewise.
 * math/test-matherr-2.c: New file.
 * math/test-matherr-3.c: Likewise.
 * sysdeps/generic/math_private.h (__kernel_standard): Remove
 declaration.
 (__kernel_standard_f): Likewise.
 (__kernel_standard_l): Likewise.
 * sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or
 <math_private.h>. Include <math-svid-compat.h>.
 (_LIB_VERSION): Undefine as macro.
 (_LIB_VERSION_INTERNAL): Always initialize to _POSIX_. Define
 only if [LIBM_SVID_COMPAT || !defined SHARED]. If
 [LIBM_SVID_COMPAT], use compat_symbol.
 * sysdeps/ieee754/s_matherr.c: Do not include <math.h> or
 <math_private.h>. Include <math-svid-compat.h>.
 (matherr): Undefine as macro.
 (__matherr): Define only if [LIBM_SVID_COMPAT]. Use
 compat_symbol.
 * sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>.
 [_LIBC && LIBM_SVID_COMPAT] (matherrf): Use
 compat_symbol_reference.
 [_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise.
 [_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro.
 [_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise.
 * sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>.
 (MATHERR_D): Remove declaration.
 [!_LIBC] (_LIB_VERSION_TYPE): Likewise
 [!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise.
 [LIBM_BUILD] (pmatherrf): Likewise.
 [LIBM_BUILD] (pmatherr): Likewise.
 [LIBM_BUILD] (pmatherrl): Likewise.
 (DOMAIN): Likewise.
 (SING): Likewise.
 (OVERFLOW): Likewise.
 (UNDERFLOW): Likewise.
 (TLOSS): Likewise.
 (PLOSS): Likewise.
 * sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>.
 (__matherrf): Define only if [LIBM_SVID_COMPAT]. Use
 compat_symbol.
 * sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>.
 (__matherrl): Define only if [LIBM_SVID_COMPAT]. Use
 compat_symbol.
 * math/lgamma-compat.h: Include <math-svid-compat.h>.
 * math/w_acos_compat.c: Likewise.
 * math/w_acosf_compat.c: Likewise.
 * math/w_acosh_compat.c: Likewise.
 * math/w_acoshf_compat.c: Likewise.
 * math/w_acoshl_compat.c: Likewise.
 * math/w_acosl_compat.c: Likewise.
 * math/w_asin_compat.c: Likewise.
 * math/w_asinf_compat.c: Likewise.
 * math/w_asinl_compat.c: Likewise.
 * math/w_atan2_compat.c: Likewise.
 * math/w_atan2f_compat.c: Likewise.
 * math/w_atan2l_compat.c: Likewise.
 * math/w_atanh_compat.c: Likewise.
 * math/w_atanhf_compat.c: Likewise.
 * math/w_atanhl_compat.c: Likewise.
 * math/w_cosh_compat.c: Likewise.
 * math/w_coshf_compat.c: Likewise.
 * math/w_coshl_compat.c: Likewise.
 * math/w_exp10_compat.c: Likewise.
 * math/w_exp10f_compat.c: Likewise.
 * math/w_exp10l_compat.c: Likewise.
 * math/w_exp2_compat.c: Likewise.
 * math/w_exp2f_compat.c: Likewise.
 * math/w_exp2l_compat.c: Likewise.
 * math/w_fmod_compat.c: Likewise.
 * math/w_fmodf_compat.c: Likewise.
 * math/w_fmodl_compat.c: Likewise.
 * math/w_hypot_compat.c: Likewise.
 * math/w_hypotf_compat.c: Likewise.
 * math/w_hypotl_compat.c: Likewise.
 * math/w_j0_compat.c: Likewise.
 * math/w_j0f_compat.c: Likewise.
 * math/w_j0l_compat.c: Likewise.
 * math/w_j1_compat.c: Likewise.
 * math/w_j1f_compat.c: Likewise.
 * math/w_j1l_compat.c: Likewise.
 * math/w_jn_compat.c: Likewise.
 * math/w_jnf_compat.c: Likewise.
 * math/w_jnl_compat.c: Likewise.
 * math/w_lgamma_main.c: Likewise.
 * math/w_lgamma_r_compat.c: Likewise.
 * math/w_lgammaf_main.c: Likewise.
 * math/w_lgammaf_r_compat.c: Likewise.
 * math/w_lgammal_main.c: Likewise.
 * math/w_lgammal_r_compat.c: Likewise.
 * math/w_log10_compat.c: Likewise.
 * math/w_log10f_compat.c: Likewise.
 * math/w_log10l_compat.c: Likewise.
 * math/w_log2_compat.c: Likewise.
 * math/w_log2f_compat.c: Likewise.
 * math/w_log2l_compat.c: Likewise.
 * math/w_log_compat.c: Likewise.
 * math/w_logf_compat.c: Likewise.
 * math/w_logl_compat.c: Likewise.
 * math/w_pow_compat.c: Likewise.
 * math/w_powf_compat.c: Likewise.
 * math/w_powl_compat.c: Likewise.
 * math/w_remainder_compat.c: Likewise.
 * math/w_remainderf_compat.c: Likewise.
 * math/w_remainderl_compat.c: Likewise.
 * math/w_scalb_compat.c: Likewise.
 * math/w_scalbf_compat.c: Likewise.
 * math/w_scalbl_compat.c: Likewise.
 * math/w_sinh_compat.c: Likewise.
 * math/w_sinhf_compat.c: Likewise.
 * math/w_sinhl_compat.c: Likewise.
 * math/w_sqrt_compat.c: Likewise.
 * math/w_sqrtf_compat.c: Likewise.
 * math/w_sqrtl_compat.c: Likewise.
 * math/w_tgamma_compat.c: Likewise.
 * math/w_tgammaf_compat.c: Likewise.
 * math/w_tgammal_compat.c: Likewise.
 * sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
 * sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
 * sysdeps/ieee754/k_standard.c: Likewise.
 * sysdeps/ieee754/k_standardf.c: Likewise.
 * sysdeps/ieee754/k_standardl.c: Likewise.
 * sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
 * sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
 * sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
 Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
 * sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
 * sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.

4504783... by Florian Weimer

benchtests: Do not compile benchmark objects as libc modules [BZ #21864]

Otherwise, this will lead to link failures due to hidden symbol
references.

b5889d2... by Florian Weimer

assert: Support types without operator== (int) [BZ #21972]