glibc:aaribaud/bugzilla/23789/v4

Last commit made on 2018-11-02
Get this branch:
git clone -b aaribaud/bugzilla/23789/v4 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
aaribaud/bugzilla/23789/v4
Repository:
lp:glibc

Recent commits

134ae5c... by "Albert ARIBAUD (3ADEV)" <albert.aribaud@3adev.fr>

Ensure mktime sets errno on error [BZ #23789]

Posix mandates that mktime set errno to EOVERFLOW
on error, but the glibc mktime wasn't doing it so
far.

Fix this and add a test to prevent regressions.
The fix also fixes the same issue in timegm.

Tested with 'make check' on x86-linux-gnu and
i686-linux-gnu.

        * time/Makefile: Add bug-mktime4.
 * time/bug-mktime4.c: New file.
 * time/mktime.c
 (__mktime_internal): Set errno to EOVERFLOW on error.
 (mktime): Move call to __tzset inside conditional.

3ae3c43... by "Gabriel F. T. Gomes" <email address hidden>

Fix typo in the documentation of gcvt

In the description of gcvt, add missing closing parenthesis in the
comparison with sprintf.

 * manual/arith.texi (gcvt): Add missing closing parenthesis.

af1d578... by Zong Li <email address hidden>

soft-fp: Add implementation for 128 bit self-contained

Here only add the implementation when building the RV32 port.

These macros are used when the following situations occur at the same
time: soft-fp fma, ldbl-128 and 32-bit _FP_W_TYPE_SIZE. The RISC-V
32-bit port is the first port which use all three together.

This is the building flow about the situation:
When building soft-fp/s_fmal.c, there uses the FP_FMA_Q in __fmal.
The _FP_W_TYPE_SIZE is defined to 32-bit in sysdeps/riscv/sfp-machine.h,
so the FP_FMA_Q was defined to _FP_FMA (Q, 4, 8, R, X, Y, Z) in
soft-fp/quad.h.

Something in the soft-fp/quad.h:
 #if _FP_W_TYPE_SIZE < 64
    # define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 4, 8, R, X, Y, Z)
 #else
    # define FP_FMA_Q(R, X, Y, Z) _FP_FMA (Q, 2, 4, R, X, Y, Z)
 #endif

Finally, in _FP_FMA (fs, wc, dwc, R, X, Y, Z), it will use the
_FP_FRAC_HIGHBIT_DW_##dwc macro, and it will be expanded to
_FP_FRAC_HIGHBIT_DW_8, but the _FP_FRAC_HIGHBIT_DW_8 is not be
implemented in soft-fp/op-8.h. there is only _FP_FRAC_HIGHBIT_DW_1,
_FP_FRAC_HIGHBIT_DW_2 and _FP_FRAC_HIGHBIT_DW_4 in the
soft-fp/op-*.h.

After this modification, we can pass the soft floating testing of glibc
testsuites on RV32.

 * soft-fp/op-8.h (_FP_FRAC_SET_8, _FP_FRAC_ADD_8, _FP_FRAC_SUB_8)
 (_FP_FRAC_CLZ_8, _FP_MINFRAC_8, _FP_FRAC_NEGP_8, _FP_FRAC_ZEROP_8)
 (_FP_FRAC_HIGHBIT_DW_8, _FP_FRAC_COPY_4_8, _FP_FRAC_COPY_8_4)
 (__FP_FRAC_SET_8): Add implementation for RV32 use.

ff48ea6... by Zong Li <email address hidden>

soft-fp: Use temporary variable in FP_FRAC_SUB_3/FP_FRAC_SUB_4

In FRAC_SUB_3(R, X, Y) and FRAC_SUB_4(R,, X, Y), it reference both
the X[N] and X[N] after R[N] have been set. If one of the X and Y is
the same address with R, the result of the calculation is wrong,
because the value of the original X and Y are overwritten.

In glibc, there are two places use FRAC_SUB and occurs the overlap.
The first is _FP_DIV_MEAT_N_loop in op-common.h, it uses the source
_FP_DIV_MEAT_N_loop_u as the destination. This macro only be used
when N is one(_FP_DIV_MEAT_1_loop) and then the _FP_FRAC_SUB_##wc
extend to _FP_FRAC_SUB_1 in this macro. so it also work because
_FP_FRAC_SUB_1 has no overlap problem in its implementation.
The second places is _FP_DIV_MEAT_4_udiv, the original value of X##_f[0]
is overwritten before the calculatation.

In FRAC_SUB_1 and FRAC_SUB_2, there don't refer the source after
destination have been set, so they have no problem.

After this modification, we can pass the soft floating testing of glibc
testsuites on RV32.

 * soft-fp/op-4.h (_FP_FRAC_SUB_3, _FP_FRAC_SUB_4): Use temporary
 variable to avoid overlap arguments.

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

Avoid printf ("%s", NULL) in posix/bug-regex22.c.

Building posix/bug-regex22.c fails with GCC mainline because of
-Wformat-overflow= warnings for NULL arguments to %s formats.

This is *not* testing how glibc handles such format arguments; in the
context of the messages in question it makes no sense to pass NULL to
such a %s format (the code passes s, inside "if (s == NULL)"). So
this patch changes the code not to pass such a format argument at all
(which means the string passed is constant, so no need to use printf
at all - however, there are two separate tests here with different
length arguments passed to re_compile_pattern, so it *does* make sense
to make the strings used different so that in the event of failure
it's clear which one of the tests failed).

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

 * posix/bug-regex22.c (main): Use puts with distinct error
 messages for unexpected success of re_compile_pattern, not printf
 with NULL argument to %s.

6f30e59... by Joseph Myers <email address hidden>

Disable -Wformat-overflow= warnings for some printf tests.

Recent GCC -Wformat-overflow= changes result in some printf tests
failing to build, because those tests are deliberately testing the
handling of formats writing more than INT_MAX characters and the
handling of NULL arguments to the %s format, which GCC now warns
about. This patch duly disables -Wformat-overflow= for the relevant
calls to printf functions.

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

 * stdio-common/bug22.c: Include <libc-diag.h>.
 (do_test): Disable -Wformat-overflow= warnings around fprintf
 calls outputting more than INT_MAX characters.
 * stdio-common/tst-printf.c: Disable -Wformat-overflow= warnings
 around printf call with NULL %s argument.

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

Update and correct SPARC configuration for supported socket syscalls (bug 23848).

Looking at kernel-features.h files, I saw that SPARC was missing full
information on when it gained separate socket syscalls.

This patch adds such information to the SPARC kernel-features.h. It
also corrects what appear to be bugs in the existing code (that would
cause syscalls to be assumed to be present when not actually present).
Various __ASSUME_* macros, defined by default, were not undefined for
32-bit despite those syscalls only being added for 32-bit in Linux
4.4. Some syscalls were used in the SPARC64 syscalls.list but only
added in 4.4; this was harmless before the __NR_* macros were defined
at all, but once the macros were defined it means a build with
post-4.4 headers would assume the syscalls to be present regardless of
--enable-kernel version. Then, various __ASSUME_* macros were
previously not defined in cases where they could be defined (this part
of the patch is just an optimization, not a bug fix).

Note the observation in a comment in the patch that even the latest
Linux kernel for SPARC does not have getpeername and getsockname
syscalls in the compat syscall table for 32-bit binaries on 64-bit
kernels (so glibc can't assume those syscalls to be present for 32-bit
at all, although the 32-bit syscall table gained them in 4.4).

Tested (compilation only) for SPARC with build-many-glibcs.py.

 [BZ #23848]
 * sysdeps/unix/sysv/linux/sparc/kernel-features.h [!__arch64__ &&
 __LINUX_KERNEL_VERSION < 0x040400] (__ASSUME_SENDMSG_SYSCALL):
 Undefine.
 [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400]
 (__ASSUME_RECVMSG_SYSCALL): Likewise.
 [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400]
 (__ASSUME_SENDTO_SYSCALL): Likewise.
 [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400]
 (__ASSUME_ACCEPT_SYSCALL): Undefine under this condition, not just
 [!__arch64__].
 [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400]
 (__ASSUME_CONNECT_SYSCALL): Likewise.
 [!__arch64__ && __LINUX_KERNEL_VERSION < 0x040400]
 (__ASSUME_RECVFROM_SYSCALL): Likewise.
 [__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_BIND_SYSCALL):
 Define.
 [__LINUX_KERNEL_VERSION >= 0x040400] (__ASSUME_LISTEN_SYSCALL):
 Likewise.
 [__LINUX_KERNEL_VERSION >= 0x040400]
 (__ASSUME_SETSOCKOPT_SYSCALL): Likewise.
 * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (bind):
 Remove.
 (listen): Likewise.
 (setsockopt): Likewise.

8e3c00d... by Fredrik Noring <email address hidden>

MIPS: Use `.set mips2' to emulate LL/SC for the R5900 too

GAS treats the R5900 as MIPS III, with some modifications. The MIPS III
designation means that the GNU C Library will try to assemble the LL and
SC instructions, even though they are not implemented in the R5900. GAS
will therefore produce the following errors:

Error: opcode not supported on this processor: r5900 (mips3) `ll $2,0($4)'
Error: opcode not supported on this processor: r5900 (mips3) `sc $6,0($4)'

The MIPS II ISA override as used here enables the kernel to trap and
emulate the LL and SC instructions, as required.

This change has been tested by compiling the GNU C Library 2.27 with a
GCC 8.2.0 cross-compiler for mipsr5900el-unknown-linux-gnu under Gentoo.

 * sysdeps/mips/sys/tas.h (_test_and_set): Handle the R5900 CPU
 with the ISA override.

fc78307... by Samuel thibault

hurd: Add pci RPC stubs

 * hurd/Makefile (user-interfaces): Add pci.

9c3dbdb... by Rafael Avila de Espindola <email address hidden>

Simplify an #if #else #endif

The #else of two nested #if clauses were identical.

 * sysdeps/unix/sysv/linux/sysdep-vdso.h: Simplify an #if #else
 #endif.

Reviewed-by: Szabolcs Nagy <email address hidden>