Commit Graph

43308 Commits

Author SHA1 Message Date
Adhemerval Zanella 52524467af bench-malloc-thread: Add libm for powf
The compiler might not constant fold the call, which issues
linker error.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:24 -03:00
Adhemerval Zanella 4d695077b8 benchtests: Remove clang warnings
clangs warns of the implicit cast of RAND_MAX to float:

  error: implicit conversion from 'int' to 'float' changes value from
  2147483647 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]

So make it explicit.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:21 -03:00
Adhemerval Zanella 9849a61b34 benchtests: Add attribute_optimize
Similar to tst-printf-bz18872.sh, add the attribute_optimize to avoid
build failures with compilers that do not support "GCC optimize" pragma.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:15 -03:00
Adhemerval Zanella 46be3e521c benchtests: Use __f128 on ilogbf128-inputs constants
The f128 is not a valid floating constant suffix on clang.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:14 -03:00
Adhemerval Zanella 8d26bed1eb Enable --enable-fortify-source with clang
clang generates internal calls for some _chk symbol, so add internal
aliases for them, and stub some with rtld-stubbed-symbols to avoid
ld.so linker issues.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:11 -03:00
Adhemerval Zanella 25de0771ec configure: Only use -fno-fp-int-builtin-inexact if compiler supports it
Checked on x86_64-linux-gnu.

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-21 13:13:10 -03:00
Adhemerval Zanella 2885d8a3ab benchtests: Add fmaf benchtests
Random inputs in the range [0,10].

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:13:05 -03:00
Adhemerval Zanella 42f07a44ef math: Remove ldbl-96 fma implementation
It is worse than the ldbl-64 version on recent x86 hardware.  With
Zen3 and gcc-15:

ldbl-96 removal
reciprocal-throughput        master        patched   improvement
x86_64                    1176.2200       289.4640         4.06x
i686                      1476.0600       636.8660         2.32x

latency                      master        patched   improvement
x86_64                    1176.2200        293.7360        4.00x
i686                      1480.0700        658.4160        2.25x

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

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:13:02 -03:00
Adhemerval Zanella 8ce2b5dd27 benchtests: Add fma benchtests
Random inputs in the range [0,10].

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-21 13:12:58 -03:00
Samuel Thibault ff92750112 htl: Move pthread_atfork compatibility symbol to libc
There is no new symbol version because of the compatibility symbol
status.
2025-11-21 00:29:44 +01:00
gfleury b36a126f7d htl: move pthread_spin_{destroy, lock, init, trylock, unlock) and remove _pthread_spin_lock, into libc.
Message-ID: <20251120085647.326643-1-gfleury@disroot.org>
2025-11-21 00:29:44 +01:00
Joseph Myers cd748a63ab Implement C23 const-preserving standard library macros
C23 makes various standard library functions, that return a pointer
into an input array, into macros that return a pointer to const when
the relevant argument passed to the macro is a pointer to const.  (The
requirement is for macros, with the existing function types applying
when macro expansion is suppressed.  When a null pointer constant is
passed, such as integer 0, that's the same as a pointer to non-const.)

Implement this feature.  This only applies to C, not C++, since such
macros are not an appropriate way of doing this for C++ and all the
affected functions other than bsearch have overloads to implement an
equivalent feature for C++ anyway.  Nothing is done to apply such a
change to any non-C23 functions with the same property of returning a
pointer into an input array.

The feature is also disabled when _LIBC is defined, since there are
various places in glibc that either redefine these identifiers as
macros, or define the functions themselves, and would need changing to
work in the presence of these macro definitions.  A natural question
is whether we should in fact change those places and not disable the
macro definitions for _LIBC.  If so, we'd need a solution for the
places in glibc that define the macro *before* including the relevant
header (in order in effect to disable the header declaration of the
function by renaming that declaration).

One testcase has #undef added to avoid conflicting with this feature
and another has const added; -Wno-discarded-qualifiers is added for
building zic (but could be removed once there's a new upstream tzcode
release that's const-safe with this C23 change and glibc has updated
to code from that new release).  Probably other places in glibc proper
would need const added if we remove the _LIBC conditionals.

Another question would be whether some GCC extension should be added
to support this feature better with macros that only expand each
argument once (as well as reducing duplication of diagnostics for bad
usages such as non-pointer and pointer-to-volatile-qualfied
arguments).

Tested for x86_64.
2025-11-20 19:31:04 +00:00
Adhemerval Zanella 64b6813338 Check if linker supports -Wl,--undefined-version
Although binutils has supported --no-undefined-version for a long timei
(319416359200 back in 2002), --undefined-version was only added more
recently (27fb6a1a7fcd on 2.40).

Reviewed-by: Sam James <sam@gentoo.org>
2025-11-20 14:33:13 -03:00
Adhemerval Zanella 20e92c9512 nptl: Replace FALLTHROUGH with [[fallthrough]]
The b9579342c6 reinstate '/* FALLTHROUGH */' that were replaced
the the C23 [[fallthrough]] by 970364dac0.
2025-11-20 14:23:43 -03:00
Samuel Thibault 951bb5c458 hurd: Add missing free_sized and free_aligned_sized
56549264d1 ("malloc: add free_sized and free_aligned_sized from C23")
missed adding them.
2025-11-20 17:41:45 +01:00
Andreas Schwab 0df50640a4 Use __fstat64_time64 in __fts64_children_time64 (bug 33653)
Make sure that fts_safe_changedir can handle a directory with a time stamp
after y2038.
2025-11-20 14:33:59 +01:00
Wilco Dijkstra 7f670284d8 malloc: Use _int_free_chunk in tcache_thread_shutdown
Directly call _int_free_chunk during tcache shutdown to avoid recursion.
Calling __libc_free on a block from tcache gets flagged as a double free,
and tcache_double_free_verify checks every tcache chunk (quadratic
overhead).

Reviewed-by: Arjun Shankar <arjun@redhat.com>
2025-11-20 12:28:46 +00:00
Adhemerval Zanella 92186652d8 math: Sync atanh from CORE-MATH
The CORE-MATH commit 703d7487 fixes some issues for RNDZ:

Failure: Test: atanh_towardzero (0x5.96200b978b69cp-4)
Result:
 is:          3.6447730550366463e-01   0x1.753989ed16faap-2
 should be:   3.6447730550366458e-01   0x1.753989ed16fa9p-2
 difference:  5.5511151231257827e-17   0x1.0000000000000p-54
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `atanh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu,
and i686-linux-gnu.
2025-11-19 15:21:44 -03:00
Justin King 56549264d1 malloc: add free_sized and free_aligned_sized from C23
Signed-off-by: Justin King <jcking@google.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-19 13:47:53 -03:00
Adhemerval Zanella 4567204feb math: Sync acosh from CORE-MATH
The CORE-MATH commit 6736002f fixes some issues for RNDZ:

Failure: Test: acosh_towardzero (0x1.08000c1e79fp+0)
Result:
 is:          2.4935636091994373e-01   0x1.feae8c399b18cp-3
 should be:   2.4935636091994370e-01   0x1.feae8c399b18bp-3
 difference:  2.7755575615628913e-17   0x1.0000000000000p-55
 ulp       :  1.0000
 max.ulp   :  0.0000
Failure: Test: acosh_towardzero (0x1.080016353964ep+0)
Result:
 is:          2.4935874767710369e-01   0x1.feafcc91f518ep-3
 should be:   2.4935874767710367e-01   0x1.feafcc91f518dp-3
 difference:  2.7755575615628913e-17   0x1.0000000000000p-55
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `acosh_towardzero'
 is      : 1 ulp
 accepted: 0 ulp

This only happens when the ISA supports fma, such as x86_64-v3, aarch64,
or powerpc.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-v3, aarch64-linux-gnu,
and i686-linux-gnu.
2025-11-19 12:58:56 -03:00
H. Peter Anvin 40a751b004 linux/termios: test the kernel-side termios canonicalization
Verify that the kernel side of the termios interface gets the various
speed fields set according to our current canonicalization policy.

[ v2.1: fix formatting - Adhemerval Netto ]
[ v4: fix typo in patch description - Dan Horák ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (v2.1)
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-19 07:54:51 +08:00
Florian Weimer cdb0e9dc70 nss: Remove effectively unused __nss_*_database variables
Use of this cache was removed in commit f8847d83e1
("nsswitch: use new internal API (core)").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-18 20:18:06 +01:00
Dylan Fleming fd1d642ef8 AArch64: Remove WANT_SIMD_EXCEPT from aarch64 AdvSIMD math routines
Remove legacy code for supporting an old Arm Optimised Routines
deprecated feature for throwing SIMD Exceptions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 15:51:15 +00:00
Pierre Blanchard bb6519de1e AArch64: Fix and improve SVE pow(f) special cases
powf:

Update scalar special case function to best use new interface.

pow:

Make specialcase NOINLINE to prevent str/ldr leaking in fast path.
Remove depency in sv_call2, as new callback impl is not a
performance gain.
Replace with vectorised specialcase since structure of scalar
routine is fairly simple.

Throughput gain of about 5-10% on V1 for large values and 25% for subnormal `x`.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 15:51:15 +00:00
Pierre Blanchard e889160273 AArch64: fix SVE tanpi(f) [BZ #33642]
Fixed svld1rq using incorrect predicates (BZ #33642).
Next to no performance variations (tested on V1).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 15:51:15 +00:00
gfleury d989840693 htl: move pthread_hurd_cond_timedwait_np, pthread_hurd_cond_wait_np into libc.
Message-ID: <20251118125044.1160780-3-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
gfleury bb3524a879 htl: move pthread_getname_np/setname_np into libc.
Message-ID: <20251118125044.1160780-2-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
gfleury 77f446346a htl: fix compatibility
This fix 91fb9914d8 which break a system
built with an old glibc
Message-ID: <20251118125044.1160780-1-gfleury@disroot.org>
2025-11-18 15:01:35 +01:00
Adhemerval Zanella 8c66b742cf Add new AArch64 HWCAP3 definitions from Linux 6.17 to bits/hwcap.h
Linux 7c7f55039b8d6 added HWCAP3_MTE_FAR and f620372209bfe added
HWCAP3_MTE_STORE_ONLY.
2025-11-18 10:35:32 -03:00
Arjun Shankar e53d85947f malloc: Simplify tst-free-errno munmap failure test
The Linux specific test-case in tst-free-errno was backing up malloc
metadata for a large mmap'd block, overwriting the block with its own
mmap, then restoring malloc metadata and calling free to force an munmap
failure.  However, the backed up pages containing metadata can
occasionally be overlapped by the overwriting mmap, leading to a
metadata corruption.

This commit replaces this Linux specific test case with a simpler,
generic, three block allocation, expecting the kernel to coalesce the
VMAs, then cause a fragmentation to trigger the same failure.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-18 14:28:42 +01:00
Stefan Liebler b9579342c6 Remove support for lock elision.
The support for lock elision was already deprecated with glibc 2.42:
commit 77438db8cf
"Mark support for lock elision as deprecated."
See also discussions:
https://sourceware.org/pipermail/libc-alpha/2025-July/168492.html

This patch removes the architecture specific support for lock elision
for x86, powerpc and s390 by removing the elision-conf.h, elision-conf.c,
elision-lock.c, elision-timed.c, elision-unlock.c, elide.h, htm.h/hle.h files.
Those generic files are also removed.

The architecture specific structures are adjusted and the elision fields are
marked as unused.  See struct_mutex.h files.
Furthermore in struct_rwlock.h, the leftover __rwelision was also removed.
Those were originally removed with commit 0377a7fde6
"nptl: Remove rwlock elision definitions"
and by chance reintroduced with commit 7df8af43ad
"nptl: Add struct_rwlock.h"

The common code (e.g. the pthread_mutex-files) are changed back to the time
before lock elision was introduced with the x86-support:
- commit 1cdbe57948
"Add the low level infrastructure for pthreads lock elision with TSX"
- commit b023e4ca99
"Add new internal mutex type flags for elision."
- commit 68cc29355f
"Add minimal test suite changes for elision enabled kernels"
- commit e8c659d74e
"Add elision to pthread_mutex_{try,timed,un}lock"
- commit 49186d21ef
"Disable elision for any pthread_mutexattr_settype call"
- commit 1717da59ae
"Add a configure option to enable lock elision and disable by default"

Elision is removed also from the tunables, the initialization part, the
pretty-printers and the manual.

Some extra handling in the testsuite is removed as well as the full tst-mutex10
testcase, which tested a race while enabling lock elision.

I've also searched the code for "elision", "elide", "transaction" and e.g.
cleaned some comments.

I've run the testsuite on x86_64 and s390x and run the build-many-glibcs.py
script.
Thanks to Sachin Monga, this patch is also tested on powerpc.

A NEWS entry also mentions the removal.
Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-18 14:21:13 +01:00
Florian Weimer 5029b63280 nss: Remove effectively unused struct nss_database_default_cache
We always start with a zero-initialized cache, so this is completely
ineffective.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-18 09:51:02 +01:00
Florian Weimer a025a9deef nss: Clean up function pointer/void * unions
All our targets support casts between function pointers and void *,
so we might as well use them.

This change was largely auto-generated, with the following prompts.

@getXXbyYY_r.c Remove the use of the `fct` union and replace it by
pointer casts.

Apply the same change to ether_* getnetgrent_r getnssent_r netname
publickey .

Do not use explicit `*` in function pointer calls. Replace
`(*((lookup_function) fct))` and similar with `((lookup_function) fct)`.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-11-18 08:35:44 +01:00
H. Peter Anvin 6463953fec linux/termios: factor out the kernel interface from termios_internal.h
Factor out the internal kernel interface from termios_internal.h, so
that it can be used in test code without causing breakage due to glibc
internals used in headers.

[ v3: fix Alpha build breakage ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 12:05:20 +08:00
H. Peter Anvin 8d999a6993 linux/termios: clear k_termios.c_cflag & CIBAUD for non-split speed [BZ 33340]
After getting more experience with the various broken direct-to-ioctl
termios2 hacks using Fedora 43 beta, I have found a fair number of
cases where the software would fail to set, or clear CIBAUD for
non-split-speed operation.

Thus it seems will help improve compatibility to clear the kernel-side
version of c_cflag & CIBAUD (having the same meaning to the Linux
kernel as the speed 0 has for cfsetibaud(), i.e. force the input speed
to equal the output speed) for non-split-speed operation, rather than
having it explicitly equal the output speed in CBAUD.

When writing the code that went into glibc 2.42 I had considered this
issue, and had to make an educated guess which way would be more
likely to break fewer things.  Unfortunately, it appears I guessed
wrong.

A third option would be to *always* set CIBAUD to __BOTHER, even for
the standard baud rates.  However, that is an even bigger departure
from legacy behavior, whereas this variant mostly preserves current
behavior in terms of under what conditions buggy utilities will
continue to work.

This change is in tcsetattr() rather than
___termios2_canonicalize_speeds(), as it should not be run for
tcgetattr(); that would break split speed support for the legacy
interface versions of cfgetispeed() and cfsetispeed().

[ v2: fixed comment style ]

Resolves: BZ #33340
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-11-18 12:04:55 +08:00
Collin Funk 04eea3aa48 manual: don't use the FSF's old address in license text.
Update to latest text from Gnulib commit
08f579c56d81cf78c60fcd3568190f97e6e7f684, file doc/lgpl-2.1.texi.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-17 18:46:12 -08:00
Pádraig Brady efc8642051 posix: execvpe: fix UMR with file > NAME_MAX [BZ #33627]
* posix/execvpe.c (__execvpe_common): Since strnlen doesn't inspect
beyond NAME_MAX and NAME_MAX does not cover the NUL, we need
to explicitly check for the NUL.  I.e. the existing check for,
file_len-1 > NAME_MAX, was never true.  This check is required
so that we're guaranteed that file_len includes the NUL, as we
depend on that in the following memcpy to properly terminate
the file buffer passed to execve().  Otherwise that call will trigger
UMR when inspecting the passed file, which can be seen with valgrind.
Note returning ENAMETOOLONG early here for FILE names > NAME_MAX
will also avoid redundant processing of ENAMETOOLONG on each entry
in $PATH, after the change in [BZ #33626] is applied.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-17 11:57:07 -08:00
Adhemerval Zanella 03db446659 configure: Remove for redirection of built-in functions
The check was initially used to define HAVE_BUILTIN_REDIRECTION, which
enables or not libc_hidden_builtin_proto support. It was later removed
with 3ce1f29594, making the feature
mandatory. The configure check was kept as a transition knob.

Current minimum gcc/linker always supports this, as well as clang with
some extra care. Also, missing hidden_proto/hidden_def support is
already flagged in the check-localplt test.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 1abdb38135 math: Handle fabsf128 !__USE_EXTERN_INLINES
Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

clang on x86_64 fails to build s_fabsf128.c with:

../sysdeps/ieee754/float128/../ldbl-128/s_fabsl.c:32:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
   32 | libm_alias_ldouble (__fabs, fabs)
      | ^
../sysdeps/generic/libm-alias-ldouble.h:63:38: note: expanded from macro 'libm_alias_ldouble'
   63 | #define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, )
      |                                      ^
../sysdeps/ieee754/float128/float128_private.h:133:43: note: expanded from macro 'libm_alias_ldouble_r'
  133 | #define libm_alias_ldouble_r(from, to, r) libm_alias_float128_r (from, to, r)
      |                                           ^
../sysdeps/ieee754/float128/s_fabsf128.c:5:3: note: expanded from macro 'libm_alias_float128_r'
    5 |   static_weak_alias (from ## f128 ## r, to ## f128 ## r);       \
      |   ^
./../include/libc-symbols.h:166:46: note: expanded from macro 'static_weak_alias'
  166 | #  define static_weak_alias(name, aliasname) weak_alias (name, aliasname)
      |                                              ^
./../include/libc-symbols.h:154:38: note: expanded from macro 'weak_alias'
  154 | # define weak_alias(name, aliasname) _weak_alias (name, aliasname)
      |                                      ^
./../include/libc-symbols.h:156:52: note: expanded from macro '_weak_alias'
  156 |   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
      |                                                    ^
../include/math.h:134:1: note: previous definition is here
  134 | fabsf128 (_Float128 x)

If compiler does not support __USE_EXTERN_INLINES we need to route
fabsf128 call to an internal symbol.
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 53ad1eae0f x86: Fix strstr ifunc on clang
Work around the clang limitation wrt inline function and attribute
definition, where it does not allow to 'add' new attribute if a
function is already defined:

Buildint with clang triggers multiple issue on how ifunc macro are
used:

  ../sysdeps/x86_64/multiarch/strstr.c:38:54: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
     38 | extern __typeof (__redirect_strstr) __strstr_generic attribute_hidden;
        |                                                      ^
  ./../include/libc-symbols.h:356:43: note: expanded from macro 'attribute_hidden'
    356 | # define attribute_hidden __attribute__ ((visibility ("hidden")))
        |                                           ^
  ../string/strstr.c:76:1: note: previous definition is here
     76 | STRSTR (const char *haystack, const char *needle)
        | ^
  ../sysdeps/x86_64/multiarch/strstr.c:27:16: note: expanded from macro 'STRSTR'
     27 | #define STRSTR __strstr_generic
        |                ^
  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^

And

  ../sysdeps/x86_64/multiarch/strstr.c:65:43: error: redefinition of '__libc_strstr'
     65 | libc_ifunc_redirected (__redirect_strstr, __libc_strstr, IFUNC_SELECTOR ());
        |                                           ^
  ../sysdeps/x86_64/multiarch/strstr.c:59:13: note: previous definition is here
     59 | libc_ifunc (__libc_strstr,
        |             ^

Refactor to use a auxiliary function like other selection (for instance,
x86_64/multiarch/strcmp.c).
2025-11-17 11:17:07 -03:00
Adhemerval Zanella edd4dc7dc8 x86: Use -mavx instead of -msse2avx
clang supports -msse2avx from version 19 and onwards, but it should
be gated as an option to assembler (either with -Wa or -Xassembler).

The -DSSE2AVX option was used because there were asm statements with
SSE-only instructions which was fixed by commit ff8be6152b.

Now we can simply use -mavx.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Adhemerval Zanella 13cfd77bf5 math: Don't redirect inlined builtin math functions
When we want to inline builtin math functions, like truncf, for

  extern float truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));
  extern float __truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

  float (truncf) (float) asm ("__truncf");

compiler may redirect truncf calls to __truncf, instead of inlining it
(for instance, clang).  The USE_TRUNCF_BUILTIN is 1 to indicate that
truncf should be inlined.  In this case, we don't want the truncf
redirection:

  1. For each math function which may be inlined, we define

  #if USE_TRUNCF_BUILTIN
   # define NO_truncf_BUILTIN inline_truncf
   #else
   # define NO_truncf_BUILTIN truncf
   #endif

in <math-use-builtins.h>.

  2. Include <math-use-builtins.h> in include/math.h.

  3. Change MATH_REDIRECT to

   #define MATH_REDIRECT(FUNC, PREFIX, ARGS)		\
    float (NO_ ## FUNC ## f ## _BUILTIN) (ARGS (float))	\
      asm (PREFIX #FUNC "f");

With this change If USE_TRUNCF_BUILTIN is 0, we get

  float (truncf) (float) asm ("__truncf");
  truncf will be redirected to __truncf.

And for USE_TRUNCF_BUILTIN 1, we get:

  float (inline_truncf) (float) asm ("__truncf");

In both cases either truncf will be inlined or the internal alias
(__truncf) will be called.

It is not required for all math-use-builtin symbol, only the one
defined in math.h.  It also allows to remove all the math-use-builtin
inclusion, since it is now implicitly included by math.h.

For MIPS, some math-use-builtin headers include sysdep.h and this
in turn includes a lot of extra headers that do not allow ldbl-128
code to override alias definition (math.h will include
some stdlib.h definition).  The math-use-builtin only requires
the __mips_isa_rev, so move the defintion to sgidefs.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
Florian Weimer a0ce8b0779 Update COPYING, COPYING.LIB from gnulib, using gnulib file names
The new file names are COPYINGv2 and COPYING.LESSERv2.  Lots of
copyright headers mention COPYING.LIB, so add a symbolic link.
(This is not the first symbolic link in the repository, so this
should be fine.)

The files come from gnulib commit 3cc5b69dda06890929a2d0433f30708.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-11-17 11:15:13 +01:00
Florian Weimer e067e53080 Add COPYINGv3 with the GPL version 3 text
The license is referenced in various headers, so we should ship it.
The text was copied from gnulib commit d64d66cc4897d605f543257dcd0,
file doc/COPYINGv3.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Florian Weimer <fweimer@redhat.com>
2025-11-17 11:15:13 +01:00
Florian Weimer c6f151839b Reference COPYING.LIB in <sframe.h> copyright header
Commit 3360913c37 ("elf: Add SFrame
stack tracing") added this file with an inconsistent copyright header.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-11-17 11:15:13 +01:00
Samuel Thibault 5b6ee0e0ba htl: move pthread_create to into libc
This is notably needed for the main thread structure to be always
initialized so that some pthread functions can work from the main thread
without other threads, e.g. pthread_cancel.
2025-11-17 00:38:37 +00:00
Samuel Thibault f63dd92431 htl: Move __pthread_enable/disable_asynccancel into libc
This is actually needed before we make pthread_cancel available in libc.
2025-11-17 00:38:36 +00:00
Samuel Thibault 5db67a03e9 hurd: Fix getting rlimit in _hurd_alloc_fd
rlim_t is unsigned, and RLIM_INFINITY can be (rlim_t) -1
2025-11-17 00:38:35 +00:00
Samuel Thibault c7d699b55b htl: Add missing include
For IS_IN.
2025-11-16 11:53:46 +01:00
Samuel Thibault a064213785 loongarch: Remove TLS_TCB_ALIGN
This reverts a part of 9f18265a8e ("Remove TLS_TCB_ALIGN and
TLS_INIT_TCB_ALIGN"), as loongarch uses this macro internally.
2025-11-16 11:27:47 +01:00