summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2026-03-15resolv: Move libanl symbols to libc on hurd tooSamuel Thibault
2026-03-15rt: Move librt symbols to libc on hurd tooSamuel Thibault
2026-02-26debug: Fix build with --enable-fortify-source=1 (BZ 33904)Adhemerval Zanella
The libio/bits/stdio2-decl.h only defined the prototypes for __vasprintf_chk and __vfprintf_chk for __USE_FORTIFY_LEVEL > 1. Also defined them for the internal header regardless. Checked with a build with --enable-fortify-source=1 and --enable-fortify-source=2 for all afftected ABIs.
2026-02-03gnulib: sync comment from upstreamPaul Eggert
2026-02-02x86: Add __issignalingl inlineAdhemerval Zanella
Checked on x86_64-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2026-02-02math: Add __issignaling inlineWilco Dijkstra
Add __issignaling inline based on the issignaling_inline implementation. Improve the __issignalingf inline. Remove issignaling(f)_inline and its uses. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2026-01-23version.h, include/features.h: Increase version numberAndreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2026-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert
2025-12-17atomic: Reinstate HAVE_64B_ATOMICS configure checkWilco Dijkstra
Reinstate HAVE_64B_ATOMICS configure check that was reverted by commit 7fec8a5de6826ef9ae440238d698f0fe5a5fb372 due to BZ #33632. This was fixed by 3dd2cbfa35e0e6e0345633079bd5a83bb822c2d8 by only allowing 64-bit atomics on sem_t if its type is 8-byte aligned. Rebase and add in cleanups in include/atomic.h that were omitted. Fix an issue with sparcv8-linux-gnu-leon3 forcing -mcpu=v8 for rtld.c which overrules -mcpu=leon3 and causes __atomic_always_lock_free (4, 0) to incorrectly return 0 and trigger asserts in atomics. Remove this as it seems to be a workaround for an issue in 1997. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-12-09Handle clang -Wignored-attributes on weak aliasesAdhemerval Zanella
Clang issues a warning for double alias redirection, indicating that thei original symbol is used even if a weak definition attempts to override it. For instance, in the construction: int __internal_impl (...) {} weak_alias (__internal_impl, external_impl); #if SOMETHING weak_alias (external_impl, another_external_impl) #endif Clang warns that another_external_impl always resolves to __internal_impl, even if external_impl is a weak reference. Using the internal symbol for both aliases resolves this warning. This issue also occurs with certain libc_hidden_def usage: int __internal_impl (...) {} weak_alias (__internal_impl, __internal_alias) libc_hidden_weak (__internal_alias) In this case, using a strong_alias is sufficient to avoid the warning (since the alias is internal, there is no need to use a weak alias). However, for the constructions like: int __internal_impl (...) {} weak_alias (__internal_impl, __internal_alias) libc_hidden_def (__internal_alias) weak_alias (__internal_impl, external_alias) libc_hidden_def (external_alias) Clang warns that the internal external_alias will always resolve to __GI___internal_impl, even if a weak definition of __GI_internal_impl is overridden. For this case, a new macro named static_weak_alias is used to create a strong alias for SHARED, or a weak_alias otherwise. With these changes, there is no need to check and enable the -Wno-ignored-attributes suppression when using clang. Checked with a build on affected ABIs, and a full check on aarch64, armhf, i686, and x86_64. Reviewed-by: Sam James <sam@gentoo.org>
2025-12-03time: Add TIME_MONOTONIC, TIME_ACTIVE, and TIME_THREAD_ACTIVEAdhemerval Zanella
The TIME_MONOTONIC maps to POSIX's CLOCK_MONOTONIC, TIME_ACTIVE to CLOCK_PROCESS_CPUTIME_ID, and TIME_THREAD_ACTIVE to CLOCK_THREAD_CPUTIME_ID. No Linux specific timer are added as extension. Co-authored-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2025-12-02misc: fix some typosYury Khrustalev
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-11-27Define C23 header version macrosJoseph Myers
C23 defines library macros __STDC_VERSION_<header>_H__ to indicate that a header has support for new / changed features from C23. Now that all the required library features are implemented in glibc, define these macros. I'm not sure this is sufficiently much of a user-visible feature to be worth a mention in NEWS. Tested for x86_64. There are various optional C23 features we don't yet have, of which I might look at the Annex H ones (floating-point encoding conversion functions and _Float16 functions) next. * Optional time bases TIME_MONOTONIC, TIME_ACTIVE, TIME_THREAD_ACTIVE. See <https://sourceware.org/pipermail/libc-alpha/2023-June/149264.html> - we need to review / update that patch. (I think patch 2/2, inventing new names for all the nonstandard CLOCK_* supported by the Linux kernel, is rather more dubious.) * Updating conform/ tests for C23. * Defining the rounding mode macro FE_TONEARESTFROMZERO for RISC-V (as far as I know, the only architecture supported by glibc that has hardware support for this rounding mode for binary floating point) and supporting it throughout glibc and its tests (especially the string/numeric conversions in both directions that explicitly handle each possible rounding mode, and various tests that do likewise). * Annex H floating-point encoding conversion functions. (It's not entirely clear which are optional even given support for Annex H; there's some wording applied inconsistently about only being required when non-arithmetic interchange formats are supported; see the comments I raised on the WG14 reflector on 23 Oct 2025.) * _Float16 functions (and other header and testcase support for this type). * Decimal floating-point support. * Fully supporting __int128 and unsigned __int128 as integer types wider than intmax_t, as permitted by C23. Would need doing in coordination with GCC, see GCC bug 113887 for more discussion of what's involved.
2025-11-22pthread: Simplify condition for hidden protoSamuel Thibault
This is not needed yet for htl (only the Linux mq_notify), but we can as well just simplify the header.
2025-11-22htl: Also use __libc_thread_freeres to clean TLS stateSamuel Thibault
2025-11-21Enable --enable-fortify-source with clangAdhemerval Zanella
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-17math: Handle fabsf128 !__USE_EXTERN_INLINESAdhemerval Zanella
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-17math: Don't redirect inlined builtin math functionsAdhemerval Zanella
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-14Revert __HAVE_64B_ATOMICS configure checkAdhemerval Zanella
The 53807741fb44edb8e7c094cb5e7d4ff4e92a6ec1 added a configure check for 64-bit atomic operations that were not previously enabled on some 32-bit ABIs. However, the NPTL semaphore code casts a sem_t to a new_sem and issues a 64-bit atomic operation for __HAVE_64B_ATOMICS. Since sem_t has 32-bit alignment on 32-bit architectures, this prevents the use of 64-bit atomics even if the ABI supports them. Assume 64-bit atomic support from __WORDSIZE, which maps to how glibc defines it before the broken change. Also rename __HAVE_64B_ATOMICS to USE_64B_ATOMICS to define better the flag meaning. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-11-13htl: move {,_IO_}f{,un,try}lockfile implementation into libcSamuel Thibault
2025-11-10string: Check if attribute can declared after function declarationAdhemerval Zanella
Some symbols that might be auto-generated by the compiler are redefined to internal alias (for instance mempcpy to __mempcpy). However, if fortify is enabled, the fortify wrapper is define before the alias re-defined and clang warns attribute declaration must precede definition. Use an asm alias if compiler does not support it, instead of an attribute. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-04Add feature test macros for POSIX.1-2024.Collin Funk
* include/features.h (_POSIX_C_SOURCE): Document the value of 202405L for POSIX.1-2024. Set it to 202405L when _GNU_SOURCE or _DEFAULT_SOURCE is defined. (_XOPEN_SOURCE): Document the value of 800 for POSIX-1.2024. Set it to 800 when _GNU_SOURCE is defined. (__USE_XOPEN2K24, __USE_XOPEN2K24XSI): New internal macros. Set them when _POSIX_C_SOURCE is 202405L or greater and/or when _XOPEN_SOURCE is 800 or greater. * manual/creature.texi (Feature Test Macros): Document the new values for _POSIX_C_SOURCE and _XOPEN_SOURCE. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Signed-off-by: Collin Funk <collin.funk1@gmail.com>
2025-11-04math: Remove the SVID error handling wrapper from sqrtAdhemerval Zanella
i386 and m68k architectures should use math-use-builtins-sqrt.h rather than relying on architecture-specific or inline assembly implementations. The PowerPC optimization for PPC 601/603 (30 years old) is removed. Tested on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-11-04nptl: Remove ATOMIC_EXCHANGE_USES_CAS usageWilco Dijkstra
The only usage was for pthread_spin_lock, introduced by 12d2dd706099aa4, as a way to optimize the code for certain architectures. Now that atomic builtins are used by default, let the compiler use the best code sequence for the atomic exchange. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04atomic: Consolidate atomic_write_barrier implementationAdhemerval Zanella
All ABIs, except alpha and sparc, define it to atomic_full_barrier/__sync_synchronize, which can be mapped to __atomic_thread_fence (__ATOMIC_RELEASE). For alpha, it uses a 'wmb' which does not map to any of C11 barriers. For sparc it uses a stronger 'member #LoadStore | #StoreStore', where the release barrier maps to just 'membar #StoreLoad'. The patch keeps the sparc definition. For PowerPC, it allows the use of lwsync for additional chips (since _ARCH_PWR4 does not cover all chips that support it). Tested on aarch64-linux-gnu. Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-11-04atomic: Consolidate atomic_read_barrier implementationAdhemerval Zanella
All ABIs, except alpha, powerpc, and x86_64, define it to atomic_full_barrier/__sync_synchronize, which can be mapped to __atomic_thread_fence (__ATOMIC_SEQ_CST) in most cases, with the exception of aarch64 (where the acquire fence is generated as 'dmb ishld' instead of 'dmb ish'). For s390x, it defaults to a memory barrier where __sync_synchronize emits a 'bcr 15,0' (which the manual describes as pipeline synchronization). For PowerPC, it allows the use of lwsync for additional chips (since _ARCH_PWR4 does not cover all chips that support it). Tested on aarch64-linux-gnu, where the acquire produces a different instruction that the current code. Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-11-04atomic: Consolidate atomic_full_barrier implementationAdhemerval Zanella
All ABIs save for sparcv9 and s390 defines it to __sync_synchronize, which can be mapped to __atomic_thread_fence (__ATOMIC_SEQ_CST). For Sparc, it uses a stricter #StoreStore|#LoadStore|#StoreLoad|#LoadLoad instead of the #StoreLoad generated by __sync_synchronize. For s390x, it defaults to a memory barrier where __sync_synchronize emits a 'bcr 15,0' (which the manual describes as pipeline synchronization). The barrier is used only in one place (pthread_mutex_setprioceiling), and using a stricter barrier for s390 is ok performance-wise. Co-authored-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com> Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-10-31debug: mark __libc_message_wrapper as always inlineYury Khrustalev
When building with -Og to enable debugging, there is currently a compiler error because if __libc_message_wrapper() is not inline, the __va_arg_pack_len macro cannot be used. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-29argp: Move attribute_hidden to argp-fmtstream.hAdhemerval Zanella
The internal header redefines the some internal argp functions with attribute_hidden, which triggers clang warning of mismatched attributes. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-29include: Sync gnulib intpropsAdhemerval Zanella
It syncs with gnulib commit 1790ef25d81983d1d25a77d452c0080345df459b. The main change is to proper support clang by using builtins. It fixes a sprof build issue, where previous version uses the generic code path when building with clang: sprof.c:682:8: error: result of comparison of constant 288230376151711743 with expression of type 'Elf64_Half' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare] 682 | if (INT_MULTIPLY_WRAPV (ehdr2.e_shnum, sizeof (ElfW(Shdr)), &size)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/intprops.h:415:34: note: expanded from macro 'INT_MULTIPLY_WRAPV' 415 | _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/intprops.h:504:45: note: expanded from macro '_GL_INT_OP_WRAPV' 504 | : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ ../include/intprops.h:511:41: note: expanded from macro '_GL_INT_OP_WRAPV_LONGISH' 511 | : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | unsigned long int, 0, ULONG_MAX)) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/intprops.h:533:4: note: expanded from macro '_GL_INT_OP_CALC' 533 | (overflow (a, b, tmin, tmax) \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/intprops.h:608:22: note: expanded from macro '_GL_INT_MULTIPLY_RANGE_OVERFLOW' 608 | : (tmax) / (b) < (a))) | ~~~~~~~~~~~~ ^ ~~~ 1 error generated. Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-10-21stdio: Only use __va_arg_pack if compiler supports itAdhemerval Zanella
Otherwise route __libc_message_wrapper to __libc_message_impl. Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21elf: Suppress unused function clang warning for __ifunc_resolverAdhemerval Zanella
The __ifunc_resolver macro expands to: extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc"))); static __typeof (__redirect_name) *name_ifunc (void) { [...] }; And although NAME_IFUNC is and alias for NAME, clang still emits an 'unused function 'name_ifunc' [-Werror,-Wunused-function]' warning. The static is used to avoid name pollution on static linkage. Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21Suppress -Wmaybe-uninitialized only for gccAdhemerval Zanella
The warning is not supported by clang. Reviewed-by: Sam James <sam@gentoo.org>
2025-10-21Disable __USE_EXTERN_INLINES for clangAdhemerval Zanella
clang does not allow to redefine attributes after function declaration. Although it work for external usage, its breaks the build for internal symbol that glibc provides as optimization (for instance bsearch with stdlib-bsearch.h or __cmsg_nxthdr). Disable such optimization for clang while building glibc. Reviewed-by: Sam James <sam@gentoo.org>
2025-10-10misc: Fix several typosYury Khrustalev
2025-10-08atomic: Remove atomic_forced_readWilco Dijkstra
Remove the odd atomic_forced_read which is neither atomic nor forced. Some uses are completely redundant, so simply remove them. In other cases the intended use is to force a memory ordering, so use acquire load for those. In yet other cases their purpose is unclear, for example __nscd_cache_search appears to allow concurrent accesses to the cache while it is being garbage collected by another thread! Use relaxed atomic loads here to block spills from accidentally reloading memory that is being changed. Passes regress on AArch64, OK for commit?
2025-10-01shm-directory: Truncated struct member name lengthPrasanna Paithankar
The struct shmdir_name in include/shm-directory.h has name field to contains the full path of the POSIX IPC object (shm and sem). The size was previously set to sizeof (SHMDIR) + 4 + NAME_MAX, where 4 bytes were reserved for the optional "sem." prefix. This led to incorrect execution of the __shm_get_name function in posix/shm-directory.c which is used accross in shm_[open/unlink] and sem_[open/unlink] functions. For shm_[open/unlink]: This is because the name field was large enough to hold 268 characters (255 + 4 + 9) instead of the maximum allowed 263 characters (255 + 9). This caused the __shm_get_name to not throw ENAMETOOLONG error when the name length exceeded NAME_MAX (255) upto 259 characters. For sem_[open/unlink]: Similarly, the __shm_get_name incorrectly returned success for names of length 255 instead of 251 (255 - 4). This was overlooked as finally these functions throw the correct ENAMETOOLONG error; which was thrown by the openat syscall, which is called later in the shm_* and sem_* functions. This patch corrects the size of name field in struct shmdir_name to sizeof (SHMDIR) + NAME_MAX. The __shm_get_name function return ENAMETOOLONG if alloc_buffer_has_failed returns true (which only happens when copy length > alloc_buffer_size (buffer)). Relevant runtime monitoring were done in gdb to confirm the same. Signed-off-by: Prasanna Paithankar <paithankarprasanna@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-10-01Implement C23 memset_explicit (bug 32378)Joseph Myers
Add the C23 memset_explicit function to glibc. Everything here is closely based on the approach taken for explicit_bzero. This includes the bits that relate to internal uses of explicit_bzero within glibc (although we don't currently have any such internal uses of memset_explicit), and also includes the nonnull attribute (when we move to nonnull_if_nonzero for various functions following C2y, this function should be included in that change). The function is declared both for __USE_MISC and for __GLIBC_USE (ISOC23) (so by default not just for compilers defaulting to C23 mode). Tested for x86_64 and x86.
2025-09-23assert: Refactor assert/assert_perrorAdhemerval Zanella
It now calls __libc_assert, which contains similar logic. The assert call only requires memory allocation for the message translation, so test-assert2.c is adapted to handle it. It also removes the fxprintf from assert/assert_perror; although it is not 100% backwards-compatible (write message only if there is a file descriptor associated with the stderr). It now writes bytes directly without going through the wide stream state. Checked on aarch64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-09-15support: add check_mem_access functionYury Khrustalev
Add check_mem_access(addr) function to check if memory at addr can be written or read returning false if memory is not accessible. This function changes signal handler for SIGSEGV and SIGBUS signals when it is called first, and it is not thread-safe. Co-authored-by: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-09-11math: Add fetestexcept internal aliasAdhemerval Zanella
To avoid linknamespace issues on old standards. It is required if the fallback fma implementation is used if/when it is also used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-11math: Add feclearexcept internal aliasAdhemerval Zanella
To avoid linknamespace issues on old standards. It is required if the fallback fma implementation is used if/when it is also used internally for other implementation. Reviewed-by: DJ Delorie <dj@redhat.com>
2025-09-10atomics: Remove unused atomicsWilco Dijkstra
Remove all unused atomics. Replace uses of catomic_increment and catomic_decrement with atomic_fetch_add_relaxed which maps to a standard compiler builtin. Relaxed memory ordering is correct for simple counters since they only need atomicity. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09atomic: Switch atomic.h to builtin atomicsWilco Dijkstra
Switch to standard builtin atomics by removing the defines for !USE_ATOMIC_COMPILER_BUILTINS. Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-09-09atomic: Use builtin atomics with USE_ATOMIC_COMPILER_BUILTINSWilco Dijkstra
Use builtin atomics for atomic_compare_and_exchange_* and atomic_exchange_and_add if USE_ATOMIC_COMPILER_BUILTINS is enabled. This allows removing target atomic-machine.h headers. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-27elf: early conversion of elf p_flags to mprotect flagsCupertino Miranda
This patch replaces _dl_stack_flags global variable by _dl_stack_prot_flags. The advantage is that any convertion from p_flags to final used mprotect flags occurs at loading of p_flags. It avoids repeated spurious convertions of _dl_stack_flags, for example in allocate_thread_stack. This modification was suggested in: https://sourceware.org/pipermail/libc-alpha/2025-March/165537.html Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-08-22Undef __INT64_C/__UINT64_C for glibc build and testH.J. Lu
Since clang 20 defines __INT64_C and __UINT64_C as built-in macros, undef them for glibc build and test. This fixes BZ #33311. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-28Bump version number to 2.42Andreas K. Hüttel
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
2025-07-05elf: Restore support for _r_debug interpositions and copy relocationsFlorian Weimer
The changes in commit a93d9e03a31ec14405cb3a09aa95413b67067380 ("Extend struct r_debug to support multiple namespaces [BZ #15971]") break the dyninst dynamic instrumentation tool. It brings its own definition of _r_debug (rather than a declaration). Furthermore, it turns out it is rather hard to use the proposed handshake for accessing _r_debug via DT_DEBUG. If applications want to access _r_debug, they can do so directly if the relevant code has been built as PIC. To protect against harm from accidental copy relocations due to linker relaxations, this commit restores copy relocation support by adjusting both copies if interposition or copy relocations are in play. Therefore, it is possible to use a hidden reference in ld.so to access _r_debug. Only perform the copy relocation initialization if libc has been loaded. Otherwise, the ld.so search scope can be empty, and the lookup of the _r_debug symbol mail fail. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-01elf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088]H.J. Lu
Add DL_ADDRESS_WITHOUT_RELOC to force an address into a general purpose register to prevent loading it into a vector register directly before run-time relocation. This is an updated fix for BZ #33088. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>