Commit Graph

1887 Commits

Author SHA1 Message Date
Adhemerval Zanella 50000da305 Filter out internal abort during ld.so build
clang might generate an abort call when cleanup functions (set by
__attribute__ ((cleanup)) calls functions not marked as nothrow.

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-10 08:58:12 -03:00
Samuel Thibault 494ba55d0b hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614] 2025-11-09 11:43:35 +01:00
Samuel Thibault a701ecc9f6 Revert "hurd: Make rename refuse trailing slashes [BZ #32570]"
This reverts commit 2ae4ec56c2.

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

This was rather fixed on the server side:
https://cgit.git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=e34000cb395a135dd2ad5c13e6f6d4c5c1006389
2025-11-09 00:06:38 +01:00
Adhemerval Zanella 3078358ac6 math: Remove the SVID error handling from tgammaf
It improves latency for about 1.5% and throughput for about 2-4%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 10:19:37 -03:00
Adhemerval Zanella de0e623434 math: Remove the SVID error handling from lgammaf/lgammaf_r
It improves latency throughput for about 2%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 09:27:07 -03:00
Adhemerval Zanella 7ec8eb5676 math: Remove the SVID error handling from atan2f
It improves latency for about 3-6% and throughput for about 5-12%.

Tested on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-05 07:15:52 -03:00
Adhemerval Zanella 0dfc849eff math: Remove the SVID error handling wrapper from sqrt
i386 and m68k architectures should use math-use-builtins-sqrt.h rather
than relying on architecture-specific or inline assembly implementations.

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

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella f27a146409 math: Remove the SVID error handling from sinhf
It improves latency for about 3-10% and throughput for about 5-15%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella 0e1a1178ee math: Remove the SVID error handling from remainder
The optimized i386 version is faster than the generic one, and
gcc implements it through the builtin. This optimization enables
us to migrate the implementation to a C version.  The performance
on a Zen3 chip is similar to the SVID one.

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

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

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

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella c4c6c79d70 math: Remove the SVID error handling from remainderf
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin.  This optimization enables us to
migrate the implementation to a C version.  The performance on a Zen3
chip is similar to the SVID one.

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

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

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

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04 04:14:01 -03:00
Adhemerval Zanella ee946212fe math: Remove the SVID error handling wrapper from yn/jn
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:35 -03:00
Adhemerval Zanella 8d4815e6d7 math: Remove the SVID error handling wrapper from y1/j1
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:33 -03:00
Adhemerval Zanella b050cb53b0 math: Remove the SVID error handling wrapper from y0/j0
Tested on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:31 -03:00
Adhemerval Zanella 03eeeba705 math: Remove the SVID error handling from coshf
It improves latency for about 3-10% and throughput for about 5-15%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:28 -03:00
Adhemerval Zanella 555c39c0fc math: Remove the SVID error handling from atanhf
It improves latency for about 1-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:26 -03:00
Adhemerval Zanella 8facb464b4 math: Remove the SVID error handling from acoshf
It improves latency for about 3-7% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:24 -03:00
Adhemerval Zanella f92aba68bc math: Remove the SVID error handling from asinf
It improves latency for about 2% and throughput for about 5%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:22 -03:00
Adhemerval Zanella 9f8dea5b5d math: Remove the SVID error handling from acosf
It improves latency for about 2-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:20 -03:00
Adhemerval Zanella 0b484d7b77 math: Remove the SVID error handling from log10f
It improves latency for about 3-10% and throughput for about 5-10%.

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:17 -03:00
Adhemerval Zanella 1dd2163e51 i386: Remove the SVID error handling from fmodf
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin. It allows us to move the
implementation to a C one.

The performance on a Zen3 chip is slight better:

reciprocal-throughput           input   master  no-SVID  improvement
i686                       subnormals  22.4741  20.1571       10.31%
i686                           normal  74.1631  70.3606        5.13%
i686                   close-exponent  22.5625  20.2435       10.28%

Tested on i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:41:07 -03:00
Adhemerval Zanella bfee89dc8a i386: Remove the SVID error handling from fmod
The optimized i386 version is faster than the generic one, and gcc
implements it through the builtin. It allows us to move the
implementation to a C one. The performance on a Zen3 chip is
similar to the SVID one.

Tested on i686-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-10-30 15:40:41 -03:00
Joseph Myers 096fcdc0a5 Rename uimaxabs to umaxabs (bug 33325)
The C2y function uimaxabs has been renamed to umaxabs.  Implement this
change in glibc, keeping a compat symbol under the old name, copying
the test to test the new name and changing the old test to test the
compat symbol.  Jakub has done the corresponding change to the
built-in function in GCC.

Tested for x86_64 and x86.
2025-10-28 12:15:02 +00:00
Adhemerval Zanella 917425ca6d 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>
2025-10-20 11:33:54 -03:00
Joseph Myers ea18d5a4c2 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.
2025-10-17 16:56:59 +00:00
Joseph Myers 0f201f4a81 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.
2025-10-01 15:14:09 +00:00
Samuel Thibault 81a6e97791 hurd: Note BZ #30166 as fixed
802b0eba51 ("hurd: implement RLIMIT_AS against Mach RPCs") brought the
needed RLIMIT_AS support for memory-crunchy tests.
2025-09-22 02:17:50 +02:00
Diego Nieto Cid 802b0eba51 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>
2025-09-22 00:52:37 +02:00
Samuel Thibault c9cc047e9f 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.
2025-09-21 23:45:40 +02:00
Cupertino Miranda 3b2b88ccee elf: early conversion of elf p_flags to mprotect flags
This patch replaces _dl_stack_flags global variable by
_dl_stack_prot_flags.
The advantage is that any convertion from p_flags to final used mprotect
flags occurs at loading of p_flags. It avoids repeated spurious
convertions of _dl_stack_flags, for example in allocate_thread_stack.

This modification was suggested in:
  https://sourceware.org/pipermail/libc-alpha/2025-March/165537.html

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-08-27 10:45:45 -03:00
gfleury 098e449df0 htl: move sem_unlink into libc.
Message-ID: <20250817104023.91919-8-gfleury@disroot.org>
2025-08-18 01:06:41 +02:00
gfleury f5a43420e2 htl: move sem_{clockwait, timedwait, wait, trywait} into libc.
Message-ID: <20250817104023.91919-7-gfleury@disroot.org>
2025-08-18 01:06:38 +02:00
gfleury 795f5f2a8b htl: move sem_post into libc.
Message-ID: <20250817104023.91919-6-gfleury@disroot.org>
2025-08-18 00:55:33 +02:00
gfleury 50f5ddc20a htl: move sem_open, sem_close into libc.
Message-ID: <20250817104023.91919-5-gfleury@disroot.org>
2025-08-18 00:55:18 +02:00
gfleury b2b6d32f11 htl: move sem_init into libc.
Message-ID: <20250817104023.91919-4-gfleury@disroot.org>
2025-08-18 00:23:11 +02:00
gfleury 11c07af422 htl: move sem_getvalue into libc.
Message-ID: <20250817104023.91919-3-gfleury@disroot.org>
2025-08-18 00:22:53 +02:00
gfleury c2560a0c56 htl: move sem_destroy into libc.
Message-ID: <20250817104023.91919-2-gfleury@disroot.org>
2025-08-18 00:22:43 +02:00
gfleury 80412aee3e htl: move __pthread_setup into libc.
Message-ID: <20250815181500.107433-19-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury b6616efe8c htl: move pthread_{join, clockjoin_np, timedjoin_np, tryjoin_np} into libc.
Message-ID: <20250815181500.107433-18-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 36982b0fdb htl: move pthread_exit into libc.
Message-ID: <20250815181500.107433-17-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury a901f2599e htl: move pthread_detach into libc.
Message-ID: <20250815181500.107433-16-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury d0667a77de htl: move __pthread_sigstate_init into libc.
Message-ID: <20250815181500.107433-15-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury f6a47e2d61 htl: move pthread_mutex_transfer_np into libc.
Message-ID: <20250815181500.107433-14-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 1e6588e777 htl: move pthread_getattr_np into libc.
Message-ID: <20250815181500.107433-13-gfleury@disroot.org>
2025-08-16 01:44:51 +02:00
gfleury 6541288cb5 htl: move pthread_testcancel into libc.
Message-ID: <20250815181500.107433-12-gfleury@disroot.org>
2025-08-16 01:44:50 +02:00
gfleury edcc9ca48c htl: move pthread_kill into libc.
Message-ID: <20250815181500.107433-11-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury de8351f4de htl: move pthread_cancel, __pthread_do_cancel into libc.
Message-ID: <20250815181500.107433-10-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury e0b765d9ba htl: move __thread_set_pcsptp into libc.
Message-ID: <20250815181500.107433-9-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury 2dcb8fb8e7 htl: move pthread_yield into libc.
Message-ID: <20250815181500.107433-8-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury fa35ccbba8 htl: move pthread_getcpuclockid into libc.
Message-ID: <20250815181500.107433-7-gfleury@disroot.org>
2025-08-16 01:44:27 +02:00
gfleury c3abc99cb0 htl: move __pthread_thread_{alloc, start, terminate} into libc.
Message-ID: <20250815181500.107433-6-gfleury@disroot.org>
2025-08-16 01:44:26 +02:00