]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
28 hours agotests-mbwc/tst_funcs.h: Fix typo master
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>
28 hours 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>
28 hours 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>
28 hours 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>
30 hours 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).

30 hours 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.

30 hours 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.

2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
2 days 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>
4 days 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 days 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 days 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>
7 days 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>
8 days 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>
9 days 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")

9 days 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.

9 days agobenchtests: Add workload for tgammaf-inputs
Adhemerval Zanella [Fri, 19 Sep 2025 16:48:16 +0000 (13:48 -0300)] 
benchtests: Add workload for tgammaf-inputs

9 days agomips: Fix delay slot filling in bsd-setjmp.S
Jovan Dmitrovic [Wed, 3 Sep 2025 13:53:39 +0000 (13:53 +0000)] 
mips: Fix delay slot filling in bsd-setjmp.S

In the !defined __PIC__ case, we cannot guarantee that the delay slot
is properly filled at the final `j` instuction without reordering
active.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9 days agomips: Remove strcmp.S
Jovan Dmitrovic [Wed, 3 Sep 2025 13:53:37 +0000 (13:53 +0000)] 
mips: Remove strcmp.S

Testing strcmp on MIPS hardware shows that strcmp.S performs worse
than the combination of using the generic strcmp.c implementation
alongside -funroll-loops.

Suggested-by: Joseph Myers <josmyers@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9 days agoassert: Refactor assert/assert_perror
Adhemerval Zanella [Thu, 21 Aug 2025 11:48:13 +0000 (08:48 -0300)] 
assert: Refactor assert/assert_perror

It now calls __libc_assert, which contains similar logic. The assert
call only requires memory allocation for the message translation, so
test-assert2.c is adapted to handle it.

It also removes the fxprintf from assert/assert_perror; although it
is not 100% backwards-compatible (write message only if there is a
file descriptor associated with the stderr). It now writes bytes
directly without going through the wide stream state.

Checked on aarch64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
9 days agonptl: Fix MADV_GUARD_INSTALL logic for thread without guard page (BZ 33356)
Adhemerval Zanella [Mon, 8 Sep 2025 16:06:13 +0000 (13:06 -0300)] 
nptl: Fix MADV_GUARD_INSTALL logic for thread without guard page (BZ 33356)

The main issue is that setup_stack_prot fails to account for cases where
the cached thread stack lacks a guard page, which can cause madvise to
fail. Update the logic to also handle whether MADV_GUARD_INSTALL is
supported when resizing the guard page.

Checked on x86_64-linux-gnu with 6.8.0 and 6.15 kernels.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
9 days agox86_64: Fix number of operands mismatch for `vdivss'
Uros Bizjak [Tue, 23 Sep 2025 06:13:13 +0000 (08:13 +0200)] 
x86_64: Fix number of operands mismatch for `vdivss'

Fixes commit ff8be6152bcd1048283663aef2da6a458f27832a
('x86: Use "%v" to emit VEX encoded instructions for AVX targets')

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
10 days agox86: Use "%v" to emit VEX encoded instructions for AVX targets
Uros Bizjak [Sun, 21 Sep 2025 18:33:09 +0000 (20:33 +0200)] 
x86: Use "%v" to emit VEX encoded instructions for AVX targets

Legacy encodings of SSE instructions incur AVX-SSE domain transition
penalties on some Intel microarchitectures (e.g. Haswell, Broadwell).
Using the VEX forms avoids these penatlies and keeps all instructions
in the VEX decode domain.  Use "%v" sequence to emit the "v" prefix
for opcodes when compiling with -mavx.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
10 days agox86: Remove obsolete "*&" GCC asm memory operand workaround
Uros Bizjak [Sun, 21 Sep 2025 15:28:51 +0000 (17:28 +0200)] 
x86: Remove obsolete "*&" GCC asm memory operand workaround

GCC now accept plain variable names as valid lvalues for "m"
constraints, automatically spilling locals to memory if necessary.
The long-standing "*&" pattern was originally used as a defensive
workaround for older compiler versions that rejected operands
such as:

     asm ("incl %0" : "+m"(x));

with errors like "memory input is not directly addressable".

Modern compilers (GCC >= 9) reliably generate correct code
without the workaround, and the resulting assembly is identical.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
10 days agobenchtests: Fix warning in bench-strchr.c
Wilco Dijkstra [Mon, 22 Sep 2025 12:39:24 +0000 (12:39 +0000)] 
benchtests: Fix warning in bench-strchr.c

Ensure benchtests compile with trunk GCC.

10 days agoNEWS: Update with removal of dumped heaps
Wilco Dijkstra [Mon, 22 Sep 2025 12:17:18 +0000 (12:17 +0000)] 
NEWS: Update with removal of dumped heaps

Support for dumped heaps has been removed - malloc_set_state() now always
returns the error code -1.

10 days agohurd: Fix RLIM_INFINITY on 64b
Samuel Thibault [Mon, 22 Sep 2025 00:28:14 +0000 (02:28 +0200)] 
hurd: Fix RLIM_INFINITY on 64b

rlim_t is 64b on 64b systems, so we should extend RLIM_INFINITY to that,
not only RLIM64_INFINITY or requiring 64b offsets.

This is similar to Linux headers.

10 days agohurd: Note BZ #30166 as fixed
Samuel Thibault [Mon, 22 Sep 2025 00:17:50 +0000 (02:17 +0200)] 
hurd: Note BZ #30166 as fixed

802b0eba519b ("hurd: implement RLIMIT_AS against Mach RPCs") brought the
needed RLIMIT_AS support for memory-crunchy tests.

10 days agohurd: implement RLIMIT_AS against Mach RPCs
Diego Nieto Cid [Fri, 15 Aug 2025 01:57:30 +0000 (02:57 +0100)] 
hurd: implement RLIMIT_AS against Mach RPCs

Check for VM limit RPCs

  * config.h.in: add #undef for HAVE_MACH_VM_GET_SIZE_LIMIT and
    HAVE_MACH_VM_SET_SIZE_LIMIT.
  * sysdeps/mach/configure.ac: use mach_RPC_CHECK to check for
    vm_set_size_limit and vm_get_size_limit RPCs in gnumach.defs.
  * sysdeps/mach/configure: regenerate file.

Use vm_get_size_limit to initialize RLIMIT_AS

  * hurd/hurdrlimit.c(init_rlimit): use vm_get_size_limit to initialize
    RLIMIT_AS entry of the _hurd_rlimits array.

Notify the kernel of the new VM size limits

  * sysdeps/mach/hurd/setrlimit.c: use the vm_set_size_limit RPC,
    if available, to notify the kernel of the new limits. Retry RPC
    calls if they were interrupted by a signal.
Message-ID: <03fb90a795b354a366ee73f56f73e6ad22a86cda.1755220108.git.dnietoc@gmail.com>

11 days agohurd: catch SIGSEGV on returning from signal handler
Samuel Thibault [Sun, 21 Sep 2025 21:45:40 +0000 (23:45 +0200)] 
hurd: catch SIGSEGV on returning from signal handler

On stack overflow typically, we may not actually have room on the stack to
trampoline back from the signal handler.  We have to detect this before
locking the ss, otherwise the signal thread will be stuck on taking the
ss lock while trying to post SIGSEGV.

13 days agomanual: Explain our implementation-defined memstream semantics
DJ Delorie [Thu, 18 Sep 2025 23:13:32 +0000 (19:13 -0400)] 
manual: Explain our implementation-defined memstream semantics

Posix Issue 8 adds an implementation-defined item we don't already
cover, about seeking backwards.  This defines our implentation.

https://issues.redhat.com/browse/RHEL-3008
https://pubs.opengroup.org/onlinepubs/9799919799/functions/open_memstream.html

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by Collin Funk <collin.funk1@gmail.com>

13 days agomalloc: Remove dumped heap support
Wilco Dijkstra [Fri, 19 Sep 2025 13:01:11 +0000 (13:01 +0000)] 
malloc: Remove dumped heap support

Remove support for obsolete dumped heaps.  Dumping heaps was discontinued
8 years ago, however loading a dumped heap is still supported. This blocks
changes and improvements of the malloc data structures - hence it is time
to remove this.  Ancient binaries that still call malloc_set_state will now
get the -1 error code.  Update tst-mallocstate.c to just check for this.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
13 days agoAArch64: Update math-vector-fortran.h
Wilco Dijkstra [Thu, 18 Sep 2025 14:24:47 +0000 (14:24 +0000)] 
AArch64: Update math-vector-fortran.h

Update math-vector-fortran.h with the latest set of math functions
and sort by name.

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
13 days agomanual: fix typo in tunables.texi
Yury Khrustalev [Fri, 19 Sep 2025 11:03:38 +0000 (12:03 +0100)] 
manual: fix typo in tunables.texi

2 weeks agomalloc: Hoist common unlock out of if-else control block
Dev Jain [Mon, 15 Sep 2025 11:43:29 +0000 (17:13 +0530)] 
malloc: Hoist common unlock out of if-else control block

We currently unlock the arena mutex in arena_get_retry() unconditionally.
Therefore, hoist out the unlock from the if-else control block.

Signed-off-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
2 weeks agostdlib: Use support_accept_oom in test-bz22786
Florian Weimer [Thu, 18 Sep 2025 17:11:38 +0000 (19:11 +0200)] 
stdlib: Use support_accept_oom in test-bz22786

The realpath call may trigger OOM termination of the test process
under difficult-to-predict circumstances.  (It depends on available
RAM and swap.)  Therefore, instruct the test driver to ignore
an OOM process termination during the realpath call.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 weeks agosupport: Add support_accept_oom to heuristically support OOM errors
Florian Weimer [Thu, 18 Sep 2025 17:11:38 +0000 (19:11 +0200)] 
support: Add support_accept_oom to heuristically support OOM errors

Some tests may trigger the kernel OOM handler under conditions
which are difficult to predict (depending on available RAM and
swap space).  If we can determine specific regions which might
do this and this does not contradict the test object, the
functions support_accept_oom (true) and support_accept_oom (false)
can be called at the start and end, and the test driver will
ignore SIGKILL signals.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2 weeks agosupport: fix build failure due to lack of stdbool.h
Yury Khrustalev [Wed, 17 Sep 2025 10:45:09 +0000 (11:45 +0100)] 
support: fix build  failure due to lack of stdbool.h

On some targets using bool in support/check_mem_access.h resulted
in build error due to stdbool.h not being included, fix this.

See 9be489d77867dd2444ecc044a5f3049d1751ee85 for details.

Reported-by: Joseph Myers <josmyers@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agox86: Don't use asm statement for trunc/truncf
H.J. Lu [Tue, 16 Sep 2025 01:52:18 +0000 (18:52 -0700)] 
x86: Don't use asm statement for trunc/truncf

Compiler inlines trunc and truncf with SSE4.1.  But older versions of GCC
doesn't inline them with -Os:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121861

Don't use asm statement for trunc and truncf if compiler can inline them
with -Os.  It removes one register move with GCC 16:

__modff_sse41:                        __modff_sse41:
.LFB23:                               .LFB23:
   .cfi_startproc                        .cfi_startproc
   endbr64                               endbr64
   subq  $24, %rsp                       subq  $24, %rsp
   .cfi_def_cfa_offset 32                .cfi_def_cfa_offset 32
   movq  %fs:40, %rax                    movq  %fs:40, %rax
   movq  %rax, 8(%rsp)                   movq  %rax, 8(%rsp)
   xorl  %eax, %eax                      xorl  %eax, %eax
   movd  %xmm0, %eax                     movd  %xmm0, %eax
   addl  %eax, %eax                      addl  %eax, %eax
   cmpl  $-16777216, %eax                cmpl  $-16777216, %eax
   je .L7                                je .L7
                                   >     movaps   %xmm0, %xmm3
   movaps   %xmm0, %xmm4                 movaps   %xmm0, %xmm4
   movss .LC0(%rip), %xmm2         |     movss .LC0(%rip), %xmm1
   movaps   %xmm2, %xmm3           |     movaps   %xmm1, %xmm2
   andps %xmm0, %xmm2              |     roundss  $11, %xmm3, %xmm3
   roundss $11, %xmm0, %xmm1       |     subss %xmm3, %xmm4
   subss %xmm1, %xmm4              |     andps %xmm0, %xmm1
   andnps   %xmm4, %xmm3           |     andnps   %xmm4, %xmm2
   orps  %xmm3, %xmm2              |     orps  %xmm2, %xmm1
.L3:                                  .L3:
   movss %xmm1, (%rdi)             |     movss %xmm3, (%rdi)
   movq  8(%rsp), %rax                   movq  8(%rsp), %rax
   subq  %fs:40, %rax                    subq  %fs:40, %rax
   jne   .L8                             jne   .L8
   movaps   %xmm2, %xmm0           |     movaps   %xmm1, %xmm0
   addq  $24, %rsp                       addq  $24, %rsp
   .cfi_remember_state                   .cfi_remember_state
   .cfi_def_cfa_offset 8                 .cfi_def_cfa_offset 8
   ret                                   ret

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Uros Bizjak <ubizjak@gmail.com>
2 weeks agoldd: define the "unused" variable
Aurelien Jarno [Fri, 12 Sep 2025 19:18:41 +0000 (21:18 +0200)] 
ldd: define the "unused" variable

The "unused" variable could be use unitialized, which is an issue if ldd
is ran with "-u". Fix that by defining the variable to an empty value,
just like it is already done for the bind_now, warn and verbose
variables.

Reported-by: Johan Palmqvist <johan.palmqvist@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoi686: Compile .op files and gmon tests with -mfentry
H.J. Lu [Thu, 4 Sep 2025 23:24:14 +0000 (16:24 -0700)] 
i686: Compile .op files and gmon tests with -mfentry

On i686, after GCC 16 commit:

commit 07d8de9174c421d719649639a1452b8b9f2eee32
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Jul 2 08:58:23 2025 +0800

    x86-64: Add --enable-x86-64-mfentry

which warns ‘-pg’ without ‘-mfentry’, when glibc is configured with
--disable-default-pie, GCC 16 fails to compile .op files and gmon tests
with error:

cc1: error: ‘-pg’ without ‘-mfentry’ may be unreliable with shrink wrapping [-Werror]

Compile .op files and gmon tests with -mfentry if it is supported by
CC/TEST_CC and glibc is configured with --disable-default-pie.  This
fixes BZ #33376.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Joseph Myers <josmyers@redhat.com>
2 weeks agosupport: add check_mem_access function
Yury Khrustalev [Tue, 9 Sep 2025 14:15:29 +0000 (15:15 +0100)] 
support: add check_mem_access function

Add check_mem_access(addr) function to check if memory at addr can
be written or read returning false if memory is not accessible.

This function changes signal handler for SIGSEGV and SIGBUS signals
when it is called first, and it is not thread-safe.

Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoi386: Use __seg_gs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Uros Bizjak [Wed, 10 Sep 2025 18:43:06 +0000 (20:43 +0200)] 
i386: Use __seg_gs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()

Use the __seg_gs named address space qualifier to cast access to the
gscope_flag in the TCB as a %gs: prefixed address.  This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
2 weeks agox86_64: Use __seg_fs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()
Uros Bizjak [Wed, 10 Sep 2025 18:30:56 +0000 (20:30 +0200)] 
x86_64: Use __seg_fs qualifier to cast access to TCB in THREAD_GSCOPE_RESET_FLAG()

Use the __seg_fs named address space qualifier to cast access to the
gscope_flag in the TCB as a %fs: prefixed address.  This enables the
use of the "m" operand constraint, which informs the compiler about
memory access in the inline assembly.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
2 weeks agoFix RISC-V soft-float _FPU_SETCW for GCC 16 set-but-not-used warnings
Joseph Myers [Wed, 3 Sep 2025 16:30:11 +0000 (16:30 +0000)] 
Fix RISC-V soft-float _FPU_SETCW for GCC 16 set-but-not-used warnings

The soft-float RISC-V definition of _FPU_SETCW results in a
-Werror=unused-but-set-variable= build failure with GCC mainline (in
math/setfpucw.c) because it does not use the dummy cw variable.
Change it to (void) (cw) as on other architectures to avoid this build
failure.

Tested with build-many-glibcs.py (compilers) for
riscv64-linux-gnu-rv64imac-lp64, which previously failed.
Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agonss: Group merge does not react to ERANGE during merge (bug 33361)
Florian Weimer [Fri, 12 Sep 2025 19:33:34 +0000 (21:33 +0200)] 
nss: Group merge does not react to ERANGE during merge (bug 33361)

The break statement in CHECK_MERGE is expected to exit the surrounding
while loop, not the do-while loop with in the macro.  Remove the
do-while loop from the macro.  It is not needed to turn the macro
expansion into a single statement due to the way CHECK_MERGE is used
(and the statement expression would cover this anyway).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoLoongArch: Use the generic shmlab.h.
caiyinyu [Fri, 3 Jan 2025 07:23:46 +0000 (15:23 +0800)] 
LoongArch: Use the generic shmlab.h.

The shmlba.h file related to the LoongArch architecture was introduced
in commit 3eed5f3a1ee to address the mismatch in the SHMLBA definition
between glibc and the kernel. See [1].  The SHMLBA definition was later
updated in commit d23b77953f5a. See [2].  Now, we adopt the definition
from the common layer.

[1]:
commit 3eed5f3a1ee356969afb403a1cf18d06f8d2d98a
Author: caiyinyu <caiyinyu@loongson.cn>
Date:   Thu May 25 17:01:11 2023 +0800

    LoongArch: Fix inconsistency in SHMLBA macro values between glibc and kernel

    The LoongArch glibc was using the value of the SHMLBA macro from common code,
    which is __getpagesize() (16k), but this was inconsistent with the value of
    the SHMLBA macro in the kernel, which is SZ_64K (64k). This caused several
    shmat-related tests in LTP (Linux Test Project) to fail. This commit fixes
    the issue by ensuring that the glibc's SHMLBA macro value matches the value
    used in the kernel like other architectures.

[2]:
commit d23b77953f5a4fbf94c05157b186aac2a247ae32
Author: Huacai Chen <chenhuacai@kernel.org>
Date:   Wed Jan 17 12:43:08 2024 +0800

    LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE

    LoongArch has hardware page coloring for L1 Cache, so we don't have
    cache aliases. But SFB (Store Fill Buffer) still has aliases. So we
    define SHMLBA to SZ_64K previously. But there are losts of applications
    use PAGE_SIZE rather than SHMLBA to mmap() file pages and shared pages.
    Of course we can fix them one by one, but not easy.

    On the other hand, we can simply disable SFB for 4KB page size to fix
    cache alias (there will be performance decrease, but acceptable), and
    in future we will fix SFB in hardware. So we can safely define SHMLBA to
    PAGE_SIZE (use the generic shmparam.h) to make life easier.

Signed-off-by: caiyinyu <caiyinyu@loongson.cn>
Reported-by: lixing <lixing@loongson.cn>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoalpha: Fix missing inexact-flag raising for lround/lrint
Adhemerval Zanella [Sat, 6 Sep 2025 22:23:22 +0000 (19:23 -0300)] 
alpha: Fix missing inexact-flag raising for lround/lrint

The l*[rint|round]f implements uses alpha 'cvtst/s', 'addt/suc',
adn 'cvttq/svd' which are not not fully IEEE compliant w.r.t
inexact-flag raising..  Use the software fallback implementation
instead.

Checked on alpha-linux-gnu.

Tested-by: Michael Cree <mcree@orcon.net.nz>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
3 weeks agomath: Remove clz_uint64/ctz_uint64 and use stdbit.h
Adhemerval Zanella [Thu, 11 Sep 2025 17:13:22 +0000 (14:13 -0300)] 
math: Remove clz_uint64/ctz_uint64 and use stdbit.h

Checked on aarch64-linux-gnu and x86_64-linux-gnu
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
3 weeks agomath: Split erf and erfc
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:40 +0000 (13:38 -0300)] 
math: Split erf and erfc

Checked on x86_64-linux-gnu, aarch64-linux-gnu, and
powerpc64le-linux-gnu.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Use internal fesetround alias on fma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:32 +0000 (13:38 -0300)] 
math: Use internal fesetround alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Use internal fetestexcept alias on fma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:31 +0000 (13:38 -0300)] 
math: Use internal fetestexcept alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Add fetestexcept internal alias
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:30 +0000 (13:38 -0300)] 
math: Add fetestexcept internal alias

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Use internal feholdexcept alias on fma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:29 +0000 (13:38 -0300)] 
math: Use internal feholdexcept alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Use internal feupdateenv alias on fma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:28 +0000 (13:38 -0300)] 
math: Use internal feupdateenv alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Use internal feholdexcept alias on fma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:27 +0000 (13:38 -0300)] 
math: Use internal feholdexcept alias on fma

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Add feclearexcept internal alias
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:26 +0000 (13:38 -0300)] 
math: Add feclearexcept internal alias

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agobenchtests: Add workload directive for tgamma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:25 +0000 (13:38 -0300)] 
benchtests: Add workload directive for tgamma

3 weeks agobenchtests: Add workload directive for erf and erfc
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:24 +0000 (13:38 -0300)] 
benchtests: Add workload directive for erf and erfc

3 weeks agobenchtests: Add workload for lgamma
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:23 +0000 (13:38 -0300)] 
benchtests: Add workload for lgamma

Random inputs in range [-20.00,20.00].
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agobenchtests: Add workload for asinh
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:22 +0000 (13:38 -0300)] 
benchtests: Add workload for asinh

Random input in range [-10,10].
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agobenchtests: Add workload for acosh
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:21 +0000 (13:38 -0300)] 
benchtests: Add workload for acosh

Random inputs in range [1.00,21.00]
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoSHARED-FILES: Adjust core-math entries
Adhemerval Zanella [Mon, 25 Aug 2025 16:38:20 +0000 (13:38 -0300)] 
SHARED-FILES: Adjust core-math entries

And remove duplicate info on each file wrt glibc changes.  Also
add the core-math git repository link.
Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agomath: Fix x86_64 build for -Os (BZ 33367)
Adhemerval Zanella [Tue, 9 Sep 2025 20:47:21 +0000 (17:47 -0300)] 
math: Fix x86_64 build for -Os (BZ 33367)

The compiler might not inline the trunc function call for
USE_TRUNC_BUILTIN [1].

This patch adds an optimized __trunc/__truncf for x86 used
on modf ifunc variant to avoid the trunc libcall.

Checked on x86_64, x86_64-v2, x86_64-v3, and x86_64-v4. Used -O2 and
-Os options. Performed a full make check on x86_64 with both
 optimizations.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121861
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agomanual: fix typo
Yury Khrustalev [Thu, 11 Sep 2025 09:50:43 +0000 (10:50 +0100)] 
manual: fix typo

3 weeks agoUpdate to Unicode 17.0.0 [BZ #33289]
Mike FABIAN [Mon, 18 Aug 2025 07:24:06 +0000 (09:24 +0200)] 
Update to Unicode 17.0.0 [BZ #33289]

Unicode 17.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 17.0.0, using
the generator scripts contributed by Mike FABIAN (Red Hat).

Changes in CHARMAP and WIDTH:

    Total added characters in newly generated CHARMAP: 4803
    Total removed characters in newly generated WIDTH: 0
    Total changed characters in newly generated WIDTH: 0
    Total added characters in newly generated WIDTH: 4512

Some combining characters and other non-spacing marks have been added
with WIDTH 0. Lots of characters have been added with WIDTH 2, most of
them are CJK Ideographs plus a few Tangut characters and 7 emoji.

Changes in ctype:

    alpha: Added 4672 characters in new ctype which were not in old ctype
    combining: Added 42 characters in new ctype which were not in old ctype
    combining_level3: Added 8 characters in new ctype which were not in old ctype
    graph: Added 4803 characters in new ctype which were not in old ctype
    lower: Missing: ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE
    lower: Added 27 characters in new ctype which were not in old ctype
    print: Added 4803 characters in new ctype which were not in old ctype
    punct: Added 131 characters in new ctype which were not in old ctype
    tolower: Added 28 characters in new ctype which were not in old ctype
    totitle: Added 28 characters in new ctype which were not in old ctype
    toupper: Added 28 characters in new ctype which were not in old ctype
    upper: Added 28 characters in new ctype which were not in old ctype

Nothing suspicious in the additions.

About the character removed from lower:

ʕ 0x295 LATIN LETTER PHARYNGEAL VOICED FRICATIVE

In UnicodeData.txt it changed from 'Ll' (Letter Lowercase) to 'Lo' (Letter Other):

-0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Ll;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;
+0295;LATIN LETTER PHARYNGEAL VOICED FRICATIVE;Lo;0;L;;;;;N;LATIN LETTER REVERSED GLOTTAL STOP;;;;

Resolves: BZ #33289

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
3 weeks agoAArch64: add optimised strspn/strcspn
remph [Thu, 4 Sep 2025 12:53:56 +0000 (12:53 +0000)] 
AArch64: add optimised strspn/strcspn

Requires Neon (aka. Advanced SIMD).  Looks up 16 characters at a time,
for a 2-3x perfomance improvement, and a ~30% speedup on the strtok &
strsep benchtests, as tested on Cortex A-{53,72}.

Signed-off-by: remph <lhr@disroot.org>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
3 weeks agoi386: Use __seg_gs qualifiers in {STACK, POINTER}_CHK_GUARD macros
Uros Bizjak [Tue, 9 Sep 2025 16:41:54 +0000 (18:41 +0200)] 
i386: Use __seg_gs qualifiers in {STACK, POINTER}_CHK_GUARD macros

Use the __seg_gs named address space qualifiers to cast reads of
the guard values in the TCB as %gs: prefixed addresses.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agox86_64: Use __seg_fs qualifiers in {STACK, POINTER}_CHK_GUARD macros
Uros Bizjak [Tue, 9 Sep 2025 16:41:53 +0000 (18:41 +0200)] 
x86_64: Use __seg_fs qualifiers in {STACK, POINTER}_CHK_GUARD macros

Use the __seg_fs named address space qualifiers to cast reads of
the guard values in the TCB as %fs: prefixed addresses.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agox86: Remove x86 version of thread_pointer.h
Uros Bizjak [Wed, 10 Sep 2025 06:43:54 +0000 (08:43 +0200)] 
x86: Remove x86 version of thread_pointer.h

The x86 version of thread_pointer.h is the same as the generic one.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agox86: Remove stale __GNUC_PREREQ (11, 1) test from __thread_pointer()
Uros Bizjak [Wed, 10 Sep 2025 06:43:53 +0000 (08:43 +0200)] 
x86: Remove stale __GNUC_PREREQ (11, 1) test from __thread_pointer()

GCC 12 is currently the minimum supported compiler version.
Remove no longer needed __GNUC_PREREQ (11, 1) test from
__thread_pointer().

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
3 weeks agomalloc: Cleanup libc_realloc
Wilco Dijkstra [Wed, 10 Sep 2025 09:11:27 +0000 (09:11 +0000)] 
malloc: Cleanup libc_realloc

Minor cleanup of libc_realloc: remove unnecessary special cases for mmap, move
ar_ptr initialization, first check for oldmem == NULL.

Reviewed-by: DJ Delorie <dj@redhat.com>
3 weeks agoatomics: Remove unused atomics
Wilco Dijkstra [Wed, 10 Sep 2025 09:07:39 +0000 (09:07 +0000)] 
atomics: Remove unused atomics

Remove all unused atomics.  Replace uses of catomic_increment and
catomic_decrement with atomic_fetch_add_relaxed which maps to a standard
compiler builtin. Relaxed memory ordering is correct for simple counters
since they only need atomicity.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agomalloc: check "negative" tcache_key values by hand
Samuel Thibault [Tue, 9 Sep 2025 21:03:26 +0000 (23:03 +0200)] 
malloc: check "negative" tcache_key values by hand

instead of undefined cases from casting uintptr_t into intptr_t.

3 weeks agox86: Define atomic_compare_and_exchange_{val, bool}_acq using __atomic_compare_exchange_n
Uros Bizjak [Mon, 8 Sep 2025 12:38:23 +0000 (14:38 +0200)] 
x86: Define atomic_compare_and_exchange_{val, bool}_acq using __atomic_compare_exchange_n

No functional changes.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Define atomic_exchange_acq using __atomic_exchange_n
Uros Bizjak [Mon, 8 Sep 2025 12:38:22 +0000 (14:38 +0200)] 
x86: Define atomic_exchange_acq using __atomic_exchange_n

The resulting libc.so is identical on both x86_64 and
i386 targets compared to unpatched builds:

$ sha1sum libc-x86_64-old.so libc-x86_64-new.so
74eca1b87f2ecc9757a984c089a582b7615d93e7  libc-x86_64-old.so
74eca1b87f2ecc9757a984c089a582b7615d93e7  libc-x86_64-new.so
$ sha1sum libc-i386-old.so libc-i386-new.so
882bbab8324f79f4fbc85224c4c914fc6822ece7  libc-i386-old.so
882bbab8324f79f4fbc85224c4c914fc6822ece7  libc-i386-new.so

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Define atomic_full_barrier using __sync_synchronize
Uros Bizjak [Mon, 8 Sep 2025 12:38:21 +0000 (14:38 +0200)] 
x86: Define atomic_full_barrier using __sync_synchronize

For x86_64 targets, __sync_synchronize emits a full 64-bit
'LOCK ORQ $0x0,(%rsp)' instead of 'LOCK ORL $0x0,(%rsp)'.

No functional changes.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Remove catomic_* locking primitives
Uros Bizjak [Mon, 8 Sep 2025 12:38:20 +0000 (14:38 +0200)] 
x86: Remove catomic_* locking primitives

Remove obsolete catomic_* locking primitives which don't map
to standard compiler builtins.

There are still a couple of places in the tree that uses them
(malloc/arena.c and malloc/malloc.c).

x86 didn't define __arch_c_compare_and_exchange_bool_* primitives
so fallback code used __arch_c_compare_and_exchange_val_* primitives
instead.  This resulted in unoptimal code for
catomic_compare_and_exchange_bool_acq where superfluous
CMP was emitted after CMPXCHG, e.g. in arena_get2:

   775b8: 48 8d 4a 01           lea    0x1(%rdx),%rcx
   775bc: 48 89 d0              mov    %rdx,%rax
   775bf: 64 83 3c 25 18 00 00  cmpl   $0x0,%fs:0x18
   775c6: 00 00
   775c8: 74 01                 je     775cb <arena_get2+0x35b>
   775ca: f0 48 0f b1 0d 75 3d  lock cmpxchg %rcx,0x163d75(%rip)        # 1db348 <narenas>
   775d1: 16 00
   775d3: 48 39 c2              cmp    %rax,%rdx
   775d6: 74 7f                 je     77657 <arena_get2+0x3e7>

that now becomes:

   775b8: 48 8d 4a 01           lea    0x1(%rdx),%rcx
   775bc: 48 89 d0              mov    %rdx,%rax
   775bf: f0 48 0f b1 0d 80 3d  lock cmpxchg %rcx,0x163d80(%rip)        # 1db348 <narenas>
   775c6: 16 00
   775c8: 74 7f                 je     77649 <arena_get2+0x3d9>

OTOH, catomic_decrement does not fallback to atomic_fetch_add (, -1)
builtin but to the cmpxchg loop, so the generated code in arena_get2
regresses a bit, from using LOCK DECQ insn:

   77829: 64 83 3c 25 18 00 00  cmpl   $0x0,%fs:0x18
   77830: 00 00
   77832: 74 01                 je     77835 <arena_get2+0x5c5>
   77834: f0 48 ff 0d 0c 3b 16  lock decq 0x163b0c(%rip)        # 1db348 <narenas>
   7783b: 00

to a cmpxchg loop:

   7783d: 48 8b 0d 04 3b 16 00  mov    0x163b04(%rip),%rcx        # 1db348 <narenas>
   77844: 48 8d 71 ff           lea    -0x1(%rcx),%rsi
   77848: 48 89 c8              mov    %rcx,%rax
   7784b: f0 48 0f b1 35 f4 3a  lock cmpxchg %rsi,0x163af4(%rip)        # 1db348 <narenas>
   77852: 16 00
   77854: 0f 84 c9 fa ff ff     je     77323 <arena_get2+0xb3>
   7785a: eb e1                 jmp    7783d <arena_get2+0x5cd>

Defining catomic_exchange_and_add using __atomic_fetch_add solves the
above issue and generates optimal:

   77809: f0 48 83 2d 36 3b 16  lock subq $0x1,0x163b36(%rip)        # 1db348 <narenas>
   77810: 00 01

Depending on the target processor, the compiler may emit either
'LOCK ADD/SUB $1, m' or 'INC/DEC $1, m' instruction, due to partial
flag register stall issue.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Remove unused atomics
Uros Bizjak [Mon, 8 Sep 2025 12:38:19 +0000 (14:38 +0200)] 
x86: Remove unused atomics

Remove unused atomics from <sysdeps/x86/atomic-machine.h>.

The resulting libc.so is identical on both x86_64 and
i386 targets compared to unpatched builds:

$ sha1sum libc-x86_64-old.so libc-x86_64-new.so
b89aaa2b71efd435104ebe6f4cd0f2ef89fcac90  libc-x86_64-old.so
b89aaa2b71efd435104ebe6f4cd0f2ef89fcac90  libc-x86_64-new.so
$ sha1sum libc-i386-old.so libc-i386-new.so
aa70f2d64da2f0f516634b116014cfe7af3e5b1a  libc-i386-old.so
aa70f2d64da2f0f516634b116014cfe7af3e5b1a  libc-i386-new.so

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: Collin Funk <collin.funk1@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch atomic.h to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:36:45 +0000 (10:36 +0000)] 
atomic: Switch atomic.h to builtin atomics

Switch to standard builtin atomics by removing the defines for
!USE_ATOMIC_COMPILER_BUILTINS.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch power to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:30:39 +0000 (10:30 +0000)] 
atomic: Switch power to builtin atomics

Switch power to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch hppa to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:29:55 +0000 (10:29 +0000)] 
atomic: Switch hppa to builtin atomics

Switch hppa to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch sh to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:29:29 +0000 (10:29 +0000)] 
atomic: Switch sh to builtin atomics

Switch sh to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch microblaze to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:28:29 +0000 (10:28 +0000)] 
atomic: Switch microblaze to builtin atomics

Switch microblaze to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch alpha to builtin atomics
Wilco Dijkstra [Tue, 9 Sep 2025 10:27:39 +0000 (10:27 +0000)] 
atomic: Switch alpha to builtin atomics

Switch alpha to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Switch m68k to builtin atomics
Wilco Dijkstra [Mon, 8 Sep 2025 17:16:03 +0000 (17:16 +0000)] 
atomic: Switch m68k to builtin atomics

Switch m68k to builtin atomics.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
3 weeks agoatomic: Use builtin atomics with USE_ATOMIC_COMPILER_BUILTINS
Wilco Dijkstra [Mon, 8 Sep 2025 17:46:29 +0000 (17:46 +0000)] 
atomic: Use builtin atomics with USE_ATOMIC_COMPILER_BUILTINS

Use builtin atomics for atomic_compare_and_exchange_* and
atomic_exchange_and_add if USE_ATOMIC_COMPILER_BUILTINS is enabled.
This allows removing target atomic-machine.h headers.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 weeks agox86: Include <bits/stdlib-bsearch.h> in dl-cacheinfo.h
H.J. Lu [Tue, 9 Sep 2025 02:49:24 +0000 (19:49 -0700)] 
x86: Include <bits/stdlib-bsearch.h> in dl-cacheinfo.h

On x86-64, when glibc is configured with --enable-stack-protector=all
and compiled with -Os, ld.so crashes very early:

(gdb) r --direct
Starting program: /export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/string/test-memswap --direct

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
    __base=__base@entry=0x7ffff7fca140 <intel_02_known>,
    __nmemb=__nmemb@entry=68, __size=__size@entry=8,
    __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
    at ../bits/stdlib-bsearch.h:22
22 {
(gdb) disass
Dump of assembler code for function bsearch:
   0x00007ffff7f41af0 <+0>: push   %r15
   0x00007ffff7f41af2 <+2>: mov    %rcx,%r15
   0x00007ffff7f41af5 <+5>: push   %r14
   0x00007ffff7f41af7 <+7>: push   %r13
   0x00007ffff7f41af9 <+9>: mov    %rsi,%r13
   0x00007ffff7f41afc <+12>: push   %r12
   0x00007ffff7f41afe <+14>: mov    %rdi,%r12
   0x00007ffff7f41b01 <+17>: push   %rbp
   0x00007ffff7f41b02 <+18>: mov    %rdx,%rbp
   0x00007ffff7f41b05 <+21>: push   %rbx
   0x00007ffff7f41b06 <+22>: sub    $0x18,%rsp
=> 0x00007ffff7f41b0a <+26>: mov    %fs:0x28,%r14
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We can't use stack protector at this point.
   0x00007ffff7f41b13 <+35>: mov    %r14,0x8(%rsp)
   0x00007ffff7f41b18 <+40>: mov    %r8,%r14
   0x00007ffff7f41b1b <+43>: test   %rbp,%rbp
   0x00007ffff7f41b1e <+46>: je     0x7ffff7f41b48 <bsearch+88>
   0x00007ffff7f41b20 <+48>: mov    %rbp,%rbx
   0x00007ffff7f41b23 <+51>: mov    %r12,%rdi
   0x00007ffff7f41b26 <+54>: shr    $1,%rbx
   0x00007ffff7f41b29 <+57>: imul   %r15,%rbx
   0x00007ffff7f41b2d <+61>: add    %r13,%rbx
   0x00007ffff7f41b30 <+64>: mov    %rbx,%rsi
(gdb) bt
 #0  0x00007ffff7f41b0a in bsearch (__key=__key@entry=0x7fffffffda28,
    __base=__base@entry=0x7ffff7fca140 <intel_02_known>,
    __nmemb=__nmemb@entry=68, __size=__size@entry=8,
    __compar=__compar@entry=0x7ffff7f3b691 <intel_02_known_compare>)
    at ../bits/stdlib-bsearch.h:22
 #1  0x00007ffff7f3c1be in intel_check_word (name=188, value=1979933440,
    has_level_2=has_level_2@entry=0x7fffffffda7f,
    no_level_2_or_3=no_level_2_or_3@entry=0x7fffffffda7e,
    cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:217
 #2  0x00007ffff7f3c29f in handle_intel (name=name@entry=188,
    cpu_features=<optimized out>) at ../sysdeps/x86/dl-cacheinfo.h:279
 #3  0x00007ffff7f3ccf9 in dl_init_cacheinfo (cpu_features=<optimized out>)
    at ../sysdeps/x86/dl-cacheinfo.h:852
 #4  init_cpu_features (cpu_features=<optimized out>)
    at ../sysdeps/x86/cpu-features.c:1153
 #5  0x00007ffff7f3d6f9 in __libc_start_main_impl (main=0x7ffff7f396dc <main>,
    argc=2, argv=0x7fffffffdbe8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=0x0, stack_end=0x7fffffffdbd8) at ../csu/libc-start.c:269
 #6  0x00007ffff7f39901 in _start () at ../sysdeps/x86_64/start.S:115
(gdb)

The problem is that since __USE_EXTERN_INLINES isn't defined with -Os,
the inline bsearch in <bits/stdlib-bsearch.h> isn't available and the
external bsearch is compiled with stack protector.  Include
<bits/stdlib-bsearch.h> in dl-cacheinfo.h fixed BZ #33374.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
3 weeks agoLinux: Add missing si_code constants from Linux kernel
Thiago Jung Bauermann [Thu, 4 Sep 2025 02:26:21 +0000 (23:26 -0300)] 
Linux: Add missing si_code constants from Linux kernel

This brings the si_codes listed in siginfo-consts.h up-to-date with
Linux v6.16's include/uapi/asm-generic/siginfo.h.

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

Suggested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>