]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
2 weeks agoiconvdata: Fix clang -Wstring-plus-int clang warning
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:50 +0000 (16:12 -0300)] 
iconvdata: Fix clang -Wstring-plus-int clang warning

clang issues an warning adding '{unsigned} int' to a string does not
append to the string.

Use array indexes instead of string addition (it is simpler than
add a supress warning).

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoelf: Fix clang -Wstring-plus-int on rtld.c
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:48 +0000 (16:12 -0300)] 
elf: Fix clang -Wstring-plus-int on rtld.c

clang issues an warning adding 'const unsigned char' to a string
does not append to the string.

Use array indexes instead of string addition (it is simpler than
add a warning suppression).

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agosunrpc: Suppress clang -Wgnu-variable-sized-type-not-at-end warning on struct cmessage
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:47 +0000 (16:12 -0300)] 
sunrpc: Suppress clang -Wgnu-variable-sized-type-not-at-end warning on struct cmessage

clang issues:

svc_unix.c:318:18: error: field 'cmsg' with variable sized type 'struct cmsghdr' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
  318 |   struct cmsghdr cmsg;
      |                  ^

The __msgread explicitly expects that 'struct ucred' is after the 'cmsg',
so suppress the warning.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agonptl: Fix Wincompatible-pointer-types on clang
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:41 +0000 (16:12 -0300)] 
nptl: Fix Wincompatible-pointer-types on clang

clang 18 issues:

pthread_join_common.c:32:3: error: incompatible pointer types passing 'struct pthread **' to parameter of type 'void **' [-Werror,-Wincompatible-pointer-types]
   32 |   atomic_compare_exchange_weak_acquire (&arg, &self, NULL);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/atomic.h:188:39: note: expanded from macro 'atomic_compare_exchange_weak_acquire'
  188 |   __atomic_compare_exchange_n ((mem), (expected), (desired), 1,

Use a void * type instead.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoSuppress -Wmaybe-uninitialized only for gcc
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:40 +0000 (16:12 -0300)] 
Suppress -Wmaybe-uninitialized only for gcc

The warning is not supported by clang.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoconfigure: Use -Wno-maybe-uninitialized iff compiler supports it
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:39 +0000 (16:12 -0300)] 
configure: Use -Wno-maybe-uninitialized iff compiler supports it

clang does not support the flag.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoDisable __USE_EXTERN_INLINES for clang
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:38 +0000 (16:12 -0300)] 
Disable __USE_EXTERN_INLINES for clang

clang does not allow to redefine attributes after function declaration.
Although it work for external usage, its breaks the build for internal
symbol that glibc provides as optimization (for instance bsearch
with stdlib-bsearch.h or __cmsg_nxthdr).

Disable such optimization for clang while building glibc.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agomalloc: Do not call madvise if heap's oldsize >= THP size
Dev Jain [Fri, 17 Oct 2025 14:18:43 +0000 (19:48 +0530)] 
malloc: Do not call madvise if heap's oldsize >= THP size

Linux handles virtual memory in Virtual Memory Areas (VMAs). The
madvise(MADV_HUGEPAGE) call works on a VMA granularity, which sets the
VM_HUGEPAGE flag on the VMA. This flag is invariant of the mprotect()
syscall which is used in growing the secondary heaps. Therefore, we
need to call madvise() only when we are sure that VM_HUGEPAGE was not
previously set, which is only in the case when h->size < mp_.thp_pagesize.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agomicroblaze: fix __syscall_cancel_arch (BZ 33547)
Luc Michel [Fri, 17 Oct 2025 09:27:12 +0000 (11:27 +0200)] 
microblaze: fix __syscall_cancel_arch (BZ 33547)

The __syscall_cancel_arch function has an epilogue that does not match
the prologue. The stack is not used and the return address still lies in
r15 when reaching the epilogue. Fix the epilogue by simply returning
from the function.

Signed-off-by: Luc Michel <luc.michel@amd.com>
Tested-by: gopi@sankhya.com
Reviewed-by: Neal Frager <neal.frager@amd.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agolocale: Fix implicit conversion on collate_finish
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:49 +0000 (16:12 -0300)] 
locale: Fix implicit conversion on collate_finish

Clang issues:

programs/ld-collate.c:1824:55: error: implicit conversion from 'unsigned
long' to 'unsigned int' changes value from 18446744073709551615 to
4294967295 [-Werror,-Wconstant-conversion]
  collate->undefined.used_in_level = need_undefined ? ~0ul : 0;
                                   ~                  ^~~~

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoposix: Only enable -Wmaybe-uninitialized suppression on gcc
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:26 +0000 (16:13 -0300)] 
posix: Only enable -Wmaybe-uninitialized suppression on gcc

clang does not support this option.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agomalloc: Use INT_ADD_OVERFLOW instead of __builtin_add_overflow_p
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:25 +0000 (16:13 -0300)] 
malloc: Use INT_ADD_OVERFLOW instead of __builtin_add_overflow_p

clang does not support the __builtin_*_overflow_p builtins, on gcc
the macros will call __builtin_*_overflow_p.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoAdjust stdint for clang-20
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:21 +0000 (16:13 -0300)] 
Adjust stdint for clang-20

clang 20 adds both __INT64_C and __UINT64_C as builtins, but different
than gcc it does not undef them in its stdint wrapper.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoBuild glibc with -ftrapping-math
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:18 +0000 (16:13 -0300)] 
Build glibc with -ftrapping-math

GCC enables it by default, clang in the other hand sets -fno-trapping-math.
This is required to fix some math and stdlib tests that explicit raises
floating point exceptions:

math/test-double-canonicalize.out
testing double (without inline functions)
Failure: canonicalize (max_value): Exception "Overflow" set
Failure: canonicalize (max_value): Exception "Inexact" set
Failure: canonicalize (-max_value): Exception "Overflow" set
Failure: canonicalize (-max_value): Exception "Inexact" set
Failure: canonicalize_downward (max_value): Exception "Overflow" set
Failure: canonicalize_downward (max_value): Exception "Inexact" set
Failure: canonicalize_downward (-max_value): Exception "Overflow" set
Failure: canonicalize_downward (-max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (max_value): Exception "Inexact" set
Failure: canonicalize_towardzero (-max_value): Exception "Overflow" set
Failure: canonicalize_towardzero (-max_value): Exception "Inexact" set
Failure: canonicalize_upward (max_value): Exception "Overflow" set
Failure: canonicalize_upward (max_value): Exception "Inexact" set
Failure: canonicalize_upward (-max_value): Exception "Overflow" set
Failure: canonicalize_upward (-max_value): Exception "Inexact" set

test-float-catanh.out
testing float (without inline functions)
Failure: Real part of: catanh (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_downward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_towardzero (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (-0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 - 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0x1.000002p+0 + 0x8p-152 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 - 0x4p-128 i): Exception "Underflow" set
Failure: Real part of: catanh_upward (0xf.fffffp-4 + 0x4p-128 i): Exception "Underflow" set

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agolinux: Fix function point cast on vDSO handling
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:16 +0000 (16:13 -0300)] 
linux: Fix function point cast on vDSO handling

There is no need to cast to avoid, both pointer already have the
expected type.

It fixes the clang -Wpointer-type-mismatch error:

../sysdeps/unix/sysv/linux/gettimeofday.c:43:6: error: pointer type mismatch ('int (*)(struct timeval *, void *)' and 'void *') [-Werror,-Wpointer-type-mismatch]
   41 | libc_ifunc (__gettimeofday,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |             GLRO(dl_vdso_gettimeofday) != NULL
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |             ? VDSO_IFUNC_RET (GLRO(dl_vdso_gettimeofday))
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   44 |             : (void*) __gettimeofday_syscall)
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:789:53: note: expanded from macro 'libc_ifunc'
  789 | #define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
      |                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:705:34: note: expanded from macro '__ifunc'
  705 |   __ifunc_args (type_name, name, expr, init, arg)
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./../include/libc-symbols.h:677:38: note: expanded from macro '__ifunc_args'
  677 |   __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__);  \
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:667:33: note: expanded from macro '__ifunc_resolver'
  667 |     __typeof (type_name) *res = expr;                                   \
      |                                 ^~~~

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoelf: Only define _dl_tls_allocate_active for SHARED
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:15 +0000 (16:13 -0300)] 
elf: Only define _dl_tls_allocate_active for SHARED

clang issues:

dl-tls.c:108:1: error: unused function '_dl_tls_allocate_active' [-Werror,-Wunused-function]
  108 | _dl_tls_allocate_active (void)
      | ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoFix -Wno-ignored-attributes configure check
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:13 +0000 (16:13 -0300)] 
Fix -Wno-ignored-attributes configure check

The configure check always fail with clang:

conftest.c:5:58: error: expected string literal as argument of 'alias' attribute
    5 | extern __typeof (__foo) foo __attribute__ ((weak, alias (__foo)));
      |                                                          ^
conftest.c:6:58: error: expected string literal as argument of 'alias' attribute
    6 | extern __typeof (__foo) bar __attribute__ ((weak, alias (foo)));
      |                                                          ^

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoaarch64: Fix gcs linker flags
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:11 +0000 (16:13 -0300)] 
aarch64: Fix gcs linker flags

clang does not work by using whitespace for defining the -z option:

$ make test t=misc/tst-gcs-disabled
[...]
clang: error: no such file or directory: 'gcs=always'

Use the usual comma separate way.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agoposix: Defined _POSIX_VDISABLE as integer literal
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:58 +0000 (16:12 -0300)] 
posix: Defined _POSIX_VDISABLE as integer literal

The constant should be used with c_cc, which for all supported ABIs
is defined as unsigned char.  By using it as literar char constant,
clang triggers an error when compared with signal literal on ABIs that
define 'char' as unsigned.

On aarch64, clang shows:

  ../sysdeps/posix/fpathconf.c:118:21: error: right side of operator
  converted from negative value to unsigned: -1 to 18446744073709551615
  [-Werror]
  #if _POSIX_VDISABLE == -1
    ~~~~~~~~~~~~~~~ ^  ~~

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoiconvdata: Remove use of GNU old-style field designator extension
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:51 +0000 (16:12 -0300)] 
iconvdata: Remove use of GNU old-style field designator extension

Use the C99 syntax instead.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agosunrpc: Remove extra parenthesis on comparison
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:46 +0000 (16:12 -0300)] 
sunrpc: Remove extra parenthesis on comparison

clang issues:

key_call.c:459:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
  459 |   if ((kcp->client == (CLIENT *) NULL))

Instead of suppress the warning, just use the more usual comparison style.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agostdlib: Remove -Wmaybe-uninitialized supression on setenv.c
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:36 +0000 (16:12 -0300)] 
stdlib: Remove -Wmaybe-uninitialized supression on setenv.c

It is not required on current supported gcc.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2 weeks agoMake <inttypes.h> printf macros narrow arguments (bug 31470)
Joseph Myers [Mon, 20 Oct 2025 12:44:40 +0000 (12:44 +0000)] 
Make <inttypes.h> printf macros narrow arguments (bug 31470)

A late change in C23, the resolution to CD2 comment GB-108, specified
that <inttypes.h> macros such as PRId8 expand to formats such that,
when an argument is passed in the promoted type that isn't
representable in the original type such as int8_t corresponding to the
format, it gets converted to that type before printing.  (Previously,
the proper handling of such arguments was unclear; the case of direct
use of formats such as %hhd was clarified earlier in C23 development,
and had been fixed in glibc in 2006.)  Implement the change to use
formats such as "hhd" for the affected macros, with associated tests.

Tested for x86_64 and x86.

3 weeks agoAArch64: Use math-use-builtins for roundeven(f)/lrint(f)/lround(f)
Wilco Dijkstra [Wed, 15 Oct 2025 16:38:03 +0000 (16:38 +0000)] 
AArch64: Use math-use-builtins for roundeven(f)/lrint(f)/lround(f)

Remove target implementations of roundeven(f)/lrint(f)/lround(f) and
use the math-use-builtins mechanism instead.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agomath: Add builtin support for (l)lround(f)
Wilco Dijkstra [Wed, 15 Oct 2025 16:39:54 +0000 (16:39 +0000)] 
math: Add builtin support for (l)lround(f)

Add builtin support for (l)lround(f) via the math-use-builtins
header mechanism.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agomalloc: Cleanup _int_memalign
Wilco Dijkstra [Thu, 2 Oct 2025 15:53:31 +0000 (15:53 +0000)] 
malloc: Cleanup _int_memalign

Cleanup _int_memalign. Simplify the logic. Add a seperate check
for mmap. Only release the tail chunk if it is at least MINSIZE.
Use the new mmap abstractions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoImplement C23 memalignment
Joseph Myers [Fri, 17 Oct 2025 16:56:59 +0000 (16:56 +0000)] 
Implement C23 memalignment

Add the C23 memalignment function (query the alignment of a pointer)
to glibc.

Given how simple this operation is, it would make sense for compilers
to inline calls to this function, but I'm treating that as a compiler
matter (compilers should add it as a built-in function) rather than
adding an inline version to glibc headers (although such an inline
version would be reasonable as well).  I've filed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122117 for this feature
in GCC.

Tested for x86_64 and x86.

3 weeks agomath: Use binary search on lgammaf slow path
Adhemerval Zanella [Fri, 10 Oct 2025 17:35:10 +0000 (14:35 -0300)] 
math: Use binary search on lgammaf slow path

And remove some unused entries of the fallback table.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agomath: Use stdbit.h instead of builtin in math_config.h
Adhemerval Zanella [Fri, 10 Oct 2025 16:16:33 +0000 (13:16 -0300)] 
math: Use stdbit.h instead of builtin in math_config.h

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agomath: Optimize fma call on log2pf1
Adhemerval Zanella [Fri, 10 Oct 2025 12:52:35 +0000 (09:52 -0300)] 
math: Optimize fma call on log2pf1

The fma is required only for x == -0x1.da285cp-5 in FE_TONEAREST
to provide correctly rounded results.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agomath: Optimize fma call on asinpif
Adhemerval Zanella [Fri, 10 Oct 2025 12:50:21 +0000 (09:50 -0300)] 
math: Optimize fma call on asinpif

The fma is required only for x == +/-0x1.6371e8p-4f in FE_TOWARDZERO
to provide correctly rounded results.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agomath: Remove erfcf fma usage
Adhemerval Zanella [Fri, 10 Oct 2025 17:49:23 +0000 (14:49 -0300)] 
math: Remove erfcf fma usage

The fma is not required to provide correctly rounded and it helps
on !__FP_FAST_FMA ISAs.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 weeks agomath: Remove asinhf fma usage
Adhemerval Zanella [Fri, 10 Oct 2025 17:49:21 +0000 (14:49 -0300)] 
math: Remove asinhf fma usage

The fma is not required to provide correctly rounded and it helps
on !__FP_FAST_FMA ISAs.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 weeks agomath: Optimize fma call on acospif
Adhemerval Zanella [Fri, 10 Oct 2025 17:49:20 +0000 (14:49 -0300)] 
math: Optimize fma call on acospif

The fma is required only for inputs less than 0x1.0fd288p-127.  Also
only add the extra check for !__FP_FAST_FMA targets.

Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 weeks agomath: Remove acoshf fma usage
Adhemerval Zanella [Fri, 10 Oct 2025 17:49:19 +0000 (14:49 -0300)] 
math: Remove acoshf fma usage

The fma is not strickly required to provide correctly rounded and
it helps on !__FP_FAST_FMA ABIs.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
3 weeks agomath: Update auto-libm-test-out-log2p1
Adhemerval Zanella [Mon, 13 Oct 2025 15:43:08 +0000 (12:43 -0300)] 
math: Update auto-libm-test-out-log2p1

The 079728391084 did not update log2p1 output with the newer values.

3 weeks agoaarch64: tests for SME
Yury Khrustalev [Fri, 26 Sep 2025 09:03:45 +0000 (10:03 +0100)] 
aarch64: tests for SME

This commit adds tests for the following use cases relevant to handing of
the SME state:

 - fork() and vfork()
 - clone() and clone3()
 - signal handler

While most cases are trivial, the case of clone3() is more complicated since
the clone3() symbol is not public in Glibc.

To avoid having to check all possible ways clone3() may be called via other
public functions (e.g. vfork() or pthread_create()), we put together a test
that links directly with clone3.o. All the existing functions that have calls
to clone3() may not actually use it, in which case the outcome of such tests
would be unexpected. Having a direct call to the clone3() symbol in the test
allows to check precisely what we need to test: that the __arm_za_disable()
function is indeed called and has the desired effect.

Linking to clone3.o also requires linking to __arm_za_disable.o that in
turn requires the _dl_hwcap2 hidden symbol which to provide in the test
and initialise it before using.

Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoaarch64: clear ZA state of SME before clone and clone3 syscalls
Yury Khrustalev [Thu, 25 Sep 2025 14:54:36 +0000 (15:54 +0100)] 
aarch64: clear ZA state of SME before clone and clone3 syscalls

This change adds a call to the __arm_za_disable() function immediately
before the SVC instruction inside clone() and clone3() wrappers. It also
adds a macro for inline clone() used in fork() and adds the same call to
the vfork implementation. This sets the ZA state of SME to "off" on return
from these functions (for both the child and the parent).

The __arm_za_disable() function is described in [1] (8.1.3). Note that
the internal Glibc name for this function is __libc_arm_za_disable().

When this change was originally proposed [2,3], it generated a long
discussion where several questions and concerns were raised. Here we
will address these concerns and explain why this change is useful and,
in fact, necessary.

In a nutshell, a C library that conforms to the AAPCS64 spec [1] (pertinent
to this change, mainly, the chapters 6.2 and 6.6), should have a call to the
__arm_za_disable() function in clone() and clone3() wrappers. The following
explains in detail why this is the case.

When we consider using the __arm_za_disable() function inside the clone()
and clone3() libc wrappers, we talk about the C library subroutines clone()
and clone3() rather than the syscalls with similar names. In the current
version of Glibc, clone() is public and clone3() is private, but it being
private is not pertinent to this discussion.

We will begin with stating that this change is NOT a bug fix for something
in the kernel. The requirement to call __arm_za_disable() does NOT come from
the kernel. It also is NOT needed to satisfy a contract between the kernel
and userspace. This is why it is not for the kernel documentation to describe
this requirement. This requirement is instead needed to satisfy a pure userspace
scheme outlined in [1] and to make sure that software that uses Glibc (or any
other C library that has correct handling of SME states (see below)) conforms
to [1] without having to unnecessarily become SME-aware thus losing portability.

To recap (see [1] (6.2)), SME extension defines SME state which is part of
processor state. Part of this SME state is ZA state that is necessary to
manage ZA storage register in the context of the ZA lazy saving scheme [1]
(6.6). This scheme exists because it would be challenging to handle ZA
storage of SME in either callee-saved or caller-saved manner.

There are 3 kinds of ZA state that are defined in terms of the PSTATE.ZA
bit and the TPIDR2_EL0 register (see [1] (6.6.3)):

- "off":       PSTATE.ZA == 0
- "active":    PSTATE.ZA == 1 TPIDR2_EL0 == null
- "dormant":   PSTATE.ZA == 1 TPIDR2_EL0 != null

As [1] (6.7.2) outlines, every subroutine has exactly one SME-interface
depending on the permitted ZA-states on entry and on normal return from
a call to this subroutine. Callers of a subroutine must know and respect
the ZA-interface of the subroutines they are using. Using a subroutine
in a way that is not permitted by its ZA-interface is undefined behaviour.

In particular, clone() and clone3() (the C library functions) have the
ZA-private interface. This means that the permitted ZA-states on entry
are "off" and "dormant" and that the permitted states on return are "off"
or "dormant" (but if and only if it was "dormant" on entry).

This means that both functions in question should correctly handle both
"off" and "dormant" ZA-states on entry. The conforming states on return
are "off" and "dormant" (if inbound state was already "dormant").

This change ensures that the ZA-state on return is always "off". Note,
that, in the context of clone() and clone3(), "on return" means a point
when execution resumes at certain address after transferring from clone()
or clone3(). For the caller (we may refer to it as "parent") this is the
return address in the link register where the RET instruction jumps. For
the "child", this is the target branch address.

So, the "off" state on return is permitted and conformant. Why can't we
retain the "dormant" state? In theory, we can, but we shouldn't, here is
why.

Every subroutine with a private-ZA interface, including clone() and clone3(),
must comply with the lazy saving scheme [1] (6.7.2). This puts additional
responsibility on a subroutine if ZA-state on return is "dormant" because
this state has special meaning. The "caller" (that is the place in code
where execution is transferred to, so this include both "parent" and "child")
may check the ZA-state and use it as per the spec of the "dormant" state that
is outlined in [1] (6.6.6 and 6.6.7).

Conforming to this would require more code inside of clone() and clone3()
which hardly is desirable.

For the return to "parent" this could be achieved in theory, but given that
neither clone() nor clone3() are supposed to be used in the middle of an
SME operation, if wouldn't be useful. For the "return" to "child" this
would be particularly difficult to achieve given the complexity of these
functions and their interfaces. Most importantly, it would be illegal
and somewhat meaningless to allow a "child" to start execution in the
"dormant" ZA-state because the very essence of the "dormant" state implies
that there is a place to return and that there is some outer context that
we are allowed to interact with.

To sum up, calling __arm_za_disable() to ensure the "off" ZA-state when the
execution resumes after a call to clone() or clone3() is correct and also
the most simple way to conform to [1].

Can there be situations when we can avoid calling __arm_za_disable()?

Calling __arm_za_disable() implies certain (sufficiently small) overhead,
so one might rightly ponder avoiding making a call to this function when
we can afford not to. The most trivial cases like this (e.g. when the
calling thread doesn't have access to SME or to the TPIDR2_EL0 register)
are already handled by this function (see [1] (8.1.3 and 8.1.2)). Reasoning
about other possible use cases would require making code inside clone() and
clone3() more complicated and it would defeat the point of trying to make
an optimisation of not calling __arm_za_disable().

Why can't the kernel do this instead?

The handling of SME state by the kernel is described in [4]. In short,
kernel must not impose a specific ZA-interface onto a userspace function.
Interaction with the kernel happens (among other thing) via system calls.
In Glibc many of the system calls (notably, including SYS_clone and
SYS_clone3) are used via wrappers, and the kernel has no control of them
and, moreover, it cannot dictate how these wrappers should behave because
it is simply outside of the kernel's remit.

However, in certain cases, the kernel may ensure that a "child" doesn't
start in an incorrect state. This is what is done by the recent change
included in 6.16 kernel [5]. This is not enough to ensure that code that
uses clone() and clone3() function conforms to [1] when it runs on a
system that provides SME, hence this change.

[1]: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst
[2]: https://inbox.sourceware.org/libc-alpha/20250522114828.2291047-1-yury.khrustalev@arm.com
[3]: https://inbox.sourceware.org/libc-alpha/20250609121407.3316070-1-yury.khrustalev@arm.com
[4]: https://www.kernel.org/doc/html/v6.16/arch/arm64/sme.html
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cde5c32db55740659fca6d56c09b88800d88fd29

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoaarch64: define macro for calling __libc_arm_za_disable
Yury Khrustalev [Thu, 25 Sep 2025 14:51:30 +0000 (15:51 +0100)] 
aarch64: define macro for calling __libc_arm_za_disable

A common sequence of instructions is used in several places
in assembly files, so define it in one place as an assembly
macro.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoreplace use of double by float [BZ#29326]
Paul Zimmermann [Fri, 10 Oct 2025 08:05:29 +0000 (10:05 +0200)] 
replace use of double by float [BZ#29326]

3 weeks agoposix: Avoid a stack overflow when glob is given many slashes [BZ #30635]
Collin Funk [Sun, 12 Oct 2025 02:01:05 +0000 (19:01 -0700)] 
posix: Avoid a stack overflow when glob is given many slashes [BZ #30635]

* posix/glob.c (__glob): Strip trailing slashes before the recursive
call, so it is not called for every slash in the pattern.
* posix/tst-glob-bz30635.c: Add two test cases that would previously
segmentation fault. The first test has many trailing slashes and the
second has many slashes following a wildcard character.
* posix/Makefile (tests): Add the new test.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agostring: Add tests for unique strerror and strsignal strings
Arjun Shankar [Mon, 13 Oct 2025 13:51:09 +0000 (15:51 +0200)] 
string: Add tests for unique strerror and strsignal strings

strerror, strsignal, and their variants should return unique strings for
each known (and, depending on the function, unknown) error/signal.  Add
tests to verify this for strerror, strerror_r (GNU and XSI compliant
variants), and strerror_l (for the C locale), strerrordesc_np,
strsignal, sigabbrev_np, and sigdescr_np.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Fix trivial code formatting erros in my last two commits
Uros Bizjak [Sun, 12 Oct 2025 15:59:16 +0000 (17:59 +0200)] 
x86: Fix trivial code formatting erros in my last two commits

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
3 weeks agoi386: Use __seg_gs qualifiers in PTR_{MANGLE,DEMANGLE}() macros
Uros Bizjak [Thu, 9 Oct 2025 18:44:59 +0000 (20:44 +0200)] 
i386: Use __seg_gs qualifiers in PTR_{MANGLE,DEMANGLE}() macros

Use __seg_gs named address space qualifiers in PTR_MANGLE() and
PTR_DEMANGLE() macros to access the pointer_guard field in the TCB.

This change allows the compiler to eliminate redundant reads of
the variable, reducing the number of reads from 105 to 94 and
decreasing the text size of the library by 280 bytes.

While at it, fix a few trivial whitespace issues as well

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agox86_64: Use __seg_fs qualifiers in PTR_{MANGLE,DEMANGLE}() macros
Uros Bizjak [Thu, 9 Oct 2025 18:44:17 +0000 (20:44 +0200)] 
x86_64: Use __seg_fs qualifiers in PTR_{MANGLE,DEMANGLE}() macros

Use __seg_fs named address space qualifiers in PTR_MANGLE() and
PTR_DEMANGLE() macros to access the pointer_guard field in the TCB.

This change allows the compiler to eliminate redundant reads of
the variable, reducing the number of reads from 98 to 89 and
decreasing the text size of the library by 512 bytes.

While at it, fix a few trivial whitespace issues as well.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoresolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]
Sergey Kolosov [Fri, 10 Oct 2025 15:15:27 +0000 (17:15 +0200)] 
resolv: Add tests for getaddrinfo returning EAI_AGAIN [BZ #16849]

This patch adds two tests that verify correct behavior of getaddrinfo
when DNS resolution fails with a temporary error. Both tests ensure
that getaddrinfo returns EAI_AGAIN in cases where no valid address can
be resolved due to network or resolver failure.

* tst-getaddrinfo-eai-again.c
  Runs inside the glibc test-container without any DNS server
  configured. The test performs queries using AF_INET, AF_INET6,
  and AF_UNSPEC and verifies that getaddrinfo returns EAI_AGAIN
  when resolution fails.

* tst-getaddrinfo-eai-again-timeout.c
  Runs outside of the container but uses the resolv_test framework
  to simulate network failures. The test covers two failure modes:
  - No response from the server (resolv_response_drop)
  - Zero-length reply from the server
  In both cases, getaddrinfo is expected to return EAI_AGAIN.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agomisc: Fix several typos
Yury Khrustalev [Fri, 10 Oct 2025 13:50:07 +0000 (14:50 +0100)] 
misc: Fix several typos

4 weeks agolibio: Add terminating NUL when the first character is EOF in getdelim [BZ #28038]
Collin Funk [Thu, 9 Oct 2025 03:10:44 +0000 (20:10 -0700)] 
libio: Add terminating NUL when the first character is EOF in getdelim [BZ #28038]

POSIX requires that the buffer used by getdelim/getline add a
terminating NUL whenever an EOF is read.

* libio/iogetdelim.c (__getdelim): Add a NUL byte when the first
__underflow is called.
* libio/tst-getdelim.c (do_test): Add a test case for the bug.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
4 weeks agoAlphabetize nss/Makefile
Andreas Schwab [Thu, 9 Oct 2025 07:40:28 +0000 (09:40 +0200)] 
Alphabetize nss/Makefile

4 weeks agoelf: Report when found libraries are rejected [BZ #25669]
Ben Boeckel [Wed, 1 Oct 2025 13:39:08 +0000 (09:39 -0400)] 
elf: Report when found libraries are rejected [BZ #25669]

When debugging library loading issues with `LD_DEBUG`, it can be
frustrating to see logs for files in a directory are searched, but the
target library is skipped over without any indication of why. Add
reporting to all paths which reject a library as `ENOENT`.

Originally created for minimum-OS version detection, but that has since
been removed in b46d250656 (Remove kernel version check, 2022-02-21).
The remaining codepaths are still useful.

Signed-off-by: Ben Boeckel <ben.boeckel@kitware.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agobenchtests: Improve fmod benchmark
Adhemerval Zanella [Sun, 5 Oct 2025 13:30:26 +0000 (10:30 -0300)] 
benchtests: Improve fmod benchmark

The gcc implements fmod as a built-in for x86, so disable it to
benchmark the C implementation.

Also, make fmod and fmodf use the workload directive to measure
the reciprocal throughput.

4 weeks agobenchtests: Add lgammaf_r benchmark
Adhemerval Zanella [Thu, 30 Jan 2025 16:28:57 +0000 (13:28 -0300)] 
benchtests: Add lgammaf_r benchmark

Random inputs in the range [-20.0,20.0].

4 weeks agomalloc: Do not call madvise if oldsize >= THP size
Dev Jain [Wed, 8 Oct 2025 12:47:12 +0000 (12:47 +0000)] 
malloc: Do not call madvise if oldsize >= THP size

Linux handles virtual memory in Virtual Memory Areas (VMAs). The
madvise(MADV_HUGEPAGE) call works on a VMA granularity, which sets the
VM_HUGEPAGE flag on the VMA. If this VMA or a portion of it is mremapped
to a different location, Linux will create a new VMA, which will have
the same flags as the old one. This implies that the VM_HUGEPAGE flag
will be retained. Therefore, if we can guarantee that the old VMA was
marked with VM_HUGEPAGE, then there is no need to call madvise_thp() in
mremap_chunk().

The old chunk comes from a heap or non-heap allocation, both of which
have already been enlightened for THP. This implies that, if THP is on,
and the size of the old chunk is greater than or equal to thp_pagesize,
the VMA to which this chunk belongs to, has the VM_HUGEPAGE flag set.
Hence in this case we can avoid invoking the madvise() syscall.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
4 weeks agomalloc: Improve mmap interface
Wilco Dijkstra [Wed, 1 Oct 2025 17:43:11 +0000 (17:43 +0000)] 
malloc: Improve mmap interface

Add mmap_set_chunk() to create a new chunk from an mmap block.
Remove set_mmap_is_hp() since it is done inside mmap_set_chunk().
Rename prev_size_mmap() to mmap_base_offset().  Cleanup comments.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
4 weeks agoatomic: Remove atomic_forced_read
Wilco Dijkstra [Fri, 3 Oct 2025 18:36:00 +0000 (18:36 +0000)] 
atomic: Remove atomic_forced_read

Remove the odd atomic_forced_read which is neither atomic nor forced.
Some uses are completely redundant, so simply remove them.  In other cases
the intended use is to force a memory ordering, so use acquire load for those.
In yet other cases their purpose is unclear, for example __nscd_cache_search
appears to allow concurrent accesses to the cache while it is being garbage
collected by another thread!  Use relaxed atomic loads here to block spills
from accidentally reloading memory that is being changed.

Passes regress on AArch64, OK for commit?

4 weeks agonss: use C locale for parsing nsswitch.conf (bug 33519)
Andreas Schwab [Wed, 8 Oct 2025 10:26:18 +0000 (12:26 +0200)] 
nss: use C locale for parsing nsswitch.conf (bug 33519)

The keywords in nsswitch.conf are ASCII-only, but some locales map ASCII
characters to non-ASCII characters in case conversion.

4 weeks agox86: Use typeof_member style in RSEQ area access expressions
Uros Bizjak [Wed, 1 Oct 2025 09:07:31 +0000 (11:07 +0200)] 
x86: Use typeof_member style in RSEQ area access expressions

Update RSEQ access macros to use `(struct rseq_area) {}.member`
in _Static_assert and __typeof expressions, instead of
RSEQ_SELF()->member.  This adopts the typeof_member style, avoiding
reliance on RSEQ_SELF for compile-time expressions.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agox86: Simplify RSEQ area access expressions
Uros Bizjak [Thu, 25 Sep 2025 08:08:11 +0000 (10:08 +0200)] 
x86: Simplify RSEQ area access expressions

Replace manual cast with a direct
`(struct rseq_area __seg_gs *)__rseq_offset` dereference to access
`member`.  This avoids redundant `offsetof(struct rseq_area, member)`
and improves readability while preserving semantics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agox86: Simplify stack and pointer guard macros
Uros Bizjak [Thu, 25 Sep 2025 07:50:13 +0000 (09:50 +0200)] 
x86: Simplify stack and pointer guard macros

Replace manual casts with a direct `(__tcbhead_t __seg_gs *)0`
dereferences for `stack_guard` and `pointer_guard`.  This makes
the macros more straightforward and removes the dependency on
<stdint.h>.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agox86: Simplify TCB access expressions
Uros Bizjak [Thu, 25 Sep 2025 07:42:15 +0000 (09:42 +0200)] 
x86: Simplify TCB access expressions

Replace manual cast with a direct `(__typeof(*descr) __seg_gs *)0`
dereference to access `member`.  This avoids redundant
`offsetof(struct pthread, member)` and improves readability while
preserving semantics.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agox86: Detect Intel Nova Lake Processor
Sunil K Pandey [Wed, 24 Sep 2025 16:38:17 +0000 (09:38 -0700)] 
x86: Detect Intel Nova Lake Processor

Detect Intel Nova Lake Processor and tune it similar to Intel Panther
Lake.  https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agox86: Detect Intel Wildcat Lake Processor
Sunil K Pandey [Tue, 7 Oct 2025 01:13:04 +0000 (18:13 -0700)] 
x86: Detect Intel Wildcat Lake Processor

Detect Intel Wildcat Lake Processor and tune it similar to Intel Panther
Lake.  https://cdrdv2.intel.com/v1/dl/getContent/671368 Section 1.2.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
4 weeks agoppc64le: Restore optimized strncmp for power10
Sachin Monga [Tue, 7 Oct 2025 08:14:04 +0000 (03:14 -0500)] 
ppc64le: Restore optimized strncmp for power10

This patch addresses the actual cause of CVE-2025-5745

The vector non-volatile registers are not used anymore for
32 byte load and comparison operation

Additionally, the assembler workaround used earlier for the
instruction lxvp is replaced with actual instruction.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Co-authored-by: Paul Murphy <paumurph@redhat.com>
4 weeks agoppc64le: Restore optimized strcmp for power10
Sachin Monga [Tue, 7 Oct 2025 08:17:00 +0000 (03:17 -0500)] 
ppc64le: Restore optimized strcmp for power10

This patch addresses the actual cause of CVE-2025-5702

The vector non-volatile registers are not used anymore for
32 byte load and comparison operation

Additionally, the assembler workaround used earlier for the
instruction lxvp is replaced with actual instruction.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Co-authored-by: Paul Murphy <paumurph@redhat.com>
4 weeks agomanual: check the correct variable in SIOCATMARK example [BZ #33093]
Collin Funk [Sat, 4 Oct 2025 07:52:57 +0000 (00:52 -0700)] 
manual: check the correct variable in SIOCATMARK example [BZ #33093]

* manual/socket.texi (Out-of-Band Data): Check the atmark variable which
is set by the ioctl instead of the undefined result variable.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agomanual: describe syscall numbers not supported via syscall()
Yury Khrustalev [Fri, 20 Jun 2025 12:37:34 +0000 (13:37 +0100)] 
manual: describe syscall numbers not supported via syscall()

The syscall() function allows to make system calls directly, however,
in the case of system calls that affect internal state of process or
thread, the caller would have to take care of extensive setup necessary
for the internals of Glibc to work correctly in the child threads. This
may make using syscall() with these syscall numbers impractical and
prone to undefined behaviour.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
4 weeks agomanual: fix some mistakes in the indices [BZ #24657]
Bruno Haible [Mon, 6 Oct 2025 04:01:49 +0000 (21:01 -0700)] 
manual: fix some mistakes in the indices [BZ #24657]

* manual/errno.texi (Error Messages): Add error_print_progname to the
variable index.
* manual/sysinfo.texi (Host Identification): Fix typo of the
getdomainname function.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
5 weeks agomanual: Fix missing reference to the mmap function [BZ #20473]
Collin Funk [Tue, 30 Sep 2025 03:14:24 +0000 (20:14 -0700)] 
manual: Fix missing reference to the mmap function [BZ #20473]

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoarm: Add ARM VFPv4 VFMA instruction support in fma/fmaf (BZ 15503)
Adhemerval Zanella [Tue, 23 Sep 2025 19:47:10 +0000 (19:47 +0000)] 
arm: Add ARM VFPv4 VFMA instruction support in fma/fmaf (BZ 15503)

It is enabled through math-use-builtins-fma.h if  glibc is built
for VPFv4 (__ARM_FEATURE_FMA predefined by GCC), or through IFUNC
(testing HWCAP_ARM_VFPv4) otherwise.

Checked on arm-linux-gnueabihf.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Optimize flt-32 remainder implementation
Adhemerval Zanella [Thu, 2 Oct 2025 11:55:47 +0000 (08:55 -0300)] 
math: Optimize flt-32 remainder implementation

With same micro-optimization done for the double variant:

  * Combine the |y| zero check.
  * Rework the check to adjust result and call fmod.
  * Remove one check after fmod.
  * Remove float-int-float roundtrip on return.

Also use math_config.h macros and indent the code.  The resulting
strategy is different in many places that I think requires a
different Copyright.

I see the following performance improvements using remainder benchtests
(using reciprocal-throughput metric):

Architecture     | Input           |   master |   patch  | Improvemnt
-----------------|-----------------|----------|-----------------------
x86_64           | subnormals      |  20.4176 |  19.6144 |      3.93%
x86_64           | normal          |  54.0939 |  52.2343 |      3.44%
x86_64           | close-exponent  |  23.9120 |  22.3768 |      6.42%
aarch64          | subnormals      |   9.2423 |   8.3825 |      9.30%
aarch64          | normal          |  30.5393 |   29.244 |      4.24%
aarch64          | close-exponent  |  15.5405 |  13.9256 |     10.39%

The aarch64 used as Neoverse-N1, gcc 15.1.1; while the x86_64 was
a AMD Ryzen 9 5900X, gcc 15.2.1.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomath: Optimize dbl-64 remainder implementation
Adhemerval Zanella [Thu, 2 Oct 2025 11:55:46 +0000 (08:55 -0300)] 
math: Optimize dbl-64 remainder implementation

The commit 34b9f8bc17 provides an optimized fmod implementation; use
the same strategy used for remainderf and implement the double variant
on top of fmod.

I see the following performance improvements using remainder benchtests
(using reciprocal-throughput metric):

Architecture     | Input           |   master |   patch  | Improvemnt
-----------------|-----------------|----------|-----------------------
x86_64           | subnormals      |  76.1345 |  21.5334 |     71.72%
x86_64           | normal          | 553.2670 | 426.5670 |     22.90%
x86_64           | close-exponent  |  30.5111 |  22.6893 |     25.64%
aarch64          | subnormals      |  26.0734 |   8.4876 |     67.45%
aarch64          | normal          | 205.2590 |  200.082 |      2.52%
aarch64          | close-exponent  |  13.8481 |  13.6663 |      1.31%

The aarch64 used as Neoverse-N1, gcc 15.1.1; while the x86_64 was
a AMD Ryzen 9 5900X, gcc 15.2.1.

This implementation also fixes the math/test-double-remainder issues
on alpha.

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agomalloc: Cleanup macros, asserts and sysmalloc_mmap_fallback
William Hunt [Fri, 3 Oct 2025 16:27:35 +0000 (16:27 +0000)] 
malloc: Cleanup macros, asserts and sysmalloc_mmap_fallback

Refactor malloc.c to remove dead code, create macros to abstract duplicated
code, and cleanup sysmalloc_mmap_fallback to remove logic not related to the
mmap call.

Change the return type of mmap_base to uintptr_t since this allows using
operations on the return value, and avoids casting in both calls in
mremap_chunk and munmap_chunk.

Cleanup sysmalloc_mmap_fallback. Remove unused parameters nb, oldsize
and av. Remove redundant overflow check and instead use size_t for all
parameters except extra_flags to prevent overflows. Move logic not concerned
with the mmap call itself outside the function after both calls to
sysmalloc_mmap_fallback are made; this means move code for naming the VMA
and marking the arena being extended as non-contiguous to the calling code to
be handled in the case that the mmap is successful. Calculate the fallback
size from nb to avoid modifying size after it has been set for MORECORE.

Remove unused noncontiguous macro.

Remove redundant assert for checking unreachable option for global_max_fast.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
5 weeks agomath: fix Wshift-overflow warning.
Collin Funk [Mon, 22 Sep 2025 05:25:46 +0000 (22:25 -0700)] 
math: fix Wshift-overflow warning.

When compiling on x86_64 with -Wshift-overflow=2 you can see the
following warning:

../sysdeps/ieee754/flt-32/math_config.h: In function ‘is_inf’:
../sysdeps/ieee754/flt-32/math_config.h:184:37: warning: result of ‘2139095040 << 1’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
  184 |   return (x << 1) == (EXPONENT_MASK << 1);
      |                                     ^~

This patch adjusts the definitions to use UINT32_C. This matches the
definitions in sysdeps/ieee754/dbl-64/math_config.h which use UINT64_C
for these definitions.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agotests-mbwc/tst_funcs.h: Fix typo
Alejandro Colomar [Sun, 14 Sep 2025 06:01:23 +0000 (08:01 +0200)] 
tests-mbwc/tst_funcs.h: Fix typo

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoshm-directory: Truncated struct member name length
Prasanna Paithankar [Thu, 4 Sep 2025 23:24:34 +0000 (04:54 +0530)] 
shm-directory: Truncated struct member name length

The struct shmdir_name in include/shm-directory.h has name field to
contains the full path of the POSIX IPC object (shm and sem).
The size was previously set to sizeof (SHMDIR) + 4 + NAME_MAX, where 4
bytes were reserved for the optional "sem." prefix.

This led to incorrect execution of the __shm_get_name function
in posix/shm-directory.c which is used accross in shm_[open/unlink] and
sem_[open/unlink] functions.

For shm_[open/unlink]:
This is because the name field was large enough to hold 268 characters
(255 + 4 + 9) instead of the maximum allowed 263 characters (255 + 9).
This caused the __shm_get_name to not throw ENAMETOOLONG error when the
name length exceeded NAME_MAX (255) upto 259 characters.

For sem_[open/unlink]:
Similarly, the __shm_get_name incorrectly returned success for names of
length 255 instead of 251 (255 - 4).

This was overlooked as finally these functions throw the correct
ENAMETOOLONG error; which was thrown by the openat syscall, which is
called later in the shm_* and sem_* functions.

This patch corrects the size of name field in struct shmdir_name to
sizeof (SHMDIR) + NAME_MAX. The __shm_get_name function return
ENAMETOOLONG if alloc_buffer_has_failed returns true (which only happens
when copy length > alloc_buffer_size (buffer)).

Relevant runtime monitoring were done in gdb to confirm the same.

Signed-off-by: Prasanna Paithankar <paithankarprasanna@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agobenchtests: Add remainderf benchtest
Adhemerval Zanella [Fri, 12 Sep 2025 16:32:00 +0000 (13:32 -0300)] 
benchtests: Add remainderf benchtest

The inputs are based on fmodf-inputs.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agobenchtests: Add remainder benchtest
Adhemerval Zanella [Fri, 12 Sep 2025 16:31:59 +0000 (13:31 -0300)] 
benchtests: Add remainder benchtest

The inputs are based on fmod-inputs.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoUse Linux 6.17 in build-many-glibcs.py
Joseph Myers [Wed, 1 Oct 2025 15:15:43 +0000 (15:15 +0000)] 
Use Linux 6.17 in build-many-glibcs.py

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

5 weeks agoAdd once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23
Joseph Myers [Wed, 1 Oct 2025 15:15:15 +0000 (15:15 +0000)] 
Add once_flag, ONCE_FLAG_INIT and call_once to stdlib.h for C23

C23 adds once_flag, ONCE_FLAG_INIT and call_once to stdlib.h (in C11
they were only in threads.h, in C23 they are in both headers; this
change came from N2840).  Implement this change, with a
bits/types/once_flag.h header for the common type and initializer
definitions.

Note that there's an omnibus bug (bug 33001) that covers more than
just these missing definitions.

This doesn't seem a significant enough feature to be worth mentioning
in NEWS.

ISO C is not concerned with whether functions are in libc or
libpthread, but POSIX links this to what header they are declared in,
so functions declared in stdlib.h are supposed to be in libc.
However, the current edition of POSIX is based on C17; hopefully Hurd
glibc will have completed the merge of libpthread into libc (in
particular, moving call_once) well before a future edition of POSIX
based on C23 (or a later version of ISO C) is released.

Tested for x86_64 and x86.

5 weeks agoImplement C23 memset_explicit (bug 32378)
Joseph Myers [Wed, 1 Oct 2025 15:14:09 +0000 (15:14 +0000)] 
Implement C23 memset_explicit (bug 32378)

Add the C23 memset_explicit function to glibc.  Everything here is
closely based on the approach taken for explicit_bzero.  This includes
the bits that relate to internal uses of explicit_bzero within glibc
(although we don't currently have any such internal uses of
memset_explicit), and also includes the nonnull attribute (when we
move to nonnull_if_nonzero for various functions following C2y, this
function should be included in that change).

The function is declared both for __USE_MISC and for __GLIBC_USE (ISOC23)
(so by default not just for compilers defaulting to C23 mode).

Tested for x86_64 and x86.

5 weeks agomanual: Fix missing declaration in inetcli example.
Collin Funk [Sun, 28 Sep 2025 22:36:32 +0000 (15:36 -0700)] 
manual: Fix missing declaration in inetcli example.

Previously this file failed to compile with the following errors:

    $ gcc manual/examples/inetcli.c
    manual/examples/inetcli.c: In function ‘write_to_server’:
    manual/examples/inetcli.c:36:37: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
       36 |   nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
          |                                     ^~~~~~
    manual/examples/inetcli.c:26:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
       25 | #include <netdb.h>
      +++ |+#include <string.h>
       26 |
    manual/examples/inetcli.c:36:37: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
       36 |   nbytes = write (filedes, MESSAGE, strlen (MESSAGE) + 1);
          |                                     ^~~~~~
    manual/examples/inetcli.c:36:37: note: include ‘<string.h>’ or provide a declaration of ‘strlen’

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix compiler errors in inetsrv example.
Collin Funk [Sun, 28 Sep 2025 22:34:20 +0000 (15:34 -0700)] 
manual: Fix compiler errors in inetsrv example.

Previously this file failed to compile with the following errors:

    $ gcc manual/examples/inetsrv.c
    manual/examples/inetsrv.c: In function ‘main’:
    manual/examples/inetsrv.c:97:31: error: passing argument 3 of ‘accept’ from incompatible pointer type [-Wincompatible-pointer-types]
       97 |                               &size);
          |                               ^~~~~
          |                               |
          |                               size_t * {aka long unsigned int *}
    In file included from manual/examples/inetsrv.c:23:
    /usr/include/sys/socket.h:307:42: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’}
      307 |                    socklen_t *__restrict __addr_len);
          |                    ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
    manual/examples/inetsrv.c:105:26: error: implicit declaration of function ‘inet_ntoa’ [-Wimplicit-function-declaration]
      105 |                          inet_ntoa (clientname.sin_addr),

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix compiler errors in filesrv example.
Collin Funk [Sun, 28 Sep 2025 22:29:51 +0000 (15:29 -0700)] 
manual: Fix compiler errors in filesrv example.

Previously this file failed to compile with the following errors:

    $ gcc manual/examples/filesrv.c
    manual/examples/filesrv.c: In function ‘main’:
    manual/examples/filesrv.c:37:3: error: implicit declaration of function ‘unlink’ [-Wimplicit-function-declaration]
       37 |   unlink (SERVER);
          |   ^~~~~~
    manual/examples/filesrv.c:40:10: error: implicit declaration of function ‘make_named_socket’ [-Wimplicit-function-declaration]
       40 |   sock = make_named_socket (SERVER);
          |          ^~~~~~~~~~~~~~~~~
    manual/examples/filesrv.c:46:54: error: passing argument 6 of ‘recvfrom’ from incompatible pointer type [-Wincompatible-pointer-types]
       46 |                          (struct sockaddr *) & name, &size);
          |                                                      ^~~~~
          |                                                      |
          |                                                      size_t * {aka long unsigned int *}
    In file included from manual/examples/filesrv.c:21:
    /usr/include/sys/socket.h:165:48: note: expected ‘socklen_t * restrict’ {aka ‘unsigned int * restrict’} but argument is of type ‘size_t *’ {aka ‘long unsigned int *’}
      165 |                          socklen_t *__restrict __addr_len);
          |                          ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

This patch fixes the missing declaration for unlink and uses
'socklen_t *' for the fourth argument of recv from. The
make_named_socket function is defined in the manual.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing declaration in select example.
Collin Funk [Sun, 28 Sep 2025 22:26:55 +0000 (15:26 -0700)] 
manual: Fix missing declaration in select example.

Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/select.c
    manual/examples/select.c: In function ‘input_timeout’:
    manual/examples/select.c:44:10: error: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Wimplicit-function-declaration]
       44 |   return TEMP_FAILURE_RETRY (select (FD_SETSIZE,
          |          ^~~~~~~~~~~~~~~~~~

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing declaration in setjmp example.
Collin Funk [Sun, 28 Sep 2025 22:23:16 +0000 (15:23 -0700)] 
manual: Fix missing declaration in setjmp example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/setjmp.c
    manual/examples/setjmp.c: In function ‘main’:
    manual/examples/setjmp.c:37:7: error: implicit declaration of function ‘do_command’ [-Wimplicit-function-declaration]
       37 |       do_command ();
          |       ^~~~~~~~~~
    manual/examples/setjmp.c: At top level:
    manual/examples/setjmp.c:42:1: warning: conflicting types for ‘do_command’; have ‘void(void)’
       42 | do_command (void)
          | ^~~~~~~~~~
    manual/examples/setjmp.c:37:7: note: previous implicit declaration of ‘do_command’ with type ‘void(void)’
       37 |       do_command ();
          |       ^~~~~~~~~~

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: fix missing include in sigh1 example.
Collin Funk [Sun, 28 Sep 2025 22:20:37 +0000 (15:20 -0700)] 
manual: fix missing include in sigh1 example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/sigh1.c
    manual/examples/sigh1.c: In function ‘main’:
    manual/examples/sigh1.c:46:3: error: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration]
       46 |   alarm (2);
          |   ^~~~~

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing declaration in strdupa example.
Collin Funk [Sun, 28 Sep 2025 22:17:17 +0000 (15:17 -0700)] 
manual: Fix missing declaration in strdupa example.

Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/strdupa.c
    manual/examples/strdupa.c: In function ‘main’:
    manual/examples/strdupa.c:27:19: error: implicit declaration of function ‘strdupa’; did you mean ‘strdup’? [-Wimplicit-function-declaration]
       27 |   char *wr_path = strdupa (path);
          |                   ^~~~~~~
          |                   strdup
    manual/examples/strdupa.c:27:19: error: initialization of ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Allow getsubopt example to compile with GCC 15.
Collin Funk [Sun, 28 Sep 2025 22:10:52 +0000 (15:10 -0700)] 
manual: Allow getsubopt example to compile with GCC 15.

GCC 15 turned -Wincompatible-pointer-types into a compiler error instead
of a warning by default. This patch prevents the following error:

    $ gcc manual/examples/subopt.c
    manual/examples/subopt.c: In function ‘main’:
    manual/examples/subopt.c:64:40: error: passing argument 2 of ‘getsubopt’ from incompatible pointer type [-Wincompatible-pointer-types]
       64 |           switch (getsubopt (&subopts, mount_opts, &value))
          |                                        ^~~~~~~~~~
          |                                        |
          |                                        const char **
    In file included from manual/examples/subopt.c:19:
    /usr/include/stdlib.h:1100:47: note: expected ‘char * const* restrict’ but argument is of type ‘const char **’
     1100 |                       char *const *__restrict __tokens,
          |                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing include in memopen example.
Collin Funk [Sun, 28 Sep 2025 22:07:59 +0000 (15:07 -0700)] 
manual: Fix missing include in memopen example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/memopen.c
    manual/examples/memopen.c: In function ‘main’:
    manual/examples/memopen.c:28:30: error: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
       28 |   stream = fmemopen (buffer, strlen (buffer), "r");
          |                              ^~~~~~
    manual/examples/memopen.c:19:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
       18 | #include <stdio.h>
      +++ |+#include <string.h>
       19 |
    manual/examples/memopen.c:28:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
       28 |   stream = fmemopen (buffer, strlen (buffer), "r");
          |                              ^~~~~~
    manual/examples/memopen.c:28:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing declaration in twalk example.
Collin Funk [Sun, 28 Sep 2025 22:05:40 +0000 (15:05 -0700)] 
manual: Fix missing declaration in twalk example.

Without _GNU_SOURCE defined this file fails to compile with the
following error:

    $ gcc manual/examples/twalk.c
    manual/examples/twalk.c: In function ‘twalk’:
    manual/examples/twalk.c:55:3: error: implicit declaration of function ‘twalk_r’; did you mean ‘twalk’? [-Wimplicit-function-declaration]
       55 |   twalk_r (root, twalk_with_twalk_r_action, &closure);
          |   ^~~~~~~
          |   twalk

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing include in sigusr example.
Collin Funk [Sun, 28 Sep 2025 22:03:06 +0000 (15:03 -0700)] 
manual: Fix missing include in sigusr example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/sigusr.c
    manual/examples/sigusr.c: In function ‘child_function’:
    manual/examples/sigusr.c:46:3: error: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
       46 |   exit (0);
          |   ^~~~
    manual/examples/sigusr.c:23:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
       22 | #include <unistd.h>
      +++ |+#include <stdlib.h>
       23 | /*@end group*/
    manual/examples/sigusr.c:46:3: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
       46 |   exit (0);
          |   ^~~~
    manual/examples/sigusr.c:46:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing includes in the mbstouwcs example.
Collin Funk [Sun, 28 Sep 2025 21:59:36 +0000 (14:59 -0700)] 
manual: Fix missing includes in the mbstouwcs example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/mbstouwcs.c
    manual/examples/mbstouwcs.c: In function ‘mbstouwcs’:
    manual/examples/mbstouwcs.c:34:11: error: ‘errno’ undeclared (first use in this function)
       34 |           errno = EILSEQ;
          |           ^~~~~
    manual/examples/mbstouwcs.c:5:1: note: ‘errno’ is defined in header ‘<errno.h>’; this is probably fixable by adding ‘#include <errno.h>’
        4 | #include <wchar.h>
      +++ |+#include <errno.h>
        5 |
    manual/examples/mbstouwcs.c:34:11: note: each undeclared identifier is reported only once for each function it appears in
       34 |           errno = EILSEQ;
          |           ^~~~~
    manual/examples/mbstouwcs.c:34:19: error: ‘EILSEQ’ undeclared (first use in this function)
       34 |           errno = EILSEQ;
          |                   ^~~~~~
    manual/examples/mbstouwcs.c:47:20: error: implicit declaration of function ‘towupper’ [-Wimplicit-function-declaration]
       47 |           *wcp++ = towupper (wc);
          |                    ^~~~~~~~
    manual/examples/mbstouwcs.c:5:1: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’
        4 | #include <wchar.h>
      +++ |+#include <wctype.h>
        5 |
    manual/examples/mbstouwcs.c:47:20: warning: incompatible implicit declaration of built-in function ‘towupper’ [-Wbuiltin-declaration-mismatch]
       47 |           *wcp++ = towupper (wc);
          |                    ^~~~~~~~
    manual/examples/mbstouwcs.c:47:20: note: include ‘<wctype.h>’ or provide a declaration of ‘towupper’

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agomanual: Fix missing include in group and user database example.
Collin Funk [Sun, 28 Sep 2025 21:54:53 +0000 (14:54 -0700)] 
manual: Fix missing include in group and user database example.

Previously this file would fail to compile with the following error:

    $ gcc manual/examples/db.c
    db.c: In function ‘main’:
    db.c:37:7: error: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
       37 |       printf ("Couldn't find out about user %d.\n", (int) me);
          |       ^~~~~~
    db.c:23:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
       22 | #include <stdlib.h>
      +++ |+#include <stdio.h>
       23 |
    db.c:37:7: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
       37 |       printf ("Couldn't find out about user %d.\n", (int) me);
          |       ^~~~~~
    db.c:37:7: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
    db.c:42:3: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
       42 |   printf ("I am %s.\n", my_passwd->pw_gecos);
          |   ^~~~~~
    db.c:42:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
5 weeks agoLinux: Fix tst-copy_file_range-large test on recent kernels [BZ #33498]
Collin Funk [Sun, 28 Sep 2025 00:28:47 +0000 (17:28 -0700)] 
Linux: Fix tst-copy_file_range-large test on recent kernels [BZ #33498]

Instead of a negative return value the fixed FUSE copy_file_range will
silently truncate the size to UINT_MAX & PAGE_MASK [1]. Allow that value
to be returned as well.

[1] https://github.com/torvalds/linux/commit/1e08938c3694f707bb165535df352ac97a8c75c9

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
5 weeks agoAArch64: Implement AdvSIMD and SVE log10p1(f) routines
Luna Lamb [Sat, 27 Sep 2025 10:37:29 +0000 (10:37 +0000)] 
AArch64: Implement AdvSIMD and SVE log10p1(f) routines

Vector variants of the new C23 log10p1 routines.

Note: Benchmark inputs for log10p1(f) are identical to log1p(f)

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
5 weeks agoAArch64: Implement AdvSIMD and SVE log2p1(f) routines
Luna Lamb [Sat, 27 Sep 2025 10:33:19 +0000 (10:33 +0000)] 
AArch64: Implement AdvSIMD and SVE log2p1(f) routines

Vector variants of the new C23 log2p1 routines.

Note: Benchmark inputs for log2p1(f) are identical to log1p(f).

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
6 weeks agomanual: Improve documentation of the shutdown function
Florian Weimer [Thu, 25 Sep 2025 06:37:13 +0000 (08:37 +0200)] 
manual: Improve documentation of the shutdown function

Document the SHUT_* constants and attempt to explain the
implications for Linux TCP and UNIX domain sockets.

The Linux TCP behavior was discovered when writing the
socket/tst-shutdown test.

Suggested by Sergey Organov in
<https://inbox.sourceware.org/libc-help/qblfrh$4m4i$1@blaine.gmane.org/>.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
6 weeks agox86: Restore "*&" GCC asm memory operand workaround to installed fpu-control.h
Uros Bizjak [Wed, 24 Sep 2025 05:59:38 +0000 (07:59 +0200)] 
x86: Restore "*&" GCC asm memory operand workaround to installed fpu-control.h

fpu_control.h is an installed header so a wider range of compiler versions
(including ones older than GCC 9) are relevant with it than are relevant
for building glibc.

Fixes commit 3014dec3ad47260283cfc8f7199b31c2ac3083f0
('x86: Remove obsolete "*&" GCC asm memory operand workaround')

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
6 weeks agohurd: Fix building on i686-gnu
Samuel Thibault [Tue, 23 Sep 2025 19:38:46 +0000 (21:38 +0200)] 
hurd: Fix building on i686-gnu

vm_size_t and rlim_t may not be the same type.

Fixes commit 802b0eba519b1333c639fd0e1b55222099df9263
("hurd: implement RLIMIT_AS against Mach RPCs")

6 weeks agomath: Remove unused files
Adhemerval Zanella [Fri, 19 Sep 2025 16:48:35 +0000 (13:48 -0300)] 
math: Remove unused files

The multiprecision slow paths were removed in glibc 2.28.