Commit graph

41935 commits

Author SHA1 Message Date
Darius Rad
274f73978c
riscv: Update nofpu libm test ulps
Fixes math test failures.

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-08 21:38:24 +01:00
Florian Weimer
39183f47d8 elf: Minimize library dependencies of tst-nolink-libc.c
On 32-bit Arm, -fasynchronous-unwind-tables creates a reference
to the symbol __aeabi_unwind_cpp_pr0.  Compile the tests without
this flag even if it is passed as part of CC, to avoid linker
failures.
2025-01-08 16:55:31 +01:00
Samuel Thibault
a4c414796a include/string.h: Also redirect calls if not inlined in libpthread
htl's pt-alloc.c calls __mempcpy, which is #defined to
__builtin_mempcpy, but which does not happen to get inlined (the size is
dynamic), and then gcc emits a reference to mempcpy, thus violating
symbol exposition standard. We thus also have to redirect such
references to __mempcpy too.
2025-01-07 20:53:18 +01:00
Stafford Horne
e3ec3fbe64 or1k: Update fpu libm-test-ulps 2025-01-07 16:13:26 +00:00
Andreas K. Hüttel
2750548afe
math: update powerpc ulps (this time LE)
Linux bogsucker 6.1.55-gentoo-dist-hardened #1 SMP Sun Oct  1 18:03:02 UTC 2023 ppc64le POWER9 (architected), altivec supported CHRP IBM pSeries (emulated by qemu) GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-07 15:58:45 +01:00
Florian Weimer
706209867f elf: Second ld.so relocation only if libc.so has been loaded
Commit 8f8dd904c4 (“elf:
rtld_multiple_ref is always true”) removed some code that happened
to enable compatibility with programs that do not link against
libc.so.  Such programs cannot call dlopen or any dynamic linker
functions (except __tls_get_addr), so this is not really useful.
Still ld.so should not crash with a null-pointer dereference
or undefined symbol reference in these cases.

In the main relocation loop, call _dl_relocate_object unconditionally
because it already checks if the object has been relocated.

If libc.so was loaded, self-relocate ld.so against it and call
__rtld_mutex_init and __rtld_malloc_init_real to activate the full
implementations.  Those are available only if libc.so is there,
so skip these initialization steps if libc.so is absent.  Without
libc.so, the global scope can be completely empty.  This can cause
ld.so self-relocation to fail because if it uses symbol-based
relocations, which is why the second ld.so self-relocation is not
performed if libc.so is missing.

The previous concern regarding GOT updates through self-relocation
no longer applies because function pointers are updated
explicitly through __rtld_mutex_init and __rtld_malloc_init_real,
and not through relocation.  However, the second ld.so self-relocation
is still delayed, in case there are other symbols being used.

Fixes commit 8f8dd904c4 (“elf:
rtld_multiple_ref is always true”).

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-07 09:19:01 +01:00
Florian Weimer
a257f201dd Revert "x86_64: Remove unused padding from tcbhead_t"
This reverts commit 30d3fd7f4f.

The padding is required by Chromium's MaybeUpdateGlibcTidCache
in sandbox/linux/services/namespace_sandbox.cc.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-07 09:17:01 +01:00
Florian Weimer
c4ed6a380e Revert "nptl: More useful padding in struct pthread"
This reverts commit 7c22dcda27.

The padding is required by Chromium's MaybeUpdateGlibcTidCache
in sandbox/linux/services/namespace_sandbox.cc.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-07 09:16:47 +01:00
Samuel Thibault
2d196c2e10 tst-xdirent: Fix allocating dirent for readdir_r call
As documented in the glibc manual, “Some systems don’t define the d_name
element sufficiently long”, and it provides an example of using a union to
properly allocate the storage under the dirent.
2025-01-07 01:56:41 +01:00
Samuel Thibault
75fed76dfd hurd: Accept null arguments for utimensat pathname
This follows Linux' behavior, making it a replacement for the futimens
interface.
2025-01-07 01:36:43 +01:00
Samuel Thibault
fb1059d42a mach: Make clock_nanosleep also check tv_sec 2025-01-07 01:24:21 +01:00
Samuel Thibault
7bc54f0965 htl: Fix making pthread_join check timeout value 2025-01-07 01:02:20 +01:00
Adhemerval Zanella
15b7a675bd i386: Update libm-test-ulps
gcc version 14.2.1 targeting '-m32 -march=i586'.
2025-01-06 16:04:04 -03:00
Michael Jeanson
ddf0a10e63 nptl: Add <thread_pointer.h> for C-SKY
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: Florian Weimer <fweimer@redhat.com>
2025-01-06 18:33:28 +00:00
Michael Jeanson
f3e690ae84 nptl: Add <thread_pointer.h> for microblaze
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: Florian Weimer <fweimer@redhat.com>
2025-01-06 18:33:28 +00:00
Andreas K. Hüttel
2af56da855
math: update i686 multiarch ulps
Linux waikiki 6.6.53-gentoo #1 SMP Wed Oct  2 13:21:27 CEST 2024 x86_64 AMD EPYC 7532 32-Core Processor AuthenticAMD GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-06 19:24:01 +01:00
Samuel Thibault
6ab5980f4c hurd: Fix shutdown() errno on non-sock 2025-01-06 18:03:16 +01:00
Andreas K. Hüttel
ff806e9233
math: update mips64 ulps
Linux matoro-mipsdev 6.12.0-gentoo-mips #2 SMP Tue Nov 19 15:34:04 EST 2024 mips64 Cavium Octeon II V0.10 EBB6800 (CN6880p2.2-1200-AAP) GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-06 12:31:52 +01:00
mengqinggang
d4cdb601df LoongArch: Regenerate preconfigure. [bug 32521]
Add "mtls_descriptor=desc" to preconfigure.ac and regenerate preconfigure.
Fix failure: elf/tst-gnu2-tls2.

Reported-by: Joseph S. Myers <josmyers@redhat.com>
Reported-by: Andreas K. Huettel <dilfridge@gentoo.org>
2025-01-06 10:27:03 +08:00
Stafford Horne
9327c8edcd or1k: Update nofpu libm-test-ulps
Updates tolerances due to change to use CORE-MATH
2025-01-06 00:31:40 +00:00
Andreas K. Hüttel
db92aff28f
math: update alpha ulps
Linux matoro-alphadev 6.12.3-gentoo-alpha #1 Sun Dec  8 04:39:11 EST 2024 alpha EV68CB Titan GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-05 20:02:53 +01:00
H.J. Lu
c2567b18fd loongarch: Drop __GI_XXX for strcpy/stpcpy IFUNC implementations
There is no need for __GI_XXX symbols, like __GI___strcpy_aligned since
__strcpy_aligned is used directly.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-05 05:40:07 +08:00
John David Anglin
d7b37322c5 hppa: Update libm-test-ulps
Signed-off-by: John David Anglin <dave.anglin@bell.net>
2025-01-04 10:39:35 -05:00
Andreas K. Hüttel
377a61c020
math: update loongarch64 ulps
Linux matoro-loongdev 6.12.0-gentoo-loongarch64 #1 SMP PREEMPT Fri Nov 22 00:38:46 EST 2024 loongarch64 GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-04 14:57:31 +01:00
Andreas K. Hüttel
5ecdbe3305
Regenerate libc.pot
Only changes to line numbers

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-04 11:05:03 +01:00
H.J. Lu
8e524ff79b loongarch: Provide stpcpy in stpcpy-aligned.S for rtld [BZ #32512]
When stpcpy-aligned.S is used in rtld, provide stpcpy as a weak alias of
__stpcpy.  This fixes BZ #32512.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-01-04 06:50:02 +08:00
Luna Lamb
f86b4cf875 AArch64: Improve codegen in SVE expm1f and users
Use unpredicated muls, use absolute compare and improve memory access.
Expm1f, sinhf and tanhf show 7%, 5% and 1% improvement in throughput
microbenchmark on Neoverse V1.
2025-01-03 21:42:51 +00:00
Joe Ramsay
080998f6e7 AArch64: Add vector tanpi routines
Vector variant of the new C23 tanpi. New tests pass on AArch64.
2025-01-03 21:39:56 +00:00
Joe Ramsay
40c3a06293 AArch64: Add vector cospi routines
Vector variant of the new C23 cospi. New tests pass on AArch64.
2025-01-03 21:39:56 +00:00
Joe Ramsay
6050b45716 AArch64: Add vector sinpi to libmvec
Vector variant of the new C23 sinpi. New tests pass on AArch64.
2025-01-03 21:39:56 +00:00
Joe Ramsay
939e770e01 math: Remove no-mathvec flag
More routines are to follow, some of which hit many failures in the
current testsuite due to wrong sign of zero (mathvec routines are not
required to get this right). Instead of disabling a large number of
tests, change the failure condition such that, for vector routines,
tests pass as long as computed == expected == 0.0, regardless of sign.

Affected tests (vector tests for expm1, log1p, sin, tan and tanh) all
still pass.
2025-01-03 21:39:56 +00:00
Yat Long Poon
91c1fadba3 AArch64: Improve codegen for SVE log1pf users
Reduce memory access by using lanewise MLA and reduce number of MOVPRFXs.
Move log1pf implementation to inline helper function.
Speedup on Neoverse V1 for log1pf (10%), acoshf (-1%), atanhf (2%), asinhf (2%).
2025-01-03 21:39:56 +00:00
Yat Long Poon
32d193a372 AArch64: Improve codegen for SVE logs
Reduce memory access by using lanewise MLA and moving constants to struct
and reduce number of MOVPRFXs.
Update maximum ULP error for double log_sve from 1 to 2.
Speedup on Neoverse V1 for log (3%), log2 (5%), and log10 (4%).
2025-01-03 21:39:56 +00:00
Luna Lamb
aa6609feb2 AArch64: Improve codegen in SVE tans
Improves memory access.
Tan: MOVPRFX 7 -> 2, LD1RD 12 -> 5, move MOV away from return.
Tanf: MOV 2 -> 1, MOVPRFX 6 -> 3, LD1RW 5 -> 4, move mov away from return.
2025-01-03 21:39:56 +00:00
Luna Lamb
140b985e5a AArch64: Improve codegen in AdvSIMD asinh
Improves memory access and removes spills.
Load the polynomial evaluation coefficients into 2 vectors and use lanewise
MLAs.  Reduces MOVs 6->3 , LDR 11->5, STR/STP 2->0, ADRP 3->2.
2025-01-03 21:39:56 +00:00
H.J. Lu
bb4f241dba math: Add a reference to Clang's <tgmath.h> C23 issue
Clang's <tgmath.h> doesn't support all C23 functions in glibc's <tgmath.h>:

https://github.com/llvm/llvm-project/issues/121536

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-04 04:52:00 +08:00
H.J. Lu
1294926da3 Rename have-mtls-descriptor to have-test-mtls-descriptor
Since have-mtls-descriptor is only used for glibc testing, rename it to
have-test-mtls-descriptor.  Also enable tst-gnu2-tls2-amx only if
$(have-test-mtls-descriptor) == gnu2.

Tested with GCC 14 and Clang 19/18/17 on x86-64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-04 04:51:21 +08:00
Andreas K. Hüttel
3674004f3f
math: update powerpc ulps
Linux timberdoodle 6.1.60-gentoo-dist-hardened #1 SMP Fri Dec  1 22:10:49 UTC 2023 ppc64 POWER9 (architected), altivec supported CHRP IBM pSeries (emulated by qemu) GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-03 19:34:53 +01:00
Andreas K. Hüttel
59b9c2b0ef
math: update sparc ulps
Linux catbus 6.1.112 #1 SMP Sun Oct 13 10:52:08 PDT 2024 sparc64 sun4v UltraSparc T5 (Niagara5) GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-03 15:40:06 +01:00
Andreas K. Hüttel
e71b548fac
math: update s390 ulps
Linux lgentoo4 6.8.9-gentoo #1 SMP Tue May  7 09:52:48 EDT 2024 s390x 8561 IBM GNU/Linux

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-01-03 15:36:56 +01:00
Adhemerval Zanella
8ed53717c4 conform: Do not use __SIG_ATOMIC_TYPE__
clang does not define __SIG_ATOMIC_TYPE__, instead add another
directive ('size:') which instruct to use an integer type of
defined minimum size.

Reviewed-by: Sam James <sam@gentoo.org>
2025-01-03 09:53:53 -03:00
H.J. Lu
e9eea05986 Redirect mempcpy and stpcpy only in libc.a
The mempcpy and stpcpy redirections to __mempcpy and __stpcpy were added
by

commit 939da41143
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Nov 12 22:36:34 2014 +0000

    Fix stpcpy / mempcpy namespace (bug 17573).

to fix the namespace bug since __mempcpy and __stpcpy were defined as
macros in <bits/string2.h>.  These macros call __builtin_mempcpy and
__builtin_stpcpy which may end up calling the C functions mempcpy
and stpcpy.  In libc.so, libc_hidden_builtin_proto ensures that calls
to mempcpy and stpcpy are in turn mapped to call __GI_mempcpy and
__GI_stpcpy.  The redirections were applied outside of libc.so, including
libc.a, to map mempcpy and stpcpy to __mempcpy and __stpcpy.  Since

commit 18b10de7ce
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Mon Jun 12 15:19:38 2017 +0100

    2017-06-12  Wilco Dijkstra  <wdijkstr@arm.com>

    There is no longer a need for string2.h, so remove it and all mention of it.
    Move the redirect for __stpcpy to include/string.h since it is
still required
    until all internal uses have been renamed.
    This fixes several linknamespace/localplt failures when building with -Os.

removed the __mempcpy and __stpcpy macros from the public header file,
limit these redirections to libc.a to avoid Clang error:

In file included from tst-iconv-sticky-input-error.c:22:
In file included from ./gconv_int.h:24:
../include/string.h:182:44: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
  182 | extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
      |                                            ^
../string/bits/string_fortified.h:42:8: note: previous definition is here
   42 | __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,
      |        ^

when testing with Clang for fortify build.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-03 05:30:44 +08:00
H.J. Lu
ed97ef7a4b not-cancel.h: Support testing fortify build with Clang
When Clang is used to test fortify glibc build configured with

--enable-fortify-source=N

clang issues errors like

In file included from tst-rfc3484.c:60:
In file included from ./getaddrinfo.c:81:
../sysdeps/unix/sysv/linux/not-cancel.h:36:10: error: reference to overloaded function could not be resolved; did you mean to call it?
   36 | __typeof (open64) __open64_nocancel;
      |          ^~~~~~~~
../include/bits/../../io/bits/fcntl2.h:127:1: note: possible target for call
  127 | open64 (__fortify_clang_overload_arg (const char *, ,__path), int __oflag,
      | ^
../include/bits/../../io/bits/fcntl2.h:118:1: note: possible target for call
  118 | open64 (__fortify_clang_overload_arg (const char *, ,__path), int __oflag)
      | ^
../include/bits/../../io/bits/fcntl2.h:114:1: note: possible target for call
  114 | open64 (const char *__path, int __oflag, mode_t __mode, ...)
      | ^
../io/fcntl.h:219:12: note: possible target for call
  219 | extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
      |            ^

because clang fortify support for functions with variable arguments relies
on function overload.  Update not-cancel.h to avoid __typeof on functions
with variable arguments.

Co-Authored-By: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-03 04:56:48 +08:00
H.J. Lu
dbc9a40007 tst-unique[34].cc: Use explicit instantiation declaration/definition
Use explicit instantiation declaration and definition 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>
Reviewed-by: Sam James <sam@gentoo.org>
2025-01-03 04:54:44 +08:00
Aurelien Jarno
d4b16e22e7
RISC-V: Regenerate ULPs
Generated on a VisionFive 2 board running Linux version 6.12.6 and
GCC 14.2.0.

Needed due to:
- commit bbd578b38d ("math: Use expm1f from CORE-MATH")
- commit 8ae9e51376 ("math: Use log1pf from CORE-MATH")
- commit 0ae0af68d8 ("Implement C23 cospi")
- commit 776938e8b8 ("Implement C23 sinpi")
- commit f9e90e4b4c ("Implement C23 tanpi")
- commit 28d102d15c ("Implement C23 acospi")
- commit f962932206 ("Implement C23 asinpi")
- commit ffe79c446c ("Implement C23 atanpi")
- commit 3374de9038 ("Implement C23 atan2pi")
- commit a357d6273f ("math: Use atanf from CORE-MATH")
- commit 6f9bacf36b ("math: Use atan2f from CORE-MATH")
- commit e5ca265a9c ("new inputs with large errors for [a]cospi,
  [a]sinpi, [a]tanpi, atan2pi")

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2025-01-02 20:46:24 +01:00
Sam James
e9be7701e6
mlock, mlock2, munlock: Use __attr_access_none macro
This fixes build failures using GCC 7.5.0 against glibc headers,
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118194#c5.

Followup to 013106ae67.

Reported-by: vvinayag@arm.com
2025-01-02 17:58:06 +00:00
Wilco Dijkstra
0ab62fa4f6 AArch64: Update libm-test-ulps
Update ulps for (a)cospi, (a)sinpi, (a)tanpi, atan2pi.
2025-01-02 17:53:07 +00:00
Paul Zimmermann
e5ca265a9c new inputs with large errors for [a]cospi, [a]sinpi, [a]tanpi, atan2pi
These inputs were generated with the programs from
https://gitlab.inria.fr/zimmerma/math_accuracy,
with rounding to nearest:

* for univariate binary32 functions by exhaustive search
* for other functions with the "threshold" parameter up to 10^6
2025-01-02 18:26:36 +01:00
Sam James
6d556522c3
stdlib: fix lint failure
Fixes: d5bceac99d
2025-01-02 17:09:24 +00:00
Sam James
d5bceac99d
stdlib: random_r: fix unaligned access in initstate and initstate_r [BZ #30584]
The initstate{,_r} interfaces are documented in BSD as needing an aligned
array of 32-bit values, but neither POSIX nor glibc's own documentation
require it to be aligned. glibc's documentation says it "should" be a power
of 2, but not must.

Use memcpy to read and write to `state` to handle such an unaligned
argument.

Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-01-02 16:47:51 +00:00