The functions argp_error and argp_failure, from argp.h, have a format
string as parameter, which can possibly request the printing of
floating-point values. These values could be of long double type, which
can have different formats, depending on the architecture and on
compilation parameters (for instance, on powerpc, long double values can
have double format (-mlong-double-64) or IBM Extended Precision format
(-mlong-double-128)).
This patch adds tests for argp_error and argp_failure that contain a
format string with double and long double conversion specifiers ('%f'
and '%Lf'). These tests automatically check that the default format of
the long double type works. A future patch will extend the test for
platforms that can have an optional format for long double.
Tested for powerpc64le.
* argp/Makefile (tests): Add tst-ldbl-argp.
* argp/tst-ldbl-argp.c: New file.
__gconv_read_conf is only ever called once during the program's lifetime.
This means that __gconv_path_elem is always uninitialized when the function
begins executing. __gconv_get_path has an assert to ensure that this
expected runtime behaviour is always exhibited. Given this, checking for a
NULL value before calling __gconv_get_path is unnecessary. This commit
drops the condition and calls __gconv_get_path unconditionally.
In the description of gcvt, add missing closing parenthesis in the
comparison with sprintf.
* manual/arith.texi (gcvt): Add missing closing parenthesis.
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.
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.
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.
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.
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.
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.
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 <szabolcs.nagy@arm.com>
This patch replaces conform/linknamespace.pl with a new
conform/linknamespace.py, so continuing the consolidation on Python
instead of Perl for miscellaneous scripts used in building and testing
glibc. The new script follows the same logic as the old one; as a
recently-added script, there were no major cleanups to be made in the
course of the language conversion.
Tested for x86_64, and with build-many-glibcs.py. For x86_64 I also
tested that if the Perl and Python scripts were made to print all the
symbols in seen_where and the paths of symbol references by which
those symbols were linked in, even when those symbols were OK,
identical symbol lists appeared in the output with both versions of
the script (the differences in linknamespace.out files were only in
paths to temporary files in diagnostics for e.g. deprecated functions,
and error output for the expected compilation failures when testing
ndbm.h and varargs.h).
* conform/linknamespace.py: New file.
* conform/linknamespace.pl: Remove file.
* conform/Makefile ($(linknamespace-header-tests)): Use
linknamespace.py instead of linknamespace.pl. Do not use --tmpdir
option.
On systems without enough random-access memory, stdlib/test-bz22786
will go deeply into swap and time out, even with a substantial
TIMEOUTFACTOR. This commit adds a facility to construct repeating
strings with alias mappings, so that the requirement for physical
memory, and uses it in stdlib/test-bz22786.
Mark the ra register as undefined in _start, so that unwinding through
main works correctly. Also, don't use a tail call so that ra points after
the call to __libc_start_main, not after the previous call.
Now that we require Python 3.4 or later, Python code creating
temporary directories can use tempfile.TemporaryDirectory in "with" to
have the directory deleted automatically instead of needing to use
try/finally to handle removing a directory created with
tempfile.mkdtemp. This patch does so in conform/glibcconform.py.
Tested for x86_64.
* conform/glibcconform.py: Do not import shutil.
(list_exported_functions): Use tempfile.TemporaryDirectory instead
of mkdtemp.
This patch makes Python 3.4 or later a required tool for building
glibc, so allowing changes of awk, perl etc. code used in the build
and test to Python code without any such changes needing makefile
conditionals or to handle older Python versions.
This patch makes the configure test for Python check the version and
give an error if Python is missing or too old, and removes makefile
conditionals that are no longer needed. It does not itself convert
any code from another language to Python, and does not remove any
compatibility with older Python versions from existing scripts.
Tested for x86_64.
* configure.ac (PYTHON_PROG): Use AC_CHECK_PROG_VER. Set
critic_missing for versions before 3.4.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for Python to build glibc.
* INSTALL: Regenerated.
* Rules [PYTHON]: Make code unconditional.
* benchtests/Makefile [PYTHON]: Likewise.
* conform/Makefile [PYTHON]: Likewise.
* manual/Makefile [PYTHON]: Likewise.
* math/Makefile [PYTHON]: Likewise.
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make
_hurd_intr_rpc_msg_about_to global point to start of controlled
assembly snippet. Make it check canceled flag.
* hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed
the _hurd_intr_rpc_msg_about_to point.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation
issue, remove cancel flag check.
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Set
intr_port to 0 when canceled.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Pass intr_port
address.
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Make
_hurd_intr_rpc_msg_about_to global point to start of controlled
assembly snippet. Make it check canceled flag again.
* hurd/hurdsig.c (_hurdsig_abort_rpcs): Only mutate thread if it passed the
_hurd_intr_rpc_msg_about_to point.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): Remove comment on mutation
issue.
since we do not actually know whether the RPC was completed or not,
which makes a huge difference for e.g. write(), so better really error
out than letting caller think that the RPC did not happen.
* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not
answer to interrupt_operation, return EIO instead of EINTR.
Seeing a server not able to get interrupted for 3s is not so surprising when
e.g. a lot of writes are happening. 1 minute allows to actually notice the
issue and be able to debug it.
* hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000.
Since we have consensus on requiring Python 3.4 or later to build
glibc, it follows that compatibility with older Python versions is
also no longer relevant to auxiliary Python scripts for use in glibc
development. This patch removes such compatibility code from
build-many-glibcs.py (compatibility code needed for 3.4, which lacks
the newer subprocess interface, is kept). Because
build-many-glibcs.py is not itself called from the glibc build system,
this patch is independent of the configure checks for having a
new-enough Python version, which are only relevant to uses of Python
from the main build and test process.
Tested with build-many-glibcs.py building glibc for aarch64-linux-gnu
(with Python 3.4 to make sure that still works).
* scripts/build-many-glibcs.py: Remove compatibility for missing
os.cpu_count and re.fullmatch.
When new symbol versions were introduced without SVID compatible
error handling the exp2f, log2f and powf symbols were accidentally
removed from the ia64 lim.a. The regression was introduced by
the commits
f5f0f52651
New expf and exp2f version without SVID compat wrapper
72d3d28108
New symbol version for logf, log2f and powf without SVID compat
With WEAK_LIBM_ENTRY(foo), there is a hidden __foo and weak foo
symbol definition in both SHARED and !SHARED build.
[BZ #23822]
* sysdeps/ia64/fpu/e_exp2f.S (exp2f): Use WEAK_LIBM_ENTRY.
* sysdeps/ia64/fpu/e_log2f.S (log2f): Likewise.
* sysdeps/ia64/fpu/e_exp2f.S (powf): Likewise.
This patch adds the IN_MASK_CREATE macro from Linux 4.19 to
sys/inotify.h.
Tested for x86_64.
* sysdeps/unix/sysv/linux/sys/inotify.h (IN_MASK_CREATE): New
macro.
This patch adds NT_MIPS_DSP and NT_MIPS_FP_MODE from Linux 4.19 to
elf.h.
Tested for x86_64.
* elf/elf.h (NT_MIPS_DSP): New macro.
(NT_MIPS_FP_MODE): Likewise.
This patch extends gen-libm-test.py to generate the ulps table for the
manual, so meaning there is only a single ulps file parser needed and
another Perl script is eliminated. As with the introduction of
gen-libm-test.py, this is designed to generate exactly the same
libm-err.texi as libm-err-tab.pl did. (gen-libm-test.py is still
shorter in lines than the old gen-libm-test.pl even after this patch.)
Note that this introduces a Python dependency for building the manual,
which is thus noted in install.texi and NEWS.
Tested building html / info / pdf versions of the manual.
* math/gen-libm-test.py: Import os.
(ALL_FLOATS_MANUAL): New constant.
(ALL_FLOATS_SUFFIX): Likewise.
(Ulps.all_functions): New function.
(real_all_ulps): Likewise.
(generate_err_table_sub): Likewise.
(generate_err_table): Likewise.
(main): Handle -s and -m options.
* manual/libm-err-tab.pl: Remove.
* manual/Makefile ($(objpfx)stamp-libm-err): Use gen-libm-test.py
instead of libm-err-tab.pl.
[$(PERL) != no]: Change condition to [$(if $(PYTHON),$(PERL),no)
!= no].
* manual/install.texi (Tools for Compilation): Document
requirement for Python to build manual.
* INSTALL: Regenerated.
glibc support for 64-bit time_t on 32-bit architectures
will involve:
- Using 64-bit times inside glibc, with conversions
to and from 32-bit times taking place as necessary
for interfaces using such times.
- Adding 64-bit-time support in the glibc public API.
This support should be dynamic, i.e. glibc should
provide both 32-bit and 64-bit implementations and
let user code choose at compile time whether to use
the 32-bit or 64-bit interfaces.
This requires a glibc-internal name for a type for times
that are always 64-bit.
Based on __TIMESIZE, a new macro is defined, __TIME64_T_TYPE,
which is always the right __*_T_TYPE to hold a 64-bit-time.
__TIME64_T_TYPE equals __TIME_T_TYPE if __TIMESIZE equals 64
and equals __SQUAD_T_TYPE otherwise.
__time64_t can then replace uses of internal_time_t.
This patch was tested by running 'make check' on branch
master then applying this patch and its predecessor and
running 'make check' again, and checking that both 'make
check' yield identical results. This was done on
x86_64-linux-gnu and i686-linux-gnu.
* bits/time64.h: New file.
* include/time.h: Replace internal_time_t with __time64_t.
* posix/bits/types (__time64_t): Add.
* stdlib/Makefile: Add bits/time64.h to includes.
* time/tzfile.c: Replace internal_time_t with __time64_t.
To determine whether the default time_t interfaces are 32-bit
and so need conversions, or are 64-bit and so are compatible
with the internal 64-bit type without conversions, a macro
giving the size of the default time_t is also required.
This macro is called __TIMESIZE.
This macro can then be used instead of __WORDSIZE in msq-pad.h
and shm-pad.h files, which in turn allows removing their x86
variants, and in sem-pad.h files but keeping the x86 variant.
This patch was tested by running 'make check' on branch master
then applying this patch and running 'make check' again, and
checking that both 'make check' yield identical results.
This was done on x86_64-linux-gnu and i686-linux-gnu.
* bits/timesize.h: New file.
* stdlib/Makefile (headers): Add bits/timesize.h.
* sysdeps/unix/sysv/linux/bits/msq-pad.h
(__MSQ_PAD_AFTER_TIME): Use __TIMESIZE instead of __WORDSIZE.
* sysdeps/unix/sysv/linux/bits/sem-pad.h
(__SEM_PAD_AFTER_TIME): Likewise.
* sysdeps/unix/sysv/linux/bits/shm-pad.h
(__SHM_PAD_AFTER_TIME): Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/msq-pad.h
(__MSQ_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/sem-pad.h
(__SEM_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/shm-pad.h
(__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise.
* sysdeps/unix/sysv/linux/mips/bits/msq-pad.h
(__MSQ_PAD_AFTER_TIME, __MSQ_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/msq-pad.h
(__MSQ_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/sem-pad.h
(__SEM_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/shm-pad.h
(__SHM_PAD_BEFORE_TIME, __SHM_PAD_BETWEEN_TIME_AND_SEGSZ): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/msq-pad.h
(__MSQ_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/sem-pad.h
(__SEM_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/shm-pad.h
(__SHM_PAD_BEFORE_TIME): Likewise.
* sysdeps/unix/sysv/linux/x86/bits/msq-pad.h: Delete file.
* sysdeps/unix/sysv/linux/x86/bits/shm-pad.h: Likewise.
* sysdeps/unix/sysv/linux/x86/bits/timesize.h: New file.
RDTSCP waits until all previous instructions have executed and all
previous loads are globally visible before reading the counter. RDTSC
doesn't wait until all previous instructions have been executed before
reading the counter. All x86 processors since 2010 support RDTSCP
instruction. This patch adds RDTSCP support to benchtests.
* benchtests/Makefile (CPPFLAGS-nonlib): Add -DUSE_RDTSCP if
USE_RDTSCP is defined.
* sysdeps/x86/hp-timing.h (HP_TIMING_NOW): Use RDTSCP if
USE_RDTSCP is defined.