]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 days agoriscv: Add Zbkb optimized repeat_bytes helper
Pincheng Wang [Fri, 31 Oct 2025 20:15:26 +0000 (15:15 -0500)] 
riscv: Add Zbkb optimized repeat_bytes helper

Introduce a RISC-V specific string-misc.h to provide an optimized
repeat_bytes implementation when the Zbkb extension is available.
The new version uses packh/packw/pack instruction count and avoiding
high latency instructions. This helper is used by several mem and string
functions, and falls back to the generic implementation when Zbkb is not
present.

Signed-off-by: Pincheng Wang <pincheng.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
6 days agomath: Remove xfail from pow test [BZ #33563]
Wilco Dijkstra [Thu, 30 Oct 2025 15:35:47 +0000 (15:35 +0000)] 
math: Remove xfail from pow test [BZ #33563]

Remove xfail from pow testcase since pow and powf have been fixed.
Also check float128 maximum value.  See BZ #33563.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agomath: Fix pow special case [BZ #33563]
Wilco Dijkstra [Thu, 30 Oct 2025 15:24:53 +0000 (15:24 +0000)] 
math: Fix pow special case [BZ #33563]

Fix pow (DBL_MAX, 1.0) to return DBL_MAX when rouding upwards without FMA.
This fixes BZ #33563.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agomath: Fix powf special case [BZ #33563]
Wilco Dijkstra [Fri, 24 Oct 2025 14:26:50 +0000 (14:26 +0000)] 
math: Fix powf special case [BZ #33563]

Fix powf (0x1.fffffep+127, 1.0f) to return 0x1.fffffep+127 when
rouding upwards.  Cleanup the special case code - performance
improves by ~1.2%.  This fixes BZ #33563.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agodebug: mark __libc_message_wrapper as always inline
Yury Khrustalev [Wed, 29 Oct 2025 15:59:53 +0000 (15:59 +0000)] 
debug: mark __libc_message_wrapper as always inline

When building with -Og to enable debugging, there is currently a compiler error
because if __libc_message_wrapper() is not inline, the __va_arg_pack_len macro
cannot be used.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agoaarch64: fix cfi directives around __libc_arm_za_disable
Yury Khrustalev [Tue, 28 Oct 2025 11:01:50 +0000 (11:01 +0000)] 
aarch64: fix cfi directives around __libc_arm_za_disable

Incorrect CFI directive corrupted call stack information
and prevented debuggers from correctly displaying call
stack information.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 days agocdefs: allow __attribute__ on tcc
Eric Wong [Fri, 31 Oct 2025 03:03:00 +0000 (20:03 -0700)] 
cdefs: allow __attribute__ on tcc

According to the tcc (tiny C compiler) Changelog, tcc supports
__attribute__ since 0.9.3.  Looking at history of tcc at
<https://repo.or.cz/tinycc.git>, __attribute__ support was added
in commit 14658993425878be300aae2e879560698e0c6c4c on 2002-01-03,
which also looks like the release of 0.9.3.  While I'm unable to
find release tags for tcc before 0.9.18 (2003-04-14), the next
release (0.9.28) will include __attribute__((cleanup(func)) which
I rely on.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
6 days agoCleanup some recently added whitespace.
Collin Funk [Thu, 30 Oct 2025 01:34:45 +0000 (18:34 -0700)] 
Cleanup some recently added whitespace.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
6 days agoriscv: memcpy_noalignment: Reorder to store via a3, then bump a3
Yao Zihong [Thu, 30 Oct 2025 22:49:21 +0000 (17:49 -0500)] 
riscv: memcpy_noalignment: Reorder to store via a3, then bump a3

Rewrite the copy micro-step from:

    REG_L  a4, 0(a5)
    addi   a3, a3, SZREG
    addi   a5, a5, SZREG
    REG_S  a4, -SZREG(a3)

to:

    REG_L  a4, 0(a5)
    addi   a5, a5, SZREG
    REG_S  a4, 0(a3)
    addi   a3, a3, SZREG

Semantics are unchanged: both read *(a5_old), write *(a3_old), and then
increment a3/a5 by SZREG. memcpy assumes non-overlapping regions, so the
reordering preserves correctness.

No functional change.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
6 days agoriscv: memcpy_noalignment: Fold SZREG/BLOCK_SIZE alignment to single andi
Yao Zihong [Thu, 30 Oct 2025 22:47:24 +0000 (17:47 -0500)] 
riscv: memcpy_noalignment: Fold SZREG/BLOCK_SIZE alignment to single andi

Simplify the alignment steps for SZREG and BLOCK_SIZE multiples. The previous
three-instruction sequences

    addi    a7, a2, -SZREG
    andi    a7, a7, -SZREG
    addi    a7, a7, SZREG

and

    addi    a7, a2, -BLOCK_SIZE
    andi    a7, a7, -BLOCK_SIZE
    addi    a7, a7, BLOCK_SIZE

are equivalent to a single

    andi    a7, a2, -SZREG
    andi    a7, a2, -BLOCK_SIZE

because SZREG and BLOCK_SIZE are powers of two in this context, making the
surrounding addi steps cancel out. Folding to one instruction reduces code
size with identical semantics.

No functional change.

sysdeps/riscv/multiarch/memcpy_noalignment.S: Remove redundant addi around
alignment; keep a single andi for SZREG/BLOCK_SIZE rounding.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
6 days agoriscv: memcpy_noalignment: Make register allocation Zca-friendly
Yao Zihong [Thu, 30 Oct 2025 22:44:07 +0000 (17:44 -0500)] 
riscv: memcpy_noalignment: Make register allocation Zca-friendly

Tidy the temporary register allocation to favor registers eligible for
compressed encodings when Zca/Zcb are enabled. This keeps the ABI and
clobber set unchanged and does not alter control flow or memory access
behavior.

No functional change.

sysdeps/riscv/multiarch/memcpy_noalignment.S: Reassign temps to improve
compressed encoding opportunities.

Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
7 days agomath: Remove the SVID error handling wrapper from yn/jn
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:21 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling wrapper from y1/j1
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:20 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling wrapper from y0/j0
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:19 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling from coshf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:15 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling from atanhf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:14 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling from acoshf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:12 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling from asinf
Adhemerval Zanella [Thu, 30 Oct 2025 13:27:10 +0000 (10:27 -0300)] 
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>
7 days agomath: Remove the SVID error handling from acosf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:10 +0000 (10:55 -0300)] 
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>
7 days agomath: Remove the SVID error handling from log10f
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:08 +0000 (10:55 -0300)] 
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>
7 days agom68k: Remove SVID error handling on fmod
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:05 +0000 (10:55 -0300)] 
m68k: Remove SVID error handling on fmod

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 days agom68k: Avoid include e_fmod.c on fmod/remainder implementation
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:04 +0000 (10:55 -0300)] 
m68k: Avoid include e_fmod.c on fmod/remainder implementation

And open-code each implementation.  It simplifies SVID error handling
removal.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 days agom68k: Remove the SVID error handling from fmodf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:03 +0000 (10:55 -0300)] 
m68k: Remove the SVID error handling from fmodf

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

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 days agoi386: Remove the SVID error handling from fmodf
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:02 +0000 (10:55 -0300)] 
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>
7 days agoi386: Remove the SVID error handling from fmod
Adhemerval Zanella [Wed, 8 Oct 2025 13:55:01 +0000 (10:55 -0300)] 
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>
8 days agox86: fix wmemset ifunc stray '!' (bug 33542)
Jiamei Xie [Tue, 14 Oct 2025 12:14:11 +0000 (20:14 +0800)] 
x86: fix wmemset ifunc stray '!' (bug 33542)

The ifunc selector for wmemset had a stray '!' in the
X86_ISA_CPU_FEATURES_ARCH_P(...) check:

  if (X86_ISA_CPU_FEATURE_USABLE_P (cpu_features, AVX2)
      && X86_ISA_CPU_FEATURES_ARCH_P (cpu_features,
                                      AVX_Fast_Unaligned_Load, !))

This effectively negated the predicate and caused the AVX2/AVX512
paths to be skipped, making the dispatcher fall back to the SSE2
implementation even on CPUs where AVX2/AVX512 are available. The
regression leads to noticeable throughput loss for wmemset.

Remove the stray '!' so the AVX_Fast_Unaligned_Load capability is
tested as intended and the correct AVX2/EVEX variants are selected.

Impact:
- On AVX2/AVX512-capable x86_64, wmemset no longer incorrectly
  falls back to SSE2; perf now shows __wmemset_evex/avx2 variants.

Testing:
- benchtests/bench-wmemset shows improved bandwidth across sizes.
- perf confirm the selected symbol is no longer SSE2.

Signed-off-by: xiejiamei <xiejiamei@hygon.com>
Signed-off-by: Li jing <lijing@hygon.cn>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agoUpdates struct tcp_zerocopy_receive from 5.11 to netinet/tcp.h.
Jiayuan Chen [Fri, 24 Oct 2025 09:24:54 +0000 (17:24 +0800)] 
Updates struct tcp_zerocopy_receive from 5.11 to netinet/tcp.h.

This patch updates struct tcp_zerocopy_receive to contain filed including
copybuf_address, copybuf_len, and others.

Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8 days agoaarch64: Fix tst-ifunc-arg-4 on clang-18
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:37 +0000 (14:08 -0300)] 
aarch64: Fix tst-ifunc-arg-4 on clang-18

It issues:

../sysdeps/aarch64/tst-ifunc-arg-4.c:39:1: error: unused function 'resolver' [-Werror,-Wunused-function]
   39 | resolver (uint64_t arg0, const uint64_t arg1[])
      | ^~~~~~~~
1 error generated.

clang-19 and onwards do not trigger the warning.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
8 days agoEnable --no-undefined-version by default
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:32 +0000 (14:08 -0300)] 
Enable --no-undefined-version by default

Recent lld version default to --no-undefined-version, which triggers
errors when building multiple libraries.  For ld.so on x86_64  it fails
with:

ld.lld: error: version script assignment of 'GLIBC_2.4' to symbol '__stack_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__nptl_set_robust_list_avail' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__pointer_chk_guard' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '_dl_starting_up' failed: symbol not defined

While for libc.so:

ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_clearerr' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fgetc' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fileno' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_freopen' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fscanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fseek' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_peekc_unlocked' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stderr_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdin_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdout_' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_pclose' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_perror' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_rewind' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_scanf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setlinebuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wdefault_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wfile_setbuf' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_tolower' failed: symbol not defined
ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_toupper' failed: symbol not defined
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

The version script is created with multiple missing symbols to simplify
the build for multiple ABIs, each of which may have different symbols.
For instance, __stack_chk_guard is defined by default. This avoids
requiring each ABI to add this symbol to its version script, depending
on the stack protector ABI it uses.

The libc.so warnings do show unused symbols being defined (like
_IO_clearerr), which might trigger potential errors depending on how
symbols are exported.  However, since we already have ABI checks for
missing and extra symbols, the linker's extra checks are not really
necessary.

The --no-undefined-version is the default for ld.bfd.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
8 days agoSupress unused command arguments warning with clang
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:31 +0000 (14:08 -0300)] 
Supress unused command arguments warning with clang

clang 20 issues an warning for the unused '-c' argument used to create
errlist-data-aux-shared.S, errlist-data-aux.S, siglist-aux-shared.S,
and siglist-aux.S.  Filter out the '-c' from the $(compile-command.c).

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
8 days agoAnnotate swtich fall-through
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:30 +0000 (14:08 -0300)] 
Annotate swtich fall-through

The clang default to warning for missing fall-through and it does
not support all comment-like annotation that gcc does.  Use C23
[[fallthrough]] annotation instead.
proper attribute instead.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agoargp: Move attribute_hidden to argp-fmtstream.h
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:20 +0000 (14:08 -0300)] 
argp: Move attribute_hidden to argp-fmtstream.h

The internal header redefines the some internal argp functions with
attribute_hidden, which triggers clang warning of mismatched attributes.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agoargp: Expand argp_usage, _option_is_short, and _option_is_end
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:19 +0000 (14:08 -0300)] 
argp: Expand argp_usage, _option_is_short, and _option_is_end

The argp code uses macro redefinitions to avoid duplicating static inline
implementations for argp_usage, _option_is_short, and _option_is_end.
However, this causes build issues with clang, as some function prototypes
are redefined to add the hidden attribute with libc_hidden_proto.

To avoid extensive changes to internal headers, just expand the function
implementations and avoid the macro redefine tricks.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agoReplace count_leading_zeros with stdc_leading_zeros
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:12 +0000 (14:08 -0300)] 
Replace count_leading_zeros with stdc_leading_zeros

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

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agomalloc: Remove unused tcache_set_inactive
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:11 +0000 (14:08 -0300)] 
malloc: Remove unused tcache_set_inactive

clang warns that this function is not used.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
8 days agoinclude: Sync gnulib intprops
Adhemerval Zanella [Tue, 28 Oct 2025 17:08:10 +0000 (14:08 -0300)] 
include: Sync gnulib intprops

It syncs with gnulib commit 1790ef25d81983d1d25a77d452c0080345df459b.

The main change is to proper support clang by using builtins.  It
fixes a sprof build issue, where previous version uses the generic
code path when building with clang:

sprof.c:682:8: error: result of comparison of constant 288230376151711743 with expression of type 'Elf64_Half' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
  682 |           if (INT_MULTIPLY_WRAPV (ehdr2.e_shnum, sizeof (ElfW(Shdr)), &size))
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:415:34: note: expanded from macro 'INT_MULTIPLY_WRAPV'
  415 |    _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW)
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:504:45: note: expanded from macro '_GL_INT_OP_WRAPV'
  504 |     : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
../include/intprops.h:511:41: note: expanded from macro '_GL_INT_OP_WRAPV_LONGISH'
  511 |         : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  512 |                            unsigned long int, 0, ULONG_MAX)) \
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:533:4: note: expanded from macro '_GL_INT_OP_CALC'
  533 |   (overflow (a, b, tmin, tmax) \
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:608:22: note: expanded from macro '_GL_INT_MULTIPLY_RANGE_OVERFLOW'
  608 |       : (tmax) / (b) < (a)))
      |         ~~~~~~~~~~~~ ^ ~~~
1 error generated.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
8 days agoi386: Build s_erf_common.c with -fexcess-precision=standard
Adhemerval Zanella [Wed, 29 Oct 2025 13:17:34 +0000 (10:17 -0300)] 
i386: Build s_erf_common.c with -fexcess-precision=standard

It is requires to provide correctly rounded results.

Checked on i686-linux-gnu.

8 days agoBuild programs in $(others-noinstall) like tests
H.J. Lu [Mon, 15 Sep 2025 18:24:22 +0000 (11:24 -0700)] 
Build programs in $(others-noinstall) like tests

Programs in $(others-noinstall) are internal to glibc build and they
aren't installed.  They should be treated like programs in $(others),
but linked like tests so that --enable-hardcoded-path-in-tests also
applies to them.

Also replace run-via-rtld-prefix with test-via-rtld-prefix when running
container tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
8 days agoFix incorrect setrlimit return value checks in tests
Osama Abdelkader [Tue, 28 Oct 2025 20:58:35 +0000 (23:58 +0300)] 
Fix incorrect setrlimit return value checks in tests

The setrlimit(2) function returns 0 on success and -1 on error, but
several test files were incorrectly checking for a return value of 1
to detect errors.  This means the error checks would never trigger,
causing tests to continue silently even when setrlimit() failed.

This commit fixes the error checks in five files to correctly test
for -1, matching both the documented behavior and the pattern used
correctly in other parts of the codebase.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
9 days agoRename uimaxabs to umaxabs (bug 33325)
Joseph Myers [Tue, 28 Oct 2025 12:15:02 +0000 (12:15 +0000)] 
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.

10 days agomath: Consolidate CORE-MATH double-double routines
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:33 +0000 (15:15 -0300)] 
math: Consolidate CORE-MATH double-double routines

For lgamma and tgamma the muldd, mulddd, and polydd are renamed
to muldd2, mulddd2, and polydd2 respectively.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Consolidate erf/erfc definitions
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:32 +0000 (15:15 -0300)] 
math: Consolidate erf/erfc definitions

The common code definitions are consolidated in s_erf_common.h
and s_erf_common.c.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Consolidate internal erf/erfc tables
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:31 +0000 (15:15 -0300)] 
math: Consolidate internal erf/erfc tables

The shared internal data definitions are consolidated in
s_erf_data.c and the erfc only one are moved to s_erfc_data.c.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use erfc from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:30 +0000 (15:15 -0300)] 
math: Use erfc from CORE-MATH

The current implementation precision shows the following accuracy, on
three ranges ([-DBL_MAX,5], [-5,5], [5,DBL_MAX]) with 10e9 uniform
randomly generated numbers for each range (first column is the
accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MAX, -5]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-5, 5]
 * FE_TONEAREST
     0:       8069309665  80.69%
     1:       1882910247  18.83%
     2:         47485296   0.47%
     3:           293749   0.00%
     4:             1043   0.00%
 * FE_UPWARD
     0:       5540301026  55.40%
     1:       2026739127  20.27%
     2:       1774882486  17.75%
     3:        567324466   5.67%
     4:         86913847   0.87%
     5:          3820789   0.04%
     6:            18259   0.00%
 * FE_DOWNWARD
     0:       5520969586  55.21%
     1:       2057293099  20.57%
     2:       1778334818  17.78%
     3:        557521494   5.58%
     4:         82473927   0.82%
     5:          3393276   0.03%
     6:            13800   0.00%
 * FE_TOWARDZERO
     0:       6220287175  62.20%
     1:       2323846149  23.24%
     2:       1251999920  12.52%
     3:        190748245   1.91%
     4:         12996232   0.13%
     5:           122279   0.00%

* Range [5, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      49.0980       267.0660      -443.94%
x86_64v2                    49.3220       257.6310      -422.34%
x86_64v3                    42.9539        84.9571       -97.79%
aarch64                     28.7266        52.9096       -84.18%
power10                     14.1673        25.1273       -77.36%

Latency                      master        patched   improvement
x86_64                      95.6640       269.7060      -181.93%
x86_64v2                    95.8296       260.4860      -171.82%
x86_64v3                    91.1658       112.7150       -23.64%
aarch64                     37.0745        58.6791       -58.27%
power10                     23.3197        31.5737       -35.39%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use erf from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:29 +0000 (15:15 -0300)] 
math: Use erf from CORE-MATH

The current implementation precision shows the following accuracy, on
three rangeis ([-DBL_MIN, -4.2], [-4.2, 4.2], [4.2, DBL_MAX]) with
10e9 uniform randomly generated numbers for each range (first column
is the accuracy in ULP, with '0' being correctly rounded, second is the
number of samples with the corresponding precision):

* Range [-DBL_MIN, -4.2]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

* Range [-4.2, 4.2]
 * FE_TONEAREST
     0:       9764404513  97.64%
     1:        235595487   2.36%
 * FE_UPWARD
     0:       9468013928  94.68%
     1:        531986072   5.32%
 * FE_DOWNWARD
     0:       9493787693  94.94%
     1:        506212307   5.06%
 * FE_TOWARDZERO
     0:       9585271351  95.85%
     1:        414728649   4.15%

* Range [4.2, DBL_MAX]
 * FE_TONEAREST
     0:      10000000000 100.00%
 * FE_UPWARD
     0:      10000000000 100.00%
 * FE_DOWNWARD
     0:      10000000000 100.00%
 * FE_TOWARDZERO
     0:      10000000000 100.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master       patched   improvement
x86_64                      38.2754       78.0311      -103.87%
x86_64v2                    38.3325       75.7555       -97.63%
x86_64v3                    34.6604       28.3182        18.30%
aarch64                     23.1499       21.4307         7.43%
power10                     12.3051       9.3766         23.80%

Latency                      master       patched   improvement
x86_64                      84.3062      121.3580       -43.95%
x86_64v2                    84.1817      117.4250       -39.49%
x86_64v3                    81.0933       70.6458        12.88%
aarch64                      35.012       29.5012        15.74%
power10                     21.7205       18.4589        15.02%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use tgamma from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:28 +0000 (15:15 -0300)] 
math: Use tgamma from CORE-MATH

The current implementation precision shows the following accuracy, on
one range ([-20,20]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-20,20]
 * FE_TONEAREST
     0:       4504877808  45.05%
     1:       4402224940  44.02%
     2:        947652295   9.48%
     3:        131076831   1.31%
     4:         13222216   0.13%
     5:           910045   0.01%
     6:            35253   0.00%
     7:              606   0.00%
     8:                6   0.00%
 * FE_UPWARD
     0:       3477307921  34.77%
     1:       4838637866  48.39%
     2:       1413942684  14.14%
     3:        240762564   2.41%
     4:         27113094   0.27%
     5:          2130934   0.02%
     6:           102599   0.00%
     7:             2324   0.00%
     8:               14   0.00%
 * FE_DOWNWARD
     0:       3923545410  39.24%
     1:       4745067290  47.45%
     2:       1137899814  11.38%
     3:        171596912   1.72%
     4:         20013805   0.20%
     5:          1773899   0.02%
     6:            99911   0.00%
     7:             2928   0.00%
     8:               31   0.00%
 * FE_TOWARDZERO
     0:       3697160741  36.97%
     1:       4731951491  47.32%
     2:       1303092738  13.03%
     3:        231969191   2.32%
     4:         32344517   0.32%
     5:          3283092   0.03%
     6:           193010   0.00%
     7:             5175   0.00%
     8:               45   0.00%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                     237.7960       175.4090        26.24%
x86_64v2                   232.9320       163.4460        29.83%
x86_64v3                   193.0680        89.7721        53.50%
aarch64                    113.6340        56.7350        50.07%
power10                     92.0617        26.6137        71.09%

Latency                      master        patched   improvement
x86_64                     266.7190       208.0130        22.01%
x86_64v2                   263.6070       200.0280        24.12%
x86_64v3                   214.0260       146.5180        31.54%
aarch64                    114.4760        58.5235        48.88%
power10                     84.3718        35.7473        57.63%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use lgamma from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:27 +0000 (15:15 -0300)] 
math: Use lgamma from CORE-MATH

The current implementation precision shows the following accuracy, on
one range ([-1,1]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-20, 20]
 * FE_TONEAREST
     0:       6701254075  67.01%
     1:       3230897408  32.31%
     2:         63986940   0.64%
     3:          3605417   0.04%
     4:           233189   0.00%
     5:            20973   0.00%
     6:             1869   0.00%
     7:              125   0.00%
     8:                4   0.00%
 * FE_UPWARDA
     0:       4207428861  42.07%
     1:       5001137116  50.01%
     2:        740542213   7.41%
     3:         49116304   0.49%
     4:          1715617   0.02%
     5:            54464   0.00%
     6:             4956   0.00%
     7:              451   0.00%
     8:               16   0.00%
     9:                2   0.00%
 * FE_DOWNWARD
     0:       4155925193  41.56%
     1:       4989821364  49.90%
     2:        770312796   7.70%
     3:         72014726   0.72%
     4:         11040522   0.11%
     5:           872811   0.01%
     6:            12480   0.00%
     7:              106   0.00%
     8:                2   0.00%
 * FE_TOWARDZERO
     0:       4225861532  42.26%
     1:       5027051105  50.27%
     2:        706443411   7.06%
     3:         39877908   0.40%
     4:           713109   0.01%
     5:            47513   0.00%
     6:             4961   0.00%
     7:              438   0.00%
     8:               23   0.00%

* Range [20, 0x5.d53649e2d4674p+1012]
 * FE_TONEAREST
     0:       7262241995  72.62%
     1:       2737758005  27.38%
 * FE_UPWARD
     0:       4690392401  46.90%
     1:       5143728216  51.44%
     2:        165879383   1.66%
 * FE_DOWNWARD
     0:       4690333331  46.90%
     1:       5143794937  51.44%
     2:        165871732   1.66%
 * FE_TOWARDZERO
     0:       4690343071  46.90%
     1:       5143786761  51.44%
     2:        165870168   1.66%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                     112.9740       135.8640       -20.26%
x86_64v2                   111.8910       131.7590       -17.76%
x86_64v3                   108.2800        68.0935        37.11%
aarch64                     61.3759        49.2403        19.77%
power10                     42.4483        24.1943        43.00%

Latency                      master        patched   improvement
x86_64                     144.0090       167.9750       -16.64%
x86_64v2                   139.2690       167.1900       -20.05%
x86_64v3                   130.1320        96.9347        25.51%
aarch64                     66.8538        53.2747        20.31%
power10                     49.5076        29.6917        40.03%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Move atanh internal data to separate file
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:26 +0000 (15:15 -0300)] 
math: Move atanh internal data to separate file

The internal data definitions are moved to s_atanh_data.c.
It helps on ABIs that build the implementation multiple times for
ifunc optimizations, like x86_64.

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Consolidate acosh and asinh internal table
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:25 +0000 (15:15 -0300)] 
math: Consolidate acosh and asinh internal table

The shared internal data definitions are consolidated in
s_asincosh_data.c.

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use atanh from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:24 +0000 (15:15 -0300)] 
math: Use atanh from CORE-MATH

The current implementation precision shows the following accuracy, on
one range ([-1,1]) with 10e9 uniform randomly generated numbers for
each range (first column is the accuracy in ULP, with '0' being
correctly rounded, second is the number of samples with the
corresponding precision):

* Range [-1, 1]
 * FE_TONEAREST
     0:       8180011860  81.80%
     1:       1819865257  18.20%
     2:           122883   0.00%
 * FE_UPWARDA
     0:       3903695744  39.04%
     1:       4992324465  49.92%
     2:       1096319340  10.96%
     3:          7660451   0.08%
 * FE_DOWNWARDA
     0:       3904555484  39.05%
     1:       4991970864  49.92%
     2:       1095447471  10.95%
     3:          8026181   0.08%
 * FE_TOWARDZERO
     0:       7070209165  70.70%
     1:       2908447434  29.08%
     2:         21343401   0.21%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      26.4969        22.4625       15.23%
x86_64v2                    26.0792        22.9822       11.88%
x86_64v3                    25.6357        22.2147       13.34%
aarch64                     20.2295        19.7001        2.62%
power10                     10.0986         9.3846        7.07%

Latency                      master        patched   improvement
x86_64                      80.2311        59.9745       25.25%
x86_64v2                    79.7010        61.4066       22.95%
x86_64v3                    78.2679        58.5804       25.15%
aarch64                     34.3959        28.1523       18.15%
power10                     23.2417        18.2694       21.39%

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use asinh from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:23 +0000 (15:15 -0300)] 
math: Use asinh from CORE-MATH

The current implementation precision shows the following accuracy, on
tthree different ranges ([-DBL_MAX, -10], [-10,10], and [10, DBL_MAX))
with 10e9 uniform randomly generated numbers for each range (first
column is the accuracy in ULP, with '0' being correctly rounded, second
is the number of samples with the corresponding precision):

* range [-DBL_MAX, -10]
 * FE_TONEAREST
     0:       5164019099  51.64%
     1:       4835980901  48.36%
 * FE_UPWARD
     1:       4836053540  48.36%
     2:       5163946460  51.64%
 * FE_DOWNWARD
     1:       5163926134  51.64%
     2:       4836073866  48.36%
 * FE_TOWARDZERO
     0:       5163937001  51.64%
     1:       4836062999  48.36%

* Range [-10, 10)
 * FE_TONEAREST
     0:       8679029381  86.79%
     1:       1320934581  13.21%
     2:            36038   0.00%
 * FE_UPWARD
     0:       3965704277  39.66%
     1:       4993616710  49.94%
     2:       1039680225  10.40%
     3:           998788   0.01%
 * FE_DOWNWARD
     0:       3965806523  39.66%
     1:       4993534438  49.94%
     2:       1039601726  10.40%
     3:          1057313   0.01%
 * FE_TOWARDZEROA
     0:       7734210130  77.34%
     1:       2261868439  22.62%
     2:          3921431   0.04%

* Range [10, DBL_MAX)
 * FE_TONEAREST
     0:       5163973212  51.64%
     1:       4836026788  48.36%
 * FE_UPWARD
     0:       4835991071  48.36%
     1:       5164008929  51.64%
 * FE_DOWNWARD
     0:       5163983594  51.64%
     1:       4836016406  48.36%
 * FE_TOWARDZERO
     0:       5163993394  51.64%
     1:       4836006606  48.36%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master        patched   improvement
x86_64                      26.5178        45.3754       -71.11%
x86_64v2                    26.3167        44.7870       -70.18%
x86_64v3                    25.9109        25.4887         1.63%
aarch64                     18.0555        17.3374         3.98%
power10                     19.8535        20.5586        -3.55%

Latency                      master        patched   improvement
x86_64                      82.6755        91.2026       -10.31%
x86_64v2                    82.4581        90.7152       -10.01%
x86_64v3                    80.7000        71.9454        10.85%
aarch64                     32.8320        28.8565        12.11%
power10                     44.5309        37.0096        16.89%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agomath: Use acosh from CORE-MATH
Adhemerval Zanella [Fri, 10 Oct 2025 18:15:22 +0000 (15:15 -0300)] 
math: Use acosh from CORE-MATH

The current implementation precision shows the following accuracy, on
two different ranges ([1,21) and [21, DBL_MAX)) with 10e9 uniform
randomly generated numbers (first column is the accuracy in ULP, with
'0' being correctly rounded, second is the number of samples with the
corresponding precision):

* range [1,21]

 * FE_TONEAREST
    0:       8931139411  89.31%
    1:       1068697545  10.69%
    2:           163044   0.00%
 * FE_UPWARD
    0:       7936620731  79.37%
    1:       2062594522  20.63%
    2:           783977   0.01%
    3:              770   0.00%
 * FE_DOWNWARD
    0:       7936459794  79.36%
    1:       2062734117  20.63%
    2:           805312   0.01%
    3:              777   0.00%
 * FE_TOWARDZERO
    0:       7910345595  79.10%
    1:       2088584522  20.89%
    2:          1069106   0.01%
    3:              777   0.00%

* Range [21, DBL_MAX)
 * FE_TONEAREST
    0:       5163888431  51.64%
    1:       4836111569  48.36%
 * FE_UPWARD
    0:       4835951885  48.36%
    1:       5164048115  51.64%
 * FE_DOWNWARD
    0:       5164048432  51.64%
    1:       4835951568  48.36%
 * FE_TOWARDZERO
    0:       5164058042  51.64%
    1:       4835941958  48.36%

The CORE-MATH implementation is correctly rounded for any rounding mode.
The code was adapted to glibc style and to use the definition of
math_config.h (to handle errno, overflow, and underflow).

Benchtest on x64_64 (Ryzen 9 5900X, gcc 14.2.1), aarch64 (Neoverse-N1,
gcc 13.3.1), and powerpc (POWER10, gcc 13.2.1) shows:

reciprocal-throughput        master       patched   improvement
x86_64                      20.9131       47.2187      -125.79%
x86_64v2                    20.8823       41.1042       -96.84%
x86_64v3                    19.0282       25.8045       -35.61%
aarch64                     14.7419       18.1535       -23.14%
power10                     8.98341       11.0423       -22.92%

Latency                      master       patched   improvement
x86_64                      75.5494       89.5979      -18.60%
x86_64v2                    74.4443       87.6292      -17.71%
x86_64v3                    71.8558       70.7086        1.60%
aarch64                     30.3361       29.2709        3.51%
power10                     20.9263       19.2482        8.02%

For x86_64/x86_64-v2, most performance hit came from the fma call
through the ifunc mechanism.

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

Reviewed-by: DJ Delorie <dj@redhat.com>
10 days agoLinux: fix tst-copy_file_range-large test on 32-bit platforms.
Collin Funk [Mon, 27 Oct 2025 02:06:08 +0000 (19:06 -0700)] 
Linux: fix tst-copy_file_range-large test on 32-bit platforms.

Since SSIZE_MAX is less than UINT_MAX on 32-bit platforms we must AND
the expression with SSIZE_MAX.

Tested on x86_64 and x86.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
11 days agox86: Disable AVX Fast Unaligned Load on Hygon 1/2/3
litenglong [Fri, 17 Oct 2025 01:45:41 +0000 (09:45 +0800)] 
x86: Disable AVX Fast Unaligned Load on Hygon 1/2/3

- Performance testing revealed significant memcpy performance degradation
  when bit_arch_AVX_Fast_Unaligned_Load is enabled on Hygon 3.
- Hygon confirmed AVX performance issues in certain memory functions.
- Glibc benchmarks show SSE outperforms AVX for
  memcpy/memmove/memset/strcmp/strcpy/strlen and so on.
- Hardware differences primarily in floating-point operations don't justify
  AVX usage for memory operations.

Reviewed-by: gaoxiang <gaoxiang@kylinos.cn>
Signed-off-by: litenglong <litenglong@kylinos.cn>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
11 days agoppc64le: Power 10 rawmemchr clobbers v20 (bug #33091)
Sachin Monga [Sun, 26 Oct 2025 17:17:12 +0000 (12:17 -0500)] 
ppc64le: Power 10 rawmemchr clobbers v20 (bug #33091)

Replace non-volatile(v20) by volatile(v17)
since v20 is not restored

Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
13 days agomalloc: fix large tcache code to check for exact size match
Dev Jain [Fri, 24 Oct 2025 16:52:21 +0000 (16:52 +0000)] 
malloc: fix large tcache code to check for exact size match

The tcache is used for allocation only if an exact match is found. In the
large tcache code added in commit cbfd7988107b, we currently extract a
chunk of size greater than or equal to the size we need, but don't check
strict equality. This patch fixes that behaviour.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agoFix configure from ab22e5ec37396f6c6f29d3e3306f6fcc2ebe9d49
Adhemerval Zanella [Wed, 22 Oct 2025 20:23:12 +0000 (17:23 -0300)] 
Fix configure from ab22e5ec37396f6c6f29d3e3306f6fcc2ebe9d49

The "-Wno-unused-command-line-argument" was incorrectly added.

2 weeks agomisc: Fix clang -Wstring-plus-int warnings on syslog
Adhemerval Zanella [Fri, 29 Apr 2022 13:50:13 +0000 (10:50 -0300)] 
misc: Fix clang -Wstring-plus-int warnings on syslog

clang issues:

syslog.c:193:9: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
  193 |                       SYSLOG_HEADER (pri, timestamp, &msgoff, pid));
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
syslog.c:180:7: note: expanded from macro 'SYSLOG_HEADER'
  180 |   "[" + (pid == 0), pid, "]" + (pid == 0)

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

2 weeks agosprof: fix -Wformat warnings on 32-bit hosts
Collin Funk [Wed, 22 Oct 2025 08:51:09 +0000 (01:51 -0700)] 
sprof: fix -Wformat warnings on 32-bit hosts

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agovarious fixes detected with -Wdouble-promotion
Paul Zimmermann [Tue, 14 Oct 2025 07:58:20 +0000 (09:58 +0200)] 
various fixes detected with -Wdouble-promotion

Changes with respect to v1:
- added comment in e_j1f.c to explain the use of float is enough
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2 weeks agoposix: Fix memory leak a memory leak in glob.
Bruno Haible [Wed, 22 Oct 2025 02:06:05 +0000 (19:06 -0700)] 
posix: Fix memory leak a memory leak in glob.

Found by Coverity in Gnulib.

* posix/glob.c (__glob): Add scratch_buffer_free invocation, to match
scratch_buffer_init invocation.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoplot_strings.py: Replace np.complex with complex
H.J. Lu [Tue, 21 Oct 2025 23:29:03 +0000 (07:29 +0800)] 
plot_strings.py: Replace np.complex with complex

Replace np.complex with complex to fix numpy error:

AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agomalloc: avoid need for tcache == NULL checks
DJ Delorie [Thu, 28 Aug 2025 20:30:30 +0000 (16:30 -0400)] 
malloc: avoid need for tcache == NULL checks

Avoid needing to check for tcache == NULL by initializing it
to a dummy read-only tcache structure.  This dummy is all zeros,
so logically it is both full (when you want to put) and empty (when
you want to get).  Also, there are two dummies, one used for
"not yet initialized" and one for "tunables say we shouldn't have
a tcache".

The net result is twofold:

1. Checks for tcache == NULL may be removed from the fast path.
    Whether this makes the fast path faster when tcache is
    disabled is TBD, but the normal case is tcache enabled.

2. no memory for tcache is allocated if tunables disable caching.

Co-authored-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2 weeks agosprof: check pread size and offset for overflow
DJ Delorie [Thu, 16 Oct 2025 01:37:56 +0000 (21:37 -0400)] 
sprof: check pread size and offset for overflow

Add a bit of descriptive paranoia to the values we read from
the ELF headers and use to access data.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agoSimplify powl computation for small integral y [BZ #33411]
Siddhesh Poyarekar [Sat, 11 Oct 2025 00:21:13 +0000 (20:21 -0400)] 
Simplify powl computation for small integral y [BZ #33411]

The powl implementation for x86_64 ends up multiplying X once more than
necessary and then throwing away that result.  This results in an
overflow flag being set in cases where there is no overflow.

Simplify the relevant portion by special casing the -3 to 3 range and
simply multiplying repetitively.

Resolves: BZ #33411
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed by: Paul Zimmermann <Paul.Zimmermann@inria.fr>

2 weeks agosunrpc: Fix clang build
Adhemerval Zanella [Mon, 20 Oct 2025 12:27:54 +0000 (09:27 -0300)] 
sunrpc: Fix clang build

clang-21 issues:

rtime.c:96:36: error: variable 'thetime' is uninitialized when passed as a const pointer argument here
      [-Werror,-Wuninitialized-const-pointer]
   96 |       res = __sendto (s, (char *) &thetime, sizeof (thetime), 0,
      |                                    ^~~~~~~

For SOCK_DGRAM the sendto sends an uninitialized value.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agomath: Fix compare sort function on compoundn
Adhemerval Zanella [Mon, 20 Oct 2025 12:27:53 +0000 (09:27 -0300)] 
math: Fix compare sort function on compoundn

To use the fabs function to the used type, instead of the double
variant.  it fixes a build issue with clang:

./s_compoundn_template.c:64:14: error: absolute value function 'fabs' given an argument of type 'const long double' but has parameter of type 'double' which may cause truncation of value [-Werror,-Wabsolute-value]
   64 |   FLOAT pd = fabs (*(const FLOAT *) p);
      |              ^
./s_compoundn_template.c:64:14: note: use function 'fabsl' instead
   64 |   FLOAT pd = fabs (*(const FLOAT *) p);
      |              ^~~~
      |              fabsl

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agogmon: Only used -fno-tree-loop-distribute-patterns if compiler supports it
Adhemerval Zanella [Mon, 20 Oct 2025 12:27:50 +0000 (09:27 -0300)] 
gmon: Only used -fno-tree-loop-distribute-patterns if compiler supports it

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agotermios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed
Adhemerval Zanella [Mon, 20 Oct 2025 12:27:49 +0000 (09:27 -0300)] 
termios: Suppress clang -Winitializer-overrider on ___cbaud_to_speed

clang-18 and onwards issues:

../sysdeps/unix/sysv/linux/speed.c:71:23: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
   71 |       [_cbix(__B0)] = 0,
      |                       ^
../sysdeps/unix/sysv/linux/speed.c:70:34: note: previous initialization is here
   70 |       [0 ... _cbix(CBAUDMASK)] = -1,
[...]

The override is explicit used to support the same initialization on
multiple platforms (since the baud values differ on alpha and powerpc).

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agostdio: Only use __va_arg_pack if compiler supports it
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:24 +0000 (16:13 -0300)] 
stdio: Only use __va_arg_pack if compiler supports it

Otherwise route __libc_message_wrapper to __libc_message_impl.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoelf: Fix tunable handing with clang
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:22 +0000 (16:13 -0300)] 
elf: Fix tunable handing with clang

Recent clang version optimizes some loops contructions to strlen [1],
which might generate function calls when self-relocation is not
already done (on tunable parsing).  Use an out-of-line function
with __attribute_optimization_barrier__ to avoid this.

[1] https://github.com/llvm/llvm-project/pull/132572/commits/facd7dfc80d655fe49baf4bf27e144a4c890a149

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agoelf: Suppress unused function clang warning for __ifunc_resolver
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:14 +0000 (16:13 -0300)] 
elf: Suppress unused function clang warning for __ifunc_resolver

The __ifunc_resolver macro expands to:

   extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc")));
   static __typeof (__redirect_name) *name_ifunc (void) { [...] };

And although NAME_IFUNC is and alias for NAME, clang still emits
an 'unused function 'name_ifunc' [-Werror,-Wunused-function]'
warning.  The static is used to avoid name pollution on static
linkage.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agosupport: Handle clang support/dtotimespec.c on dtotimespec
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:02 +0000 (16:13 -0300)] 
support: Handle clang support/dtotimespec.c on dtotimespec

clang issues:

dtotimespec.c:31:25: error: implicit conversion from 'time_t' (aka
'long') to 'double' changes value from 9223372036854775807 to
9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
  else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
                      ~ ^~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM'
  ((t) (! TYPE_SIGNED (t)
\
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So explicit cast it to double.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agostdio: Fix -Wtautological-constant-out-of-range-compare on clang
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:01 +0000 (16:13 -0300)] 
stdio: Fix -Wtautological-constant-out-of-range-compare on clang

clang emits an error while building vfprintf-internal for default
case:

error: result of comparison of constant 255 with expression of type
'char' is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
          if (spec <= UCHAR_MAX

The test is indeed not required for default non-wide build.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2 weeks agomath: Suppress more aliases builtin type conflicts
Adhemerval Zanella [Fri, 17 Oct 2025 19:13:00 +0000 (16:13 -0300)] 
math: Suppress more aliases builtin type conflicts

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agosupport: Use CHAR_MAX as maximum value
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:59 +0000 (16:12 -0300)] 
support: Use CHAR_MAX as maximum value

On ABIs with defined 'char' was unsigned type, clang fails to build
support_process_state.c with:

  support_process_state.c:70:21: error: result of comparison of constant  -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
     70 |       if (cur_state == -1)
        |           ~~~~~~~~~ ^  ~~
  1 error generated.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agomath: Suppress clang -Wincompatible-library-redeclaration on s_llround
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:55 +0000 (16:12 -0300)] 
math: Suppress clang -Wincompatible-library-redeclaration on s_llround

Clang issues:

  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: error: incompatible
  redeclaration of library function 'lround'
  [-Werror,-Wincompatible-library-redeclaration]
  libm_alias_double (__lround, lround)
                               ^
  ../sysdeps/ieee754/dbl-64/s_llround.c:83:30: note: 'lround' is a builtin
  with type 'long (double)'

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agomath: use fabs on __ieee754_lgamma_r
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:54 +0000 (16:12 -0300)] 
math: use fabs on __ieee754_lgamma_r

clang issues:

  ../sysdeps/ieee754/dbl-64/e_lgamma_r.c:234:29: error: absolute value function 'fabsf'
  given an argument of type 'double' but has parameter of type 'float' which may cause \
  truncation of value [-Werror,-Wabsolute-value]

It should not matter because the value is 0.0, but using fabs is
simpler than adding a warning suppresion.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agomath: Suppress clang -Wabsolute-value warning on math_check_force_underflow
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:53 +0000 (16:12 -0300)] 
math: Suppress clang -Wabsolute-value warning on math_check_force_underflow

clang warns:

  ../sysdeps/x86/fpu/powl_helper.c:233:3: error: absolute value function
  '__builtin_fabsf' given an argument of type 'typeof (res)' (aka 'long
  double') but has parameter of type 'float' which may cause truncation of
  value [-Werror,-Wabsolute-value]
    math_check_force_underflow (res);
    ^
  ./math-underflow.h:45:11: note: expanded from macro
  'math_check_force_underflow'
        if (fabs_tg (force_underflow_tmp)                         \
            ^
  ./math-underflow.h:27:20: note: expanded from macro 'fabs_tg'
  #define fabs_tg(x) __MATH_TG ((x), (__typeof (x)) __builtin_fabs, (x))
                     ^
  ../math/math.h:899:16: note: expanded from macro '__MATH_TG'
                 float: FUNC ## f ARGS,           \
                        ^
  <scratch space>:73:1: note: expanded from here
  __builtin_fabsf
  ^

Due the use of _Generic from TG_MATH.

Reviewed-by: Sam James <sam@gentoo.org>
2 weeks agocatgets: Remove catgets/config.h
Adhemerval Zanella [Fri, 17 Oct 2025 19:12:52 +0000 (16:12 -0300)] 
catgets: Remove catgets/config.h

It simplifies the code a bit and avoid the clang warning:

  ./config.h:12:2: error: #include_next in file found relative to primary
  source file or found by absolute path; will search from start of include
  path [-Werror,-Winclude-next-absolute-path]
  #include_next <config.h>
   ^

Reviewed-by: Sam James <sam@gentoo.org>
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>