]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
7 months agoelf: Introduce is_rtld_link_map
Florian Weimer [Fri, 20 Dec 2024 14:52:57 +0000 (15:52 +0100)] 
elf: Introduce is_rtld_link_map

Unconditionally define it to false for static builds.

This avoids the awkward use of weak_extern for _dl_rtld_map
in checks that cannot be possibly true on static builds.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agoAdd F_CREATED_QUERY from Linux 6.12 to bits/fcntl-linux.h
Joseph Myers [Fri, 20 Dec 2024 11:47:33 +0000 (11:47 +0000)] 
Add F_CREATED_QUERY from Linux 6.12 to bits/fcntl-linux.h

Linux 6.12 adds a new constant F_CREATED_QUERY.  Add it to glibc's
bits/fcntl-linux.h.

Tested for x86_64.

7 months agoAdd HWCAP_LOONGARCH_LSPW from Linux 6.12 to bits/hwcap.h
Joseph Myers [Fri, 20 Dec 2024 11:47:03 +0000 (11:47 +0000)] 
Add HWCAP_LOONGARCH_LSPW from Linux 6.12 to bits/hwcap.h

Add the new Linux 6.12 HWCAP_LOONGARCH_LSPW to the corresponding
bits/hwcap.h.

Tested with build-many-glibcs.py for loongarch64-linux-gnu-lp64d.

7 months agoAdd MSG_SOCK_DEVMEM from Linux 6.12 to bits/socket.h
Joseph Myers [Fri, 20 Dec 2024 11:45:45 +0000 (11:45 +0000)] 
Add MSG_SOCK_DEVMEM from Linux 6.12 to bits/socket.h

Linux 6.12 adds a constant MSG_SOCK_DEVMEM (recall that various
constants such as this one are defined in the non-uapi linux/socket.h
but still form part of the kernel/userspace interface, so that
non-uapi header is one that needs checking each release for new such
constants).  Add it to glibc's bits/socket.h.

Tested for x86_64.

7 months agoi386: Regenerate ulps
Florian Weimer [Fri, 20 Dec 2024 11:40:17 +0000 (12:40 +0100)] 
i386: Regenerate ulps

As seen on an Intel i9-9900K CPU, with glibc built with GCC 11.5,
configured with and without --disable-multi-arch.

7 months agox86_64: Regenerate ulps
Florian Weimer [Fri, 20 Dec 2024 06:21:48 +0000 (07:21 +0100)] 
x86_64: Regenerate ulps

As seen with an AMD 7950X CPU, on a glibc built with GCC 11.5.

7 months agoaarch64: Regenerate ulps
Florian Weimer [Fri, 20 Dec 2024 06:12:30 +0000 (07:12 +0100)] 
aarch64: Regenerate ulps

Results from running on Neoverse-V2, built with GCC 11.5.

7 months agoelf: Remove code dependent on __rtld_lock_default_lock_recursive macro
Florian Weimer [Thu, 19 Dec 2024 20:28:50 +0000 (21:28 +0100)] 
elf: Remove code dependent on __rtld_lock_default_lock_recursive macro

Neither NPTL nor Hurd define this macro anymore.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agoLinux: Accept null arguments for utimensat pathname
Florian Weimer [Thu, 19 Dec 2024 19:56:44 +0000 (20:56 +0100)] 
Linux: Accept null arguments for utimensat pathname

This matches kernel behavior.  With this change, it is possible
to use utimensat as a replacement for the futimens interface,
similar to what glibc does internally.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
7 months agox86_64: Remove unused padding from tcbhead_t
Florian Weimer [Thu, 19 Dec 2024 19:56:44 +0000 (20:56 +0100)] 
x86_64: Remove unused padding from tcbhead_t

This padding is difficult to use for preserving the internal
GLIBC_PRIVATE ABI.  The comment is misleading.  Current Address
Sanitizer uses heuristics to determine struct pthread size.
It does not depend on its precise layout.  It merely scans for
pointers allocated using malloc.

Due to the removal of the padding, the assert for its start
is no longer required.

Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
7 months agoAdd further DSO dependency sorting tests
Joseph Myers [Thu, 19 Dec 2024 18:56:04 +0000 (18:56 +0000)] 
Add further DSO dependency sorting tests

The current DSO dependency sorting tests are for a limited number of
specific cases, including some from particular bug reports.

Add tests that systematically cover all possible DAGs for an
executable and the shared libraries it depends on, directly or
indirectly, up to four objects (an executable and three shared
libraries).  (For this kind of DAG - ones with a single source vertex
from which all others are reachable, and an ordering on the edges from
each vertex - there are 57 DAGs on four vertices, 3399 on five
vertices and 1026944 on six vertices; see
https://arxiv.org/pdf/2303.14710 for more details on this enumeration.
I've tested that the 3399 cases with five vertices do all pass if
enabled.)

These tests are replicating the sorting logic from the dynamic linker
(thereby, for example, asserting that it doesn't accidentally change);
I'm not claiming that the logic in the dynamic linker is in some
abstract sense optimal.  Note that these tests do illustrate how in
some cases the two sorting algorithms produce different results for a
DAG (I think all the existing tests for such differences are ones
involving cycles, and the motivation for the new algorithm was also to
improve the handling of cycles):

  tst-dso-ordering-all4-44: a->[bc];{}->[cba]
  output(glibc.rtld.dynamic_sort=1): c>b>a>{}<a<b<c
  output(glibc.rtld.dynamic_sort=2): b>c>a>{}<a<c<b

They also illustrate that sometimes the sorting algorithms do not
follow the order in which dependencies are listed in DT_NEEDED even
though there is a valid topological sort that does follow that, which
might be counterintuitive considering that the DT_NEEDED ordering is
followed in the simplest cases:

  tst-dso-ordering-all4-56: {}->[abc]
  output: c>b>a>{}<a<b<c

shows such a simple case following DT_NEEDED order for destructor
execution (the reverse of it for constructor execution), but

  tst-dso-ordering-all4-41: a->[cb];{}->[cba]
  output: c>b>a>{}<a<b<c

shows that c and b are in the opposite order to what might be expected
from the simplest case, though there is no dependency requiring such
an opposite order to be used.

(I'm not asserting that either of those things is a problem, simply
observing them as less obvious properties of the sorting algorithms
shown up by these tests.)

Tested for x86_64.

7 months agoAdd NT_X86_XSAVE_LAYOUT and NT_ARM_POE from Linux 6.12 to elf.h
Joseph Myers [Thu, 19 Dec 2024 17:09:19 +0000 (17:09 +0000)] 
Add NT_X86_XSAVE_LAYOUT and NT_ARM_POE from Linux 6.12 to elf.h

Linux 6.12 adds new ELF note types NT_X86_XSAVE_LAYOUT and NT_ARM_POE.
Add these to glibc's elf.h.

Tested for x86_64.

7 months agoAdd SCHED_EXT from Linux 6.12 to bits/sched.h
Joseph Myers [Thu, 19 Dec 2024 17:08:38 +0000 (17:08 +0000)] 
Add SCHED_EXT from Linux 6.12 to bits/sched.h

Linux 6.12 adds the SCHED_EXT constant.  Add it to glibc's
bits/sched.h and update the kernel version in tst-sched-consts.py.

Tested for x86_64.

7 months agohppa: Fix strace detach-vfork test
John David Anglin [Thu, 19 Dec 2024 16:30:09 +0000 (11:30 -0500)] 
hppa: Fix strace detach-vfork test

This change implements vfork.S for direct support of the vfork
syscall.  clone.S is revised to correct child support for the
vfork case.

The main bug was creating a frame prior to the clone syscall.
This was done to allow the rp and r4 registers to be saved and
restored from the stack frame.  r4 was used to save and restore
the PIC register, r19, across the system call and the call to
set errno.  But in the vfork case, it is undefined behavior
for the child to return from the function in which vfork was
called.  It is surprising that this usually worked.

Syscalls on hppa save and restore rp and r19, so we don't need
to create a frame prior to the clone syscall.  We only need a
frame when __syscall_error is called.  We also don't need to
save and restore r19 around the call to $$dyncall as r19 is not
used in the code after $$dyncall.

This considerably simplifies clone.S.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
7 months agoUpdate kernel version to 6.12 in header constant tests
Joseph Myers [Thu, 19 Dec 2024 15:38:59 +0000 (15:38 +0000)] 
Update kernel version to 6.12 in header constant tests

There are no new constants covered by tst-mman-consts.py,
tst-mount-consts.py or tst-pidfd-consts.py in Linux 6.12 that need any
header changes, so update the kernel version in those tests.
(tst-sched-consts.py will need updating separately along with adding
SCHED_EXT.)

Tested with build-many-glibcs.py.

7 months agoadded url of CORE-MATH project
Paul Zimmermann [Thu, 12 Dec 2024 10:05:23 +0000 (11:05 +0100)] 
added url of CORE-MATH project

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agomath: Use tanhf from CORE-MATH
Adhemerval Zanella [Tue, 19 Nov 2024 19:30:16 +0000 (16:30 -0300)] 
math: Use tanhf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic tanhf.

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):

Latency                      master        patched   improvement
x86_64                      51.5273        41.0951        20.25%
x86_64v2                    47.7021        39.1526        17.92%
x86_64v3                    45.0373        34.2737        23.90%
i686                       133.9970        83.8596        37.42%
aarch64 (Neoverse)          21.5439        14.7961        31.32%
power10                     13.3301         8.4406        36.68%

reciprocal-throughput        master        patched   improvement
x86_64                      24.9493        12.8547        48.48%
x86_64v2                    20.7051        12.7761        38.29%
x86_64v3                    19.2492        11.0851        42.41%
i686                        78.6498        29.8211        62.08%
aarch64 (Neoverse)          11.6026        7.11487        38.68%
power10                      6.3328         2.8746        54.61%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use sinhf from CORE-MATH
Adhemerval Zanella [Tue, 19 Nov 2024 17:26:17 +0000 (14:26 -0300)] 
math: Use sinhf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic sinhf.

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):

Latency                      master        patched   improvement
x86_64                      52.6819        49.1489         6.71%
x86_64v2                    49.1162        42.9447        12.57%
x86_64v3                    46.9732        39.9157        15.02%
i686                       141.1470       129.6410         8.15%
aarch64 (Neoverse)          20.8539        17.1288        17.86%
power10                     14.5258        9.1906         36.73%

reciprocal-throughput        master        patched   improvement
x86_64                      27.5553        23.9395        13.12%
x86_64v2                    21.6423        20.3219         6.10%
x86_64v3                    21.4842        16.0224        25.42%
i686                        87.9709        86.1626         2.06%
aarch64 (Neoverse)          15.1919        12.2744        19.20%
power10                      7.2188         5.2611        27.12%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use coshf from CORE-MATH
Adhemerval Zanella [Tue, 19 Nov 2024 13:40:07 +0000 (10:40 -0300)] 
math: Use coshf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode),
although it should worse performance than current one.  The current
implementation performance comes mainly from the internal usage of
the optimize expf implementation, and shows a maximum ULPs of 2 for
FE_TONEAREST and 3 for other rounding modes.

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):

Latency                      master        patched   improvement
x86_64                      40.6995        49.0737       -20.58%
x86_64v2                    40.5841        44.3604        -9.30%
x86_64v3                    39.3879        39.7502        -0.92%
i686                       112.3380       129.8570       -15.59%
aarch64 (Neoverse)          18.6914        17.0946         8.54%
power10                     11.1343        9.3245         16.25%

reciprocal-throughput        master        patched   improvement
x86_64                      18.6471        24.1077       -29.28%
x86_64v2                    17.7501        20.2946       -14.34%
x86_64v3                    17.8262        17.1877         3.58%
i686                        64.1454        86.5645       -34.95%
aarch64 (Neoverse)          9.77226        12.2314       -25.16%
power10                      4.0200        5.3316        -32.63%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use atanhf from CORE-MATH
Adhemerval Zanella [Tue, 19 Nov 2024 16:31:14 +0000 (13:31 -0300)] 
math: Use atanhf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic atanhf.

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):

Latency                      master        patched   improvement
x86_64                      59.4930        45.8568        22.92%
x86_64v2                    59.5705        45.5804        23.48%
x86_64v3                    53.1838        37.7155        29.08%
i686                        169.354       133.5940        21.12%
aarch64 (Neoverse)          26.0781        16.9829        34.88%
power10                     15.6591        10.7623        31.27%

reciprocal-throughput        master        patched   improvement
x86_64                      23.5903        18.5766        21.25%
x86_64v2                    22.6489        18.2683        19.34%
x86_64v3                    19.0401        13.9474        26.75%
i686                        97.6034       107.3260        -9.96%
aarch64 (Neoverse)          15.3664        9.57846        37.67%
power10                      6.8877        4.6242         32.86%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use atan2f from CORE-MATH
Adhemerval Zanella [Mon, 18 Nov 2024 20:57:31 +0000 (17:57 -0300)] 
math: Use atan2f from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic atan2f.

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):

Latency                      master        patched   improvement
x86_64                      68.1175        69.2014        -1.59%
x86_64v2                    66.9884        66.0081         1.46%
x86_64v3                    57.7034        61.6407        -6.82%
i686                       189.8690        152.7560       19.55%
aarch64 (Neoverse)          32.6151        24.5382        24.76%
power10                     21.7282        17.1896        20.89%

reciprocal-throughput        master        patched   improvement
x86_64                      34.5202        31.6155         8.41%
x86_64v2                    32.6379        30.3372         7.05%
x86_64v3                    34.3677        23.6455        31.20%
i686                       157.7290        75.8308        51.92%
aarch64 (Neoverse)          27.7788        16.2671        41.44%
power10                     15.5715         8.1588        47.60%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use atanf from CORE-MATH
Adhemerval Zanella [Mon, 18 Nov 2024 11:45:16 +0000 (08:45 -0300)] 
math: Use atanf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic atanf.

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):

Latency                      master        patched   improvement
x86_64                      56.8265        53.6842         5.53%
x86_64v2                    54.8177        53.6842         2.07%
x86_64v3                    46.2915        48.7034        -5.21%
i686                       158.3760        108.9560       31.20%
aarch64 (Neoverse)           21.687        20.5893         5.06%
power10                     13.1903        13.5012        -2.36%

reciprocal-throughput        master        patched   improvement
x86_64                      16.6787        16.7601        -0.49%
x86_64v2                    16.6983        16.7601        -0.37%
x86_64v3                    16.2268        12.1391        25.19%
i686                       138.6840        36.0640        74.00%
aarch64 (Neoverse)          11.8012        10.3565        12.24%
power10                      5.3212         4.2894        19.39%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use asinhf from CORE-MATH
Adhemerval Zanella [Thu, 14 Nov 2024 14:07:11 +0000 (11:07 -0300)] 
math: Use asinhf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic asinhf.

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):

Latency                      master        patched   improvement
x86_64                      64.5128        56.9717        11.69%
x86_64v2                    63.3065        57.2666         9.54%
x86_64v3                    62.8719        51.4170        18.22%
i686                       189.1630        137.635        27.24%
aarch64 (Neoverse)          25.3551        20.5757        18.85%
power10                     17.9712        13.3302        25.82%

reciprocal-throughput        master        patched   improvement
x86_64                      20.0844        15.4731        22.96%
x86_64v2                    19.2919        15.4000        20.17%
x86_64v3                    18.7226        11.9009        36.44%
i686                       103.7670        80.2681        22.65%
aarch64 (Neoverse)          12.5005        8.68969        30.49%
power10                      7.2220        5.03617        30.27%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>:
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use asinf from CORE-MATH
Adhemerval Zanella [Wed, 13 Nov 2024 16:48:14 +0000 (13:48 -0300)] 
math: Use asinf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic asinf.

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):

Latency                      master        patched   improvement
x86_64                      42.8237        35.2460        17.70%
x86_64v2                    43.3711        35.9406        17.13%
x86_64v3                    35.0335        30.5744        12.73%
i686                       213.8780        104.4710       51.15%
aarch64 (Neoverse)          17.2937        13.6025        21.34%
power10                     12.0227        7.4241         38.25%

reciprocal-throughput        master        patched   improvement
x86_64                      13.6770        15.5231       -13.50%
x86_64v2                    13.8722        16.0446       -15.66%
x86_64v3                    13.6211        13.2753         2.54%
i686                       186.7670        45.4388        75.67%
aarch64 (Neoverse)          9.96089        9.39285         5.70%
power10                      4.9862        3.7819         24.15%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use acoshf from CORE-MATH
Adhemerval Zanella [Mon, 21 Oct 2024 13:51:09 +0000 (10:51 -0300)] 
math: Use acoshf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic acoshf.

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):

Latency                      master        patched   improvement
x86_64                      61.2471        58.7742         4.04%
x86_64-v2                   62.6519        59.0523         5.75%
x86_64-v3                   58.7408        50.1393        14.64%
aarch64                     24.8580        21.3317        14.19%
power10                     17.0469        13.1345        22.95%

reciprocal-throughput        master        patched   improvement
x86_64                      16.1618        15.1864         6.04%
x86_64-v2                   15.7729        14.7563         6.45%
x86_64-v3                   14.1669        11.9568        15.60%
aarch64                      10.911        9.5486         12.49%
power10                     6.38196        5.06734        20.60%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Use acosf from CORE-MATH
Adhemerval Zanella [Fri, 18 Oct 2024 19:04:30 +0000 (16:04 -0300)] 
math: Use acosf from CORE-MATH

The CORE-MATH implementation is correctly rounded (for any rounding mode)
and shows slight better performance to the generic acosf.

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):

Latency                      master        patched   improvement
x86_64                      52.5098        36.6312        30.24%
x86_64v2                    53.0217        37.3091        29.63%
x86_64v3                    42.8501        32.3977        24.39%
i686                       207.3960       109.4000        47.25%
aarch64                     21.3694        13.7871        35.48%
power10                     14.5542         7.2891        49.92%

reciprocal-throughput        master        patched   improvement
x86_64                      14.1487        15.9508       -12.74%
x86_64v2                    14.3293        16.1899       -12.98%
x86_64v3                    13.6563        12.6161         7.62%
i686                       158.4060        45.7354        71.13%
aarch64                     12.5515        9.19233        26.76%
power10                      5.7868         3.3487        42.13%

Signed-off-by: Alexei Sibidanov <sibid@uvic.ca>
Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Fix the expected carg (inf) results
Adhemerval Zanella [Wed, 4 Dec 2024 15:55:42 +0000 (12:55 -0300)] 
math: Fix the expected carg (inf) results

The pi defined constants are not the expected value for carg
on non-default rounding modes (similar to atan).  Instead use
autogenerated value.

7 months agomath: Fix the expected atan2f (inf) results
Adhemerval Zanella [Wed, 20 Nov 2024 18:50:22 +0000 (15:50 -0300)] 
math: Fix the expected atan2f (inf) results

The pi defined constants are not the expected value for atan2
on non-default rounding modes.  Instead use the autogenerated value.

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agomath: Fix the expected atanf (inf) results
Adhemerval Zanella [Wed, 20 Nov 2024 17:21:56 +0000 (14:21 -0300)] 
math: Fix the expected atanf (inf) results

The M_PI_2 (lit_pi_2_d) constant is not the expected value for atanf
on non-default rounding modes.  Instead use the autogenerated value.

7 months agomath: Add inf support on gen-auto-libm-tests.c
Adhemerval Zanella [Wed, 20 Nov 2024 18:44:58 +0000 (15:44 -0300)] 
math: Add inf support on gen-auto-libm-tests.c

For some correctly rounded inputs where infinity might generate
a number (like atanf), comparing to a pre-defined constant does not
yield the expected result in all rounding modes.

The most straightforward way to handle it would be to get the expected
result from mpfr, where it handles all the rounding modes.

7 months agomath: Fix spurious-divbyzero flag name
Adhemerval Zanella [Wed, 4 Dec 2024 13:05:05 +0000 (10:05 -0300)] 
math: Fix spurious-divbyzero flag name

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add tanhf benchmark
Adhemerval Zanella [Tue, 19 Nov 2024 19:09:11 +0000 (16:09 -0300)] 
benchtests: Add tanhf benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add sinhf benchmark
Adhemerval Zanella [Tue, 19 Nov 2024 16:47:15 +0000 (13:47 -0300)] 
benchtests: Add sinhf benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add coshf benchmark
Adhemerval Zanella [Tue, 19 Nov 2024 12:46:22 +0000 (09:46 -0300)] 
benchtests: Add coshf benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add atanhf benchmark
Adhemerval Zanella [Tue, 19 Nov 2024 14:11:05 +0000 (11:11 -0300)] 
benchtests: Add atanhf benchmark

The input is based on acosf one (random inputs in [-1,1]).

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add atan2f benchmark
Adhemerval Zanella [Mon, 18 Nov 2024 13:12:06 +0000 (10:12 -0300)] 
benchtests: Add atan2f benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add atanf benchmark
Adhemerval Zanella [Thu, 14 Nov 2024 17:56:20 +0000 (14:56 -0300)] 
benchtests: Add atanf benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add asinhf benchmark
Adhemerval Zanella [Thu, 14 Nov 2024 12:55:35 +0000 (09:55 -0300)] 
benchtests: Add asinhf benchmark

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

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add asinf benchmark
Adhemerval Zanella [Wed, 13 Nov 2024 16:29:41 +0000 (13:29 -0300)] 
benchtests: Add asinf benchmark

The input is based on acosf one (random inputs in [-1,1]).

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add acoshf benchmark
Adhemerval Zanella [Mon, 21 Oct 2024 12:08:01 +0000 (09:08 -0300)] 
benchtests: Add acoshf benchmark

Random inputs in the range [1,21].

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agobenchtests: Add acosf benchmark
Adhemerval Zanella [Fri, 18 Oct 2024 18:27:25 +0000 (15:27 -0300)] 
benchtests: Add acosf benchmark

The input is based on acos one (random inputs in [-1,1]).

Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agonptl: Add <thread_pointer.h> for sparc
Michael Jeanson [Wed, 31 Jul 2024 21:04:10 +0000 (17:04 -0400)] 
nptl: Add <thread_pointer.h> for sparc

This will be required by the rseq extensible ABI implementation on all
Linux architectures exposing the '__rseq_size' and '__rseq_offset'
symbols to set the initial value of the 'cpu_id' field which can be used
by applications to test if rseq is available and registered. As long as
the symbols are exposed it is valid for an application to perform this
test even if rseq is not yet implemented in libc for this architecture.

Compile tested with build-many-glibcs.py but I don't have access to any
hardware to run the tests.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agopowerpc: Update libm-test-ulps
Adhemerval Zanella [Wed, 18 Dec 2024 18:43:09 +0000 (15:43 -0300)] 
powerpc: Update libm-test-ulps

Regen to add new functions acospi, asinpi, atan2pi, atanpi, and
tanpi.

7 months agoarm: Update libm-test-ulps
Adhemerval Zanella [Wed, 18 Dec 2024 17:19:36 +0000 (14:19 -0300)] 
arm: Update libm-test-ulps

Regen to add new functions acospi, asinpi, atan2pi, atanpi, cospi,
sinpi, and tanpi.

7 months agoi386: Update libm-test-ulps
Adhemerval Zanella [Wed, 18 Dec 2024 17:16:06 +0000 (14:16 -0300)] 
i386: Update libm-test-ulps

Regen to add new functions acospi, asinpi, atan2pi, atanpi, cospi,
sinpi, and tanpi.

7 months agoUpdate syscall lists for Linux 6.12
Joseph Myers [Wed, 18 Dec 2024 15:12:36 +0000 (15:12 +0000)] 
Update syscall lists for Linux 6.12

Linux 6.12 has no new syscalls.  Update the version number in
syscall-names.list to reflect that it is still current for 6.12.

Tested with build-many-glibcs.py.

7 months agoHide memset/bzero from compiler
H.J. Lu [Tue, 17 Dec 2024 18:38:26 +0000 (02:38 +0800)] 
Hide memset/bzero from compiler

Hide memset/bzero from compiler to silence Clang error:

./tester.c:1345:29: error: 'size' argument to memset is '0'; did you mean to transpose the last two arguments? [-Werror,-Wmemset-transposed-args]
 1345 |   (void) memset(one+2, 'y', 0);
      |                             ^
./tester.c:1345:29: note: parenthesize the third argument to silence
./tester.c:1432:16: error: 'size' argument to bzero is '0' [-Werror,-Wsuspicious-bzero]
 1432 |   bzero(one+2, 0);
      |                ^
./tester.c:1432:16: note: parenthesize the second argument to silence

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoCheck if clang and clang++ are used to test glibc
H.J. Lu [Tue, 17 Dec 2024 19:25:09 +0000 (03:25 +0800)] 
Check if clang and clang++ are used to test glibc

Set have-test-clang to yes if clang is used to test glibc.  Set
have-test-clangxx to yes if clang++ is used to test glibc.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoReplace __strcpy_chk with __builtin___strcpy_chk
H.J. Lu [Tue, 17 Dec 2024 22:55:35 +0000 (06:55 +0800)] 
Replace __strcpy_chk with __builtin___strcpy_chk

Although _chk functions are exported in libc.so.6, their prototypes aren't
provided.  Their built versions are supported by compiler.  Replace
__strcpy_chk with __builtin___strcpy_chk to silence Clang error:

./tst-gnuglob-skeleton.c:225:3: error: call to undeclared function '__strcpy_chk'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  225 |   __strcpy_chk (dir->d.d_name, filesystem[dir->idx].name, NAME_MAX);
      |   ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
7 months agoungetc: Guarantee single char pushback
Siddhesh Poyarekar [Thu, 7 Nov 2024 16:16:04 +0000 (11:16 -0500)] 
ungetc: Guarantee single char pushback

The C standard requires that ungetc guarantees at least one pushback,
but the malloc call to allocate the pushback buffer could fail, thus
violating that requirement.  Fix this by adding a single byte pushback
buffer in the FILE struct that the pushback can fall back to if malloc
fails.

The side-effect is that if the initial malloc fails and the 1-byte
fallback buffer is used, future resizing (if it succeeds) will be
2-bytes, 4-bytes and so on, which is suboptimal but it's after a malloc
failure, so maybe even desirable.

A future optimization here could be to have the pushback code use the
single byte buffer first and only fall back to malloc for subsequent
calls.

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
7 months agolibio: Fix last NULL-as-0 issue in libioP.h
Siddhesh Poyarekar [Tue, 17 Dec 2024 22:36:36 +0000 (17:36 -0500)] 
libio: Fix last NULL-as-0 issue in libioP.h

Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
7 months agosys/platform/x86.h: Do not depend on _Bool definition in C++ mode
H.J. Lu [Tue, 17 Dec 2024 18:25:03 +0000 (02:25 +0800)] 
sys/platform/x86.h: Do not depend on _Bool definition in C++ mode

Clang does not define _Bool for -std=c++98:

/usr/include/bits/platform/features.h:31:19: error: unknown type name '_Bool'
   31 | static __inline__ _Bool
      |                   ^

Change _Bool to bool to silence clang++ error.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
7 months agoReplace copysign (0,-1) with -0.0 in initializer
H.J. Lu [Sat, 14 Dec 2024 11:21:15 +0000 (19:21 +0800)] 
Replace copysign (0,-1) with -0.0 in initializer

GCC 4.9 issues an error for copysign in initializer:

In file included from tst-printf-format-p-double.c:20:0:
tst-printf-format-skeleton-double.c:29:3: error: initializer element is not a constant expression [-Werror]
   { -HUGE_VAL, -DBL_MAX, -DBL_MIN, copysign (0, -1), -NAN, NAN, 0, DBL_MIN,
   ^

since it can't fold "copysign (0, -1)".  Replace copysign (0,-1) with -0.0.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 months agotst-unique3.cc: Add explicit instantiation declaration for S<char>::i
H.J. Lu [Mon, 16 Dec 2024 21:57:49 +0000 (05:57 +0800)] 
tst-unique3.cc: Add explicit instantiation declaration for S<char>::i

Add explicit instantiation declaration of S<char>::i to silence Clang
error:

tst-unique3.cc:6:18: error: instantiation of variable 'S<char>::i' required here, but no definition is available [-Werror,-Wundefined-var-template]
    6 | int t = S<char>::i;
      |                  ^
./tst-unique3.h:5:14: note: forward declaration of template entity is here
    5 |   static int i;
      |              ^
tst-unique3.cc:6:18: note: add an explicit instantiation declaration to suppress this warning if 'S<char>::i' is explicitly instantiated in another translation unit
    6 | int t = S<char>::i;
      |                  ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 months agoldbl-96: Set -1 to "int sign_exponent:16"
H.J. Lu [Mon, 16 Dec 2024 21:50:47 +0000 (05:50 +0800)] 
ldbl-96: Set -1 to "int sign_exponent:16"

ieee_long_double_shape_type has

typedef union
{
  long double value;
  struct
  {
    ...
    int sign_exponent:16;
    ...
  } parts;
} ieee_long_double_shape_type;

Clang issues an error:

../sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c:49:2: error: implicit truncation from 'int' to bit-field changes value from 65535 to -1 [-Werror,-Wbitfield-constant-conversion]
   49 |         SET_LDOUBLE_WORDS (ldnx, 0xffff,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   50 |                            tests[i] >> 32, tests[i] & 0xffffffffULL);
      |

Use -1, instead of 0xffff, to silence Clang.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotst-clone3[-internal].c: Add _Atomic to silence Clang
H.J. Lu [Mon, 16 Dec 2024 21:54:19 +0000 (05:54 +0800)] 
tst-clone3[-internal].c: Add _Atomic to silence Clang

Add _Atomic to futex_wait argument and ctid in tst-clone3[-internal].c to
silence Clang error:

../sysdeps/unix/sysv/linux/tst-clone3-internal.c:93:3: error: address argument to atomic operation must be a pointer to _Atomic type ('pid_t *' (aka 'int *') invalid)
   93 |   wait_tid (&ctid, CTID_INIT_VAL);
      |   ^         ~~~~~
../sysdeps/unix/sysv/linux/tst-clone3-internal.c:51:21: note: expanded from macro 'wait_tid'
   51 |     while ((__tid = atomic_load_explicit (ctid_ptr,                     \
      |                     ^                     ~~~~~~~~
/usr/bin/../lib/clang/19/include/stdatomic.h:145:30: note: expanded from macro 'atomic_load_explicit'
  145 | #define atomic_load_explicit __c11_atomic_load
      |                              ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotst-atexit-common.c: Mark _exit_with_flush as noreturn
H.J. Lu [Mon, 16 Dec 2024 21:51:07 +0000 (05:51 +0800)] 
tst-atexit-common.c: Mark _exit_with_flush as noreturn

Mark _exit_with_flush as noreturn to silence the Clang error on
tst-atexit-common.c:

In file included from tst-atexit.c:22:
../stdlib/tst-atexit-common.c:113:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  113 |     case 0:  /* Child.  */
      |     ^
../stdlib/tst-atexit-common.c:113:5: note: insert 'break;' to avoid fall-through
  113 |     case 0:  /* Child.  */
      |     ^
      |     break;
1 error generated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agox86: Avoid integer truncation with large cache sizes (bug 32470)
Florian Weimer [Tue, 17 Dec 2024 17:12:03 +0000 (18:12 +0100)] 
x86: Avoid integer truncation with large cache sizes (bug 32470)

Some hypervisors report 1 TiB L3 cache size.  This results
in some variables incorrectly getting zeroed, causing crashes
in memcpy/memmove because invariants are violated.

7 months agotst-timespec.c: Explicitly cast TIME_T_MAX to double
H.J. Lu [Mon, 16 Dec 2024 21:52:43 +0000 (05:52 +0800)] 
tst-timespec.c: Explicitly cast TIME_T_MAX to double

Explicitly cast TIME_T_MAX to double in tst-timespec.c to silence Clang
error:

tst-timespec.c:290:19: error: implicit conversion from 'time_t' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
  287 |   {.expected = {.tv_sec = 0, .tv_nsec = 1},
      |   ~
  288 |    .observed = {.tv_sec = TIME_T_MAX / TIMESPEC_HZ,
  289 |                 .tv_nsec = TIMESPEC_HZ - 1},
  290 |    .upper_bound = TIME_T_MAX, .lower_bound = 1, .result = 1,
      |                   ^~~~~~~~~~

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotst-resolv-invalid-cname.c: Explicitly cast 192 and 168 to char
H.J. Lu [Mon, 16 Dec 2024 21:54:52 +0000 (05:54 +0800)] 
tst-resolv-invalid-cname.c: Explicitly cast 192 and 168 to char

Explicitly cast 192 and 168 to char to silence Clang error:

tst-resolv-invalid-cname.c:313:17: error: implicit conversion from 'int' to 'char' changes value from 192 to -64 [-Werror,-Wconstant-conversion]
  313 |       addr[0] = 192;
      |               ~ ^~~
tst-resolv-invalid-cname.c:314:17: error: implicit conversion from 'int' to 'char' changes value from 168 to -88 [-Werror,-Wconstant-conversion]
  314 |       addr[1] = 168;
      |               ~ ^~~

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoSilence Clang #include_next error
H.J. Lu [Mon, 16 Dec 2024 21:56:53 +0000 (05:56 +0800)] 
Silence Clang #include_next error

Use "#include <...>" to silence Clang #include_next error:

In file included from ../sysdeps/x86_64/fpu/test-double-vlen4-wrappers.c:19:
../sysdeps/x86_64/fpu/test-double-vlen4.h:19: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]
   19 | #include_next <test-double-vlen4.h>
      |  ^
1 error generated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agocet: Pass -mshstk to compiler for tst-cet-legacy-10a[-static].c
H.J. Lu [Mon, 16 Dec 2024 22:18:55 +0000 (06:18 +0800)] 
cet: Pass -mshstk to compiler for tst-cet-legacy-10a[-static].c

Pass -mshstk to compiler to silence Clang:

In file included from ../sysdeps/x86_64/tst-cet-legacy-10a.c:2:
../sysdeps/x86_64/tst-cet-legacy-10.c:29:7: error: always_inline function '_get_ssp' requires target feature 'shstk', but would be inlined into function 'do_test' that is compiled without support for 'shstk'
   29 |   if (_get_ssp () != 0)
      |       ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoAArch64: Improve codegen of AdvSIMD expf family
Joana Cruz [Tue, 17 Dec 2024 14:50:33 +0000 (14:50 +0000)] 
AArch64: Improve codegen of AdvSIMD expf family

Load the polynomial evaluation coefficients into 2 vectors and use lanewise MLAs.
Also use intrinsics instead of native operations.
expf: 3% improvement in throughput microbenchmark on Neoverse V1, exp2f: 5%,
exp10f: 13%, coshf: 14%.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 months agoAArch64: Improve codegen of AdvSIMD atan(2)(f)
Joana Cruz [Tue, 17 Dec 2024 14:49:30 +0000 (14:49 +0000)] 
AArch64: Improve codegen of AdvSIMD atan(2)(f)

Load the polynomial evaluation coefficients into 2 vectors and use lanewise MLAs.
8% improvement in throughput microbenchmark on Neoverse V1.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 months agoAArch64: Improve codegen of AdvSIMD logf function family
Joana Cruz [Tue, 17 Dec 2024 14:47:31 +0000 (14:47 +0000)] 
AArch64: Improve codegen of AdvSIMD logf function family

Load the polynomial evaluation coefficients into 2 vectors and use lanewise MLAs.
8% improvement in throughput microbenchmark on Neoverse V1 for log2 and log,
and 2% for log10.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
7 months agoHide all malloc functions from compiler [BZ #32366]
H.J. Lu [Tue, 17 Dec 2024 10:41:45 +0000 (18:41 +0800)] 
Hide all malloc functions from compiler [BZ #32366]

Since -1 isn't a power of two, compiler may reject it, hide memalign from
Clang 19 which issues an error:

tst-memalign.c:86:31: error: requested alignment is not a power of 2 [-Werror,-Wnon-power-of-two-alignment]
   86 |   p = memalign (-1, pagesize);
      |                 ^~
tst-memalign.c:86:31: error: requested alignment must be 4294967296 bytes or smaller; maximum alignment assumed [-Werror,-Wbuiltin-assume-aligned-alignment]
   86 |   p = memalign (-1, pagesize);
      |                 ^~

Update tst-malloc-aux.h to hide all malloc functions and include it in
all malloc tests to prevent compiler from optimizing out any malloc
functions.

Tested with Clang 19.1.5 and GCC 15 20241206 for BZ #32366.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agolibio: Use NULL instead of 0 as a null pointer constant
Alejandro Colomar [Mon, 16 Dec 2024 23:22:19 +0000 (00:22 +0100)] 
libio: Use NULL instead of 0 as a null pointer constant

This was missed in a recent global change.

Fixes: 53fcdf5f743a (2024-11-25, "Silence most -Wzero-as-null-pointer-constant diagnostics")
Reported-by: "Maciej W. Rozycki" <macro@redhat.com>
Cc: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: Bruno Haible <bruno@clisp.org>
Cc: Martin Uecker <uecker@tugraz.at>
Cc: Xi Ruoyao <xry111@xry111.site>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Joseph Myers <josmyers@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
7 months agomanual: Document more sigaction flags
DJ Delorie [Tue, 10 Dec 2024 22:07:21 +0000 (17:07 -0500)] 
manual: Document more sigaction flags

Adds documentation for three-argument handler

Adds remainder of the SA_* flags

Reviewed-by: Florian Weimer <fweimer@redhat.com>
7 months agoRemove duplicated BUILD_CC in Makeconfig
H.J. Lu [Thu, 5 Dec 2024 07:47:53 +0000 (15:47 +0800)] 
Remove duplicated BUILD_CC in Makeconfig

Remove the second

ifndef BUILD_CC
BUILD_CC = $(CC)
endif

in Makeconfig.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
7 months agoiconv: do not report error exit with transliteration [BZ #32448]
Aurelien Jarno [Sat, 14 Dec 2024 10:44:11 +0000 (11:44 +0100)] 
iconv: do not report error exit with transliteration [BZ #32448]

Commit 6cbf845fcdc7 ("iconv: Preserve iconv -c error exit on invalid
inputs (bug 32046)") changed the error exit code to report an error when
an input character has been transliterated. This looks like a bug as the
moto in the iconv program is to report an error code in the same
condition as the iconv() function.

This happens because the STANDARD_TO_LOOP_ERR_HANDLER macro sets a
default value for result and later updates it if the transliteration
succeed. With the changes, setting the default value also marks the
input as illegal.

Fix that by setting up the default value of result only when the
transliteration is not used. This works because __gconv_transliterate()
calls __gconv_mark_illegal_input() to return an error. At the same time
also fix the typo outself -> ourselves.

Fixes: 6cbf845fcdc7
Resolves: BZ #32448
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
7 months agoFix sysdeps/x86/fpu/Makefile: Split and sort tests
H.J. Lu [Sun, 15 Dec 2024 21:57:28 +0000 (05:57 +0800)] 
Fix sysdeps/x86/fpu/Makefile: Split and sort tests

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 months agosysdeps/x86/fpu/Makefile: Split and sort tests
H.J. Lu [Sun, 15 Dec 2024 21:49:43 +0000 (05:49 +0800)] 
sysdeps/x86/fpu/Makefile: Split and sort tests

Split and sort tests in sysdeps/x86/fpu/Makefile.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 months agoUse empty initializer to silence GCC 4.9 or older
H.J. Lu [Sun, 15 Dec 2024 14:44:49 +0000 (22:44 +0800)] 
Use empty initializer to silence GCC 4.9 or older

Use empty initializer to silence GCC 4.9 or older:

getaddrinfo.c: In function ‘gaih_inet’:
getaddrinfo.c:1135:24: error: missing braces around initializer [-Werror=missing-braces]
       / sizeof (struct gaih_typeproto)] = {0};
                        ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoLinux: Check for 0 return value from vDSO getrandom probe
Florian Weimer [Sun, 15 Dec 2024 16:05:25 +0000 (17:05 +0100)] 
Linux: Check for 0 return value from vDSO getrandom probe

As of Linux 6.13, there is no code in the vDSO that declines this
initialization request with the special ~0UL state size.  If the vDSO
has the function, the call succeeds and returns 0.  It's expected
that the code would follow the “a negative value indicating an error”
convention, as indicated in the __cvdso_getrandom_data function
comment, so that INTERNAL_SYSCALL_ERROR_P on glibc's side would return
true.  This commit changes the commit to check for zero to indicate
success instead, which covers potential future non-zero success
return values and error returns.

Fixes commit 4f5704ea347e52ac3f272d1341da10aed6e9973e ("powerpc: Use
correct procedure call standard for getrandom vDSO call (bug 32440)").

7 months agohppa: Update libm-test-ulps
John David Anglin [Sun, 15 Dec 2024 14:24:53 +0000 (09:24 -0500)] 
hppa: Update libm-test-ulps

Signed-off-by: John David Anglin <dave.anglin@bell.net>
7 months agoRevert "Add braces in initializers for GCC 4.9 or older"
H.J. Lu [Sun, 15 Dec 2024 10:49:43 +0000 (18:49 +0800)] 
Revert "Add braces in initializers for GCC 4.9 or older"

This reverts commit 8aa2a9e0339215012354f3c4a262edda838134e8.

as not all targets need braces.

7 months agotst-difftime.c: Use "main (void)"
H.J. Lu [Sun, 15 Dec 2024 07:01:57 +0000 (15:01 +0800)] 
tst-difftime.c: Use "main (void)"

Use "main (void)" instead of "main (void)" to avoid GCC 4.9 warning:

tst-difftime.c:62:1: error: function declaration isn’t a prototype [-Werror=strict-prototypes]
 main ()
 ^
tst-difftime.c: In function ‘main’:
tst-difftime.c:62:1: error: old-style function definition [-Werror=old-style-definition]
cc1: all warnings being treated as errors

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
7 months agoor1k: Update libm-test-ulps
Stafford Horne [Fri, 13 Dec 2024 11:24:12 +0000 (11:24 +0000)] 
or1k: Update libm-test-ulps

Regen to add new functions acospi, asinpi, atan2pi and atanpi.

7 months agohtl: move pthread_sigmask into libc.
gfleury [Thu, 12 Dec 2024 22:06:12 +0000 (00:06 +0200)] 
htl: move pthread_sigmask into libc.

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

7 months agohtl: move __pthread_sigstate into libc.
gfleury [Thu, 12 Dec 2024 22:06:11 +0000 (00:06 +0200)] 
htl: move __pthread_sigstate into libc.

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

7 months agohtl: move __pthread_sigstate_destroy into libc.
gfleury [Thu, 12 Dec 2024 22:06:10 +0000 (00:06 +0200)] 
htl: move __pthread_sigstate_destroy into libc.

Message-ID: <20241212220612.782313-1-gfleury@disroot.org>

7 months agoReturn EXIT_UNSUPPORTED if __builtin_add_overflow unavailable
H.J. Lu [Sat, 14 Dec 2024 12:12:21 +0000 (20:12 +0800)] 
Return EXIT_UNSUPPORTED if __builtin_add_overflow unavailable

Since GCC 4.9 doesn't have __builtin_add_overflow:

In file included from tst-stringtable.c:180:0:
stringtable.c: In function ‘stringtable_finalize’:
stringtable.c:185:7: error: implicit declaration of function ‘__builtin_add_overflow’ [-Werror=implicit-function-declaration]
       else if (__builtin_add_overflow (previous->offset,
       ^

return EXIT_UNSUPPORTED for GCC 4.9 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoifuncmain9.c: Return EXIT_UNSUPPORTED for GCC 5.4 or older
H.J. Lu [Thu, 12 Dec 2024 21:22:47 +0000 (05:22 +0800)] 
ifuncmain9.c: Return EXIT_UNSUPPORTED for GCC 5.4 or older

Since elf/ifuncmain9.c fails at run-time when compiled with GCC 5.4 or
older (PR ipa/81128), return EXIT_UNSUPPORTED for GCC 5.4 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoinclude/bits/sigstksz.h: Avoid #elif IS_IN (libsupport)
H.J. Lu [Thu, 12 Dec 2024 21:56:05 +0000 (05:56 +0800)] 
include/bits/sigstksz.h: Avoid #elif IS_IN (libsupport)

GCC 4.9 issues an error when generating misc/check-installed-headers-c.out:

In file included from ../signal/signal.h:328:0,
                 from ../include/signal.h:2,
                 from ../misc/sys/param.h:28,
                 from ../include/sys/param.h:1,
                 from /tmp/cih_test_e156ZB.c:10:
../include/bits/sigstksz.h:5:7: error: "IS_IN" is not defined [-Werror=undef]
 #elif IS_IN (libsupport)
       ^

Use "#else" instead.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoregex.h: Avoid #elif __STDC_VERSION__
H.J. Lu [Thu, 12 Dec 2024 23:13:00 +0000 (07:13 +0800)] 
regex.h: Avoid #elif __STDC_VERSION__

GCC 4.9 doesn't define __STDC_VERSION__ and issues an error:

In file included from ../include/regex.h:2:0,
                 from ../posix/re_comp.h:23,
                 from ../include/re_comp.h:1,
                 from /tmp/cih_test_7IKTRI.c:10:
../posix/regex.h:650:19: error: "__STDC_VERSION__" is not defined [-Werror=undef]
 # elif 199901L <= __STDC_VERSION__ || defined restrict
                   ^

Use "#else" instead.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotst-assert-c++.cc: Return EXIT_UNSUPPORTED for GCC 4.9 or older
H.J. Lu [Thu, 12 Dec 2024 21:31:05 +0000 (05:31 +0800)] 
tst-assert-c++.cc: Return EXIT_UNSUPPORTED for GCC 4.9 or older

Since assert/tst-assert-c++.cc fails to compile with GCC 4.9:

./tst-assert-c++.cc: In function ‘constexpr int check_constexpr()’:
./tst-assert-c++.cc:30:1: error: body of constexpr function ‘constexpr int check_constexpr()’ not a return-statement
 }
 ^

return EXIT_UNSUPPORTED for GCC 4.9 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoAdd braces in initializers for GCC 4.9 or older
H.J. Lu [Thu, 12 Dec 2024 21:38:57 +0000 (05:38 +0800)] 
Add braces in initializers for GCC 4.9 or older

Add braces to silence GCC 4.9 or older:

getaddrinfo.c: In function ‘gaih_inet’:
getaddrinfo.c:1135:24: error: missing braces around initializer [-Werror=missing-braces]
       / sizeof (struct gaih_typeproto)] = {0};
                        ^

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoReturn EXIT_UNSUPPORTED if __builtin_mul_overflow unavailable
H.J. Lu [Thu, 12 Dec 2024 21:59:59 +0000 (05:59 +0800)] 
Return EXIT_UNSUPPORTED if __builtin_mul_overflow unavailable

Since GCC 4.9 doesn't support __builtin_mul_overflow:

tst-fd_to_filename.c: In function ‘check_ranges’:
tst-fd_to_filename.c:51:3: error: implicit declaration of function ‘__builtin_mul_overflow’ [-Werror=implicit-function-declaration]
   while (!__builtin_mul_overflow (power, base, &power));
   ^
cc1: all warnings being treated as errors

return EXIT_UNSUPPORTED for GCC 4.9 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotst-minsigstksz-1.c: Return EXIT_UNSUPPORTED for GCC 4.9 or older
H.J. Lu [Thu, 12 Dec 2024 22:28:45 +0000 (06:28 +0800)] 
tst-minsigstksz-1.c: Return EXIT_UNSUPPORTED for GCC 4.9 or older

Since ATOMIC_INT_LOCK_FREE in GCC 4.9 is defined as

 #define ATOMIC_INT_LOCK_FREE                    \
  __atomic_type_lock_free (atomic_int)

GCC 4.9 fails to compile tst-minsigstksz-1.c:

tst-minsigstksz-1.c:45:6: error: missing binary operator before token "("
 # if ATOMIC_INT_LOCK_FREE != 2
      ^

Change tst-minsigstksz-1.c to define TEST_ATOMIC_OPS to 0 for GCC 4.9 or
older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agotester.c: Use -Wmemset-transposed-args for GCC 5 or newer
H.J. Lu [Thu, 12 Dec 2024 22:51:22 +0000 (06:51 +0800)] 
tester.c: Use -Wmemset-transposed-args for GCC 5 or newer

Since GCC 4.9 issues an error:

In file included from inl-tester.c:6:0:
tester.c:58:1: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
 DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args");
 ^

use it for GCC 5 or newer.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoMakefile.in: Add test to check xcheck rule
H.J. Lu [Sat, 14 Dec 2024 00:43:29 +0000 (08:43 +0800)] 
Makefile.in: Add test to check xcheck rule

Add test to check xcheck rule so that TEST_CC and TEST_CXX are used for
"make test".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoDon't use TEST_CXX as CXX for build
H.J. Lu [Sat, 14 Dec 2024 00:43:01 +0000 (08:43 +0800)] 
Don't use TEST_CXX as CXX for build

Since the C++ compiler is also used to compile links-dso-program.cc in
libsupport, use TEST_CXX to get C++ headers for testing, but don't use
TEST_CXX as CXX for build.

Tested for m68k-linux-gnu-coldfire build and native build on x86-64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoAArch64: Update libm-test-ulps
Wilco Dijkstra [Fri, 13 Dec 2024 16:50:25 +0000 (16:50 +0000)] 
AArch64: Update libm-test-ulps

Update ulps for acospi, asinpi, atanpi, atan2pi.

7 months agos390: Simplify elf_machine_{load_address, dynamic} [BZ #31799]
Stefan Liebler [Fri, 6 Dec 2024 11:50:09 +0000 (12:50 +0100)] 
s390: Simplify elf_machine_{load_address, dynamic} [BZ #31799]

If an executable is static PIE and has a non-zero load address
(compare to elf/tst-pie-address-static), it segfaults as
elf_machine_load_address() returns 0x0 and elf_machine_dynamic()
returns the run-time instead of link-time address of _DYNAMIC.

Now rely on __ehdr_start and _DYNAMIC as also done on other
architectures.

Checked back to old arch-levels that this approach works fine:
- 31bit: -march=g5
- 64bit: -march=z900

Note, that there is no static-PIE support on 31bit, but this
approach cleans it also up.

Furthermore this cleanup in glibc does not change anything
regarding the first GOT-element as the s390 ABI
(https://github.com/IBM/s390x-abi) explicitely defines:
The doubleword at _GLOBAL_OFFSET_TABLE_[0] is set by the linkage
editor to hold the address of the dynamic structure, referenced
with the symbol _DYNAMIC. This allows a program, such as the dynamic
linker, to find its own dynamic structure without having yet processed
its relocation entries. This is especially important for the dynamic
linker, because it must initialize itself without relying on other
programs to relocate its memory image.

7 months agoor1k: Update libm-test-ulps
Stafford Horne [Thu, 12 Dec 2024 21:04:50 +0000 (21:04 +0000)] 
or1k: Update libm-test-ulps

Pick up new functions cospi, "Imaginary part of csin", exp10m1, exp2m1,
log10p1, log2p1, sinpi and tanpi.

7 months agonptl: Add <thread_pointer.h> for or1k
Michael Jeanson [Fri, 1 Nov 2024 19:23:24 +0000 (15:23 -0400)] 
nptl: Add <thread_pointer.h> for or1k

This will be required by the rseq extensible ABI implementation on all
Linux architectures exposing the '__rseq_size' and '__rseq_offset'
symbols to set the initial value of the 'cpu_id' field which can be used
by applications to test if rseq is available and registered. As long as
the symbols are exposed it is valid for an application to perform this
test even if rseq is not yet implemented in libc for this architecture.

Compile tested with build-many-glibcs.py but I don't have access to any
hardware to run the tests.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
7 months agoImplement C23 atan2pi
Joseph Myers [Thu, 12 Dec 2024 20:57:44 +0000 (20:57 +0000)] 
Implement C23 atan2pi

C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the atan2pi functions (atan2(y,x)/pi).

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

7 months agoClear CXX and TEST_CXX if C++ link test fails
H.J. Lu [Thu, 12 Dec 2024 11:13:52 +0000 (19:13 +0800)] 
Clear CXX and TEST_CXX if C++ link test fails

Since the C++ compiler is used only for testing, use TEST_CXX as the C++
compiler if available.  If C++ link test fails, clear both CXX and
TEST_CXX so that the C++ compiler isn't used for glibc build nor test.

Tested for m68k-linux-gnu-coldfire build and native build on x86-64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agomath: Remove __XXX math functions from installed math.h [BZ #32418]
H.J. Lu [Thu, 5 Dec 2024 00:05:04 +0000 (08:05 +0800)] 
math: Remove __XXX math functions from installed math.h [BZ #32418]

Since libm doesn't export __XXX math functions, don't declare them in
the installed math.h by adding <bits/mathcalls-macros.h> to declare
__XXX math functions internally for glibc build.  This fixes BZ #32418.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoOptimize bsearch() implementation for performance
Kuan-Wei Chiu [Mon, 9 Sep 2024 16:23:27 +0000 (00:23 +0800)] 
Optimize bsearch() implementation for performance

Optimize the bsearch() function to improve binary search performance.
Although the code size grew by 8 bytes, the new implementation achieves
a 15% reduction in execution time on my x86 machine, according to the
bench-bsearch benchmark results.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Reviewed-by: DJ Delorie <dj@redhat.com>