]> sourceware.org Git - glibc.git/log
glibc.git
7 hours agoLoongArch: Add cfi instructions for _dl_tlsdesc_dynamic master
mengqinggang [Fri, 5 Jul 2024 02:40:33 +0000 (10:40 +0800)]
LoongArch: Add cfi instructions for _dl_tlsdesc_dynamic

In _dl_tlsdesc_dynamic, there are three 'addi.d sp, sp, -size'
instructions to allocate stack size for Float/LSX/LASX registers.
Every 'addi.d sp, sp, -size' needs a cfi_adjust_cfa_offset because
of sp is used to compute CFA. But only one 'addi.d sp, sp, -size'
will be run according to HWCAP value. And all cfi_adjust_cfa_offset
will be executed in stack unwinding, it result in incorrect CFA.

Change _dl_tlsdesc_dynamic to _dl_tlsdesc_dynamic,
_dl_tlsdesc_dynamic_lsx and _dl_tlsdesc_dynamic_lasx.
Conflicting cfi instructions can be distributed to the three functions.
And cfi instructions can correspond to stack down instructions.

23 hours agox86: Disable non-temporal memset on Skylake Server
Noah Goldstein [Mon, 15 Jul 2024 08:19:17 +0000 (16:19 +0800)]
x86: Disable non-temporal memset on Skylake Server

The original commit enabling non-temporal memset on Skylake Server had
erroneous benchmarks (actually done on ICX).

Further benchmarks indicate non-temporal stores may in fact by a
regression on Skylake Server.

This commit may be over-cautious in some cases, but should avoid any
regressions for 2.40.

Tested using qemu on all x86_64 cpu arch supported by both qemu +
GLIBC.

Reviewed-by: DJ Delorie <dj@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
25 hours agoAdd pthread_getname_np and pthread_setname_np for Hurd
Flavio Cruz [Thu, 11 Jul 2024 22:37:35 +0000 (23:37 +0100)]
Add pthread_getname_np and pthread_setname_np for Hurd

We use thread_get_name and thread_set_name to get and set the thread
name, so nothing is stored in the thread structure since these functions
are supposed to be called sparingly.

One notable difference with Linux is that the thread name is up to 32
chars, whereas Linux's is 16.

Also added a mach_RPC_CHECK to check for the existing of gnumach RPCs.

2 days agomath: Update alpha ulps
Andreas K. Hüttel [Sun, 14 Jul 2024 10:44:15 +0000 (12:44 +0200)]
math: Update alpha ulps

Linux alphadev 6.9.8-gentoo-alpha #1 Sun Jul  7 00:45:49 EDT 2024 alpha EV68CB Titan GNU/Linux
gcc (Gentoo 14.1.1_p20240622 p2) 14.1.1 20240622
GNU ld (Gentoo 2.42 p6) 2.42.0

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 days agohurd: Fix restoring message to be retried
Samuel Thibault [Sat, 13 Jul 2024 15:00:55 +0000 (17:00 +0200)]
hurd: Fix restoring message to be retried

save_data stores the start of the original message to be retried,
overwritten by the EINTR reply. In 64b builds the overwrite is however
rounded up to the 64b pointer size, so we have to save more than just
the 32b err.

Thanks a lot to Luca Dariz for the investigation!

4 days agonptl: Convert tst-sem11 and tst-sem12 tests to use the test driver
Maciej W. Rozycki [Thu, 11 Jul 2024 13:17:20 +0000 (14:17 +0100)]
nptl: Convert tst-sem11 and tst-sem12 tests to use the test driver

Fix an issue with commit 2af4e3e5668f ("Test of semaphores.") by making
the tst-sem11 and tst-sem12 tests use the test driver, preventing them
from ever causing testing to hang forever and never complete, such as
currently happening with the 'mips-linux-gnu' (o32 ABI) target.  Adjust
the name of the PREPARE macro, which clashes with the interpretation of
its presence by the test driver, by using a TF_ prefix in reference to
the name of the 'tf' function.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 days agonptl: Add copyright notice tst-sem11 and tst-sem12 tests
Maciej W. Rozycki [Thu, 11 Jul 2024 13:17:15 +0000 (14:17 +0100)]
nptl: Add copyright notice tst-sem11 and tst-sem12 tests

Add a copyright notice to the tst-sem11 and tst-sem12 tests, observing
that they have been originally contributed back in 2007, with commit
2af4e3e5668f ("Test of semaphores.").
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 days agotests: XFAIL audit tests failing on all mips configurations, bug 29404
Andreas K. Hüttel [Fri, 12 Jul 2024 16:36:44 +0000 (18:36 +0200)]
tests: XFAIL audit tests failing on all mips configurations, bug 29404

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 days agotime/Makefile: Split and sort tests
Samuel Dobron [Thu, 11 Jul 2024 03:31:11 +0000 (05:31 +0200)]
time/Makefile: Split and sort tests

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 days agos390x: Fix segfault in wcsncmp [BZ #31934]
Stefan Liebler [Thu, 11 Jul 2024 09:28:53 +0000 (11:28 +0200)]
s390x: Fix segfault in wcsncmp [BZ #31934]

The z13/vector-optimized wcsncmp implementation segfaults if n=1
and there is only one character (equal on both strings) before
the page end.  Then it loads and compares one character and misses
to check n again.  The following load fails.

This patch removes the extra load and compare of the first character
and just start with the loop which uses vector-load-to-block-boundary.
This code-path also checks n.

With this patch both tests are passing:
- the simplified one mentioned in the bugzilla 31934
- the full one in Florian Weimer's patch:
"manual: Document a GNU extension for strncmp/wcsncmp"
(https://patchwork.sourceware.org/project/glibc/patch/874j9eml6y.fsf@oldenburg.str.redhat.com/):
On s390x-linux-gnu (z16), the new wcsncmp test fails due to bug 31934.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
7 days agoLinux: Make __rseq_size useful for feature detection (bug 31965)
Florian Weimer [Mon, 8 Jul 2024 19:14:00 +0000 (21:14 +0200)]
Linux: Make __rseq_size useful for feature detection (bug 31965)

The __rseq_size value is now the active area of struct rseq
(so 20 initially), not the full struct size including padding
at the end (32 initially).

Update misc/tst-rseq to print some additional diagnostics.

Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 days agopo: incorporate translations (bg)
Andreas K. Hüttel [Tue, 9 Jul 2024 11:35:12 +0000 (13:35 +0200)]
po: incorporate translations (bg)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 days agomanual: add syscalls
DJ Delorie [Mon, 8 Jul 2024 21:52:15 +0000 (17:52 -0400)]
manual: add syscalls

The purpose of this patch is to add some system calls that (1) aren't
otherwise documented, and (2) are merely redirected to the kernel, so
can refer to their documentation; and define a standard way of doing
so in the future.  A more detailed explaination of how system calls
are wrapped is added along with reference to the Linux Man-Pages
project.

Default version of man-pages is in configure.ac but can be overridden
by --with-man-pages=X.Y

Reviewed-by: Alejandro Colomar <alx@kernel.org>
8 days agolibio: handle opening a file when all files are closed (bug 31963)
Andreas Schwab [Mon, 8 Jul 2024 13:52:35 +0000 (15:52 +0200)]
libio: handle opening a file when all files are closed (bug 31963)

_IO_list_all becomes NULL when all files (including standard files) are
closed.

8 days agoldconfig: Ignore all GDB extension files
Adam Sampson [Mon, 6 May 2024 17:16:33 +0000 (18:16 +0100)]
ldconfig: Ignore all GDB extension files

ldconfig already ignores files with the -gdb.py suffix, but GDB also
looks for -gdb.gdb and -gdb.scm files. These aren't as widely used, but
libguile at least comes with a -gdb.scm file.

Rename is_gdb_python_file to is_gdb_extension_file, and make it
recognise all three types of GDB extension.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agoldconfig: Move endswithn into a new header file
Adam Sampson [Mon, 6 May 2024 17:16:32 +0000 (18:16 +0100)]
ldconfig: Move endswithn into a new header file

is_gdb_python_file is doing a similar test, so it can use this helper
function as well.

Signed-off-by: Adam Sampson <ats@offog.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agomath: Update m68k ULPs
Andreas K. Hüttel [Mon, 8 Jul 2024 19:51:03 +0000 (21:51 +0200)]
math: Update m68k ULPs

This hasn't been looked at for a loong time (already guessing from
the number of missing entries), and it ain't pretty.
There are some 9-ulps results for float.

- ZaZaZebra (qemu-system-m68k clone of PowerBook 190 system)
- GCC 13.3.1 20240614 (Gentoo 13.3.1_p20240614 p17)
- ld GNU ld (Gentoo 2.42 p6) 2.42.0
- Linux ZaZaZebra  4.19.0-5-m68k #1 Gentoo 4.19.37-5 (2019-06-19) m68k 68040 68040 GNU/Linux
- manual build
- ../glibc/configure --enable-fortify-source --prefix=/usr
- Tested by Immolo (via Andreas K. Hüttel)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
8 days agostdlib: fix arc4random fallback to /dev/urandom (BZ 31612)
Adhemerval Zanella [Fri, 5 Apr 2024 13:27:29 +0000 (10:27 -0300)]
stdlib: fix arc4random fallback to /dev/urandom (BZ 31612)

The __getrandom_nocancel used by __arc4random_buf uses
INLINE_SYSCALL_CALL (which returns -1/errno) and the loop checks for
the return value instead of errno to fallback to /dev/urandom.

The malloc code now uses __getrandom_nocancel_nostatus, which uses
INTERNAL_SYSCALL_CALL, so there is no need to use the variant that does
not set errno (BZ#29624).

Checked on x86_64-linux-gnu.

Reviewed-by: Xi Ruoyao <xry111@xry111.site>
12 days agoelf: Make dl-rseq-symbols Linux only
Adhemerval Zanella [Thu, 4 Jul 2024 13:09:07 +0000 (10:09 -0300)]
elf: Make dl-rseq-symbols Linux only

And avoid a Hurd build failures.

Checked on x86_64-linux-gnu.

13 days agonptl: fix potential merge of __rseq_* relro symbols
Michael Jeanson [Wed, 3 Jul 2024 16:35:34 +0000 (12:35 -0400)]
nptl: fix potential merge of __rseq_* relro symbols

While working on a patch to add support for the extensible rseq ABI, we
came across an issue where a new 'const' variable would be merged with
the existing '__rseq_size' variable. We tracked this to the use of
'-fmerge-all-constants' which allows the compiler to merge identical
constant variables. This means that all 'const' variables in a compile
unit that are of the same size and are initialized to the same value can
be merged.

In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t'
are both 4 bytes and initialized to 0 which should trigger the merge.
However for reasons we haven't delved into when the attribute 'section
(".data.rel.ro")' is added to the mix, only variables of the same exact
types are merged. As far as we know this behavior is not specified
anywhere and could change with a new compiler version, hence this patch.

Move the definitions of these variables into an assembler file and add
hidden writable aliases for internal use. This has the added bonus of
removing the asm workaround to set the values on rseq registration.

Tested on Debian 12 with GCC 12.2.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 days agoriscv: Update nofpu libm test ulps
Darius Rad [Wed, 3 Jul 2024 18:50:59 +0000 (14:50 -0400)]
riscv: Update nofpu libm test ulps

Fixes 32 test failures.

13 days agomanual: Recommendations for dynamic linker hardening
Florian Weimer [Thu, 2 May 2024 14:26:36 +0000 (16:26 +0200)]
manual: Recommendations for dynamic linker hardening

This new section in the manual provides recommendations for
use of glibc in environments with higher integrity requirements.
It's reflecting both current implementation shortcomings, and
challenges we inherit from ELF and psABI requirements.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
13 days agosocket: Add new test for shutdown
Sergey Kolosov [Tue, 25 Jun 2024 09:19:03 +0000 (11:19 +0200)]
socket: Add new test for shutdown

This commit adds shutdown test with SHUT_RD, SHUT_WR, SHUT_RDWR for an
UNIX socket connection.

Reviewed-by: DJ Delorie <dj@redhat.com>
13 days agoelf/rtld: Fix auxiliary vector for enable_secure
Stefan Liebler [Tue, 2 Jul 2024 13:25:20 +0000 (15:25 +0200)]
elf/rtld: Fix auxiliary vector for enable_secure

Starting with commit
59974938fe1f4add843f5325f78e2a7ccd8db853
elf/rtld: Count skipped environment variables for enable_secure

The new testcase elf/tst-tunables-enable_secure-env segfaults on s390 (31bit).
There _start parses the auxiliary vector for some additional checks.

Therefore it skips over the zeros after the environment variables ...
0x7fffac20:     0x7fffbd17      0x7fffbd32      0x7fffbd69      0x00000000
------------------------------------------------^^^last environment variable

... and then it parses the auxiliary vector and stops at AT_NULL.
0x7fffac30:     0x00000000      0x00000021      0x00000000      0x00000000
--------------------------------^^^AT_SYSINFO_EHDR--------------^^^AT_NULL
----------------^^^newp-----------------------------------------^^^oldp
Afterwards it tries to access AT_PHDR which points to somewhere and segfaults.

Due to not incorporating the skip_env variable in the computation of oldp
when shuffling down the auxv in rtld.c, it just copies one entry with AT_NULL
and value 0x00000021 and stops the loop.  In reality we have skipped
GLIBC_TUNABLES environment variable (=> skip_env=1). Thus we should copy from
here:
0x7fffac40:     0x00000021      0x7ffff000      0x00000010      0x007fffff
----------------^^^fixed-oldp

This patch fixes the computation of oldp when shuffling down auxiliary vector.
It also adds some checks in the testcase.  Those checks also fail on
s390x (64bit) and x86_64 without the fix.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agohppa/vdso: Provide 64-bit clock_gettime() vDSO only
John David Anglin [Tue, 2 Jul 2024 20:26:32 +0000 (16:26 -0400)]
hppa/vdso: Provide 64-bit clock_gettime() vDSO only

Adhemerval noticed that the gettimeofday() and 32-bit clock_gettime()
vDSO calls won't be used by glibc on hppa, so there is no need to
declare them.  Both syscalls will be emulated by utilizing return values
of the 64-bit clock_gettime() vDSO instead.

Signed-off-by: Helge Deller <deller@gmx.de>
Suggested-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
2 weeks agodebug: Fix clang open fortify wrapper (BZ 31927)
Adhemerval Zanella [Fri, 28 Jun 2024 19:20:15 +0000 (16:20 -0300)]
debug: Fix clang open fortify wrapper (BZ 31927)

The clang open fortify wrapper from 4228baef1a94e8bde84ad74 added
a restriction where open with 3 arguments where flags do not
contain O_CREAT or O_TMPFILE are handled as invalid.  They are
not invalid, since the third argument is ignored, and the gcc
wrapper also allows it.

Checked x86_64-linux-gnu and with a yocto build for some affected
packages.
Tested-by: “Khem Raj <raj.khen@gmail.com>”
2 weeks agoAdd --disable-static-c++-tests option [BZ #31797]
H.J. Lu [Thu, 20 Jun 2024 22:28:13 +0000 (15:28 -0700)]
Add --disable-static-c++-tests option [BZ #31797]

By default, if the C++ toolchain lacks support for static linking,
configure fails to find the C++ header files and the glibc build fails.
The --disable-static-c++-link-check option allows the glibc build to
finish, but static C++ tests will fail if the C++ toolchain doesn't
have the necessary static C++ libraries which may not be easily installed.
Add --disable-static-c++-tests option to skip the static C++ link check
and tests.  This fixes BZ #31797.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoAdd --disable-static-c++-link-check option [BZ #31412]
H.J. Lu [Thu, 20 Jun 2024 22:28:12 +0000 (15:28 -0700)]
Add --disable-static-c++-link-check option [BZ #31412]

The current minimum GCC version of glibc build is GCC 6.2 or newer. But
building i686 glibc with GCC 6.4 on Fedora 40 failed since the C++ header
files couldn't be found which was caused by the static C++ link check
failure due to missing __divmoddi4 which was referenced in i686 libc.a
and added to GCC 7.  Add --disable-static-c++-link-check configure option
to disable the static C++ link test.  The newly built i686 libc.a can be
used by GCC 6.4 to create static C++ tests.  This fixes BZ #31412.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoUpdate mmap() flags and errors lists
DJ Delorie [Fri, 10 May 2024 18:52:09 +0000 (14:52 -0400)]
Update mmap() flags and errors lists

Extend the list of MAP_* macros to include all macros available
to the average program (gcc -E -dM | grep MAP_*)

Extend the list of errno codes.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agoMIPSr6/math: Use builtin fma and fmaf
YunQiang Su [Thu, 20 Jun 2024 16:07:56 +0000 (00:07 +0800)]
MIPSr6/math: Use builtin fma and fmaf

MIPSr6 has MADDF.s/MADDF.d instructions, which are fused.

In MIPS ISA, double support can be subsetted.  Only FMAF is enabled
for this case.

* sysdeps/mips/fpu/math-use-builtins-fma.h

Signed-off-by: YunQiang Su <syq@gcc.gnu.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoelf: Support recursive use of dynamic TLS in interposed malloc
Florian Weimer [Mon, 1 Jul 2024 15:42:04 +0000 (17:42 +0200)]
elf: Support recursive use of dynamic TLS in interposed malloc

It turns out that quite a few applications use bundled mallocs that
have been built to use global-dynamic TLS (instead of the recommended
initial-exec TLS).  The previous workaround from
commit afe42e935b3ee97bac9a7064157587777259c60e ("elf: Avoid some
free (NULL) calls in _dl_update_slotinfo") does not fix all
encountered cases unfortunatelly.

This change avoids the TLS generation update for recursive use
of TLS from a malloc that was called during a TLS update.  This
is possible because an interposed malloc has a fixed module ID and
TLS slot.  (It cannot be unloaded.)  If an initially-loaded module ID
is encountered in __tls_get_addr and the dynamic linker is already
in the middle of a TLS update, use the outdated DTV, thus avoiding
another call into malloc.  It's still necessary to update the
DTV to the most recent generation, to get out of the slow path,
which is why the check for recursion is needed.

The bookkeeping is done using a global counter instead of per-thread
flag because TLS access in the dynamic linker is tricky.

All this will go away once the dynamic linker stops using malloc
for TLS, likely as part of a change that pre-allocates all TLS
during pthread_create/dlopen.

Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow
tls access after dlopen [BZ #19924]").

Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2 weeks agoFix conditionals on mtrace-based tests (bug 31892)
Carlos O'Donell [Wed, 19 Jun 2024 15:48:05 +0000 (11:48 -0400)]
Fix conditionals on mtrace-based tests (bug 31892)

The conditionals for several mtrace-based tests in catgets, elf, libio,
malloc, misc, nptl, posix, and stdio-common were incorrect leading to
test failures when bootstrapping glibc without perl.

The correct conditional for mtrace-based tests requires three checks:
first checking for run-built-tests, then build-shared, and lastly that
PERL is not equal to "no" (missing perl).
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agosignal/Makefile: Split and sort tests
Michel Lind [Fri, 14 Jun 2024 13:45:48 +0000 (15:45 +0200)]
signal/Makefile: Split and sort tests

This will make it easier to add tests later; see also the test section
in malloc/Makefile that inspires this.

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
Suggested-by: Arjun Shankar <arjun@redhat.com>
Reviewed-by: Arjun Shankar <arjun@redhat.com>
2 weeks agox86: Set default non_temporal_threshold for Zhaoxin processors
MayShao-oc [Sat, 29 Jun 2024 03:58:28 +0000 (11:58 +0800)]
x86: Set default non_temporal_threshold for Zhaoxin processors

Current 'non_temporal_threshold' set to 'non_temporal_threshold_lowbound'
on Zhaoxin processors without ERMS. The default
'non_temporal_threshold_lowbound' is too small for the KH-40000 and KX-7000
Zhaoxin processors, this patch updates the value to
'shared / cachesize_non_temporal_divisor'.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 weeks agox86_64: Optimize large size copy in memmove-ssse3
MayShao-oc [Sat, 29 Jun 2024 03:58:27 +0000 (11:58 +0800)]
x86_64: Optimize large size copy in memmove-ssse3

This patch optimizes large size copy using normal store when src > dst
and overlap.  Make it the same as the logic in memmove-vec-unaligned-erms.S.

Current memmove-ssse3 use '__x86_shared_cache_size_half' as the non-
temporal threshold, this patch updates that value to
'__x86_shared_non_temporal_threshold'.  Currently, the
__x86_shared_non_temporal_threshold is cpu-specific, and different CPUs
will have different values based on the related nt-benchmark results.
However, in memmove-ssse3, the nontemporal threshold uses
'__x86_shared_cache_size_half', which sounds unreasonable.

The performance is not changed drastically although shows overall
improvements without any major regressions or gains.

Results on Zhaoxin KX-7000:
bench-memcpy geometric_mean(N=20) New / Original: 0.999

bench-memcpy-random geometric_mean(N=20) New / Original: 0.999

bench-memcpy-large geometric_mean(N=20) New / Original: 0.978

bench-memmove geometric_mean(N=20) New / Original: 1.000

bench-memmmove-large geometric_mean(N=20) New / Original: 0.962

Results on Intel Core i5-6600K:
bench-memcpy geometric_mean(N=20) New / Original: 1.001

bench-memcpy-random geometric_mean(N=20) New / Original: 0.999

bench-memcpy-large geometric_mean(N=20) New / Original: 1.001

bench-memmove geometric_mean(N=20) New / Original: 0.995

bench-memmmove-large geometric_mean(N=20) New / Original: 0.936
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 weeks agox86: Set preferred CPU features on the KH-40000 and KX-7000 Zhaoxin processors
MayShao-oc [Sat, 29 Jun 2024 03:58:26 +0000 (11:58 +0800)]
x86: Set preferred CPU features on the KH-40000 and KX-7000 Zhaoxin processors

Fix code formatting under the Zhaoxin branch and add comments for
different Zhaoxin models.

Unaligned AVX load are slower on KH-40000 and KX-7000, so disable
the AVX_Fast_Unaligned_Load.

Enable Prefer_No_VZEROUPPER and Fast_Unaligned_Load features to
use sse2_unaligned version of memset,strcpy and strcat.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2 weeks agoAarch64: Add new memset for Qualcomm's oryon-1 core
Andrew Pinski [Wed, 12 Jun 2024 22:53:36 +0000 (15:53 -0700)]
Aarch64: Add new memset for Qualcomm's oryon-1 core

Qualcom's new core, oryon-1, has a different characteristics for
memset than the current versions of memset. For non-zero, larger
sizes, using GPRs rather than the SIMD stores is ~30% faster.
For even larger sizes, using the nontemporal stores is needed
not to polute the L1/L2 caches.

For zero values, using `dc zva` should be used. Since we
know the size will always be 64 bytes, we don't need to figure
out the size there.

I started with the emag memset and added back the `dc zva` code.

Changes since v1:
* v3: Fix comment formating

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoAarch64: Add memcpy for qualcomm's oryon-1 core
Andrew Pinski [Wed, 12 Jun 2024 22:53:35 +0000 (15:53 -0700)]
Aarch64: Add memcpy for qualcomm's oryon-1 core

Qualcomm's new core (oryon-1) has a different performance characteristic
than other cores. For memcpy, it is faster to use the GPRs to
do the copy for large sizes (2x faster). For even larger sizes,
it is better to use the nontemporal load/store instructions so
we don't pollute the L1/L2 caches.

For smaller sizes, the characteristic are very similar to
other cores.
I used the thunderx memcpy as a starting point and expanded from there.

Changes since v1:
* v2: Fix ordering in Makefile.
* v3: Fix comment grammar about the ldnp/stnp instructions.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agodebug: Fix clang open fortify wrapper (BZ 31927)
Adhemerval Zanella [Tue, 25 Jun 2024 14:57:15 +0000 (11:57 -0300)]
debug: Fix clang open fortify wrapper (BZ 31927)

The fcntl.h fortify wrapper for clang added by 86889e22db329abac61
missed the __fortify_clang_overload_arg and and also added the
mode argument for the __fortify_function_error_function function,
which leads clang to be able to correct resolve which overloaded
function it should emit.

Checked on x86_64-linux-gnu.

Reported-by: Khem Raj <raj.khem@gmail.com>
Tested-by: Khem Raj <raj.khem@gmail.com>
2 weeks agodebug: Fix clang mq_open fortify wrapper (BZ 31917)
Adhemerval Zanella [Fri, 21 Jun 2024 14:08:38 +0000 (11:08 -0300)]
debug: Fix clang mq_open fortify wrapper (BZ 31917)

The mqueue.h fortify wrapper for clang added by c23107effbfe5300
is not fully correct, where correct 4 argument usage are not
being correctly handled.  For instance, while building socat 1.8
with a yocto clang based system shows:

  ./socat-1.8.0.0/xio-posixmq.c:119:8: error: 'mq_open' is unavailable: mq_open can be called either with 2 or 4 arguments
    119 |         mqd = mq_open(name, oflag, opt_mode, NULL);
        |               ^
  [...] /usr/include/bits/mqueue2.h:66:8: note: 'mq_open' has been explicitly marked unavailable here
     66 | __NTH (mq_open (const char *__name, int __oflag, mode_t mode,
        |        ^
  1 error generated.

The correct way to define the wrapper is to set invalid usage
with __fortify_clang_unavailable (for the case with 5 or more
arguments), followed by the expected ones.  This fix make mq_open
similar to current open wrappers.

[1] http://www.dest-unreach.org/socat/

Reported-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Khem Raj <raj.khem@gmail.com>
2 weeks agotests-mbwc: Silence gcc 14 -Werror=format-overflow=
Stefan Liebler [Thu, 27 Jun 2024 11:42:37 +0000 (13:42 +0200)]
tests-mbwc: Silence gcc 14 -Werror=format-overflow=

With gcc 14, I get this warning/werror when building the localedata tests:
tests-mbwc/tsp_common.c: In function ‘result.constprop.isra’:
tests-mbwc/tsp_common.c:55:43: error: ‘%s’ directive writing up to 92 bytes into a region of size between 0 and 114 [-Werror=format-overflow=]
   55 |   sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
      |                                           ^~
In file included from ../include/bits/stdio2.h:1,
                 from ../libio/stdio.h:980,
                 from ../include/stdio.h:14,
                 from tests-mbwc/tsp_common.c:10:
In function ‘sprintf’,
    inlined from ‘result.constprop.isra’ at tests-mbwc/tsp_common.c:55:3:
../libio/bits/stdio2.h:30:10: note: ‘__builtin___sprintf_chk’ output between 20 and 234 bytes into a destination of size 132
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

This patch now gets rid of using sprintf and the result_rec buffer and just
prints to fp directly.

2 weeks agotime: Avoid memcmp overread in tzset (bug 31931)
Florian Weimer [Wed, 26 Jun 2024 17:36:58 +0000 (19:36 +0200)]
time: Avoid memcmp overread in tzset (bug 31931)

The test does not necessarily trigger the crash, depending on memcmp
behavior.  A crash was observed in __memcmp_ia32 on i686 builds.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2 weeks agoFix strnlen doc re array size
Paul Eggert [Wed, 26 Jun 2024 15:14:26 +0000 (16:14 +0100)]
Fix strnlen doc re array size

* manual/string.texi: For strnlen (s, maxlen), do not say that s must
be of size maxlen, as it can be smaller if it is null-terminated.
This should help avoid confusion such as seen in
<https://lists.gnu.org/r/bug-gnulib/2024-06/msg00280.html>.
Mention that strnlen and wcsnlen have been in POSIX since
POSIX.1-2008.

2 weeks agoarm: Avoid UB in elf_machine_rel()
Palmer Dabbelt [Thu, 23 Jun 2022 21:49:32 +0000 (14:49 -0700)]
arm: Avoid UB in elf_machine_rel()

This recently came up during a cleanup to remove misaligned accesses
from the RISC-V port.

Link: https://sourceware.org/pipermail/libc-alpha/2022-June/139961.html
Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Fangrui Song <maskray@google.com>
3 weeks agoLoongArch: Fix tst-gnu2-tls2 test case
mengqinggang [Fri, 21 Jun 2024 08:08:53 +0000 (16:08 +0800)]
LoongArch: Fix tst-gnu2-tls2 test case

asm volatile ("movfcsr2gr $t0, $fcsr0" ::: "$t0");
asm volatile ("st.d $t0, %0" :"=m"(restore_fcsr));

generate to the following instructions with -Og flag:

movfcsr2gr      $t0, $zero
addi.d          $t0, $sp, 2047(0x7ff)
addi.d          $t0, $t0, 77(0x4d)
st.w            $t0, $t0, 0

fcsr0 register and restore_fcsr variable are both stored in t0 register.

Change to:

asm volatile ("movfcsr2gr %0, $fcsr0" :"=r"(restore_fcsr));

to avoid restore_fcsr address in t0.

Comparing float value using memcmp because float value cannot be
directly compared for equality.

Put LOAD_REGISTER_FCSR and SAVE_REGISTER_FCC after LOAD_REGISTER_FLOAT.
Some float instructions may change fcsr register.

3 weeks agoposix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)
Adhemerval Zanella [Mon, 6 May 2024 16:20:56 +0000 (13:20 -0300)]
posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695)

If the pidfd_spawn/pidfd_spawnp helper process succeeds, but evecve
fails for some reason (either with an invalid/non-existent, memory
allocation, etc.) the resulting pidfd is never closed, nor returned
to caller (so it can call close).

Since the process creation failed, it should be up to posix_spawn to
also, close the file descriptor in this case (similar to what it
does to reap the process).

This patch also changes the waitpid with waitid (P_PIDFD) for pidfd
case, to avoid a possible pid re-use.

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agoINSTALL: regenerate
Andreas K. Hüttel [Tue, 25 Jun 2024 07:05:20 +0000 (09:05 +0200)]
INSTALL: regenerate

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoRevert "MIPSr6/math: Use builtin fma and fmaf"
Andreas K. Hüttel [Mon, 24 Jun 2024 23:02:58 +0000 (01:02 +0200)]
Revert "MIPSr6/math: Use builtin fma and fmaf"

Apologies, I mistakenly interpreted this to be already accepted.
Reverting until v6 or later is reviewed and approved.

This reverts commit 9e06e4a43b58519991acbed1d7f33abc40249226.

3 weeks agoINSTALL: Fix typo ibmlondouble to ibmlongdouble
Joe Simmons-Talbott [Thu, 13 Jul 2023 19:49:17 +0000 (15:49 -0400)]
INSTALL: Fix typo ibmlondouble to ibmlongdouble

3 weeks agoRISC-V: Execute a PAUSE hint in spin loops
Christoph Müllner [Thu, 18 Apr 2024 21:58:58 +0000 (23:58 +0200)]
RISC-V: Execute a PAUSE hint in spin loops

The atomic_spin_nop() macro can be used to run arch-specific
code in the body of a spin loop to potentially improve efficiency.
RISC-V's Zihintpause extension includes a PAUSE instruction for
this use-case, which is encoded as a HINT, which means that it
behaves like a NOP on systems that don't implement Zihintpause.

Binutils supports Zihintpause since 2.36, so this patch uses
the ".insn" directive to keep the code compatible with older
toolchains.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
3 weeks agoMIPSr6/math: Use builtin fma and fmaf
YunQiang Su [Tue, 4 Jun 2024 01:31:19 +0000 (09:31 +0800)]
MIPSr6/math: Use builtin fma and fmaf

MIPSr6 has MADDF.s/MADDF.d instructions, which are fused.

In MIPS ISA, double support can be subsetted.  Only FMAF is enabled
for this case.

* sysdeps/mips/fpu/math-use-builtins-fma.h

Signed-off-by: YunQiang Su <syq@gcc.gnu.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
3 weeks agopo: incorporate translations (cs, de, hr, ko, pl, ro, ru, sv, uk, zh_CN)
Andreas K. Hüttel [Mon, 24 Jun 2024 10:09:30 +0000 (12:09 +0200)]
po: incorporate translations (cs, de, hr, ko, pl, ro, ru, sv, uk, zh_CN)

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agomtrace: make shell commands robust against meta characters
Andreas Schwab [Thu, 20 Jun 2024 12:13:01 +0000 (14:13 +0200)]
mtrace: make shell commands robust against meta characters

Use the list form of the open function to avoid interpreting meta
characters in the arguments.

3 weeks agohppa/vdso: Add wrappers for vDSO functions
John David Anglin [Sun, 23 Jun 2024 23:39:28 +0000 (19:39 -0400)]
hppa/vdso: Add wrappers for vDSO functions

The upcoming parisc (hppa) v6.11 Linux kernel will include vDSO
support for gettimeofday(), clock_gettime() and clock_gettime64()
syscalls for 32- and 64-bit userspace.
The patch below adds the necessary glue code for glibc.

Signed-off-by: Helge Deller <deller@gmx.de>
Changes in v2:
- add vsyscalls for 64-bit too

3 weeks agoUpdate hppa libm-test-ulps
John David Anglin [Sun, 23 Jun 2024 17:51:25 +0000 (13:51 -0400)]
Update hppa libm-test-ulps

3 weeks agoBenchtests: Remove broken walk benchmarks
Wilco Dijkstra [Thu, 20 Jun 2024 10:43:54 +0000 (11:43 +0100)]
Benchtests: Remove broken walk benchmarks

The walk benchmarks don't measure anything useful - memory is not initialized
properly so doing a single walk in 32MB just measures reading the 4KB zero
page for reads and clear_page overhead for writes.  The memset variants don't
even manage to do a walk in the 32MB region due to using incorrect pointer
increments...  Neither is it clear why it is walking backwards since this
won't confuse modern prefetchers.  If you fix the benchmark and print the
bandwidth, the results are identical for all sizes larger than ~1KB since it
is just testing memory bandwidth of a single 32MB block.  This case is already
tested by the large benchmark, so overall it doesn't seem useful to keep these.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agoUpdate hppa libm-test-ulps
John David Anglin [Thu, 20 Jun 2024 23:44:04 +0000 (19:44 -0400)]
Update hppa libm-test-ulps

3 weeks agoRISC-V: Update ulps
Julian Zhu [Wed, 19 Jun 2024 12:03:22 +0000 (20:03 +0800)]
RISC-V: Update ulps

For the exp10m1, exp2m1, log10p1 and log2p1 implementations.

Signed-off-by: Julian Zhu <jz531210@gmail.com>
3 weeks agoMIPS: Update ulps
Julian Zhu [Wed, 19 Jun 2024 12:58:55 +0000 (20:58 +0800)]
MIPS: Update ulps

Update mips32/mips64 ulps for the exp10m1, exp2m1, and log10p1 implementations.

Signed-off-by: Julian Zhu <jz531210@gmail.com>
3 weeks agomalloc: Replace shell/Perl gate in mtrace
Florian Weimer [Thu, 20 Jun 2024 18:55:10 +0000 (20:55 +0200)]
malloc: Replace shell/Perl gate in mtrace

The previous version expanded $0 and $@ twice.

The new version defines a q no-op shell command.  The Perl syntax
error is masked by the eval Perl function.  The q { … } construct
is executed by the shell without errors because the q shell function
was defined, but treated as a non-expanding quoted string by Perl,
effectively hiding its context from the Perl interpreter.  As before
the script is read by require instead of executed directly, to avoid
infinite recursion because the #! line contains /bin/sh.

Introduce the “fatal” function to produce diagnostics that are not
suppressed by “do”.  Use “do” instead of “require” because it has
fewer requirements on the executed script than “require”.

Prefix relative paths with './' because “do” (and “require“ before)
searches for the script in @INC if the path is relative and does not
start with './'.  Use $_ to make the trampoline shorter.

Add an Emacs mode marker to indentify the script as a Perl script.

3 weeks agoi386: Update ulps
Florian Weimer [Thu, 20 Jun 2024 17:00:48 +0000 (19:00 +0200)]
i386: Update ulps

This is from a -march=i686 -mtune=generic build with
--disable-multi-arch, running on a Cascade Lake CPU.

3 weeks agos390x: Capture grep output in static PIE check
Florian Weimer [Thu, 20 Jun 2024 08:40:02 +0000 (10:40 +0200)]
s390x: Capture grep output in static PIE check

The test is not a run-time check, so update the description.
Also use readelf -W for a more stable output format and fix
an LC_ALL typo.

This avoids garbled configure messages:

checking for s390-specific static PIE requirements (runtime check)...  0x0000000000000017 (JMPREL)             0x280
yes

3 weeks agopowerpc: Update ulps
Florian Weimer [Thu, 20 Jun 2024 09:07:17 +0000 (11:07 +0200)]
powerpc: Update ulps

Results based on POWER8 and POWER9 machines running
powerpc64-linux-gnu, with and without --disable-multi-arch.

3 weeks agoi386: Update ulps
Florian Weimer [Thu, 20 Jun 2024 09:09:37 +0000 (11:09 +0200)]
i386: Update ulps

Based on a -march=x86-64-v4 -mfpmath=sse build, with and without
--disable-multi-arch, running on a Zen 4 CPU.  Also used different
-march=x8i6-64-v… settings.

3 weeks agomalloc: Always install mtrace (bug 31892)
Florian Weimer [Thu, 20 Jun 2024 08:32:16 +0000 (10:32 +0200)]
malloc: Always install mtrace (bug 31892)

Generation of the Perl script does not depend on Perl, so we can
always install it even if $(PERL) is not set during the build.

Change the malloc/mtrace.pl text substition not to rely on $(PERL).
Instead use PATH at run time to find the Perl interpreter. The Perl
interpreter cannot execute directly a script that starts with
“#! /bin/sh”: it always executes it with /bin/sh.  There is no
perl command line switch to disable this behavior.  Instead, use
the Perl require function to execute the script.  The additional
shift calls remove the “.” shell arguments.  Perl interprets the
“.” as a string concatenation operator, making the expression
syntactically valid.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agoTranslations: Regenerate libc.pot
Andreas K. Hüttel [Wed, 19 Jun 2024 20:32:09 +0000 (22:32 +0200)]
Translations: Regenerate libc.pot

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
3 weeks agoLoongArch: Update ulps
Xi Ruoyao [Wed, 19 Jun 2024 14:55:44 +0000 (22:55 +0800)]
LoongArch: Update ulps

Add ulps for recently added C23 exp10m1, exp2m1, and log10p1 functions.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
3 weeks agosparc: Regenerate ULPs
Andreas K. Hüttel [Wed, 19 Jun 2024 12:58:32 +0000 (14:58 +0200)]
sparc: Regenerate ULPs

Linux catbus 5.15.110-gentoo-r1 #1 SMP Fri Jun 9 17:53:23 PDT 2023 sparc64 sun4v UltraSparc T5 (Niagara5) GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 weeks agos390x: Regenerate ULPs.
Stefan Liebler [Wed, 19 Jun 2024 06:42:30 +0000 (08:42 +0200)]
s390x: Regenerate ULPs.

Needed due to:
- "Implement C23 log10p1"
  commit ID 55eb99e9a9d840ba452b128be14d6529c2dde039
- "Implement C23 exp2m1, exp10m1"
  commit ID 7ec903e028271d029818378fd60ddaf6b76b89ac

4 weeks agoLoongArch: Fix _dl_tlsdesc_dynamic in LSX case
mengqinggang [Fri, 14 Jun 2024 03:58:30 +0000 (11:58 +0800)]
LoongArch: Fix _dl_tlsdesc_dynamic in LSX case

HWCAP value is overwritten at the first comparison of the LASX case.
The second comparison at LSX get incorrect result.
Change to use t0 to save HWCAP value, and use t1 to save comparison
result.

4 weeks agoarm: Update ulps
Adhemerval Zanella [Tue, 18 Jun 2024 20:02:34 +0000 (20:02 +0000)]
arm: Update ulps

For the exp10m1, exp2m1, and log10p1 implementations.

4 weeks agoaarch64: Update ulps
Adhemerval Zanella [Tue, 18 Jun 2024 20:01:40 +0000 (20:01 +0000)]
aarch64: Update ulps

For the exp10m1, exp2m1, and log10p1 implementations.

4 weeks agopowerpc: Update ulps
Adhemerval Zanella [Tue, 18 Jun 2024 20:02:48 +0000 (23:02 +0300)]
powerpc: Update ulps

For the exp10m1, exp2m1, and log10p1 implementations.

4 weeks agoLinux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c
Florian Weimer [Tue, 18 Jun 2024 08:56:34 +0000 (10:56 +0200)]
Linux: Include <dl-symbol-redir-ifunc.h> in dl-sysdep.c

The _dl_sysdep_parse_arguments function contains initalization
of a large on-stack variable:

  dl_parse_auxv_t auxv_values = { 0, };

This uses a non-inline version of memset on powerpc64le-linux-gnu,
so it must use the baseline memset.

4 weeks agolinux: add definitions for hugetlb page size encodings
Carlos Llamas [Tue, 18 Jun 2024 08:56:34 +0000 (10:56 +0200)]
linux: add definitions for hugetlb page size encodings

A desired hugetlb page size can be encoded in the flags parameter of
system calls such as mmap() and shmget(). The Linux UAPI headers have
included explicit definitions for these encodings since v4.14.

This patch adds these definitions that are used along with MAP_HUGETLB
and SHM_HUGETLB flags as specified in the corresponding man pages. This
relieves programs from having to duplicate and/or compute the encodings
manually.

Additionally, the filter on these definitions in tst-mman-consts.py is
removed, as suggested by Florian. I then ran this tests successfully,
confirming the alignment with the kernel headers.

  PASS: misc/tst-mman-consts
  original exit status 0

Signed-off-by: Carlos Llamas <cmllamas@google.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoelf: Remove HWCAP_IMPORTANT
Stefan Liebler [Fri, 7 Jun 2024 11:42:44 +0000 (13:42 +0200)]
elf: Remove HWCAP_IMPORTANT

Remove the definitions of HWCAP_IMPORTANT after removal of
LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask.  There HWCAP_IMPORTANT
was used as default value.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask
Stefan Liebler [Fri, 7 Jun 2024 11:42:43 +0000 (13:42 +0200)]
elf: Remove LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask

Remove the environment variable LD_HWCAP_MASK and the tunable
glibc.cpu.hwcap_mask as those are not used anymore in common-code
after removal in elf/dl-cache.c:search_cache().

The only remaining user is sparc32 where it is used in
elf_machine_matches_host().  If sparc32 does not need it anymore,
we can get rid of it at all.  Otherwise we could also move
LD_HWCAP_MASK / tunable glibc.cpu.hwcap_mask to be sparc32 specific.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove _DL_PLATFORMS_COUNT
Stefan Liebler [Fri, 7 Jun 2024 11:42:42 +0000 (13:42 +0200)]
elf: Remove _DL_PLATFORMS_COUNT

Remove the definitions of _DL_PLATFORMS_COUNT as those are not used
anymore after removal in elf/dl-cache.c:search_cache().

Note: On x86, we can also get rid of the definitions
HWCAP_PLATFORMS_START and HWCAP_PLATFORMS_COUNT.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove _DL_FIRST_PLATFORM
Stefan Liebler [Fri, 7 Jun 2024 11:42:41 +0000 (13:42 +0200)]
elf: Remove _DL_FIRST_PLATFORM

Remove the definitions of _DL_FIRST_PLATFORM as those were only used
in the _DL_HWCAP_PLATFORM definitions and in _dl_string_platform().
Both were removed.

Note: Removed on every architecture despite of powerpc, where
_dl_string_platform() is still used.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove _DL_HWCAP_PLATFORM
Stefan Liebler [Fri, 7 Jun 2024 11:42:40 +0000 (13:42 +0200)]
elf: Remove _DL_HWCAP_PLATFORM

Remove the definitions of _DL_HWCAP_PLATFORM as those are not used
anymore after removal in elf/dl-cache.c:search_cache().
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove platform strings in dl-procinfo.c
Stefan Liebler [Wed, 12 Jun 2024 07:32:36 +0000 (09:32 +0200)]
elf: Remove platform strings in dl-procinfo.c

Remove the platform strings in dl-procinfo.c where also
the implementation of _dl_string_platform() was removed.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove _dl_string_platform
Stefan Liebler [Fri, 7 Jun 2024 11:42:38 +0000 (13:42 +0200)]
elf: Remove _dl_string_platform

Despite of powerpc where the returned integer is stored in tcb,
and the diagnostics output, there is no user anymore.

Thus this patch removes the diagnostics output and
_dl_string_platform for all other platforms.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoelf: Remove loading legacy hwcaps/platform entries in dynamic loader
Stefan Liebler [Fri, 7 Jun 2024 11:42:37 +0000 (13:42 +0200)]
elf: Remove loading legacy hwcaps/platform entries in dynamic loader

The legacy hwcaps mechanism was removed with glibc 2.37:
See this commit series:
d178c67535f0d159df73843e7c18cbdb39b4d25d
x86_64: Remove platform directory library loading test
6099908fb84debee4c3bcb05d88769410c2aecd1
elf: Remove legacy hwcaps support from the dynamic loader
b78ff5a25dc8ba9d8c6df10bb0a533254bdd193f
elf: Remove legacy hwcaps support from ldconfig
4a7094119ce05cadf927f52cc5d723e2195e65f9
elf: Remove hwcap parameter from add_to_cache signature
cfbf883db36727a84ef7929af49ef68c195b5972
elf: Remove hwcap and bits_hwcap fields from struct cache_entry
78d9a1620b840deb0880686e4159eaf70708866a
Add NEWS entry for legacy hwcaps removal
ab40f20364f4a417a63dd51fdd943742070bfe96
elf: Remove _dl_string_hwcap
e76369ed6371734f77f468eab097ef4e5b5db1c5
elf: Simplify output of hwcap subdirectories in ld.so help

According to Florian Weimer, this was an oversight and should also
have been removed.

As ldconfig does not generate ld.so.cache entries with hwcap/platform
bits in the hwcap-field anymore, this patch now skips those entries.
Thus currently only named-hwcap-entries and the default entries are
allowed.
For named-hwcap entries bit 62 is set and also the isa-level bits can
be set.
For the default entries the hwcap-field is 0.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agox86: Remove HWCAP_START and HWCAP_COUNT
Stefan Liebler [Fri, 7 Jun 2024 11:42:36 +0000 (13:42 +0200)]
x86: Remove HWCAP_START and HWCAP_COUNT

Both defines are not used anymore.  Those were only used for
_dl_string_hwcap(), which itself was removed with commit
ab40f20364f4a417a63dd51fdd943742070bfe96
"elf: Remove _dl_string_hwcap"

Just clean up.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agomath: Update mips32/mips64 ulps for log2p1
YunQiang Su [Fri, 31 May 2024 15:50:38 +0000 (23:50 +0800)]
math: Update mips32/mips64 ulps for log2p1

4 weeks agoConvert to autoconf 2.72 (vanilla release, no distribution patches)
Andreas K. Hüttel [Tue, 11 Jun 2024 21:34:54 +0000 (23:34 +0200)]
Convert to autoconf 2.72 (vanilla release, no distribution patches)

As discussed at the patch review meeting

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Reviewed-by: Simon Chopin <simon.chopin@canonical.com>
4 weeks agoImplement C23 exp2m1, exp10m1
Joseph Myers [Mon, 17 Jun 2024 16:31:49 +0000 (16:31 +0000)]
Implement C23 exp2m1, exp10m1

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the exp2m1 and exp10m1 functions (exp2(x)-1 and
exp10(x)-1, like expm1).

As with other such functions, these use type-generic templates that
could be replaced with faster and more accurate type-specific
implementations in future.  Test inputs are copied from those for
expm1, plus some additions close to the overflow threshold (copied
from exp2 and exp10) and also some near the underflow threshold.

exp2m1 has the unusual property of having an input (M_MAX_EXP) where
whether the function overflows (under IEEE semantics) depends on the
rounding mode.  Although these could reasonably be XFAILed in the
testsuite (as we do in some cases for arguments very close to a
function's overflow threshold when an error of a few ulps in the
implementation can result in the implementation not agreeing with an
ideal one on whether overflow takes place - the testsuite isn't smart
enough to handle this automatically), since these functions aren't
required to be correctly rounding, I made the implementation check for
and handle this case specially.

The Makefile ordering expected by lint-makefiles for the new functions
is a bit peculiar, but I implemented it in this patch so that the test
passes; I don't know why log2 also needed moving in one Makefile
variable setting when it didn't in my previous patches, but the
failure showed a different place was expected for that function as
well.

The powerpc64le IFUNC setup seems not to be as self-contained as one
might hope; it shouldn't be necessary to add IFUNCs for new functions
such as these simply to get them building, but without setting up
IFUNCs for the new functions, there were undefined references to
__GI___expm1f128 (that IFUNC machinery results in no such function
being defined, but doesn't stop include/math.h from doing the
redirection resulting in the exp2m1f128 and exp10m1f128
implementations expecting to call it).

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

4 weeks agoImplement C23 log10p1
Joseph Myers [Mon, 17 Jun 2024 13:48:13 +0000 (13:48 +0000)]
Implement C23 log10p1

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the log10p1 functions (log10(1+x): like log1p, but for
base-10 logarithms).

This is directly analogous to the log2p1 implementation (except that
whereas log2p1 has a smaller underflow range than log1p, log10p1 has a
larger underflow range).  The test inputs are copied from those for
log1p and log2p1, plus a few more inputs in that wider underflow
range.

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

4 weeks agoImplement C23 logp1
Joseph Myers [Mon, 17 Jun 2024 13:47:09 +0000 (13:47 +0000)]
Implement C23 logp1

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the logp1 functions (aliases for log1p functions - the
name is intended to be more consistent with the new log2p1 and
log10p1, where clearly it would have been very confusing to name those
functions log21p and log101p).  As aliases rather than new functions,
the content of this patch is somewhat different from those actually
adding new functions.

Tests are shared with log1p, so this patch *does* mechanically update
all affected libm-test-ulps files to expect the same errors for both
functions.

The vector versions of log1p on aarch64 and x86_64 are *not* updated
to have logp1 aliases (and thus there are no corresponding header,
tests, abilist or ulps changes for vector functions either).  It would
be reasonable for such vector aliases and corresponding changes to
other files to be made separately.  For now, the log1p tests instead
avoid testing logp1 in the vector case (a Makefile change is needed to
avoid problems with grep, used in generating the .c files for vector
function tests, matching more than one ALL_RM_TEST line in a file
testing multiple functions with the same inputs, when it assumes that
the .inc file only has a single such line).

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

4 weeks agosupport: Include <limits.h> for NAME_MAX use in temp_file.c
Florian Weimer [Mon, 17 Jun 2024 13:14:05 +0000 (15:14 +0200)]
support: Include <limits.h> for NAME_MAX use in temp_file.c

4 weeks agosupport: Include <stdlib.h> for atoi use in support_wait_for_thread_exit
Florian Weimer [Mon, 17 Jun 2024 13:14:05 +0000 (15:14 +0200)]
support: Include <stdlib.h> for atoi use in support_wait_for_thread_exit

4 weeks agoExtend tst-getconf.sh test with NPROCESSORS_CONF and NPROCESSORS_ONLN
Jan Kurik [Fri, 14 Jun 2024 18:49:39 +0000 (20:49 +0200)]
Extend tst-getconf.sh test with NPROCESSORS_CONF and NPROCESSORS_ONLN

Reviewed-by: Arjun Shankar <arjun@redhat.com>
4 weeks agoDefine ISO 639-3 "ltg" (Latgalian) and add ltg_LV locale
Mike FABIAN [Mon, 10 Jun 2024 17:54:42 +0000 (19:54 +0200)]
Define ISO 639-3 "ltg" (Latgalian) and add ltg_LV locale

Resolves: BZ # 31411

References:
https://iso639-3.sil.org/code/ltg
https://en.wikipedia.org/wiki/Latgalian_language
https://github.com/unicode-org/cldr/blob/main/common/main/ltg.xml

4 weeks agoINSTALL: regenerate
Paul Eggert [Sat, 15 Jun 2024 17:32:34 +0000 (10:32 -0700)]
INSTALL: regenerate

4 weeks agoMinor code improvement to timespec_subtract example
Paul Eggert [Sat, 15 Jun 2024 15:40:41 +0000 (08:40 -0700)]
Minor code improvement to timespec_subtract example

This saves a few instructions.
BORROW cannot be -1, since NSEC_DIFF is at most 999999999.
Idea taken from Gnulib, here:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=fe33f943054b93af8b965ce6564b8713b0979a21

4 weeks agoModernize and fix doc’s “Date and Time” (BZ 31876)
Paul Eggert [Sat, 8 Jun 2024 16:48:25 +0000 (09:48 -0700)]
Modernize and fix doc’s “Date and Time” (BZ 31876)

POSIX.1-2024 (now official) specifies tm_gmtoff and tm_zone.
This is a good time to update the manual’s “Date and Time”
chapter so I went through it, fixed some outdated
stuff that had been in there for decades, and improved it to match
POSIX.1-2024 better and to clarify some implementation-defined
behavior.  Glibc already conforms to POSIX.1-2024 in these matters, so
this is merely a documentation change.

* manual/examples/strftim.c: Use snprintf instead of now-deprecated
  function asctime.  Check for localtime failure.  Simplify by using
  puts instead of fputs.  Prefer ‘buf, sizeof buf’ to less-obvious
  ‘buffer, SIZE’.

* manual/examples/timespec_subtract.c: Modernize to use struct
  timespec not struct timeval, and rename from timeval_subtract.c.
  All uses changed.  Check for overflow.  Do not check for negative
  return value, which ought to be OK since negative time_t is OK.
  Use GNU indenting style.

* manual/time.texi:

  Document CLOCKS_PER_SEC, TIME_UTC, timespec_get, timespec_getres,
  strftime_l.

  Document the storage lifetime of tm_zone and of tzname.

  Caution against use of tzname, timezone and daylight, saying that
  these variables have unspecified values when TZ is geographic.
  This is what glibc actually does (contrary to what the manual said
  before this patch), and POSIX is planned to say the same thing
  <https://austingroupbugs.net/view.php?id=1816>.
  Also say that directly accessing the variables is not thread-safe.

  Say that localtime_r and ctime_r don’t necessarily set time zone
  state.  Similarly, in the tzset documentation, say that it is called
  by ctime, localtime, mktime, strftime, not that it is called by all
  time conversion functions that depend on the time zone.

  Say that tm_isdst is useful mostly just for mktime, and that
  other uses should prefer tm_gmtoff and tm_zone instead.

  Do not say that strftime ignores tm_gmtoff and tm_zone, because
  it doesn’t do that.

  Document what gmtime does to tm_gmtoff and tm_zone.

  Say that the asctime, asctime_r, ctime, and ctime_r are now deprecated
  and/or obsolescent, and that behavior is undefined if the year is <
  1000 or > 9999.  Document strftime before these now-obsolescent
  functions, so that readers see the useful function first.

  Coin the terms “geographical format” and “proleptic format” for the
  two main formats of TZ settings, to simplify exposition.  Use this
  wording consistently.

  Update top-level proleptic syntax to match POSIX.1-2024, which glibc
  already implements.  Document the angle-bracket quoted forms of time
  zone abbreviations in proleptic TZ.  Say that time zone abbreviations
  can contain only ASCII alphanumerics, ‘+’, and ‘-’.

  Document what happens if the proleptic form specifies a DST
  abbreviation and offset but omits the rules.  POSIX says this is
  implementation-defined so we need to document it.  Although this
  documentation mentions ‘posixrules’ tersely, we need to rethink
  ‘posixrules’ since I think it stops working after 2038.

  Clarify wording about TZ settings beginning with ‘;’.

  Say that timegm is in ISO C (as of C23).

  Say that POSIX.1-2024 removed gettimeofday.

  Say that tm_gmtoff and tm_zone are extensions to ISO C, which is
  clearer than saying they are invisible in a struct ISO C enviroment,
  and gives us more wiggle room if we want to make them visible in
  strict ISO C, something that ISO C allows.

  Drop mention of old standards like POSIX.1c and POSIX.2-1992 in the
  text when the history is so old that it’s no longer useful in a
  general-purpose manual.

  Define Coordinated Universal Time (UTC), time zone, time zone ruleset,
  and POSIX Epoch, and use these phrases more consistently.

  Improve TZ examples to show more variety, and to reflect current
  practice and timestamps.  Remove obsolete example about Argentina.
  Add an example for Ireland.

  Don’t rely on GCC extensions when explaining ctime_r.

  Do not say that difftime produces the mathematically correct result,
  since it might be inexact.

  For clock_t don’t say “as in the example above” when there is no
  such example, and don’t say that casting to double works “properly
  and consistently no matter what”, as it suffers from rounding and
  overflow.

  Don’t say broken-down time is not useful for calculations; it’s
  merely painful.

  Say that UTC is not defined before 1960.

  Rename Time Zone Functions to Time Zone State.  All uses changed.

  Update Internet RFC 822 → 5322, 1305 → 5905.  Drop specific years of
  ISO 8601 as they don’t matter.

  Minor style changes: @code{"..."} → @t{"..."} to avoid overquoting in
  info files, @code → @env for environment variables, Daylight Saving
  Time → daylight saving time, white space → whitespace, prime meridian
  → Prime Meridian.

4 weeks agomanual: minor language fix (bz 31340)
Andreas K. Hüttel [Sat, 15 Jun 2024 13:41:22 +0000 (15:41 +0200)]
manual: minor language fix (bz 31340)

Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=31340
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
4 weeks agox86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable
Noah Goldstein [Fri, 14 Jun 2024 18:01:58 +0000 (13:01 -0500)]
x86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable

When we don't want to use non-temporal stores for memset, we set
`x86_memset_non_temporal_threshold` to SIZE_MAX.

The current code, however, we using `maximum_non_temporal_threshold`
as the upper bound which is `SIZE_MAX >> 4` so we ended up with a
value of `0`.

Fix is to just use `SIZE_MAX` as the upper bound for when setting the
tunable.
Tested-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoelf: Change module-names to modules-names in comments
H.J. Lu [Fri, 14 Jun 2024 20:29:21 +0000 (13:29 -0700)]
elf: Change module-names to modules-names in comments

module-names should be modules-names.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoi686: Regenerate ulps
Andreas K. Hüttel [Fri, 14 Jun 2024 19:23:10 +0000 (21:23 +0200)]
i686: Regenerate ulps

Linux pinacolada 6.6.32-gentoo #1 SMP PREEMPT Sun Jun  9 14:18:17 CEST 2024 x86_64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz GenuineIntel GNU/Linux
32bit build for multilib environment

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
This page took 0.089211 seconds and 5 git commands to generate.