]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
4 weeks agonss: Remove effectively unused __nss_*_database variables
Florian Weimer [Tue, 18 Nov 2025 19:18:06 +0000 (20:18 +0100)] 
nss: Remove effectively unused __nss_*_database variables

Use of this cache was removed in commit f8847d83e17774ed5e9c0f75ef693
("nsswitch: use new internal API (core)").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agoAArch64: Remove WANT_SIMD_EXCEPT from aarch64 AdvSIMD math routines
Dylan Fleming [Tue, 18 Nov 2025 15:34:41 +0000 (15:34 +0000)] 
AArch64: Remove WANT_SIMD_EXCEPT from aarch64 AdvSIMD math routines

Remove legacy code for supporting an old Arm Optimised Routines
deprecated feature for throwing SIMD Exceptions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agoAArch64: Fix and improve SVE pow(f) special cases
Pierre Blanchard [Tue, 18 Nov 2025 15:09:05 +0000 (15:09 +0000)] 
AArch64: Fix and improve SVE pow(f) special cases

powf:

Update scalar special case function to best use new interface.

pow:

Make specialcase NOINLINE to prevent str/ldr leaking in fast path.
Remove depency in sv_call2, as new callback impl is not a
performance gain.
Replace with vectorised specialcase since structure of scalar
routine is fairly simple.

Throughput gain of about 5-10% on V1 for large values and 25% for subnormal `x`.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
4 weeks agoAArch64: fix SVE tanpi(f) [BZ #33642]
Pierre Blanchard [Tue, 18 Nov 2025 15:03:10 +0000 (15:03 +0000)] 
AArch64: fix SVE tanpi(f) [BZ #33642]

Fixed svld1rq using incorrect predicates (BZ #33642).
Next to no performance variations (tested on V1).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
4 weeks agohtl: move pthread_hurd_cond_timedwait_np, pthread_hurd_cond_wait_np into libc.
gfleury [Tue, 18 Nov 2025 12:50:44 +0000 (14:50 +0200)] 
htl: move pthread_hurd_cond_timedwait_np, pthread_hurd_cond_wait_np into libc.

Message-ID: <20251118125044.1160780-3-gfleury@disroot.org>

4 weeks agohtl: move pthread_getname_np/setname_np into libc.
gfleury [Tue, 18 Nov 2025 12:50:43 +0000 (14:50 +0200)] 
htl: move pthread_getname_np/setname_np into libc.

Message-ID: <20251118125044.1160780-2-gfleury@disroot.org>

4 weeks agohtl: fix compatibility
gfleury [Tue, 18 Nov 2025 12:50:42 +0000 (14:50 +0200)] 
htl: fix compatibility

This fix 91fb9914d867320d65a2abe284fb623d91ae5efb which break a system
built with an old glibc
Message-ID: <20251118125044.1160780-1-gfleury@disroot.org>

4 weeks agoAdd new AArch64 HWCAP3 definitions from Linux 6.17 to bits/hwcap.h
Adhemerval Zanella [Thu, 2 Oct 2025 19:43:33 +0000 (16:43 -0300)] 
Add new AArch64 HWCAP3 definitions from Linux 6.17 to bits/hwcap.h

Linux 7c7f55039b8d6 added HWCAP3_MTE_FAR and f620372209bfe added
HWCAP3_MTE_STORE_ONLY.

4 weeks agomalloc: Simplify tst-free-errno munmap failure test
Arjun Shankar [Thu, 13 Nov 2025 20:26:08 +0000 (21:26 +0100)] 
malloc: Simplify tst-free-errno munmap failure test

The Linux specific test-case in tst-free-errno was backing up malloc
metadata for a large mmap'd block, overwriting the block with its own
mmap, then restoring malloc metadata and calling free to force an munmap
failure.  However, the backed up pages containing metadata can
occasionally be overlapped by the overwriting mmap, leading to a
metadata corruption.

This commit replaces this Linux specific test case with a simpler,
generic, three block allocation, expecting the kernel to coalesce the
VMAs, then cause a fragmentation to trigger the same failure.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoRemove support for lock elision.
Stefan Liebler [Tue, 28 Oct 2025 14:21:18 +0000 (15:21 +0100)] 
Remove support for lock elision.

The support for lock elision was already deprecated with glibc 2.42:
commit 77438db8cfa6ee66b3906230156bdae11c49a195
"Mark support for lock elision as deprecated."
See also discussions:
https://sourceware.org/pipermail/libc-alpha/2025-July/168492.html

This patch removes the architecture specific support for lock elision
for x86, powerpc and s390 by removing the elision-conf.h, elision-conf.c,
elision-lock.c, elision-timed.c, elision-unlock.c, elide.h, htm.h/hle.h files.
Those generic files are also removed.

The architecture specific structures are adjusted and the elision fields are
marked as unused.  See struct_mutex.h files.
Furthermore in struct_rwlock.h, the leftover __rwelision was also removed.
Those were originally removed with commit 0377a7fde6dfcc078dda29a1225d7720a0931357
"nptl: Remove rwlock elision definitions"
and by chance reintroduced with commit 7df8af43ad1cd8ce527444de50bee6f35eebe071
"nptl: Add struct_rwlock.h"

The common code (e.g. the pthread_mutex-files) are changed back to the time
before lock elision was introduced with the x86-support:
- commit 1cdbe579482c07e9f4bb3baa4864da2d3e7eb837
"Add the low level infrastructure for pthreads lock elision with TSX"
- commit b023e4ca99f5e81f90d87d23cd267ef2abd2388c
"Add new internal mutex type flags for elision."
- commit 68cc29355f3334c7ad18f648ff9a6383a0916d23
"Add minimal test suite changes for elision enabled kernels"
- commit e8c659d74e011346785355eeef03b7fb6f533c61
"Add elision to pthread_mutex_{try,timed,un}lock"
- commit 49186d21ef2d87986bccaf0a7c45c48c91b265f3
"Disable elision for any pthread_mutexattr_settype call"
- commit 1717da59aed9612becd56aaa1249aac695af4c8a
"Add a configure option to enable lock elision and disable by default"

Elision is removed also from the tunables, the initialization part, the
pretty-printers and the manual.

Some extra handling in the testsuite is removed as well as the full tst-mutex10
testcase, which tested a race while enabling lock elision.

I've also searched the code for "elision", "elide", "transaction" and e.g.
cleaned some comments.

I've run the testsuite on x86_64 and s390x and run the build-many-glibcs.py
script.
Thanks to Sachin Monga, this patch is also tested on powerpc.

A NEWS entry also mentions the removal.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
4 weeks agonss: Remove effectively unused struct nss_database_default_cache
Florian Weimer [Mon, 17 Nov 2025 17:43:50 +0000 (18:43 +0100)] 
nss: Remove effectively unused struct nss_database_default_cache

We always start with a zero-initialized cache, so this is completely
ineffective.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agonss: Clean up function pointer/void * unions
Florian Weimer [Mon, 17 Nov 2025 16:18:00 +0000 (17:18 +0100)] 
nss: Clean up function pointer/void * unions

All our targets support casts between function pointers and void *,
so we might as well use them.

This change was largely auto-generated, with the following prompts.

@getXXbyYY_r.c Remove the use of the `fct` union and replace it by
pointer casts.

Apply the same change to ether_* getnetgrent_r getnssent_r netname
publickey .

Do not use explicit `*` in function pointer calls. Replace
`(*((lookup_function) fct))` and similar with `((lookup_function) fct)`.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agolinux/termios: factor out the kernel interface from termios_internal.h
H. Peter Anvin [Mon, 20 Oct 2025 20:42:10 +0000 (13:42 -0700)] 
linux/termios: factor out the kernel interface from termios_internal.h

Factor out the internal kernel interface from termios_internal.h, so
that it can be used in test code without causing breakage due to glibc
internals used in headers.

[ v3: fix Alpha build breakage ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agolinux/termios: clear k_termios.c_cflag & CIBAUD for non-split speed [BZ 33340]
H. Peter Anvin [Mon, 20 Oct 2025 20:42:09 +0000 (13:42 -0700)] 
linux/termios: clear k_termios.c_cflag & CIBAUD for non-split speed [BZ 33340]

After getting more experience with the various broken direct-to-ioctl
termios2 hacks using Fedora 43 beta, I have found a fair number of
cases where the software would fail to set, or clear CIBAUD for
non-split-speed operation.

Thus it seems will help improve compatibility to clear the kernel-side
version of c_cflag & CIBAUD (having the same meaning to the Linux
kernel as the speed 0 has for cfsetibaud(), i.e. force the input speed
to equal the output speed) for non-split-speed operation, rather than
having it explicitly equal the output speed in CBAUD.

When writing the code that went into glibc 2.42 I had considered this
issue, and had to make an educated guess which way would be more
likely to break fewer things.  Unfortunately, it appears I guessed
wrong.

A third option would be to *always* set CIBAUD to __BOTHER, even for
the standard baud rates.  However, that is an even bigger departure
from legacy behavior, whereas this variant mostly preserves current
behavior in terms of under what conditions buggy utilities will
continue to work.

This change is in tcsetattr() rather than
___termios2_canonicalize_speeds(), as it should not be run for
tcgetattr(); that would break split speed support for the legacy
interface versions of cfgetispeed() and cfsetispeed().

[ v2: fixed comment style ]

Resolves: BZ #33340
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agomanual: don't use the FSF's old address in license text.
Collin Funk [Tue, 11 Nov 2025 19:49:07 +0000 (11:49 -0800)] 
manual: don't use the FSF's old address in license text.

Update to latest text from Gnulib commit
08f579c56d81cf78c60fcd3568190f97e6e7f684, file doc/lgpl-2.1.texi.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoposix: execvpe: fix UMR with file > NAME_MAX [BZ #33627]
Pádraig Brady [Fri, 14 Nov 2025 13:58:58 +0000 (13:58 +0000)] 
posix: execvpe: fix UMR with file > NAME_MAX [BZ #33627]

* posix/execvpe.c (__execvpe_common): Since strnlen doesn't inspect
beyond NAME_MAX and NAME_MAX does not cover the NUL, we need
to explicitly check for the NUL.  I.e. the existing check for,
file_len-1 > NAME_MAX, was never true.  This check is required
so that we're guaranteed that file_len includes the NUL, as we
depend on that in the following memcpy to properly terminate
the file buffer passed to execve().  Otherwise that call will trigger
UMR when inspecting the passed file, which can be seen with valgrind.
Note returning ENAMETOOLONG early here for FILE names > NAME_MAX
will also avoid redundant processing of ENAMETOOLONG on each entry
in $PATH, after the change in [BZ #33626] is applied.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agoconfigure: Remove for redirection of built-in functions
Adhemerval Zanella [Mon, 10 Nov 2025 13:29:02 +0000 (10:29 -0300)] 
configure: Remove for redirection of built-in functions

The check was initially used to define HAVE_BUILTIN_REDIRECTION, which
enables or not libc_hidden_builtin_proto support. It was later removed
with 3ce1f2959437e952b9db4eaeed2407424f11a4d1, making the feature
mandatory. The configure check was kept as a transition knob.

Current minimum gcc/linker always supports this, as well as clang with
some extra care. Also, missing hidden_proto/hidden_def support is
already flagged in the check-localplt test.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agomath: Handle fabsf128 !__USE_EXTERN_INLINES
Adhemerval Zanella [Mon, 10 Nov 2025 13:29:01 +0000 (10:29 -0300)] 
math: Handle fabsf128 !__USE_EXTERN_INLINES

Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

clang on x86_64 fails to build s_fabsf128.c with:

../sysdeps/ieee754/float128/../ldbl-128/s_fabsl.c:32:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
   32 | libm_alias_ldouble (__fabs, fabs)
      | ^
../sysdeps/generic/libm-alias-ldouble.h:63:38: note: expanded from macro 'libm_alias_ldouble'
   63 | #define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, )
      |                                      ^
../sysdeps/ieee754/float128/float128_private.h:133:43: note: expanded from macro 'libm_alias_ldouble_r'
  133 | #define libm_alias_ldouble_r(from, to, r) libm_alias_float128_r (from, to, r)
      |                                           ^
../sysdeps/ieee754/float128/s_fabsf128.c:5:3: note: expanded from macro 'libm_alias_float128_r'
    5 |   static_weak_alias (from ## f128 ## r, to ## f128 ## r);       \
      |   ^
./../include/libc-symbols.h:166:46: note: expanded from macro 'static_weak_alias'
  166 | #  define static_weak_alias(name, aliasname) weak_alias (name, aliasname)
      |                                              ^
./../include/libc-symbols.h:154:38: note: expanded from macro 'weak_alias'
  154 | # define weak_alias(name, aliasname) _weak_alias (name, aliasname)
      |                                      ^
./../include/libc-symbols.h:156:52: note: expanded from macro '_weak_alias'
  156 |   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
      |                                                    ^
../include/math.h:134:1: note: previous definition is here
  134 | fabsf128 (_Float128 x)

If compiler does not support __USE_EXTERN_INLINES we need to route
fabsf128 call to an internal symbol.

4 weeks agox86: Fix strstr ifunc on clang
Adhemerval Zanella [Mon, 10 Nov 2025 13:28:59 +0000 (10:28 -0300)] 
x86: Fix strstr ifunc on clang

Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

Buildint with clang triggers multiple issue on how ifunc macro are
used:

  ../sysdeps/x86_64/multiarch/strstr.c:38:54: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
     38 | extern __typeof (__redirect_strstr) __strstr_generic attribute_hidden;
        |                                                      ^
  ./../include/libc-symbols.h:356:43: note: expanded from macro 'attribute_hidden'
    356 | # define attribute_hidden __attribute__ ((visibility ("hidden")))
        |                                           ^
  ../string/strstr.c:76:1: note: previous definition is here
     76 | STRSTR (const char *haystack, const char *needle)
        | ^
  ../sysdeps/x86_64/multiarch/strstr.c:27:16: note: expanded from macro 'STRSTR'
     27 | #define STRSTR __strstr_generic
        |                ^
  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^

And

  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^
  ../sysdeps/x86_64/multiarch/strstr.c:59:13: note: previous definition is here
     59 | libc_ifunc (__libc_strstr,
        |             ^

Refactor to use a auxiliary function like other selection (for instance,
x86_64/multiarch/strcmp.c).

4 weeks agox86: Use -mavx instead of -msse2avx
Adhemerval Zanella [Mon, 10 Nov 2025 13:28:58 +0000 (10:28 -0300)] 
x86: Use -mavx instead of -msse2avx

clang supports -msse2avx from version 19 and onwards, but it should
be gated as an option to assembler (either with -Wa or -Xassembler).

The -DSSE2AVX option was used because there were asm statements with
SSE-only instructions which was fixed by commit ff8be6152bc.

Now we can simply use -mavx.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agomath: Don't redirect inlined builtin math functions
Adhemerval Zanella [Mon, 10 Nov 2025 13:28:56 +0000 (10:28 -0300)] 
math: Don't redirect inlined builtin math functions

When we want to inline builtin math functions, like truncf, for

  extern float truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));
  extern float __truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

  float (truncf) (float) asm ("__truncf");

compiler may redirect truncf calls to __truncf, instead of inlining it
(for instance, clang).  The USE_TRUNCF_BUILTIN is 1 to indicate that
truncf should be inlined.  In this case, we don't want the truncf
redirection:

  1. For each math function which may be inlined, we define

  #if USE_TRUNCF_BUILTIN
   # define NO_truncf_BUILTIN inline_truncf
   #else
   # define NO_truncf_BUILTIN truncf
   #endif

in <math-use-builtins.h>.

  2. Include <math-use-builtins.h> in include/math.h.

  3. Change MATH_REDIRECT to

   #define MATH_REDIRECT(FUNC, PREFIX, ARGS) \
    float (NO_ ## FUNC ## f ## _BUILTIN) (ARGS (float)) \
      asm (PREFIX #FUNC "f");

With this change If USE_TRUNCF_BUILTIN is 0, we get

  float (truncf) (float) asm ("__truncf");
  truncf will be redirected to __truncf.

And for USE_TRUNCF_BUILTIN 1, we get:

  float (inline_truncf) (float) asm ("__truncf");

In both cases either truncf will be inlined or the internal alias
(__truncf) will be called.

It is not required for all math-use-builtin symbol, only the one
defined in math.h.  It also allows to remove all the math-use-builtin
inclusion, since it is now implicitly included by math.h.

For MIPS, some math-use-builtin headers include sysdep.h and this
in turn includes a lot of extra headers that do not allow ldbl-128
code to override alias definition (math.h will include
some stdlib.h definition).  The math-use-builtin only requires
the __mips_isa_rev, so move the defintion to sgidefs.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoUpdate COPYING, COPYING.LIB from gnulib, using gnulib file names
Florian Weimer [Mon, 17 Nov 2025 10:15:13 +0000 (11:15 +0100)] 
Update COPYING, COPYING.LIB from gnulib, using gnulib file names

The new file names are COPYINGv2 and COPYING.LESSERv2.  Lots of
copyright headers mention COPYING.LIB, so add a symbolic link.
(This is not the first symbolic link in the repository, so this
should be fine.)

The files come from gnulib commit 3cc5b69dda06890929a2d0433f30708.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agoAdd COPYINGv3 with the GPL version 3 text
Florian Weimer [Mon, 17 Nov 2025 10:15:13 +0000 (11:15 +0100)] 
Add COPYINGv3 with the GPL version 3 text

The license is referenced in various headers, so we should ship it.
The text was copied from gnulib commit d64d66cc4897d605f543257dcd0,
file doc/COPYINGv3.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoReference COPYING.LIB in <sframe.h> copyright header
Florian Weimer [Mon, 17 Nov 2025 10:15:13 +0000 (11:15 +0100)] 
Reference COPYING.LIB in <sframe.h> copyright header

Commit 3360913c37f5c3a0c8737b76321fd5ce2608fcd5 ("elf: Add SFrame
stack tracing") added this file with an inconsistent copyright header.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
4 weeks agohtl: move pthread_create to into libc
Samuel Thibault [Sun, 16 Nov 2025 14:09:11 +0000 (14:09 +0000)] 
htl: move pthread_create to into libc

This is notably needed for the main thread structure to be always
initialized so that some pthread functions can work from the main thread
without other threads, e.g. pthread_cancel.

4 weeks agohtl: Move __pthread_enable/disable_asynccancel into libc
Samuel Thibault [Sun, 16 Nov 2025 15:40:19 +0000 (15:40 +0000)] 
htl: Move __pthread_enable/disable_asynccancel into libc

This is actually needed before we make pthread_cancel available in libc.

4 weeks agohurd: Fix getting rlimit in _hurd_alloc_fd
Samuel Thibault [Sun, 16 Nov 2025 16:34:40 +0000 (16:34 +0000)] 
hurd: Fix getting rlimit in _hurd_alloc_fd

rlim_t is unsigned, and RLIM_INFINITY can be (rlim_t) -1

4 weeks agohtl: Add missing include
Samuel Thibault [Sun, 16 Nov 2025 10:53:46 +0000 (11:53 +0100)] 
htl: Add missing include

For IS_IN.

4 weeks agoloongarch: Remove TLS_TCB_ALIGN
Samuel Thibault [Sun, 16 Nov 2025 10:26:34 +0000 (11:26 +0100)] 
loongarch: Remove TLS_TCB_ALIGN

This reverts a part of 9f18265a8ec8 ("Remove TLS_TCB_ALIGN and
TLS_INIT_TCB_ALIGN"), as loongarch uses this macro internally.

4 weeks agohurd: Fix restoring SSE state on signal
Samuel Thibault [Sun, 16 Nov 2025 00:32:22 +0000 (01:32 +0100)] 
hurd: Fix restoring SSE state on signal

mach_port_mod_refs() needs to avoid using SSE&MMX for __sigreturn2 to be
able to use it without thrashing SSE&MMX.

4 weeks agoRemove TLS_TCB_ALIGN and TLS_INIT_TCB_ALIGN
Samuel Thibault [Sat, 15 Nov 2025 21:01:07 +0000 (22:01 +0100)] 
Remove TLS_TCB_ALIGN and TLS_INIT_TCB_ALIGN

This is the rest of 627f5ede70d7 ("Remove TLS_TCB_ALIGN and
TLS_INIT_TCB_ALIGN"), for loongarch and or1k which missed it.

4 weeks agomath: Optimize frexpl (intel96) with fast path for normal numbers
Osama Abdelkader [Mon, 10 Nov 2025 20:17:07 +0000 (20:17 +0000)] 
math: Optimize frexpl (intel96) with fast path for normal numbers

Add fast path optimization for frexpl (80-bit x87 extended precision) using
a single unsigned comparison to identify normal floating-point numbers and
return immediately via arithmetic on the exponent field.

The implementation uses arithmetic operations (se - ex ) to
adjust the exponent directly, which is simpler than bit masking. For subnormals,
the traditional multiply-based normalization is retained as it handles the
split word format more reliably.

The zero/infinity/NaN check groups these special cases together for better
branch prediction.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     25.543 ns/op
  Optimized:    25.531 ns/op
  Speedup:      1.00x (neutral)
  Zero:         17.774 ns/op
  Denormal:     23.900 ns/op

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
4 weeks agoRevert __HAVE_64B_ATOMICS configure check
Adhemerval Zanella [Thu, 13 Nov 2025 17:26:08 +0000 (14:26 -0300)] 
Revert __HAVE_64B_ATOMICS configure check

The 53807741fb44edb8e7c094cb5e7d4ff4e92a6ec1 added a configure check
for 64-bit atomic operations that were not previously enabled on some
32-bit ABIs.

However, the NPTL semaphore code casts a sem_t to a new_sem and issues
a 64-bit atomic operation for __HAVE_64B_ATOMICS.  Since sem_t has
32-bit alignment on 32-bit architectures, this prevents the use of
64-bit atomics even if the ABI supports them.

Assume 64-bit atomic support from __WORDSIZE, which maps to how glibc
defines it before the broken change.  Also rename __HAVE_64B_ATOMICS
to USE_64B_ATOMICS to define better the flag meaning.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
4 weeks agox86: Increase allowable TSX abort rate to 6%.
Carlos O'Donell [Mon, 10 Nov 2025 20:17:45 +0000 (15:17 -0500)] 
x86: Increase allowable TSX abort rate to 6%.

In pre-commit CI on an E5-2698 v4 we sometimes see ~5% aborts.

Set the trip point to 6%.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agohtl: Remove errno and herrno from libpthread
Samuel Thibault [Thu, 13 Nov 2025 22:45:12 +0000 (23:45 +0100)] 
htl: Remove errno and herrno from libpthread

libc already has them.

4 weeks agohtl: Drop pthread-functions infrastructure
Samuel Thibault [Thu, 13 Nov 2025 22:08:34 +0000 (23:08 +0100)] 
htl: Drop pthread-functions infrastructure

All previously forwarded functions are now called directly (either via local
call in libc, or through a __export).t

4 weeks agohtl: Move __pthread_cleanup_stack out of libc_pthread_init.c
Samuel Thibault [Thu, 13 Nov 2025 22:20:23 +0000 (23:20 +0100)] 
htl: Move __pthread_cleanup_stack out of libc_pthread_init.c

It does not actually need to be extern any more.

4 weeks agohtl: move {,_IO_}f{,un,try}lockfile implementation into libc
Samuel Thibault [Thu, 13 Nov 2025 20:13:53 +0000 (21:13 +0100)] 
htl: move {,_IO_}f{,un,try}lockfile implementation into libc

4 weeks agolinux: Add mseal to mips32 nofpu abilist
Adhemerval Zanella [Thu, 13 Nov 2025 18:32:26 +0000 (15:32 -0300)] 
linux: Add mseal to mips32 nofpu abilist

It was missing from 3d52fd274e9.

4 weeks agohppa: Consistently reference LGPL in copyright header
Florian Weimer [Thu, 13 Nov 2025 08:46:15 +0000 (09:46 +0100)] 
hppa: Consistently reference LGPL in copyright header

The file was added with a GPL reference (but LGPL statement) in
commit 0d6bed71502f053fa702ccbb7dd4fa6741b2a0ed ("hppa: Add
____longjmp_check C implementation.").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agoChange fromfp functions to return floating types following C23 (bug 28327)
Joseph Myers [Thu, 13 Nov 2025 00:04:21 +0000 (00:04 +0000)] 
Change fromfp functions to return floating types following C23 (bug 28327)

As discussed in bug 28327, C23 changed the fromfp functions to return
floating types instead of intmax_t / uintmax_t.  (Although the
motivation in N2548 was reducing the use of intmax_t in library
interfaces, the new version does have the advantage of being able to
specify arbitrary integer widths for e.g. assigning the result to a
_BitInt, as well as being able to indicate an error case in-band with
a NaN return.)

As with other such changes from interfaces introduced in TS 18661,
implement the new types as a replacement for the old ones, with the
old functions remaining as compat symbols but not supported as an API.
The test generator used for many of the tests is updated to handle
both versions of the functions.

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

Also tested tgmath tests for x86_64 with GCC 7 to make sure that the
modified case for older compilers in <tgmath.h> does work.

Also tested for powerpc64le to cover the ldbl-128ibm implementation
and the other things that are handled differently for that
configuration.  The new tests fail for ibm128, but all the failures
relate to incorrect signs of zero results and turn out to arise from
bugs in the underlying roundl, ceill, truncl and floorl
implementations that I've reported in bug 33623, rather than
indicating any bug in the actual new implementation of the functions
for that format.  So given fixes for those functions (which shouldn't
be hard, and of course should add to the tests for those functions
rather than relying only on indirect testing via fromfp), the fromfp
tests should start passing for ibm128 as well.

4 weeks agomath: Remove float_t and double_t [BZ #33563]
Wilco Dijkstra [Tue, 11 Nov 2025 17:46:19 +0000 (17:46 +0000)] 
math: Remove float_t and double_t [BZ #33563]

Remove uses of float_t and double_t. This is not useful on modern machines,
and does not help given GCC defaults to -fexcess-precision=fast.
One use of double_t remains to allow forcing the precision to double
on targets where FLT_EVAL_METHOD=2. This fixes BZ #33563 on
i486-pc-linux-gnu.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
4 weeks agomath: Remove ldbl-128/s_fma.c
Wilco Dijkstra [Mon, 10 Nov 2025 13:52:14 +0000 (13:52 +0000)] 
math: Remove ldbl-128/s_fma.c

Remove ldbl-128/s_fma.c - it makes no sense to use emulated float128
operations to emulate FMA.  Benchmarking shows dbl-64/s_fma.c is about
twice as fast.  Remove redundant dbl-64/s_fma.c includes in targets
that were trying to work around this issue.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
4 weeks agolinux: Add mseal syscall support
Adhemerval Zanella [Mon, 10 Nov 2025 18:03:05 +0000 (15:03 -0300)] 
linux: Add mseal syscall support

It has been added on Linux 6.10 (8be7258aad44b5e25977a98db136f677fa6f4370)
as a way to block operations such as mapping, moving to another location,
shrinking the size, expanding the size, or modifying it to a pre-existing
memory mapping.

Although the system only works on 64-bit CPUs, the entrypoint was added
for all ABIs (since the kernel might eventually implement it for additional
ones and/or the ABI can execute on a 64-bit kernel).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
4 weeks agoaarch64: fix includes in SME tests
Yury Khrustalev [Tue, 11 Nov 2025 11:40:25 +0000 (11:40 +0000)] 
aarch64: fix includes in SME tests

Use the correct include for the SIGCHLD macro: signal.h

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
4 weeks agoLoongArch: Call elf_ifunc_invoke for R_LARCH_IRELATIVE in elf_machine_rela
Xi Ruoyao [Fri, 7 Nov 2025 15:49:22 +0000 (23:49 +0800)] 
LoongArch: Call elf_ifunc_invoke for R_LARCH_IRELATIVE in elf_machine_rela

When R_LARCH_IRELATIVE is resolved by apply_irel, the ifunc resolver is
called via elf_ifunc_invoke so it can read HWCAP from the __ifunc_arg_t
argument.  But when R_LARCH_IRELATIVE is resolved by elf_machine_rela (it
will happen if we dlopen() a shared object containing R_LARCH_IRELATIVE),
the ifunc resolver is invoked directly with no or different argument.
This causes a segfault if the resolver uses the __ifunc_arg_t.

Despite the LoongArch psABI does not specify this argument, IMO it's
more convenient to have this argument IMO and per hyrum's rule there may
be objects in wild which already relies on this argument (they just
didn't blow up because they are not dlopen()ed yet).  So make the
behavior handling R_LARCH_IRELATIVE of elf_machine_rela same as
apply_irel.

This fixes BZ #33610.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
4 weeks agohurd: Drop remnants of cthreads
Samuel Thibault [Tue, 11 Nov 2025 21:32:39 +0000 (22:32 +0100)] 
hurd: Drop remnants of cthreads

These are not used in GNU/Hurd since very long now.

5 weeks agocdefs: Fix some typos in comments.
Bruno Haible [Tue, 11 Nov 2025 19:04:29 +0000 (11:04 -0800)] 
cdefs: Fix some typos in comments.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agostdlib: Do not define once_flag, ONCE_FLAG_INIT for C++
Florian Weimer [Tue, 11 Nov 2025 17:20:10 +0000 (18:20 +0100)] 
stdlib: Do not define once_flag, ONCE_FLAG_INIT for C++

The definition of once_flag conflicts with std::once_flag in
if “using namespace std;” is active.

Updates commit a7ddbf456d97ac8d1aa7afd735e196a1488bd874
("Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23").

Suggested-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agox86-64: Fix a typo in fesetenv.c [BZ #33619]
H.J. Lu [Tue, 11 Nov 2025 07:43:31 +0000 (15:43 +0800)] 
x86-64: Fix a typo in fesetenv.c [BZ #33619]

Fix a typo in

commit 427c25278d1dae62dffa07ea5cd0fc33f07190af
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 31 17:00:46 2025 -0300

    x86: Adapt "%v" usage on clang to emit VEX enconding

@@ -103,8 +104,8 @@ __fesetenv (const fenv_t *envp)
       temp.__mxcsr = envp->__mxcsr;
     }

-  __asm__ ("fldenv %0\n"
-          "%vldmxcsr %1" : : "m" (temp), "m" (temp.__mxcsr));
+  asm volatile ("fldenv %0" : "=m" (temp));
+  ldmxcsr_inline_asm (&temp.__mxcsr);

   /* Success.  */
   return 0;

"temp" is input not output.  This fixes BZ #33619.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agoSet Prefer_No_AVX512 flag for hygon platform
Xie jiamei [Tue, 11 Nov 2025 02:28:54 +0000 (10:28 +0800)] 
Set Prefer_No_AVX512 flag for hygon platform

Benchmarks indicate evex can be more profitable on Hygon hardware
than AVX512. So add Prefer_No_AVX512 to make it run with evex.

Change-Id: Icc59492f71fde7a783a8bd315714ffd6f7ecaf29
Signed-off-by: Li jing <lijing@hygon.cn>
Signed-off-by: Xie jiamei <xiejiamei@hygon.cn>
5 weeks agomath: Optimize frexpl (binary128) with fast path for normal numbers
Osama Abdelkader [Wed, 5 Nov 2025 20:24:08 +0000 (22:24 +0200)] 
math: Optimize frexpl (binary128) with fast path for normal numbers

Add fast path optimization for frexpl (128-bit IEEE quad precision) using
a single unsigned comparison to identify normal floating-point numbers and
return immediately via arithmetic on the exponent field.

The implementation uses arithmetic operations hx = hx - (ex << 48)
to adjust the exponent in place, which is simpler and more efficient than
bit masking. For subnormals, the traditional multiply-based normalization
is retained for reliability with the split 64-bit word format.

The zero/infinity/NaN check groups these special cases together for better
branch prediction.

This optimization provides the same algorithmic improvements as the other
frexp variants while maintaining correctness for all edge cases.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Optimize frexp (binary64) with fast path for normal numbers
Osama Abdelkader [Thu, 23 Oct 2025 15:06:29 +0000 (18:06 +0300)] 
math: Optimize frexp (binary64) with fast path for normal numbers

Add fast path optimization for frexp using a single unsigned comparison
to identify normal floating-point numbers and return immediately via
arithmetic on the bit representation.

The implementation uses asuint64()/asdouble() from math_config.h and arithmetic
operations to adjust the exponent, which generates better code than bit masking
on ARM and RISC-V architectures. For subnormals, stdc_leading_zeros provides
faster normalization than the traditional multiply approach.

The zero/infinity/NaN check is simplified to (int64_t)(ix << 1) <= 0, which
is more efficient than separate comparisons.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     6.778 ns/op
  Optimized:    4.007 ns/op
  Speedup:      1.69x (40.9% faster)
  Zero:         3.580 ns/op (fast path)
  Denormal:     6.096 ns/op (slower, rare case)

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomath: Optimize frexpf (binary32) with fast path for normal numbers
Osama Abdelkader [Thu, 23 Oct 2025 15:06:28 +0000 (18:06 +0300)] 
math: Optimize frexpf (binary32) with fast path for normal numbers

Add fast path optimization for frexpf using a single unsigned comparison
to identify normal floating-point numbers and return immediately via
arithmetic on the bit representation.

The implementation uses asuint()/asfloat() from math_config.h and arithmetic
operations to adjust the exponent, which generates better code than bit masking
on ARM and RISC-V architectures. For subnormals, stdc_leading_zeros provides
faster normalization than the traditional multiply approach.

The zero/infinity/NaN check is simplified to (int32_t)(hx << 1) <= 0, which
is more efficient than separate comparisons.

Benchmark results on Intel Core i9-13900H (13th Gen):
  Baseline:     5.858 ns/op
  Optimized:    4.003 ns/op
  Speedup:      1.46x (31.7% faster)
  Zero:         3.580 ns/op (fast path)
  Denormal:     5.597 ns/op (slower, rare case)

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agobenchtests: Add benchmarks for frexp functions
Osama Abdelkader [Tue, 4 Nov 2025 17:55:05 +0000 (19:55 +0200)] 
benchtests: Add benchmarks for frexp functions

Add benchmark support for frexp, frexpf, and frexpl to measure the
performance improvement of the fast path optimization.

- Created frexp-inputs, frexpf-inputs, frexpl-inputs with random test values
- Added frexp, frexpf, frexpl to bench-math list
- Added CFLAGS to disable builtins for accurate benchmarking

These benchmarks will be used to quantify the performance gains from the
fast path optimization for normal floating-point numbers.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
5 weeks agomath: Sync acosh from CORE-MATH
Adhemerval Zanella [Mon, 10 Nov 2025 11:44:14 +0000 (08:44 -0300)] 
math: Sync acosh from CORE-MATH

The c9abdf80 fix handle some cases for RNDZ.

Checked on x86_64-linux-gnu.

5 weeks agoFilter out internal abort during ld.so build
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:49 +0000 (17:00 -0300)] 
Filter out internal abort during ld.so build

clang might generate an abort call when cleanup functions (set by
__attribute__ ((cleanup)) calls functions not marked as nothrow.

The hurd already provides abort for the loader at
sysdeps/mach/hurd/dl-sysdep.c, and adding it rtld-stubbed-symbols
triggers duplicate symbols.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agox86: Fix THREAD_GSCOPE_RESET_FLAG build on clang
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:47 +0000 (17:00 -0300)] 
x86: Fix THREAD_GSCOPE_RESET_FLAG build on clang

clang does not support __seg_fs in asm constraint.

Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
5 weeks agox86: Adapt "%v" usage on clang to emit VEX enconding
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:46 +0000 (17:00 -0300)] 
x86: Adapt "%v" usage on clang to emit VEX enconding

clang does not support the %v to select the AVX encoding, nor the '%d' asm
contrain, and for AVX build it requires all 3 arguments.

This patch add a new internal header, math-inline-asm.h, that adds
functions to abstract the inline asm required differences between
gcc and clang.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agox86: math: Use of __libgcc_cmp_return__ iff compiler supports it
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:44 +0000 (17:00 -0300)] 
x86: math: Use of __libgcc_cmp_return__ iff compiler supports it

clang does not support '__attribute__ ((mode (__libgcc_cmp_return__)))',
so use a more close related type instead fo the default 'int'.

5 weeks agostring: Check if attribute can declared after function declaration
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:42 +0000 (17:00 -0300)] 
string: Check if attribute can declared after function declaration

Some symbols that might be auto-generated by the compiler are redefined
to internal alias (for instance mempcpy to __mempcpy).  However, if fortify
is enabled, the fortify wrapper is define before the alias re-defined and
clang warns attribute declaration must precede definition.

Use an asm alias if compiler does not support it, instead of an
attribute.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agonss: Suppress clang -Wstring-plus-int on __nss_shlib_revision definition
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:41 +0000 (17:00 -0300)] 
nss: Suppress clang -Wstring-plus-int on __nss_shlib_revision definition

clang issues an warning that adding 'unsigned long' to a string does not
append to the string.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agostdlib: Remove mp_clz_tab.c
Adhemerval Zanella [Fri, 31 Oct 2025 20:00:34 +0000 (17:00 -0300)] 
stdlib: Remove mp_clz_tab.c

The count_leading_zeros is not used anymore, so there is no need to
provide the table for possible usage.  The hppa already provides
the compat symbol on libgcc-compat.c.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agohurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
Samuel Thibault [Sun, 9 Nov 2025 10:32:42 +0000 (11:32 +0100)] 
hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]

5 weeks agoRevert "hurd: Make rename refuse trailing slashes [BZ #32570]"
Samuel Thibault [Sat, 8 Nov 2025 23:06:38 +0000 (00:06 +0100)] 
Revert "hurd: Make rename refuse trailing slashes [BZ #32570]"

This reverts commit 2ae4ec56c2b18c46ef8220bcddac4303a4b6ef1c.

This introduced regressions, as rename should accept trailing slashes
for directories: BZ #33607, BZ #33608

This was rather fixed on the server side:
https://cgit.git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=e34000cb395a135dd2ad5c13e6f6d4c5c1006389

5 weeks agoAdd missing $(rpath-link) to elf/ld.so --library-path
Samuel Thibault [Sat, 8 Nov 2025 20:47:25 +0000 (21:47 +0100)] 
Add missing $(rpath-link) to elf/ld.so --library-path

This is notably needed for GNU/Hurd's libmachuser.so and libhurduser.so.

5 weeks agoAdd missing $(rpath-link) to /elf/ld.so --library-path
Samuel Thibault [Sat, 8 Nov 2025 16:44:05 +0000 (17:44 +0100)] 
Add missing $(rpath-link) to /elf/ld.so --library-path

This is notably needed for GNU/Hurd's libmachuser.so and libhurduser.so.

5 weeks agonss: Add ERANGE testing to tst-nss-test4 (bug 33361)
Carlos O'Donell [Fri, 7 Nov 2025 14:46:10 +0000 (09:46 -0500)] 
nss: Add ERANGE testing to tst-nss-test4 (bug 33361)

This adds testing for the fix added in commit:
0fceed254559836b57ee05188deac649bc505d05
"nss: Group merge does not react to ERANGE during merge (bug 33361)"

The in-use group size is increased large enough to trigger ERANGE
for initial buffers and cause a retry.  The actualy size is
approximately twice that required to trigger the defect, though
any size larger than NSS_BUFLEN_GROUP triggers the defect.

Without the fix the group is not merged and the failure is detected,
but with the fix the ERANGE error is handled, buffers are enlarged
and subsequently correctly merged.

Tested with a/b testing before and after patching.
Tested on x86_64 with no regression.

Co-authored-by: Patsy Griffin <patsy@redhat.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
5 weeks agoaarch64: Remove $(aarch64-bti) check
Florian Weimer [Fri, 7 Nov 2025 11:29:09 +0000 (12:29 +0100)] 
aarch64: Remove $(aarch64-bti) check

The variable was removed in commit 2c421fc4302ecb729823ca442f9dfab9
("AArch64: Cleanup PAC and BTI"), so this Makefile fragment is
always excluded.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
5 weeks agoposix: Fix invalid flags test for p{write,read}v2
Yury Khrustalev [Thu, 6 Nov 2025 12:57:58 +0000 (12:57 +0000)] 
posix: Fix invalid flags test for p{write,read}v2

Two tests fail from time to time when a new flag is added for the
p{write,read}v2 functions in a new Linux kernel:

 - misc/tst-preadvwritev2
 - misc/tst-preadvwritev64v2

This disrupts when testing Glibc on a system with a newer kernel
and it seems we can try improve testing for invalid flags setting
all the bits that are not supposed to be supported (rather than
setting only the next unsupported bit).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agosupport: Exit on consistency check failure in resolv_response_add_name
Florian Weimer [Thu, 6 Nov 2025 13:49:21 +0000 (14:49 +0100)] 
support: Exit on consistency check failure in resolv_response_add_name

Using TEST_VERIFY (crname_target != crname) instructs some analysis
tools that crname_target == crname might hold.  Under this assumption,
they report a use-after-free for crname_target->offset below, caused
by the previous free (crname).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agoAArch64: Fix instability in AdvSIMD sinh
Joe Ramsay [Thu, 6 Nov 2025 18:29:33 +0000 (18:29 +0000)] 
AArch64: Fix instability in AdvSIMD sinh

Previously presence of special-cases in one lane could affect the
results in other lanes due to unconditional scalar fallback. The old
WANT_SIMD_EXCEPT option (which has never been enabled in libmvec) has
been removed from AOR, making it easier to spot and fix
this. No measured change in performance. This patch applies cleanly as
far back as 2.41, however there are conflicts with 2.40 where sinh was
first introduced.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoAArch64: Fix instability in AdvSIMD tan
Joe Ramsay [Thu, 6 Nov 2025 18:26:54 +0000 (18:26 +0000)] 
AArch64: Fix instability in AdvSIMD tan

Previously presence of special-cases in one lane could affect the
results in other lanes due to unconditional scalar fallback. The old
WANT_SIMD_EXCEPT option (which has never been enabled in libmvec) has
been removed from AOR, making it easier to spot and fix this. 4%
improvement in throughput with GCC 14 on Neoverse V1. This bug is
present as far back as 2.39 (where tan was first introduced).

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoAArch64: Optimise SVE scalar callbacks
Joe Ramsay [Thu, 6 Nov 2025 15:36:03 +0000 (15:36 +0000)] 
AArch64: Optimise SVE scalar callbacks

Instead of using SVE instructions to marshall special results into the
correct lane, just write the entire vector (and the predicate) to
memory, then use cheaper scalar operations.

Geomean speedup of 16% in special intervals on Neoverse with GCC 14.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agosupport: Fix FILE * leak in check_for_unshare_hints in test-container
Florian Weimer [Thu, 6 Nov 2025 13:33:22 +0000 (14:33 +0100)] 
support: Fix FILE * leak in check_for_unshare_hints in test-container

The file opened via fopen is never closed.

5 weeks agoi386: Simplify powl computation for small integral y [BZ #33586]
H.J. Lu [Sun, 2 Nov 2025 00:47:53 +0000 (08:47 +0800)] 
i386: Simplify powl computation for small integral y [BZ #33586]

On i386, tests added by

commit 1b657c53c21a100082b0855392e4cb40c9c43a87
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri Oct 10 20:21:13 2025 -0400

    Simplify powl computation for small integral y [BZ #33411]

exposed the same bug in i386 e_powl.S:

FAIL: math/test-float64x-pow
original exit status 1
testing _Float64x (without inline functions)
Failure: pow (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_downward (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_towardzero (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_upward (0x1p+8192, 0x1p+0): Exception "Overflow" set

FAIL: math/test-ldouble-pow
original exit status 1
testing long double (without inline functions)
Failure: pow (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_downward (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_towardzero (0x1p+8192, 0x1p+0): Exception "Overflow" set
Failure: pow_upward (0x1p+8192, 0x1p+0): Exception "Overflow" set

Port x86-64 e_powl.S fix to i386 e_powl.S.  This fixes BZ #33586.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
5 weeks agomath: Remove the SVID error handling from tgammaf
Adhemerval Zanella [Wed, 5 Nov 2025 11:10:01 +0000 (08:10 -0300)] 
math: Remove the SVID error handling from tgammaf

It improves latency for about 1.5% and throughput for about 2-4%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Remove the SVID error handling from lgammaf/lgammaf_r
Adhemerval Zanella [Wed, 5 Nov 2025 11:10:00 +0000 (08:10 -0300)] 
math: Remove the SVID error handling from lgammaf/lgammaf_r

It improves latency throughput for about 2%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoAdd FD_PIDFS_ROOT from Linux 6.17 to bits/fcntl-linux.h
Adhemerval Zanella [Fri, 3 Oct 2025 19:39:04 +0000 (16:39 -0300)] 
Add FD_PIDFS_ROOT from Linux 6.17 to bits/fcntl-linux.h

It was added by commit 3941e37f62fe2c3c8b8675c12183185f20450539

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agoAdd AT_EXECVE_CHECK from Linux 6.14 to bits/fcntl-linux.h
Adhemerval Zanella [Fri, 3 Oct 2025 19:39:03 +0000 (16:39 -0300)] 
Add AT_EXECVE_CHECK from Linux 6.14 to bits/fcntl-linux.h

It was added by commit a5874fde3c0884a33ed4145101052318c5e17c74

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agoAdd AT_HANDLE_CONNECTABLE from Linux 6.13 to bits/fcntl-linux.h
Adhemerval Zanella [Fri, 3 Oct 2025 19:39:02 +0000 (16:39 -0300)] 
Add AT_HANDLE_CONNECTABLE from Linux 6.13 to bits/fcntl-linux.h

It was added by commit c374196b2b9f4b803fccd59ed82f0712041e21e1.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agolinux: Update statx-generic.h with linux 6.16
Adhemerval Zanella [Fri, 3 Oct 2025 19:39:01 +0000 (16:39 -0300)] 
linux: Update statx-generic.h with linux 6.16

It adds the new fields on generic statx struct from Linux commit
5d894321c49e61379189b0ff605f316e39cbd1e9.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agolinux: Update statx-generic.h with linux 6.14
Adhemerval Zanella [Fri, 3 Oct 2025 19:39:00 +0000 (16:39 -0300)] 
linux: Update statx-generic.h with linux 6.14

It adds the new constant STATX_DIO_READ_ALIGN and related fields in
generic statx struct from Linux commit
7ed6cbe0f8caa6ee38a2dc8f1b925acb904cc01f.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agolinux: Add STATX_WRITE_ATOMIC/STATX_ATTR_WRITE_ATOMIC definitions to generic statx
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:59 +0000 (16:38 -0300)] 
linux: Add STATX_WRITE_ATOMIC/STATX_ATTR_WRITE_ATOMIC definitions to generic statx

The commit fc650bfd71081d26c1015d299827fb58a23a6b02 added
STATX_WRITE_ATOMIC/STATX_ATTR_WRITE_ATOMIC on the statx-generic.h
without updating the generic statx struct.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agolinux: Add STATX_SUBVOL definition to generic statx
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:58 +0000 (16:38 -0300)] 
linux: Add STATX_SUBVOL definition to generic statx

The commit bbb6a742c88b4a37c5410eceefbc9c94df815075 added
STATX_SUBVOL on the statx-generic.h without updating the
generic statx struct.

5 weeks agolinux: Add STATX_DOALIGN definition to generic statx
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:57 +0000 (16:38 -0300)] 
linux: Add STATX_DOALIGN definition to generic statx

The commit 07937809ac377f8ffb5bad3335194dd9a447922f added
STATX_MNT_ID_UNIQUE on the statx-generic.h without updating the
generic statx struct.

5 weeks agolinux: Add STATX_MNT_ID_UNIQUE definition to generic statx
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:56 +0000 (16:38 -0300)] 
linux: Add STATX_MNT_ID_UNIQUE definition to generic statx

The commit 88a2cf6c4bab6e94a65e9c0db8813709372e9180 added
STATX_MNT_ID_UNIQUE on the statx-generic.h without updating the
generic statx struct.

5 weeks agoUpdate syscall lists for Linux 6.17
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:55 +0000 (16:38 -0300)] 
Update syscall lists for Linux 6.17

Linux 6.16 adds no new syscalls, while Linux 6.17 adds file_getattr
and file_setattr (commit be7efb2d20d67f334a7de2aef77ae6c69367e646).
Update syscall-names.list and regenerate the arch-syscall.h headers
with build-many-glibcs.py update-syscalls.

5 weeks agoUpdate PIDFD_* constants for Linux 6.17
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:53 +0000 (16:38 -0300)] 
Update PIDFD_* constants for Linux 6.17

The pidfd interface was extended with:

  * PIDFD_GET_INFO and pidfd_info (along with related extra flags) to
    allow get information about the process without the need to parse
    /proc (commit cdda1f26e74ba, Linux 6.13).

  * PIDFD_SELF_{THREAD,THREAD_GROUP,SELF,SELF_PROCESS} to allow
    pidfd_send_signal refer to the own process or thread lead groups
    without the need of allocating a file descriptor (commit f08d0c3a71114,
    Linux 6.15).

  * PIDFD_INFO_COREDUMP that extends PIDFD_GET_INFO to obtain coredump
    information.

Linux uAPI header defines both PIDFD_SELF_THREAD and
PIDFD_SELF_THREAD_GROUP on linux/fcntl.h (since they reserve part of the
AT_* values), however for glibc I do not see any good reason to add pidfd
definitions on fcntl-linux.h.

The tst-pidfd.c is extended with some PIDFD_SELF_* tests and a new
‘tst-pidfd_getinfo.c’ test is added to check PIDFD_GET_INFO. The
PIDFD_INFO_COREDUMP tests would require very large and complex tests
that are already covered by kernel tests.

Checked on aarch64-linux-gnu and x86_64-linux-gnu on kernels 6.8 and
6.17.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 weeks agoUpdate kernel version to 6.17 in header constant tests
Adhemerval Zanella [Fri, 3 Oct 2025 19:38:52 +0000 (16:38 -0300)] 
Update kernel version to 6.17 in header constant tests

There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-sched-consts.py in Linux 6.17.

5 weeks agomath: Remove the SVID error handling from atan2f
Adhemerval Zanella [Tue, 4 Nov 2025 16:20:00 +0000 (13:20 -0300)] 
math: Remove the SVID error handling from atan2f

It improves latency for about 3-6% and throughput for about 5-12%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoAdd feature test macros for POSIX.1-2024.
Collin Funk [Fri, 23 May 2025 04:00:05 +0000 (21:00 -0700)] 
Add feature test macros for POSIX.1-2024.

* include/features.h (_POSIX_C_SOURCE): Document the value of 202405L
for POSIX.1-2024.  Set it to 202405L when _GNU_SOURCE or _DEFAULT_SOURCE
is defined.
(_XOPEN_SOURCE): Document the value of 800 for POSIX-1.2024.  Set it to
800 when _GNU_SOURCE is defined.
(__USE_XOPEN2K24, __USE_XOPEN2K24XSI): New internal macros.  Set them
when _POSIX_C_SOURCE is 202405L or greater and/or when _XOPEN_SOURCE is
800 or greater.
* manual/creature.texi (Feature Test Macros): Document the new values
for _POSIX_C_SOURCE and _XOPEN_SOURCE.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agoRename fromfp files in preparation for changing types for C23
Joseph Myers [Tue, 4 Nov 2025 23:41:35 +0000 (23:41 +0000)] 
Rename fromfp files in preparation for changing types for C23

As discussed in bug 28327, the fromfp functions changed type in C23
(compared to the version in TS 18661-1); they now return the same type
as the floating-point argument, instead of intmax_t / uintmax_t.

As with other such incompatible changes compared to the initial TS
18661 versions of interfaces (the types of totalorder functions, in
particular), it seems appropriate to support only the new version as
an API, not the old one (although many programs written for the old
API might in fact work wtih the new one as well).  Thus, the existing
implementations should become compat symbols.  They are sufficiently
different from how I'd expect to implement the new version that using
separate implementations in separate files is more convenient than
trying to share code, and directly sharing testcases would be
problematic as well.

Rename the existing fromfp implementation and test files to names
reflecting how they're intended to become compat symbols, so freeing
up the existing filenames for a subsequent implementation of the C23
versions of these functions (which is the point at which the existing
implementations would actually become compat symbols).

gen-fromfp-tests.py and gen-fromfp-tests-inputs are not renamed; I
think it will make sense to adapt the test generator to be able to
generate most tests for both versions of the functions (with extra
test inputs added that are only of interest with the C23 version).
The ldbl-opt/nldbl-* files are also not renamed; since those are for a
static only library, no compat versions are needed, and they'll just
have their contents changed when the C23 version is implemented.

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

6 weeks agoAdd C23 long_double_t, _FloatN_t
Joseph Myers [Tue, 4 Nov 2025 17:12:00 +0000 (17:12 +0000)] 
Add C23 long_double_t, _FloatN_t

C23 Annex H adds <math.h> typedefs long_double_t and _FloatN_t
(originally introduced in TS 18661-3), analogous to float_t and
double_t.  Add these typedefs to glibc.  (There are no _FloatNx_t
typedefs.)

C23 also slightly changes the rules for how such typedef names should
be defined, compared to the definition in TS 18661-3.  In both cases,
<TYPE>_t corresponds to the evaluation format for <TYPE>, as specified
by FLT_EVAL_METHOD (for which <math.h> uses glibc's internal
__GLIBC_FLT_EVAL_METHOD).  Specifically, each FLT_EVAL_METHOD value
corresponds to some type U (for example, 64 corresponds to U =
_Float64), and for types with exactly the same set of values as U, TS
18661-3 says expressions with those types are to be evaluated to the
range and precision of type U (so <TYPE>_t is defined to U), whereas
C23 only does that for types whose values are a strict subset of those
of type U (so <TYPE>_t is defined to <TYPE>).

As with other cases where semantics changed between TS 18661 and C23,
this patch only implements the newer version of the semantics
(including adjusting existing definitions of float_t and double_t as
needed).  The new semantics are contradictory between the main
standard and Annex H for the case of FLT_EVAL_METHOD == 2 and the
choice of double_t when double and long double have the same values
(the main standard says it's defined as long double in that case,
whereas Annex H would define it as double), which I've raised on the
WG14 reflector (but I think setting FLT_EVAL_METHOD == 2 when double
and long double have the same values is a fairly theoretical
combination of features); for now glibc follows the value in the main
standard in that case.

Note that I think all existing GCC targets supported by glibc only use
values -1, 0, 1, 2 or 16 for FLT_EVAL_METHOD (so most of the header
code is somewhat theoretical, though potentially relevant with other
compilers since the choice of FLT_EVAL_METHOD is only an API choice,
not an ABI one; it can vary with compiler options, and these typedefs
should not be used in ABIs).  The testcase (expanded to cover the new
typedefs) is really just repeating the same logic in a second place
(so all it really tests is that __GLIBC_FLT_EVAL_METHOD is consistent
with FLT_EVAL_METHOD).

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

6 weeks agoriscv: Add vector registers to __SYSCALL_CLOBBERS
Peter Bergner [Wed, 3 Sep 2025 19:26:03 +0000 (14:26 -0500)] 
riscv: Add vector registers to __SYSCALL_CLOBBERS

The Linux kernel ABI specifies that the vector registers are not preserved
across system calls, but the __SYSCALL_CLOBBERS macro doesn't mention them.
This could possibly lead to compilers trying to keep data in the vector
registers across the syscall leading to corruption.  Add the vector registers
to __SYSCALL_CLOBBERS when the vector extension is enabled.  If the vector
extension is enabled, then require GCC 15 or later and RVV 1.0 or later.

Fixes: 36960f0c76 ("RISC-V: Linux Syscall Interface")
Signed-off-by: Peter Bergner <bergner@tenstorrent.com>
6 weeks agoRegenerate charmap-kw.h and locfile-kw.h with gperf 3.3
Collin Funk [Tue, 4 Nov 2025 02:08:37 +0000 (18:08 -0800)] 
Regenerate charmap-kw.h and locfile-kw.h with gperf 3.3

In commit 970364dac00b38333e5b2d91c90d11e80141d265 we switched some
/*FALLTHROUGH*/ comments to [[fallthrough]] to avoid warnings with
Clang. However, since gperf emitted different output the buildbot
failed. The buildbot has been updated to use gperf 3.3 which will use
__attribute__ ((__fallthrough__)) where needed to avoid warnings [1].
This patch regenerates these files with the same version.

[1] https://sourceware.org/pipermail/libc-testresults/2025q4/014123.html

Reviewed-by: Mark Wielaard <mark@klomp.org>
6 weeks agomath: Remove the SVID error handling wrapper from sqrt
Adhemerval Zanella [Fri, 31 Oct 2025 16:08:56 +0000 (13:08 -0300)] 
math: Remove the SVID error handling wrapper from sqrt

i386 and m68k architectures should use math-use-builtins-sqrt.h rather
than relying on architecture-specific or inline assembly implementations.

The PowerPC optimization for PPC 601/603 (30 years old) is removed.

Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
6 weeks agomath: Remove the SVID error handling from sinhf
Adhemerval Zanella [Fri, 31 Oct 2025 16:08:54 +0000 (13:08 -0300)] 
math: Remove the SVID error handling from sinhf

It improves latency for about 3-10% and throughput for about 5-15%.

Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
6 weeks agomath: Remove the SVID error handling from remainder
Adhemerval Zanella [Fri, 31 Oct 2025 16:08:51 +0000 (13:08 -0300)] 
math: Remove the SVID error handling from remainder

The optimized i386 version is faster than the generic one, and
gcc implements it through the builtin. This optimization enables
us to migrate the implementation to a C version.  The performance
on a Zen3 chip is similar to the SVID one.

The m68k provided an optimized version through __m81_u(remainderf)
(mathimpl.h), and gcc does not implement it through a builtin
(different than i386).

Performance improves a bit on x86_64 (Zen3, gcc 15.2.1):

reciprocal-throughput           input    master   NO-SVID  improvement
x86_64                     subnormals   18.8522   16.2506       13.80%
x86_64                         normal  421.8260  403.9270        4.24%
x86_64                 close-exponent   21.0579   18.7642       10.89%
i686                       subnormals   21.3443   21.4229       -0.37%
i686                           normal  525.8380   538.807       -2.47%
i686                   close-exponent   21.6589   21.7983       -0.64%

Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
6 weeks agomath: Remove the SVID error handling from remainderf
Adhemerval Zanella [Fri, 31 Oct 2025 16:08:50 +0000 (13:08 -0300)] 
math: Remove the SVID error handling from remainderf

The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin.  This optimization enables us to
migrate the implementation to a C version.  The performance on a Zen3
chip is similar to the SVID one.

The m68k provided an optimized version through __m81_u(remainderf)
(mathimpl.h), and gcc does not implement it through a builtin (different
than i386).

Performance improves a bit on x86_64 (Zen3, gcc 15.2.1):

reciprocal-throughput          input   master  NO-SVID  improvement
x86_64                    subnormals  17.5349  15.6125       10.96%
x86_64                        normal  53.8134  52.5754        2.30%
x86_64                close-exponent  20.0211  18.6656        6.77%
i686                      subnormals  21.8105  20.1856        7.45%
i686                          normal  73.1945  71.2199        2.70%
i686                  close-exponent  22.2141   20.331        8.48%

Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>