]> git.ipfire.org Git - thirdparty/glibc.git/log
thirdparty/glibc.git
6 months agoor1k: Update nofpu libm-test-ulps
Stafford Horne [Mon, 6 Jan 2025 00:29:37 +0000 (00:29 +0000)] 
or1k: Update nofpu libm-test-ulps

Updates tolerances due to change to use CORE-MATH

6 months agomath: update alpha ulps
Andreas K. Hüttel [Sun, 5 Jan 2025 19:02:53 +0000 (20:02 +0100)] 
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>
6 months agoloongarch: Drop __GI_XXX for strcpy/stpcpy IFUNC implementations
H.J. Lu [Fri, 3 Jan 2025 21:53:19 +0000 (05:53 +0800)] 
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>
6 months agohppa: Update libm-test-ulps
John David Anglin [Sat, 4 Jan 2025 15:39:35 +0000 (10:39 -0500)] 
hppa: Update libm-test-ulps

Signed-off-by: John David Anglin <dave.anglin@bell.net>
6 months agomath: update loongarch64 ulps
Andreas K. Hüttel [Sat, 4 Jan 2025 13:57:31 +0000 (14:57 +0100)] 
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>
6 months agoRegenerate libc.pot
Andreas K. Hüttel [Sat, 4 Jan 2025 10:05:03 +0000 (11:05 +0100)] 
Regenerate libc.pot

Only changes to line numbers

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
6 months agoloongarch: Provide stpcpy in stpcpy-aligned.S for rtld [BZ #32512]
H.J. Lu [Fri, 3 Jan 2025 21:43:21 +0000 (05:43 +0800)] 
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>
6 months agoAArch64: Improve codegen in SVE expm1f and users
Luna Lamb [Fri, 3 Jan 2025 20:15:17 +0000 (20:15 +0000)] 
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.

6 months agoAArch64: Add vector tanpi routines
Joe Ramsay [Fri, 3 Jan 2025 20:13:51 +0000 (20:13 +0000)] 
AArch64: Add vector tanpi routines

Vector variant of the new C23 tanpi. New tests pass on AArch64.

6 months agoAArch64: Add vector cospi routines
Joe Ramsay [Fri, 3 Jan 2025 20:12:10 +0000 (20:12 +0000)] 
AArch64: Add vector cospi routines

Vector variant of the new C23 cospi. New tests pass on AArch64.

6 months agoAArch64: Add vector sinpi to libmvec
Joe Ramsay [Fri, 3 Jan 2025 20:07:51 +0000 (20:07 +0000)] 
AArch64: Add vector sinpi to libmvec

Vector variant of the new C23 sinpi. New tests pass on AArch64.

6 months agomath: Remove no-mathvec flag
Joe Ramsay [Fri, 3 Jan 2025 19:13:36 +0000 (19:13 +0000)] 
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.

6 months agoAArch64: Improve codegen for SVE log1pf users
Yat Long Poon [Fri, 3 Jan 2025 19:09:05 +0000 (19:09 +0000)] 
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%).

6 months agoAArch64: Improve codegen for SVE logs
Yat Long Poon [Fri, 3 Jan 2025 19:07:30 +0000 (19:07 +0000)] 
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%).

6 months agoAArch64: Improve codegen in SVE tans
Luna Lamb [Fri, 3 Jan 2025 19:02:52 +0000 (19:02 +0000)] 
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.

6 months agoAArch64: Improve codegen in AdvSIMD asinh
Luna Lamb [Fri, 3 Jan 2025 19:00:12 +0000 (19:00 +0000)] 
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.

6 months agomath: Add a reference to Clang's <tgmath.h> C23 issue
H.J. Lu [Fri, 3 Jan 2025 02:24:54 +0000 (10:24 +0800)] 
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>
6 months agoRename have-mtls-descriptor to have-test-mtls-descriptor
H.J. Lu [Fri, 3 Jan 2025 02:21:56 +0000 (10:21 +0800)] 
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>
6 months agomath: update powerpc ulps
Andreas K. Hüttel [Fri, 3 Jan 2025 18:34:53 +0000 (19:34 +0100)] 
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>
6 months agomath: update sparc ulps
Andreas K. Hüttel [Fri, 3 Jan 2025 14:40:06 +0000 (15:40 +0100)] 
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>
6 months agomath: update s390 ulps
Andreas K. Hüttel [Fri, 3 Jan 2025 14:36:56 +0000 (15:36 +0100)] 
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>
6 months agoconform: Do not use __SIG_ATOMIC_TYPE__
Adhemerval Zanella [Tue, 31 Dec 2024 18:26:12 +0000 (15:26 -0300)] 
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>
6 months agoRedirect mempcpy and stpcpy only in libc.a
H.J. Lu [Wed, 1 Jan 2025 00:20:34 +0000 (08:20 +0800)] 
Redirect mempcpy and stpcpy only in libc.a

The mempcpy and stpcpy redirections to __mempcpy and __stpcpy were added
by

commit 939da41143341bbcdd3dd50ee7b57776603da260
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 18b10de7ced9e9c3843299fb600e40b11af3e0af
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>
6 months agonot-cancel.h: Support testing fortify build with Clang
H.J. Lu [Wed, 1 Jan 2025 23:22:36 +0000 (07:22 +0800)] 
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>
6 months agotst-unique[34].cc: Use explicit instantiation declaration/definition
H.J. Lu [Thu, 2 Jan 2025 11:03:47 +0000 (19:03 +0800)] 
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>
6 months agoRISC-V: Regenerate ULPs
Aurelien Jarno [Thu, 2 Jan 2025 18:38:47 +0000 (19:38 +0100)] 
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 bbd578b38df4 ("math: Use expm1f from CORE-MATH")
- commit 8ae9e513762b ("math: Use log1pf from CORE-MATH")
- commit 0ae0af68d8fa ("Implement C23 cospi")
- commit 776938e8b8dc ("Implement C23 sinpi")
- commit f9e90e4b4ce7 ("Implement C23 tanpi")
- commit 28d102d15c6a ("Implement C23 acospi")
- commit f962932206ec ("Implement C23 asinpi")
- commit ffe79c446ced ("Implement C23 atanpi")
- commit 3374de90386f ("Implement C23 atan2pi")
- commit a357d6273f79 ("math: Use atanf from CORE-MATH")
- commit 6f9bacf36b20 ("math: Use atan2f from CORE-MATH")
- commit e5ca265a9c90 ("new inputs with large errors for [a]cospi,
  [a]sinpi, [a]tanpi, atan2pi")

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
6 months agomlock, mlock2, munlock: Use __attr_access_none macro
Sam James [Thu, 2 Jan 2025 17:26:28 +0000 (17:26 +0000)] 
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 013106ae677af9836614ace1a01d25b63fa555a7.

Reported-by: vvinayag@arm.com
6 months agoAArch64: Update libm-test-ulps
Wilco Dijkstra [Thu, 2 Jan 2025 17:51:11 +0000 (17:51 +0000)] 
AArch64: Update libm-test-ulps

Update ulps for (a)cospi, (a)sinpi, (a)tanpi, atan2pi.

6 months agonew inputs with large errors for [a]cospi, [a]sinpi, [a]tanpi, atan2pi
Paul Zimmermann [Fri, 20 Dec 2024 09:41:38 +0000 (10:41 +0100)] 
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

6 months agostdlib: fix lint failure
Sam James [Thu, 2 Jan 2025 17:09:14 +0000 (17:09 +0000)] 
stdlib: fix lint failure

Fixes: d5bceac99d24af1131b90027dab267e437b65cd1
6 months agostdlib: random_r: fix unaligned access in initstate and initstate_r [BZ #30584]
Sam James [Tue, 10 Dec 2024 01:21:46 +0000 (01:21 +0000)] 
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>
6 months agoassert: Remove the use of %n from __assert_fail_base (BZ #32456)
Adhemerval Zanella [Mon, 30 Dec 2024 19:36:18 +0000 (16:36 -0300)] 
assert: Remove the use of %n from __assert_fail_base (BZ #32456)

The require size for mmap can be inferred from __vasprintf return
value.  It also fixes tst-assert-2 when building with --enable-fortify,
where even if the format is not translated, __readonly_area fails
because malloc can not be used.

Checked on aarch64-linux-gnu.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoTranslations: Regenerate libc.pot
Adhemerval Zanella [Mon, 30 Dec 2024 19:36:17 +0000 (16:36 -0300)] 
Translations: Regenerate libc.pot

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoelf: Remove the remaining uses of GET_ADDR_OFFSET
Florian Weimer [Thu, 2 Jan 2025 12:45:27 +0000 (13:45 +0100)] 
elf: Remove the remaining uses of GET_ADDR_OFFSET

Expand the macro where it is used in static definitions of
__tls_get_addr.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoelf: Use TLS_DTV_OFFSET in __tls_get_addr
Florian Weimer [Thu, 2 Jan 2025 12:45:27 +0000 (13:45 +0100)] 
elf: Use TLS_DTV_OFFSET in __tls_get_addr

This fixes commit 5e249192cac7354af02a7347a0d8c984e0c88ed3 ("elf:
Remove the GET_ADDR_ARGS and related macros from the TLS code"):
GET_ADDR_ARGS was indeed unused, but GET_ADDR_OFFSET was used
on several targets, those that define TLS_DTV_OFFSET.  Instead
of reintroducing GET_ADDR_OFFSET, use TLS_DTV_OFFSET directly,
now that it is defined on all targets.

In the new tls_get_addr_adjust helper function, add a cast to
uintptr_t to help the s390 case, where the offset can be positive or
negative, depending on the addresses malloc returns.  The cast avoids
pointer wraparound/overflow.  The outer uintptr_t cast is needed
to suppress a warning on x86-64 x32 about mismatched integer/pointer
sizes.

Eventually this offset should be folded into the DTV addresses
themselves, to eliminate the subtraction on the TLS fast path.
This will require an adjustment to libthread_db because the
debugger interface currently returns unadjusted pointers.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agos390: Define TLS_DTV_OFFSET instead of GET_ADDR_OFFSET
Florian Weimer [Thu, 2 Jan 2025 12:45:27 +0000 (13:45 +0100)] 
s390: Define TLS_DTV_OFFSET instead of GET_ADDR_OFFSET

This will be used in __tls_get_addr to adjust the returned pointer
value.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agoelf: Introduce generic <dl-tls.h>
Florian Weimer [Thu, 2 Jan 2025 12:45:27 +0000 (13:45 +0100)] 
elf: Introduce generic <dl-tls.h>

On arc, the definition of TLS_DTV_UNALLOCATED now comes from
<dl-dtv.h>.

For x86-64 x32, a separate version is needed because unsigned long int
is 32 bits on this target.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 months agopowerpc: Update acosf ulps
Florian Weimer [Thu, 2 Jan 2025 10:56:42 +0000 (11:56 +0100)] 
powerpc: Update acosf ulps

As seen on powerpc64le-linux-gnu with GCC 11 defaulting to POWER9
instructions.

6 months agohtl: move pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling into...
gfleury [Tue, 31 Dec 2024 13:49:09 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling into libc.

Message-ID: <20241231134909.1166440-9-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_{setrobust, setrobust_np}, pthread_mutexattr_{getrobust...
gfleury [Tue, 31 Dec 2024 13:49:08 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_{setrobust, setrobust_np}, pthread_mutexattr_{getrobust, getrobust_np} into libc.

Message-ID: <20241231134909.1166440-8-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_setpshared, pthread_mutexattr_getpshared into libc.
gfleury [Tue, 31 Dec 2024 13:49:07 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_setpshared, pthread_mutexattr_getpshared into libc.

Message-ID: <20241231134909.1166440-7-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_settype, pthread_mutexattr_gettype into libc.
gfleury [Tue, 31 Dec 2024 13:49:06 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_settype, pthread_mutexattr_gettype into libc.

Message-ID: <20241231134909.1166440-6-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_setprotocol into libc.
Samuel Thibault [Wed, 1 Jan 2025 22:51:53 +0000 (23:51 +0100)] 
htl: move pthread_mutexattr_setprotocol into libc.

Message-ID: <20241231134909.1166440-5-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_getprotocol into libc.
gfleury [Tue, 31 Dec 2024 13:49:04 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_getprotocol into libc.

Message-ID: <20241231134909.1166440-4-gfleury@disroot.org>

6 months agohtl: move pthread_mutexattr_destroy into libc.
gfleury [Tue, 31 Dec 2024 13:49:03 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_destroy into libc.

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

6 months agohtl: move pthread_mutexattr_init into libc.
gfleury [Tue, 31 Dec 2024 13:49:02 +0000 (15:49 +0200)] 
htl: move pthread_mutexattr_init into libc.

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

6 months agobits/socket.h: Update to recent BSD definition
Samuel Thibault [Wed, 1 Jan 2025 21:07:42 +0000 (22:07 +0100)] 
bits/socket.h: Update to recent BSD definition

The old BSD 4.4 definition (not used by Linux) was not 64b-proof: the
cmsg_data field is supposed to CMSG_ALIGN'ed (as can be also seen in the
CMSG_LEN macro).

Suggested-by: Diego Nieto Cid <dnietoc@gmail.com>
6 months agoDon't update copyright notices in Linux licenses
Paul Eggert [Wed, 1 Jan 2025 20:16:06 +0000 (12:16 -0800)] 
Don't update copyright notices in Linux licenses

* scripts/update-copyrights: Do not update copyright notices
in licenses imported from the Linux kernel.
This should prevent glitches such as those fixed in my
recent commit.

6 months agoFix license typo induced by update-copyrighyt
Paul Eggert [Wed, 1 Jan 2025 19:07:29 +0000 (11:07 -0800)] 
Fix license typo induced by update-copyrighyt

6 months agoUpdate copyright dates not handled by scripts/update-copyrights
Paul Eggert [Wed, 1 Jan 2025 18:31:31 +0000 (10:31 -0800)] 
Update copyright dates not handled by scripts/update-copyrights

I've updated copyright dates in glibc for 2025.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.

6 months agoUpdate copyright in generated files by running "make"
Paul Eggert [Wed, 1 Jan 2025 18:25:08 +0000 (10:25 -0800)] 
Update copyright in generated files by running "make"

6 months agoUpdate copyright dates with scripts/update-copyrights
Paul Eggert [Wed, 1 Jan 2025 18:14:45 +0000 (10:14 -0800)] 
Update copyright dates with scripts/update-copyrights

6 months agoPass glibc pre-commit checks
Paul Eggert [Wed, 1 Jan 2025 19:16:35 +0000 (11:16 -0800)] 
Pass glibc pre-commit checks

This is needed for the next patch which updates copyright dates.
* assert/test-assert-2.c: Remove trailing white space.
* elf/tst-startup-errno.c: Remove trailing empty lines.

6 months agomlock, mlock2, munlock: Tell the compiler we don't dereference the pointer
Xi Ruoyao [Thu, 26 Dec 2024 04:51:18 +0000 (12:51 +0800)] 
mlock, mlock2, munlock: Tell the compiler we don't dereference the pointer

Since https://gcc.gnu.org/r11-959, the compiler emits
-Wmaybe-uninitialized if a const pointer to an uninitialized buffer is
passed.  Tell the compiler we don't dereference the pointer to remove
the false alarm.

Link: https://gcc.gnu.org/PR118194
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Sam James <sam@gentoo.org>
6 months agoelf: Add glibc.rtld.execstack
Adhemerval Zanella [Thu, 28 Nov 2024 17:36:45 +0000 (14:36 -0300)] 
elf: Add glibc.rtld.execstack

The new tunable can be used to control whether executable stacks are
allowed from either the main program or dependencies.  The default is
to allow executable stacks.

The executable stacks default permission is checked agains the one
provided by the PT_GNU_STACK from program headers (if present).  The
tunable also disables the stack permission change if any dependency
requires an executable stack at loading time.

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoelf: Add tst-execstack-prog-static
Adhemerval Zanella [Thu, 28 Nov 2024 17:36:44 +0000 (14:36 -0300)] 
elf: Add tst-execstack-prog-static

Similar to tst-execstack-prog, check if executable stacks works for
statically linked programs.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoelf: Do not change stack permission on dlopen/dlmopen
Adhemerval Zanella [Thu, 28 Nov 2024 17:36:43 +0000 (14:36 -0300)] 
elf: Do not change stack permission on dlopen/dlmopen

If some shared library loaded with dlopen/dlmopen requires an executable
stack, either implicitly because of a missing GNU_STACK ELF header
(where the ABI default flags implies in the executable bit) or explicitly
because of the executable bit from GNU_STACK; the loader will try to set
the both the main thread and all thread stacks (from the pthread cache)
as executable.

Besides the issue where any __nptl_change_stack_perm failure does not
undo the previous executable transition (meaning that if the library
fails to load, there can be thread stacks with executable stacks), this
behavior was used on a CVE [1] as a vector for RCE.

This patch changes that if a shared library requires an executable
stack, and the current stack is not executable, dlopen fails.  The
change is done only for dynamically loaded modules, if the program
or any dependency requires an executable stack, the loader will still
change the main thread before program execution and any thread created
with default stack configuration.

[1] https://www.qualys.com/2023/07/19/cve-2023-38408/rce-openssh-forwarded-ssh-agent.txt

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

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoelf: Cleanup and improve tst-execstack
Adhemerval Zanella [Thu, 26 Dec 2024 14:25:28 +0000 (11:25 -0300)] 
elf: Cleanup and improve tst-execstack

Reviewed-by: Florian Weimer <fweimer@redhat.com>
6 months agoUse GCC 14 branch in build-many-glibcs.py
H.J. Lu [Tue, 31 Dec 2024 07:56:23 +0000 (15:56 +0800)] 
Use GCC 14 branch in build-many-glibcs.py

Tested with build-many-glibcs.py with

--exclude m68k-linux-gnu-coldfire-soft

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoINSTALL, NEWS: Document requirement of gawk with MPFR support
Andreas K. Hüttel [Fri, 27 Dec 2024 18:31:07 +0000 (19:31 +0100)] 
INSTALL, NEWS: Document requirement of gawk with MPFR support

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
7 months agoMention CORE-MATH optimize routines on NEWS
Adhemerval Zanella [Thu, 26 Dec 2024 12:11:06 +0000 (09:11 -0300)] 
Mention CORE-MATH optimize routines on NEWS

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
7 months agox86-64: Reorder dynamic linker list in ldd script (bug 32508)
Florian Weimer [Mon, 30 Dec 2024 11:41:51 +0000 (12:41 +0100)] 
x86-64: Reorder dynamic linker list in ldd script (bug 32508)

Move the x86-64 loader first, before the i386 and x32 loaders.  In
most cases, it's the loader the script needs.  This avoids an error
message if the i386 loader does not work.

The effect of this change to the generated ldd script looks like this:

-RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
+RTLDLIST="/lib64/ld-linux-x86-64.so.2 /lib/ld-linux.so.2 /libx32/ld-linux-x32.so.2"

Reviewed-by: Sam James <sam@gentoo.org>
7 months agonptl: hppa: replace __get_cr27 with __thread_pointer
Michael Jeanson [Fri, 27 Dec 2024 16:41:02 +0000 (17:41 +0100)] 
nptl: hppa: replace __get_cr27 with __thread_pointer

The addition of the new thread_pointer.h header on HPPA resulted in
duplicated inline asm to get the current thread pointer from the cr27
register.

Include thread_pointer.h in tls.h and replace __get/set_cr27() with
__set_/thread_pointer() with the appropriate casts.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
7 months agonptl: Add <thread_pointer.h> for hppa
Michael Jeanson [Fri, 27 Dec 2024 16:41:02 +0000 (17:41 +0100)] 
nptl: Add <thread_pointer.h> for hppa

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>
7 months agolibio: asprintf should write NULL upon failure
Florian Weimer [Fri, 27 Dec 2024 08:17:41 +0000 (09:17 +0100)] 
libio: asprintf should write NULL upon failure

This was suggested most recently by Solar Designer, noting
that code replacing vsprintf with vasprintf in a security fix
was subtly wrong:

  Re: GStreamer Security Advisory 2024-0003: Orc compiler
  stack-based buffer overflow
  <https://www.openwall.com/lists/oss-security/2024/07/26/2>

Previous libc-alpha discussions:

  I: [PATCH] asprintf error handling fix
  <https://inbox.sourceware.org/libc-alpha/20011205185828.GA8376@ldv.office.alt-linux.org/>

  asprintf() issue
  <https://inbox.sourceware.org/libc-alpha/CANSoFxt-cdc-+C4u-rTENMtY4X9RpRSuv+axDswSPxbDgag8_Q@mail.gmail.com/>

I don't think we need a compatibility symbol for this.  As the
GStreamer example shows, this change is much more likely to fix bugs
than cause compatibility issues.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
Suggested-by: Archie Cobbs <archie.cobbs@gmail.com>
Suggested-by: Solar Designer <solar@openwall.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agonptl: More useful padding in struct pthread
Florian Weimer [Tue, 17 Dec 2024 08:20:20 +0000 (09:20 +0100)] 
nptl: More useful padding in struct pthread

The previous use of padding within a union made it impossible to
re-use the padding for GLIBC_PRIVATE ABI preservation because
tcbhead_t could use up all of the padding (as was historically the
case on x86-64).  Allocating padding unconditionally addresses this
issue.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agoelf: Remove the GET_ADDR_ARGS and related macros from the TLS code
Florian Weimer [Mon, 23 Dec 2024 12:55:49 +0000 (13:55 +0100)] 
elf: Remove the GET_ADDR_ARGS and related macros from the TLS code

This was used to manage an IA-64 ABI divergence is no longere needed
after the IA-64 removal.

(It should be possible to encode all the required information in
one machine word, so the pointer indirection is really unnecessary.
Technically, none of this is part of the ABI, so perhaps it's
possible to do this retroactively.  See bug 27404.)

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
7 months agohurd: Avoid asm statements which return
Samuel Thibault [Thu, 26 Dec 2024 22:11:28 +0000 (23:11 +0100)] 
hurd: Avoid asm statements which return

They are not supposed to change flow control.

This fixes miscompilation with gcc 14.2.0 which then drops code, see
https://lists.gnu.org/archive/html/bug-hurd/2024-11/msg00145.html

7 months agobuild-many-glibcs.py: Add --exclude option
H.J. Lu [Tue, 24 Dec 2024 21:05:31 +0000 (05:05 +0800)] 
build-many-glibcs.py: Add --exclude option

m68k-linux-gnu-coldfire-soft GCC and glibc often won't build due to

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103370

which results in build-many-glibcs.py failure.  Add an option, --exclude,
to exclude some targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agostdio-common: Tweak comment in Makefile
Sam James [Tue, 24 Dec 2024 11:38:09 +0000 (11:38 +0000)] 
stdio-common: Tweak comment in Makefile

Followup to 5a96da210c15e18c3c5298dc23a9e2e57691b6c6.

7 months agostdio-common: Use clang with bugfix for bug28
Dmitry Chestnykh [Tue, 24 Dec 2024 08:52:35 +0000 (11:52 +0300)] 
stdio-common: Use clang with bugfix for bug28

The issue that was the cause of hang was fixed in upstream.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
7 months agoNEWS: Mention testing glibc build with a different set of compilers
H.J. Lu [Mon, 23 Dec 2024 21:20:43 +0000 (05:20 +0800)] 
NEWS: Mention testing glibc build with a different set of compilers

Also document C and C++ compilers used to test glibc should come from
the same set of compilers.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agosupport: Add support_record_failure_barrier
Florian Weimer [Mon, 23 Dec 2024 12:57:55 +0000 (13:57 +0100)] 
support: Add support_record_failure_barrier

This can be used to stop execution after a TEST_COMPARE_BLOB
failure, for example.

7 months agoio: statx, fstatat: Drop nonnull attribute on the path argument
Miao Wang [Mon, 23 Dec 2024 09:30:43 +0000 (10:30 +0100)] 
io: statx, fstatat: Drop nonnull attribute on the path argument

Since Linux 6.11 the kernel allows path to be NULL if flags &
AT_EMPTY_PATH.  Let's allow users to take the advantage if they don't
care running on old kernels.

Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
7 months agoconfigure: Improve configure output for C++ Compiler
H.J. Lu [Mon, 23 Dec 2024 00:11:58 +0000 (08:11 +0800)] 
configure: Improve configure output for C++ Compiler

Change configure output for C++ Compiler from

...
checking -finput-charset=ascii in testing... -finput-charset=ascii
checking -finput-charset=ascii in testing... -finput-charset=ascii
...

to

...
checking -finput-charset=ascii in testing... -finput-charset=ascii
checking g++ -finput-charset=ascii in testing... -finput-charset=ascii
...

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agogetaddrinfo.c: Avoid uninitialized pointer access [BZ #32465]
H.J. Lu [Tue, 17 Dec 2024 07:18:36 +0000 (15:18 +0800)] 
getaddrinfo.c: Avoid uninitialized pointer access [BZ #32465]

Add valid_decimal_value to check valid decimal value in a string to
avoid uninitialized endp in add_prefixlist and gaiconf_init as reported
by Clang 19:

./getaddrinfo.c:1884:11: error: variable 'endp' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
 1884 |       && (cp == NULL
      |           ^~~~~~~~~~
./getaddrinfo.c:1887:11: note: uninitialized use occurs here
 1887 |       && *endp == '\0'
      |           ^~~~
./getaddrinfo.c:1884:11: note: remove the '||' if its condition is always false
 1884 |       && (cp == NULL
      |           ^~~~~~~~~~
 1885 |           || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX
      |           ~~
./getaddrinfo.c:1875:13: note: initialize the variable 'endp' to silence this warning
 1875 |   char *endp;
      |             ^
      |              = NULL

This fixes BZ #32465.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agohtl: move pthread_cond_timedwait, pthread_cond_clockwait, pthread_cond_wait into...
gfleury [Thu, 19 Dec 2024 20:37:27 +0000 (22:37 +0200)] 
htl: move pthread_cond_timedwait, pthread_cond_clockwait, pthread_cond_wait into libc.

Message-ID: <20241219203727.669825-9-gfleury@disroot.org>

7 months agohtl: move __pthread_mutex_checklocked into libc.
gfleury [Thu, 19 Dec 2024 20:37:26 +0000 (22:37 +0200)] 
htl: move __pthread_mutex_checklocked into libc.

move out __getpid from pt-mutex.h
and in pt-mutex-* include <unistd.h> where
__getpid was called

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-8-gfleury@disroot.org>

7 months agohtl: move __pthread_timedblock, __pthread_timedblock_intr, __pthread_block, __pthread...
gfleury [Thu, 19 Dec 2024 20:37:25 +0000 (22:37 +0200)] 
htl: move __pthread_timedblock, __pthread_timedblock_intr, __pthread_block, __pthread_block_intr into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-7-gfleury@disroot.org>

7 months agohtl: move pthread_cond_signal into libc.
gfleury [Thu, 19 Dec 2024 20:37:24 +0000 (22:37 +0200)] 
htl: move pthread_cond_signal into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-6-gfleury@disroot.org>

7 months agohtl: move pthread_cond_broadcast into libc.
gfleury [Thu, 19 Dec 2024 20:37:23 +0000 (22:37 +0200)] 
htl: move pthread_cond_broadcast into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-5-gfleury@disroot.org>

7 months agohtl: move pthread_cond_destroy into libc.
gfleury [Thu, 19 Dec 2024 20:37:22 +0000 (22:37 +0200)] 
htl: move pthread_cond_destroy into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-4-gfleury@disroot.org>

7 months agohtl: move __pthread_wakeup into libc.
gfleury [Thu, 19 Dec 2024 20:37:21 +0000 (22:37 +0200)] 
htl: move __pthread_wakeup into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-3-gfleury@disroot.org>

7 months agohtl: move pthread_cond_init into libc.
gfleury [Thu, 19 Dec 2024 20:37:20 +0000 (22:37 +0200)] 
htl: move pthread_cond_init into libc.

Signed-off-by: gfleury <gfleury@disroot.org>
Message-ID: <20241219203727.669825-2-gfleury@disroot.org>

7 months agoassert/test-assert-2.c: Include <unistd.h>
Samuel Thibault [Sun, 22 Dec 2024 22:33:27 +0000 (23:33 +0100)] 
assert/test-assert-2.c: Include <unistd.h>

For _exit declaration.

7 months agostdio-common: Suppress Clang warnings on scanf13.c
H.J. Lu [Sun, 22 Dec 2024 21:12:03 +0000 (05:12 +0800)] 
stdio-common: Suppress Clang warnings on scanf13.c

Suppress Clang warnings on stdio-common/scanf13.c:

1. Before this commit:

scanf13.c:43:17: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                    ~~~~^
scanf13.c:43:22: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                         ~~~~^
scanf13.c:43:50: error: data argument not used by format string [-Werror,-Wformat-extra-args]
   43 |               "A%mS%10mls%4ml[bcd]%4mCB", &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~                ^
scanf13.c:145:27: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                     ~~~~~~^
scanf13.c:145:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                            ~~~^
scanf13.c:145:43: error: data argument not used by format string [-Werror,-Wformat-extra-args]
  145 |   if (sscanf (buf, "%2048mls%mlc", &lsp3, &lsp4) != 2)
      |                    ~~~~~~~~~~~~~~         ^
scanf13.c:161:31: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                         ~~~~~~^
scanf13.c:161:42: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                                ~~~~~~~~~~^
scanf13.c:161:53: error: invalid conversion specifier 'l' [-Werror,-Wformat-invalid-specifier]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                                           ~~~~~~~~~~^
scanf13.c:162:15: error: data argument not used by format string [-Werror,-Wformat-extra-args]
  161 |   if (sscanf (buf, "%4mC%1500ml[dr/]%548ml[abc/d]%3mlc",
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  162 |               &lsp1, &lsp2, &lsp3, &lsp4) != 4)
      |                      ^
10 errors generated.

2. With DIAG_IGNORE_NEEDS_COMMENT_CLANG changes in stdio-common/scanf13.c:

scanf13.c:28:40: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 11 [-Werror,-Wfortify-source]
   28 |               "A%ms%10ms%4m[bcd]%4mcB", &sp1, &sp2, &sp3, &sp4) != 4)
      |                                               ^
scanf13.c:94:34: error: 'sscanf' may overflow; destination buffer in argument 3 has size 8, but the corresponding specifier may require size 2049 [-Werror,-Wfortify-source]
   94 |   if (sscanf (buf, "%2048ms%mc", &sp3, &sp4) != 2)
      |                                  ^
scanf13.c:110:61: error: 'sscanf' may overflow; destination buffer in argument 4 has size 8, but the corresponding specifier may require size 1501 [-Werror,-Wfortify-source]
  110 |   if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4)
      |                                                             ^
scanf13.c:110:67: error: 'sscanf' may overflow; destination buffer in argument 5 has size 8, but the corresponding specifier may require size 549 [-Werror,-Wfortify-source]
  110 |   if (sscanf (buf, "%4mc%1500m[dr/]%548m[abc/d]%3mc", &sp1, &sp2, &sp3, &sp4)
      |                                                                   ^
4 errors generated.

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>
7 months agostring: Suppress Clang warnings on tester.c
H.J. Lu [Sun, 22 Dec 2024 21:12:02 +0000 (05:12 +0800)] 
string: Suppress Clang warnings on tester.c

Add a configure check for -Wno-fortify-source to suppress Clang warnings
on string/tester.c, like:

tester.c:385:10: error: 'strncat' size argument is too large; destination buffer has size 50, but size argument is 99 [-Werror,-Wfortify-source]
  385 |   check (strncat (one, "lmn", 99) == one, 1);   /* Returned value. */

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoAdd a reference to Clang /usr/include/tgmath.h dependency
H.J. Lu [Sun, 22 Dec 2024 21:12:01 +0000 (05:12 +0800)] 
Add a reference to Clang /usr/include/tgmath.h dependency

The fake Clang /usr/include/tgmath.h dependency bug is:

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

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoSuppress Clang -Wimplicit-fallthrough warnings
H.J. Lu [Sun, 22 Dec 2024 21:12:00 +0000 (05:12 +0800)] 
Suppress Clang -Wimplicit-fallthrough warnings

Since Clang doesn't properly handle

/* FALLTHROUGH */

in elf/tst-align2.c nor

/* fall through */

in misc/tst-tsearch.c

tst-align2.c:100:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
  100 |         case 'A':
      |         ^
tst-align2.c:100:9: note: insert '__attribute__((fallthrough));' to silence this warning
  100 |         case 'A':
      |         ^
      |         __attribute__((fallthrough));
tst-align2.c:100:9: note: insert 'break;' to avoid fall-through
  100 |         case 'A':
      |         ^
      |         break;

suppress them when compiled with Clang.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agostdio: Suppress -Wformat only for gcc in tst-sprintf-errno.c
Adhemerval Zanella [Sun, 22 Dec 2024 21:11:59 +0000 (05:11 +0800)] 
stdio: Suppress -Wformat only for gcc in tst-sprintf-errno.c

Since Clang doesn't support

DIAG_IGNORE_NEEDS_COMMENT (11, "-Wformat=");

and for unknown reasons, it doesn't warn the %#m specifier, suppress
-Wformat only for gcc in tst-sprintf-errno.c.

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoinclude/sys/cdefs.h: Add __attribute_optimization_barrier__
Adhemerval Zanella [Sun, 22 Dec 2024 21:11:58 +0000 (05:11 +0800)] 
include/sys/cdefs.h: Add __attribute_optimization_barrier__

Add __attribute_optimization_barrier__ to disable inlining and cloning on a
function.  For Clang, expand it to

__attribute__ ((optnone))

Otherwise, expand it to

__attribute__ ((noinline, clone))

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoassert: Use __writev in assert.c [BZ #32492]
DJ Delorie [Sun, 22 Dec 2024 04:12:41 +0000 (23:12 -0500)] 
assert: Use __writev in assert.c [BZ #32492]

Replace writev with __writev in assert/assert.c.  This fixes [BZ #32492].

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
7 months agoFix build without stack protector [BZ #32494]
H.J. Lu [Sun, 22 Dec 2024 19:58:54 +0000 (03:58 +0800)] 
Fix build without stack protector [BZ #32494]

Without stack protector, inhibit_stack_protector is undefined during build:

In file included from <command-line>:
./../include/libc-symbols.h:665:3: error: expected ';' before '__typeof'
  665 |   __typeof (type_name) *name##_ifunc (__VA_ARGS__)
         \
      |   ^~~~~~~~
./../include/libc-symbols.h:676:3: note: in expansion of macro
'__ifunc_resolver'
  676 |   __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__)
      |   ^~~~~~~~~~~~~~~~
./../include/libc-symbols.h:703:3: note: in expansion of macro '__ifunc_args'
  703 |   __ifunc_args (type_name, name, expr, init, arg)
      |   ^~~~~~~~~~~~
./../include/libc-symbols.h:790:3: note: in expansion of macro '__ifunc'
  790 |   __ifunc (redirected_name, name, expr, void, INIT_ARCH)
      |   ^~~~~~~
../sysdeps/x86_64/multiarch/memchr.c:29:1: note: in expansion of macro
'libc_ifunc_redirected'
   29 | libc_ifunc_redirected (__redirect_memchr, memchr, IFUNC_SELECTOR ());
      | ^~~~~~~~~~~~~~~~~~~~~

1. Fix a typo in include/libc-symbols.h to define inhibit_stack_protector
for build.
2. Don't include <config.h> in include/libc-symbols.h since it has been
included in include/libc-misc.h.
3. Change #include "libc-misc.h" to #include <libc-misc.h> in
string/test-string.h.

This fixes BZ #32494.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agoCheck if TEST_CC supports -Wno-restrict before using it
Adhemerval Zanella [Thu, 27 Jul 2023 18:49:52 +0000 (15:49 -0300)] 
Check if TEST_CC supports -Wno-restrict before using it

Check if TEST_CC supports -Wno-restrict before using it to avoid Clang
error:

error: unknown warning option '-Wno-restrict' [-Werror,-Wunknown-warning-option]

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agohppa: Simplify handling of sanity check errors in clone.S.
John David Anglin [Sun, 22 Dec 2024 14:58:02 +0000 (09:58 -0500)] 
hppa: Simplify handling of sanity check errors in clone.S.

This simplifies the handling of sanity check errors in clone.S.
Adjusted a couple of comments to reflect current code.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
7 months agohppa: add cacheflush() syscall wrapper
John David Anglin [Sun, 22 Dec 2024 14:51:54 +0000 (09:51 -0500)] 
hppa: add cacheflush() syscall wrapper

The hppa Linux kernel supports the cacheflush() syscall
since version 6.5. This adds the glibc syscall wrapper.

Signed-off-by: Helge Deller <deller@gmx.de>
---
v2: This patch was too late in release cycle for GLIBC_2.40,
    so update now to GLIBC_2.41 instead.

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

Signed-off-by: John David Anglin <dave.anglin@bell.net>
7 months agohurd: make mprotect translate KERN_PROTECTION_FAILURE to EACCESS
Samuel Thibault [Sun, 22 Dec 2024 10:40:18 +0000 (11:40 +0100)] 
hurd: make mprotect translate KERN_PROTECTION_FAILURE to EACCESS

Suggested-by: Sergey Bugaev <bugaevc@gmail.com>
7 months agoCompile tst-deadline.c with -Wno-ignored-attributes for Clang
H.J. Lu [Thu, 19 Dec 2024 21:52:56 +0000 (05:52 +0800)] 
Compile tst-deadline.c with -Wno-ignored-attributes for Clang

Since tst-deadline.c is an internal test, compile tst-deadline.c with
-Wno-ignored-attributes for Clang to silence -Werror,-Wunknown-attributes
errors.  Also suppress -Wmaybe-uninitialized only for GCC in net-internal.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
7 months agomalloc: Only enable -Waggressive-loop-optimizations suppression for gcc
Adhemerval Zanella [Fri, 25 Mar 2022 12:00:12 +0000 (09:00 -0300)] 
malloc: Only enable -Waggressive-loop-optimizations suppression for gcc

Reviewed-by: Sam James <sam@gentoo.org>