[BZ#23789]
mktime was not properly reporting failures when the underlying
localtime_r fails with errno != EOVERFLOW; it incorrectly treated
them like EOVERFLOW failures, and set errno to EOVERFLOW.
The problem could happen on non-glibc platforms, with Gnulib.
* time/mktime.c (guess_time_tm): Remove, replacing with ...
(tm_diff): ... this simpler function, which does not change errno.
All callers changed to deal with errno themselves.
(ranged_convert, __mktime_internal): Return failure immediately if
the underlying function reports any failure other than EOVERFLOW.
(__mktime_internal): Set errno to EOVERFLOW if the spring-forward
gap code fails.
[BZ#23789]
* time/mktime.c (ranged_convert): On 32-bit platforms, don’t
mishandle a DST transition that jumps over the Y2038 boundary.
No such DST transitions are known so this is only a theoretical
bug, but we might as well do things right.
[BZ#23789]
* time/mktime.c (long_int): Now 4⨯ int, not just 3⨯.
This is so that we can add tm_diff results to a previous guess,
which will be useful in a later patch.
[BZ#23789]
* time/mktime.c [!_LIBC && !DEBUG_MKTIME]:
Include libc-config.h, not config.h, for __set_errno.
(guess_time_tm, __mktime_internal): Set errno to EOVERFLOW on overflow.
* sysdeps/mach/hurd/dl-sysdep.c (check_no_hidden): Use
__attribute_copy__ to copy attributes from name. Drop static qualifier
to avoid warnings about leaf attribute not having effect on static
functions.
This patch fixes the build for MIPS (o32) with GCC 9 by stopping MIPS
__longjmp from using strong_alias, instead defining the alias
manually, so that the intended effect of not copying the nomips16
attribute is achieved, as explained in the included comment.
Tested with build-many-glibcs.py compilers build for mips64-linux-gnu
(which includes glibc builds for all three ABIs).
* sysdeps/mips/__longjmp.c (__longjmp): Define alias manually with
alias attribute, not with strong_alias.
Soft-float powerpc fails to build with current GCC mainline because of
use of libc_hidden_data_def for TLS variables, resulting in a non-TLS
alias being defined, to which the tls_model attribute is now copied,
resulting in a warning about it being ignored.
The problem here appears to be the non-TLS alias. This patch adds a
hidden_tls_def macro family, corresponding to the hidden_tls_proto
macros, to define TLS aliases properly in such a case, and uses it for
those powerpc soft-float variables.
Tested with build-many-glibcs.py compilers build for powerpc-linux-gnu
soft-float. Also tested for x86_64.
* include/libc-symbols.h [SHARED && !NO_HIDDEN && !__ASSEMBLER__]
(__hidden_ver2): New macro. Use old definition of __hidden_ver1
with additional parameter thread.
[SHARED && !NO_HIDDEN && !__ASSEMBLER__] (__hidden_ver1): Define
in terms of __hidden_ver2.
(hidden_tls_def): New macro.
(libc_hidden_tls_def): Likewise.
(rtld_hidden_tls_def): Likewise.
(libm_hidden_tls_def): Likewise.
(libmvec_hidden_tls_def): Likewise.
(libresolv_hidden_tls_def): Likewise.
(librt_hidden_tls_def): Likewise.
(libdl_hidden_tls_def): Likewise.
(libnss_files_hidden_tls_def): Likewise.
(libnsl_hidden_tls_def): Likewise.
(libnss_nisplus_hidden_tls_def): Likewise.
(libutil_hidden_tls_def): Likewise.
(libutil_hidden_tls_def): Likweise.
* sysdeps/powerpc/nofpu/sim-full.c (__sim_exceptions_thread): Use
libc_hidden_tls_def.
(__sim_disabled_exceptions_thread): Likewise.
(__sim_round_mode_thread): Likewise.
Similar to the x86_64 and armv7 build issues, glibc fails to build for
sparc64 with current mainline GCC because of aliases declared in the
course of defining IFUNCs, which copy their attributes from a header
declaration, ending up with fewer attributes than the (built-in)
string function they alias. This patch fixes the issue similarly to
the fixes for those other architectures.
Tested with build-many-glibcs.py compilers build for
sparc64-linux-gnu.
* sysdeps/sparc/sparc-ifunc.h [SHARED]
(sparc_ifunc_redirected_hidden_def): Use __attribute_copy__ to
copy attributes from name.
Similar to the x86_64 build issues, glibc fails to build for armv7
with current mainline GCC because of aliases declared in the course of
defining IFUNCs, which copy their attributes from a header
declaration, ending up with fewer attributes than the (built-in)
string function they alias: the relevant attributes (nonnull, leaf)
are present on the header declaration, but elided therefrom when glibc
itself if being built (whatever the reasons are for disabling the
nonnull and leaf attributes in that case, and whether or not those
reasons are actually still valid). This patch fixes the issue
similarly to the x86_64 fix, by adding an addition __attribute_copy__
use (in this case, on the definition of arm_libc_ifunc_hidden_def).
Tested with build-many-glibcs.py build for armeb-linux-gnueabi-be8.
* sysdeps/arm/arm-ifunc.h [SHARED] (arm_libc_ifunc_hidden_def):
Use __attribute_copy__ to copy attributes from name.
This patch fixes the glibc build for i686 with current mainline GCC,
where there are warnings about inconsistent attributes for aliases in
certain files defining libm IFUNCs.
In three of the files, the aliases were defined in terms of internal
symbols such as __sinf, and copied attributes from file-local
declarations of those functions which lacked the nothrow attribute.
Since the nothrow attribute is present on the declarations from
<math.h> (which include declarations of those __-prefixed functions),
the natural fix was to include <math.h> in those files, replacing the
local declarations.
In the other three files, a more complicated __hidden_ver1 call was
involved in the warnings. <math.h> has not been included at this
point and, furthermore, it is included indirectly only later in the
source file after macros have been defined to remap a function name
therein. So there isn't an obvious declaration from which to copy the
attribute and it seems simplest and safest just to add __THROW to the
hidden_ver1 calls.
Tested for i686 (build-many-glibcs.py compilers build for
x86_64-linux-gnu with GCC mainline; full testsuite run with GCC 7).
* sysdeps/i386/i686/fpu/multiarch/e_expf.c [SHARED]: Use __THROW
with __hidden_ver1 call.
* sysdeps/i386/i686/fpu/multiarch/e_log2f.c [SHARED]: Likewise.
* sysdeps/i386/i686/fpu/multiarch/e_logf.c [SHARED]: Likewise.
* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Include <math.h>.
(__cosf): Do not declare here.
* sysdeps/i386/i686/fpu/multiarch/s_sincosf.c: Include <math.h>.
(__sincosf): Do not declare here.
* sysdeps/i386/i686/fpu/multiarch/s_sinf.c: Include <math.h>.
(__sinf): Do not declare here.
After the changes to use the copy attribute, building glibc for ia64
fails, even with older compilers, because
sysdeps/ia64/fpu/sfp-machine.h has a definition of _strong_alias that
now differs from the one in libc-symbols.h.
That definition is a relic of this file coming from libgcc, as are
some other such macro definitions in this file; in the glibc context,
there is no need for those macros, and this patch removes them to fix
the build.
Tested with build-many-glibcs.py for ia64-linux-gnu.
* sysdeps/ia64/fpu/sfp-machine.h (__LITTLE_ENDIAN): Remove.
(__BIG_ENDIAN): Likewise.
(__BYTE_ORDER): Likewise.
(strong_alias): Likewise.
(_strong_alias): Likewise.
This commit is in preparation of turning the macro into a proper
function. The output arguments of the macro were in fact unused.
Also clean up uses of __builtin_expect.
* hurd/hurd/userlink.h (_hurd_userlink_move): New function.
* hurd/hurd/port.h (_hurd_port_move): New function.
* sysdeps/mach/hurd/spawni.c (NEW_ULINK_TABLE): New macro.
(EXPAND_DTABLE): Use NEW_ULINK_TABLE macro for ulink_dtable.
This fixes build-many-glibcs.py on i686-gnu.
Thanks Florian Weimer for the initial version.
* sysdeps/mach/hurd/spawni.c (__spawni): Add ccwdir port. Test and use
it, free it if needed.
(reauthenticate): Test and use ccwdir.
(child_init_port): In non-resetids case, test and use ccwdir.
(child_chdir): New nested function to set ccwdir.
GCC 9 has gained an enhancement to help detect attribute mismatches
between alias declarations and their targets. It consists of a new
warning, -Wattribute-alias, an enhancement to an existing warning,
-Wmissing-attributes, and a new attribute called copy.
The purpose of the warnings is to help identify either possible bugs
(an alias declared with more restrictive attributes than its target
promises) or optimization or diagnostic opportunities (an alias target
missing some attributes that it could be declared with that might
benefit analysis and code generation). The purpose of the new
attribute is to easily apply (almost) the same set of attributes
to one declaration as those already present on another.
As expected (and intended) the enhancement triggers warnings for
many alias declarations in Glibc code. This change, tested on
x86_64-linux, avoids all instances of the new warnings by making
use of the attribute where appropriate. To fully benefit from
the enhancement Glibc will need to be compiled with
-Wattribute-alias=2 and remaining warnings reviewed and dealt with
(there are a couple of thousand but most should be straightforward
to deal with).
ChangeLog:
* include/libc-symbols.h (__attribute_copy__): Define macro unless
it's already defined.
(_strong_alias): Use __attribute_copy__.
(_weak_alias, __hidden_ver1, __hidden_nolink2): Same.
* misc/sys/cdefs.h (__attribute_copy__): New macro.
* sysdeps/x86_64/multiarch/memchr.c (memchr): Use __attribute_copy__.
* sysdeps/x86_64/multiarch/memcmp.c (memcmp): Same.
* sysdeps/x86_64/multiarch/mempcpy.c (mempcpy): Same.
* sysdeps/x86_64/multiarch/memset.c (memset): Same.
* sysdeps/x86_64/multiarch/stpcpy.c (stpcpy): Same.
* sysdeps/x86_64/multiarch/strcat.c (strcat): Same.
* sysdeps/x86_64/multiarch/strchr.c (strchr): Same.
* sysdeps/x86_64/multiarch/strcmp.c (strcmp): Same.
* sysdeps/x86_64/multiarch/strcpy.c (strcpy): Same.
* sysdeps/x86_64/multiarch/strcspn.c (strcspn): Same.
* sysdeps/x86_64/multiarch/strlen.c (strlen): Same.
* sysdeps/x86_64/multiarch/strncmp.c (strncmp): Same.
* sysdeps/x86_64/multiarch/strncpy.c (strncpy): Same.
* sysdeps/x86_64/multiarch/strnlen.c (strnlen): Same.
* sysdeps/x86_64/multiarch/strpbrk.c (strpbrk): Same.
* sysdeps/x86_64/multiarch/strrchr.c (strrchr): Same.
* sysdeps/x86_64/multiarch/strspn.c (strspn): Same.
The function do_test, in tst-efgcvt.c, increments an error counter for
each error that it finds, then returns it to the test framework.
However, the test framework does not expect an error count as return,
but zero for a passing test, one for a failing test, or 77 for an
unsupported test. Alternatively, the framework provides the function
support_record_failure that records errors, which then allows the test
program to return zero unconditionally.
This patch removes the error counter, replaces each increment of the
counter with a call to support_record_failure, and makes do_test
unconditionally return zero.
Tested for powerpc64le (as-is and with a patched results table to check
that the error reporting actually works).
* misc/tst-efgcvt.c: Include support/check.h and
support/test-driver.c. Do not include test-skeleton.c.
(error_count): Remove.
(output_error): Replace increments to error_count with calls to
support_record_failure.
(output_r_error): Likewise.
(special): Likewise.
(do_test): Unconditionally return zero.
(TEST_FUNCTION): Remove.
conform/Makefile creates $(@D)/scratch for the per-standard per-header
tests. That directory was formerly used by the Perl scripts for
temporary files, but the Python implementations use
tempfile.TemporaryDirectory to get such files cleaned up
automatically. This patch changes the Makefile to create only $(@D)
(required for the output redirection to work), not the scratch
subdirectory.
Tested for x86_64.
* conform/Makefile ($(conformtest-header-tests)): Create $(@D),
not $(@D)/scratch.
($(linknamespace-header-tests)): Likewise.
Continuing the consolidation on Python for various miscellaneous build
and test scripts, this patch moves conformtest from Perl to Python.
The substance of the tests run is intended to be the same as before,
except that the previous test for tags did not actually achieve the
intended purpose of verifying whether a tag was already declared, so
is changed to one that would actually fail for a tag that wasn't
declared, and a typo in the old test for variables being available
($xyzzy instead of xyzzy) would have made that test not use the
correct type (but it would have passed anyway with warnings). No
attempt is made to keep the details of what the test output looks
like; instead, tests are given names which are made to follow PASS: /
FAIL: / XFAIL: / SKIP: / MISSING: as appropriate.
In the new version, there is more consistent parsing of test lines
(into a series of words, either surrounded by {} or separated by
spaces) that applies for all kinds of test lines, rather than the old
approach of different regular expressions for every kind of test. A
few of the conform/data/ files are adjusted so their syntax works with
the new script (which now requires spaces in certain cases where the
old script tolerated them being missing, and does not allow stray
semicolons at the end of "function" lines). Similarly, common logic
is used around what happens with a second subtest if a first one fails
(e.g., a test for a symbol's type if the test for availability fails),
rather than such logic being replicated separately for each kind of
test. Common parsing also applies for test lines both when they are
lines for the header under test and when they are lines for another
header specified with allow-header, again unlike the old script.
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py: New file.
* conform/conformtest.pl: Remove.
* conform/GlibcConform.pm: Likewise.
* conform/glibcconform.py (KEYWORDS_C90): New constant.
(KEYWORDS_C99): Likewise.
(KEYWORDS): Likewise.
* conform/Makefile ($(conformtest-header-tests)): Use
conformtest.py instead of conformtest.pl. Do not pass --tmpdir
option. Use --header instead of --headers.
* conform/data/arpa/inet.h-data: Remove trailing semicolons on
function entries.
* conform/data/spawn.h-data: Likewise.
* conform/data/fcntl.h-data (openat): Add space after function
name.
* conform/data/wchar.h-data (wcscasecmp): Likewise.
(wcscasecmp_l): Likewise.
* conform/data/termios.h-data (c_cc): Add space after element
name.
The commit
commit 1df872fd74
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Nov 7 12:42:44 2018 +0100
support: Implement TEST_COMPARE_STRING
added the new macro TEST_COMPARE_STRING, which compares the output of
functions under test against expected strings, and, when there's a
mismatch, automatically reports an error and prints the differences.
This patch adapts recently added test cases to use this new macro.
Tested for powerpc64le (as is, and locally patched to intentionally fail
and produce error output).
* argp/tst-ldbl-argp.c (do_one_test): Use TEST_COMPARE_STRING,
instead of manually comparing and reporting mismatching strings.
* misc/tst-ldbl-error.c (do_one_test): Likewise.
* misc/tst-ldbl-warn.c (do_one_test): Likewise.
The __ASSUME_SOCKETCALL macro in kernel-features.h is no longer used
for anything. (It used to be used in defining other macros related to
accept4 / recvmmsg / sendmmsg availability, but the code in that area
was simplified once we could assume a kernel with those features,
whether through a syscall or through socketcall, so allowing those
functions to be handled much like other socket operations, without
requring __ASSUME_SOCKETCALL.) This patch removes that unused macro.
(Note: once we can assume a Linux 4.4 or later kernel, much of the
support for using socketcall at all can be removed from glibc,
although a few functions may need that support in glibc for longer.)
Tested with build-many-glibcs.py.
* sysdeps/unix/sysv/linux/kernel-features.h: Remove comment about
__ASSUME_SOCKETCALL.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SOCKETCALL): Remove.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_SOCKETCALL): Likewise.
Linkers group input note sections with the same name into one output
note section with the same name. One output note section is placed in
one PT_NOTE segment. Since new linkers merge input .note.gnu.property
sections into one output .note.gnu.property section, there is only
one NT_GNU_PROPERTY_TYPE_0 note in one PT_NOTE segment with new linkers.
Since older linkers treat input .note.gnu.property section as a generic
note section and just concatenate all input .note.gnu.property sections
into one output .note.gnu.property section without merging them, we may
see multiple NT_GNU_PROPERTY_TYPE_0 notes in one PT_NOTE segment with
older linkers.
When an older linker is used to created the program on CET-enabled OS,
the linker output has a single .note.gnu.property section with multiple
NT_GNU_PROPERTY_TYPE_0 notes, some of which have IBT and SHSTK enable
bits set even if the program isn't CET enabled. Such programs will
crash on CET-enabled machines. This patch updates the note parser:
1. Skip note parsing if a NT_GNU_PROPERTY_TYPE_0 note has been processed.
2. Check multiple NT_GNU_PROPERTY_TYPE_0 notes.
[BZ #23509]
* sysdeps/x86/dl-prop.h (_dl_process_cet_property_note): Skip
note parsing if a NT_GNU_PROPERTY_TYPE_0 note has been processed.
Update the l_cet field when processing NT_GNU_PROPERTY_TYPE_0 note.
Check multiple NT_GNU_PROPERTY_TYPE_0 notes.
* sysdeps/x86/link_map.h (l_cet): Expand to 3 bits, Add
lc_unknown.
The generic kernel-features.h defines __ASSUME_MLOCK2 for 4.4 and
later kernels. However, for 32-bit ARM binaries running on 64-bit ARM
kernels, and for MicroBlaze, the syscall was only wired up in the 4.7
kernel. (32-bit ARM kernels did have the syscall from 4.4 onwards.)
This patch duly arranges for the macro to be undefined for those
architectures for kernels before 4.7.
Tested with build-many-glibcs.py for its ARM and MicroBlaze
configurations.
[BZ #23867]
* sysdeps/unix/sysv/linux/arm/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x040700] (__ASSUME_MLOCK2): Undefine.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x040700] (__ASSUME_MLOCK2): Undefine.
Fix the following on 32 bits targets:
support_test_compare_string.c: In function ‘support_test_compare_string’:
support_test_compare_string.c:80:37: error: format ‘%lu’ expects argument of
type ‘long unsigned int’, but argument 2 has type ‘size_t’ {aka ‘unsigned int’}
[-Werror=format=]
printf (" string length: %lu bytes\n", left_length);
~~^ ~~~~~~~~~~~
%u
Checked on arm-linux-gnueabihf.
* support/support_test_compare_string.c
(support_test_compare_string): Fix printf format.
The SH kernel-features.h undefines __ASSUME_RENAMEAT2 for kernel
versions before 4.8, but fails to undefine __ASSUME_EXECVEAT,
__ASSUME_MLOCK2 and __ASSUME_COPY_FILE_RANGE, although all those
syscalls (and several others) were added for SH in the same Linux
kernel commit (first released in 4.8). This patch adds the proper
undefines of those macros.
Tested with build-many-glibcs.py for its SH configurations.
[BZ #23862]
* sysdeps/unix/sysv/linux/sh/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_EXECVEAT): Undefine.
[__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_MLOCK2): Likewise.
[__LINUX_KERNEL_VERSION < 0x040800] (__ASSUME_COPY_FILE_RANGE):
Likewise.
Similarly to what has been done for argp_error, and argp_failure, as
well as for warn, warnx, vwarn, and vwarnx, this patch adds new tests
for the following functions: err, errx, verr, verrx, error, and
error_at_line. The new tests check that the conversion of long double
variables into string works correctly on the default format of the type.
Future patches will reuse these tests for other formats that long double
can take.
Tested for powerpc64le.
* misc/Makefile (tests): Add tst-ldbl-error.
* misc/tst-ldbl-error.c: New file.
Similarly to what has been done for argp_error and argp_failure, this
patch patch adds new tests for the warn, warnx, vwarn, and vwarnx
functions. The new tests use the format string to request the
conversion of long double parameters into string. Currently, these
tests only check that the default format of the long double type works.
Future patches will extend the test for platforms that can have an
optional format for long double.
Tested for powerpc64le.
* misc/Makefile (tests): Add tst-ldbl-warn.
* misc/tst-ldbl-warn.c: New file.
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.
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>