authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-08 04:04:39+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-08 04:41:04+02:00
log21ff35590c8c66c9054c53b2ccc4f6f2fd738115
tree99616eb49e71267f3a095921f64f7aac0adb7466
parent0b76be3a01dc09dbd3333a795203cb087629edbd
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Update glibc start files to 2.40.


21 files changed, 401 insertions(+), 78 deletions(-)

lib/libc/glibc/bits/libc-header-start.h+18-18
......@@ -44,23 +44,23 @@
4444
4545/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
4646 macro. Most but not all symbols enabled by that macro in TS
47 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
47 18661-1 are enabled unconditionally in C23. In C23, the symbols in
4848 Annex F still require a new feature test macro
49 __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define
49 __STDC_WANT_IEC_60559_EXT__ instead (C23 does not define
5050 __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
51 18661-1 are not included in C2X (and thus should depend on
52 __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are
51 18661-1 are not included in C23 (and thus should depend on
52 __STDC_WANT_IEC_60559_BFP_EXT__ even when C23 features are
5353 enabled).
5454
5555 __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
56 18661-1 not included in C2X.
56 18661-1 not included in C23.
5757
58 __GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS
59 18661-1 that are also included in C2X (with no feature test macro
60 required in C2X).
58 __GLIBC_USE (IEC_60559_BFP_EXT_C23) controls those features from TS
59 18661-1 that are also included in C23 (with no feature test macro
60 required in C23).
6161
6262 __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
63 that are included in C2X but conditional on
63 that are included in C23 but conditional on
6464 __STDC_WANT_IEC_60559_EXT__. (There are currently no features
6565 conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
6666 18661-1.) */
......@@ -70,11 +70,11 @@
7070#else
7171# define __GLIBC_USE_IEC_60559_BFP_EXT 0
7272#endif
73#undef __GLIBC_USE_IEC_60559_BFP_EXT_C2X
74#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
75# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 1
73#undef __GLIBC_USE_IEC_60559_BFP_EXT_C23
74#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC23)
75# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 1
7676#else
77# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
77# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 0
7878#endif
7979#undef __GLIBC_USE_IEC_60559_EXT
8080#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
......@@ -86,18 +86,18 @@
8686/* ISO/IEC TS 18661-4:2015 defines the
8787 __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
8888 functions, the symbols from this TS are enabled unconditionally in
89 C2X. */
89 C23. */
9090#undef __GLIBC_USE_IEC_60559_FUNCS_EXT
9191#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
9292# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
9393#else
9494# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
9595#endif
96#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
97#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
98# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 1
96#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C23
97#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC23)
98# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 1
9999#else
100# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0
100# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 0
101101#endif
102102
103103/* ISO/IEC TS 18661-3:2015 defines the
lib/libc/glibc/elf/elf.h+32-1
......@@ -831,6 +831,10 @@ typedef struct
831831 control. */
832832#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication
833833 enabled keys. */
834#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers. */
835#define NT_ARM_ZA 0x40c /* ARM SME ZA registers. */
836#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */
837#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */
834838#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
835839#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
836840#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
......@@ -1234,6 +1238,10 @@ typedef struct
12341238#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */
12351239#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment. */
12361240
1241/* More machine-dependent hints about processor capabilities. */
1242#define AT_HWCAP3 29 /* extension of AT_HWCAP. */
1243#define AT_HWCAP4 30 /* extension of AT_HWCAP. */
1244
12371245#define AT_EXECFN 31 /* Filename of executable. */
12381246
12391247/* Pointer to the global system page used for system calls and other
......@@ -1333,9 +1341,13 @@ typedef struct
13331341#define NT_GNU_PROPERTY_TYPE_0 5
13341342
13351343/* Packaging metadata as defined on
1336 https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
1344 https://systemd.io/ELF_PACKAGE_METADATA/ */
13371345#define NT_FDO_PACKAGING_METADATA 0xcafe1a7e
13381346
1347/* dlopen metadata as defined on
1348 https://systemd.io/ELF_DLOPEN_METADATA/ */
1349#define NT_FDO_DLOPEN_METADATA 0x407c0c0a
1350
13391351/* Note section name of program property. */
13401352#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
13411353
......@@ -4237,6 +4249,8 @@ enum
42374249#define R_LARCH_TLS_TPREL32 10
42384250#define R_LARCH_TLS_TPREL64 11
42394251#define R_LARCH_IRELATIVE 12
4252#define R_LARCH_TLS_DESC32 13
4253#define R_LARCH_TLS_DESC64 14
42404254
42414255/* Reserved for future relocs that the dynamic linker must understand. */
42424256
......@@ -4331,6 +4345,23 @@ enum
43314345#define R_LARCH_ADD_ULEB128 107
43324346#define R_LARCH_SUB_ULEB128 108
43334347#define R_LARCH_64_PCREL 109
4348#define R_LARCH_CALL36 110
4349#define R_LARCH_TLS_DESC_PC_HI20 111
4350#define R_LARCH_TLS_DESC_PC_LO12 112
4351#define R_LARCH_TLS_DESC64_PC_LO20 113
4352#define R_LARCH_TLS_DESC64_PC_HI12 114
4353#define R_LARCH_TLS_DESC_HI20 115
4354#define R_LARCH_TLS_DESC_LO12 116
4355#define R_LARCH_TLS_DESC64_LO20 117
4356#define R_LARCH_TLS_DESC64_HI12 118
4357#define R_LARCH_TLS_DESC_LD 119
4358#define R_LARCH_TLS_DESC_CALL 120
4359#define R_LARCH_TLS_LE_HI20_R 121
4360#define R_LARCH_TLS_LE_ADD_R 122
4361#define R_LARCH_TLS_LE_LO12_R 123
4362#define R_LARCH_TLS_LD_PCREL20_S2 124
4363#define R_LARCH_TLS_GD_PCREL20_S2 125
4364#define R_LARCH_TLS_DESC_PCREL20_S2 126
43344365
43354366/* ARC specific declarations. */
43364367
lib/libc/glibc/include/libc-symbols.h+17-11
......@@ -679,9 +679,9 @@ for linking")
679679#endif
680680
681681/* Helper / base macros for indirect function symbols. */
682#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
682#define __ifunc_resolver(type_name, name, expr, init, classifier, ...) \
683683 classifier inhibit_stack_protector \
684 __typeof (type_name) *name##_ifunc (arg) \
684 __typeof (type_name) *name##_ifunc (__VA_ARGS__) \
685685 { \
686686 init (); \
687687 __typeof (type_name) *res = expr; \
......@@ -689,13 +689,13 @@ for linking")
689689 }
690690
691691#ifdef HAVE_GCC_IFUNC
692# define __ifunc(type_name, name, expr, arg, init) \
692# define __ifunc_args(type_name, name, expr, init, ...) \
693693 extern __typeof (type_name) name __attribute__ \
694694 ((ifunc (#name "_ifunc"))); \
695 __ifunc_resolver (type_name, name, expr, arg, init, static)
695 __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__)
696696
697# define __ifunc_hidden(type_name, name, expr, arg, init) \
698 __ifunc (type_name, name, expr, arg, init)
697# define __ifunc_args_hidden(type_name, name, expr, init, ...) \
698 __ifunc_args (type_name, name, expr, init, __VA_ARGS__)
699699#else
700700/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
701701 as fallback. But keep in mind that the debug information for the ifunc
......@@ -706,18 +706,24 @@ for linking")
706706 different signatures. (Gcc support is disabled at least on a ppc64le
707707 Ubuntu 14.04 system.) */
708708
709# define __ifunc(type_name, name, expr, arg, init) \
709# define __ifunc_args(type_name, name, expr, init, ...) \
710710 extern __typeof (type_name) name; \
711 __typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \
712 __ifunc_resolver (type_name, name, expr, arg, init,) \
711 __typeof (type_name) *name##_ifunc (__VA_ARGS__) __asm__ (#name); \
712 __ifunc_resolver (type_name, name, expr, init, , __VA_ARGS__) \
713713 __asm__ (".type " #name ", %gnu_indirect_function");
714714
715# define __ifunc_hidden(type_name, name, expr, arg, init) \
715# define __ifunc_args_hidden(type_name, name, expr, init, ...) \
716716 extern __typeof (type_name) __libc_##name; \
717 __ifunc (type_name, __libc_##name, expr, arg, init) \
717 __ifunc (type_name, __libc_##name, expr, __VA_ARGS__, init) \
718718 strong_alias (__libc_##name, name);
719719#endif /* !HAVE_GCC_IFUNC */
720720
721#define __ifunc(type_name, name, expr, arg, init) \
722 __ifunc_args (type_name, name, expr, init, arg)
723
724#define __ifunc_hidden(type_name, name, expr, arg, init) \
725 __ifunc_args_hidden (type_name, name, expr, init, arg)
726
721727/* The following macros are used for indirect function symbols in libc.so.
722728 First of all, you need to have the function prototyped somewhere,
723729 say in foo.h:
lib/libc/glibc/include/stdlib.h+2-2
......@@ -53,8 +53,8 @@ libc_hidden_proto (__isoc23_strtoul_l)
5353libc_hidden_proto (__isoc23_strtoll_l)
5454libc_hidden_proto (__isoc23_strtoull_l)
5555
56#if __GLIBC_USE (C2X_STRTOL)
57/* Redirect internal uses of these functions to the C2X versions; the
56#if __GLIBC_USE (C23_STRTOL)
57/* Redirect internal uses of these functions to the C23 versions; the
5858 redirection in the installed header does not work with
5959 libc_hidden_proto. */
6060# undef strtol
lib/libc/glibc/io/fcntl.h+3-4
......@@ -176,7 +176,7 @@ typedef __pid_t pid_t;
176176
177177 This function is a cancellation point and therefore not marked with
178178 __THROW. */
179#ifndef __USE_TIME_BITS64
179#ifndef __USE_TIME64_REDIRECTS
180180# ifndef __USE_FILE_OFFSET64
181181extern int fcntl (int __fd, int __cmd, ...);
182182# else
......@@ -189,7 +189,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
189189# ifdef __USE_LARGEFILE64
190190extern int fcntl64 (int __fd, int __cmd, ...);
191191# endif
192#else /* __USE_TIME_BITS64 */
192#else /* __USE_TIME64_REDIRECTS */
193193# ifdef __REDIRECT
194194extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
195195 __fcntl_time64);
......@@ -344,8 +344,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
344344
345345
346346/* Define some inlines helping to catch common problems. */
347#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
348 && defined __va_arg_pack_len
347#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
349348# include <bits/fcntl2.h>
350349#endif
351350
lib/libc/glibc/io/sys/stat.h+8-8
......@@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file,
209209 that file descriptor FD is open on and put them in BUF. */
210210extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
211211#else
212# ifdef __USE_TIME_BITS64
212# ifdef __USE_TIME64_REDIRECTS
213213# ifdef __REDIRECT_NTH
214214extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
215215 struct stat *__restrict __buf),
......@@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
236236# endif
237237#endif
238238#ifdef __USE_LARGEFILE64
239# ifndef __USE_TIME_BITS64
239# ifndef __USE_TIME64_REDIRECTS
240240extern int stat64 (const char *__restrict __file,
241241 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
242242extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
......@@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file,
265265 struct stat *__restrict __buf, int __flag)
266266 __THROW __nonnull ((2, 3));
267267# else
268# ifdef __USE_TIME_BITS64
268# ifdef __USE_TIME64_REDIRECTS
269269# ifdef __REDIRECT_NTH
270270extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
271271 struct stat *__restrict __buf,
......@@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
287287# endif
288288
289289# ifdef __USE_LARGEFILE64
290# ifndef __USE_TIME_BITS64
290# ifndef __USE_TIME64_REDIRECTS
291291extern int fstatat64 (int __fd, const char *__restrict __file,
292292 struct stat64 *__restrict __buf, int __flag)
293293 __THROW __nonnull ((2, 3));
......@@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
313313extern int lstat (const char *__restrict __file,
314314 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
315315# else
316# ifdef __USE_TIME_BITS64
316# ifdef __USE_TIME64_REDIRECTS
317317# ifdef __REDIRECT_NTH
318318extern int __REDIRECT_NTH (lstat,
319319 (const char *__restrict __file,
......@@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat,
334334# endif
335335# endif
336336# ifdef __USE_LARGEFILE64
337# ifndef __USE_TIME_BITS64
337# ifndef __USE_TIME64_REDIRECTS
338338extern int lstat64 (const char *__restrict __file,
339339 struct stat64 *__restrict __buf)
340340 __THROW __nonnull ((1, 2));
......@@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
427427#endif
428428
429429#ifdef __USE_ATFILE
430# ifndef __USE_TIME_BITS64
430# ifndef __USE_TIME64_REDIRECTS
431431/* Set file access and modification times relative to directory file
432432 descriptor. */
433433extern int utimensat (int __fd, const char *__path,
......@@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
447447#endif
448448
449449#ifdef __USE_XOPEN2K8
450# ifndef __USE_TIME_BITS64
450# ifndef __USE_TIME64_REDIRECTS
451451/* Set file access and modification times of the file associated with FD. */
452452extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
453453
lib/libc/glibc/misc/sys/cdefs.h+168-5
......@@ -145,6 +145,14 @@
145145#endif
146146
147147
148/* The overloadable attribute was added on clang 2.6. */
149#if defined __clang_major__ \
150 && (__clang_major__ + (__clang_minor__ >= 6) > 2)
151# define __attribute_overloadable__ __attribute__((__overloadable__))
152#else
153# define __attribute_overloadable__
154#endif
155
148156/* Fortify support. */
149157#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
150158#define __bos0(ptr) __builtin_object_size (ptr, 0)
......@@ -187,27 +195,173 @@
187195 __s, __osz)) \
188196 && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
189197
198/* To correctly instrument the fortify wrapper clang requires the
199 pass_object_size attribute, and the attribute has the restriction that the
200 argument needs to be 'const'. Furthermore, to make it usable with C
201 interfaces, clang provides the overload attribute, which provides a C++
202 like function overload support. The overloaded fortify wrapper with the
203 pass_object_size attribute has precedence over the default symbol.
204
205 Also, clang does not support __va_arg_pack, so variadic functions are
206 expanded to issue va_arg implementations. The error function must not have
207 bodies (address takes are expanded to nonfortified calls), and with
208 __fortify_function compiler might still create a body with the C++
209 mangling name (due to the overload attribute). In this case, the function
210 is defined with __fortify_function_error_function macro instead.
211
212 The argument size check is also done with a clang-only attribute,
213 __attribute__ ((__diagnose_if__ (...))), different than gcc which calls
214 symbol_chk_warn alias with uses __warnattr attribute.
215
216 The pass_object_size was added on clang 4.0, __diagnose_if__ on 5.0,
217 and pass_dynamic_object_size on 9.0. */
218#if defined __clang_major__ && __clang_major__ >= 5
219# define __fortify_use_clang 1
220
221# define __fortify_function_error_function static __attribute__((__unused__))
222
223# define __fortify_clang_pass_object_size_n(n) \
224 __attribute__ ((__pass_object_size__ (n)))
225# define __fortify_clang_pass_object_size0 \
226 __fortify_clang_pass_object_size_n (0)
227# define __fortify_clang_pass_object_size \
228 __fortify_clang_pass_object_size_n (__USE_FORTIFY_LEVEL > 1)
229
230# if __clang_major__ >= 9
231# define __fortify_clang_pass_dynamic_object_size_n(n) \
232 __attribute__ ((__pass_dynamic_object_size__ (n)))
233# define __fortify_clang_pass_dynamic_object_size0 \
234 __fortify_clang_pass_dynamic_object_size_n (0)
235# define __fortify_clang_pass_dynamic_object_size \
236 __fortify_clang_pass_dynamic_object_size_n (1)
237# else
238# define __fortify_clang_pass_dynamic_object_size_n(n)
239# define __fortify_clang_pass_dynamic_object_size0
240# define __fortify_clang_pass_dynamic_object_size
241# endif
242
243# define __fortify_clang_bos_static_lt_impl(bos_val, n, s) \
244 ((bos_val) != -1ULL && (n) > (bos_val) / (s))
245# define __fortify_clang_bos_static_lt2(__n, __e, __s) \
246 __fortify_clang_bos_static_lt_impl (__bos (__e), __n, __s)
247# define __fortify_clang_bos_static_lt(__n, __e) \
248 __fortify_clang_bos_static_lt2 (__n, __e, 1)
249# define __fortify_clang_bos0_static_lt2(__n, __e, __s) \
250 __fortify_clang_bos_static_lt_impl (__bos0 (__e), __n, __s)
251# define __fortify_clang_bos0_static_lt(__n, __e) \
252 __fortify_clang_bos0_static_lt2 (__n, __e, 1)
253
254# define __fortify_clang_bosn_args(bos_fn, n, buf, div, complaint) \
255 (__fortify_clang_bos_static_lt_impl (bos_fn (buf), n, div)), (complaint), \
256 "warning"
257
258# define __fortify_clang_warning(__c, __msg) \
259 __attribute__ ((__diagnose_if__ ((__c), (__msg), "warning")))
260# define __fortify_clang_error(__c, __msg) \
261 __attribute__ ((__diagnose_if__ ((__c), (__msg), "error")))
262# define __fortify_clang_warning_only_if_bos0_lt(n, buf, complaint) \
263 __attribute__ ((__diagnose_if__ \
264 (__fortify_clang_bosn_args (__bos0, n, buf, 1, complaint))))
265# define __fortify_clang_warning_only_if_bos0_lt2(n, buf, div, complaint) \
266 __attribute__ ((__diagnose_if__ \
267 (__fortify_clang_bosn_args (__bos0, n, buf, div, complaint))))
268# define __fortify_clang_warning_only_if_bos_lt(n, buf, complaint) \
269 __attribute__ ((__diagnose_if__ \
270 (__fortify_clang_bosn_args (__bos, n, buf, 1, complaint))))
271# define __fortify_clang_warning_only_if_bos_lt2(n, buf, div, complaint) \
272 __attribute__ ((__diagnose_if__ \
273 (__fortify_clang_bosn_args (__bos, n, buf, div, complaint))))
274
275# define __fortify_clang_prefer_this_overload \
276 __attribute__ ((enable_if (1, "")))
277# define __fortify_clang_unavailable(__msg) \
278 __attribute__ ((unavailable(__msg)))
279
280# if __USE_FORTIFY_LEVEL == 3
281# define __fortify_clang_overload_arg(__type, __attr, __name) \
282 __type __attr const __fortify_clang_pass_dynamic_object_size __name
283# define __fortify_clang_overload_arg0(__type, __attr, __name) \
284 __type __attr const __fortify_clang_pass_dynamic_object_size0 __name
285# else
286# define __fortify_clang_overload_arg(__type, __attr, __name) \
287 __type __attr const __fortify_clang_pass_object_size __name
288# define __fortify_clang_overload_arg0(__type, __attr, __name) \
289 __type __attr const __fortify_clang_pass_object_size0 __name
290# endif
291
292# define __fortify_clang_mul_may_overflow(size, n) \
293 ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2)))
294
295# define __fortify_clang_size_too_small(__bos, __dest, __len) \
296 (__bos (__dest) != (size_t) -1 && __bos (__dest) < __len)
297# define __fortify_clang_warn_if_src_too_large(__dest, __src) \
298 __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \
299 __dest, \
300 __builtin_strlen (__src) + 1), \
301 "destination buffer will always be overflown by source")
302# define __fortify_clang_warn_if_dest_too_small(__dest, __len) \
303 __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \
304 __dest, \
305 __len), \
306 "function called with bigger length than the destination buffer")
307# define __fortify_clang_warn_if_dest_too_small0(__dest, __len) \
308 __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize0, \
309 __dest, \
310 __len), \
311 "function called with bigger length than the destination buffer")
312#else
313# define __fortify_use_clang 0
314# define __fortify_clang_warning(__c, __msg)
315# define __fortify_clang_warning_only_if_bos0_lt(__n, __buf, __complaint)
316# define __fortify_clang_warning_only_if_bos0_lt2(__n, __buf, __div, complaint)
317# define __fortify_clang_warning_only_if_bos_lt(__n, __buf, __complaint)
318# define __fortify_clang_warning_only_if_bos_lt2(__n, __buf, div, __complaint)
319# define __fortify_clang_overload_arg(__type, __attr, __name) \
320 __type __attr __name
321# define __fortify_clang_overload_arg0(__type, __attr, __name) \
322 __fortify_clang_overload_arg (__type, __attr, __name)
323# define __fortify_clang_warn_if_src_too_large(__dest, __src)
324# define __fortify_clang_warn_if_dest_too_small(__dest, __len)
325# define __fortify_clang_warn_if_dest_too_small0(__dest, __len)
326#endif
327
328
190329/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be
191330 declared. */
192331
193#define __glibc_fortify(f, __l, __s, __osz, ...) \
332#if !__fortify_use_clang
333# define __glibc_fortify(f, __l, __s, __osz, ...) \
194334 (__glibc_safe_or_unknown_len (__l, __s, __osz) \
195335 ? __ ## f ## _alias (__VA_ARGS__) \
196336 : (__glibc_unsafe_len (__l, __s, __osz) \
197337 ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
198338 : __ ## f ## _chk (__VA_ARGS__, __osz)))
339#else
340# define __glibc_fortify(f, __l, __s, __osz, ...) \
341 (__osz == (__SIZE_TYPE__) -1) \
342 ? __ ## f ## _alias (__VA_ARGS__) \
343 : __ ## f ## _chk (__VA_ARGS__, __osz)
344#endif
199345
200346/* Fortify function f, where object size argument passed to f is the number of
201347 elements and not total size. */
202348
203#define __glibc_fortify_n(f, __l, __s, __osz, ...) \
349#if !__fortify_use_clang
350# define __glibc_fortify_n(f, __l, __s, __osz, ...) \
204351 (__glibc_safe_or_unknown_len (__l, __s, __osz) \
205352 ? __ ## f ## _alias (__VA_ARGS__) \
206353 : (__glibc_unsafe_len (__l, __s, __osz) \
207354 ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
208355 : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))
356# else
357# define __glibc_fortify_n(f, __l, __s, __osz, ...) \
358 (__osz == (__SIZE_TYPE__) -1) \
359 ? __ ## f ## _alias (__VA_ARGS__) \
360 : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))
209361#endif
210362
363#endif /* __USE_FORTIFY_LEVEL > 0 */
364
211365#if __GNUC_PREREQ (4,3)
212366# define __warnattr(msg) __attribute__((__warning__ (msg)))
213367# define __errordecl(name, msg) \
......@@ -683,10 +837,10 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
683837# define __attr_access(x) __attribute__ ((__access__ x))
684838/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
685839 use the access attribute to get object sizes from function definition
686 arguments, so we can't use them on functions we fortify. Drop the object
687 size hints for such functions. */
840 arguments, so we can't use them on functions we fortify. Drop the access
841 attribute for such functions. */
688842# if __USE_FORTIFY_LEVEL == 3
689# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o)))
843# define __fortified_attr_access(a, o, s)
690844# else
691845# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
692846# endif
......@@ -720,4 +874,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
720874# define __attribute_returns_twice__ /* Ignore. */
721875#endif
722876
877/* Mark struct types as aliasable. Restricted to compilers that
878 support forward declarations of structs in the presence of the
879 attribute. */
880#if __GNUC_PREREQ (7, 1) || defined __clang__
881# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__))
882#else
883# define __attribute_struct_may_alias__
884#endif
885
723886#endif /* sys/cdefs.h */
lib/libc/glibc/misc/sys/select.h+2-2
......@@ -98,7 +98,7 @@ __BEGIN_DECLS
9898
9999 This function is a cancellation point and therefore not marked with
100100 __THROW. */
101#ifndef __USE_TIME_BITS64
101#ifndef __USE_TIME64_REDIRECTS
102102extern int select (int __nfds, fd_set *__restrict __readfds,
103103 fd_set *__restrict __writefds,
104104 fd_set *__restrict __exceptfds,
......@@ -123,7 +123,7 @@ extern int __REDIRECT (select,
123123
124124 This function is a cancellation point and therefore not marked with
125125 __THROW. */
126# ifndef __USE_TIME_BITS64
126# ifndef __USE_TIME64_REDIRECTS
127127extern int pselect (int __nfds, fd_set *__restrict __readfds,
128128 fd_set *__restrict __writefds,
129129 fd_set *__restrict __exceptfds,
lib/libc/glibc/signal/signal.h+1-1
......@@ -269,7 +269,7 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,
269269
270270 This function is a cancellation point and therefore not marked with
271271 __THROW. */
272# ifndef __USE_TIME_BITS64
272# ifndef __USE_TIME64_REDIRECTS
273273extern int sigtimedwait (const sigset_t *__restrict __set,
274274 siginfo_t *__restrict __info,
275275 const struct timespec *__restrict __timeout)
lib/libc/glibc/stdlib/stdlib.h+3-3
......@@ -210,7 +210,7 @@ extern unsigned long long int strtoull (const char *__restrict __nptr,
210210
211211/* Versions of the above functions that handle '0b' and '0B' prefixes
212212 in base 0 or 2. */
213#if __GLIBC_USE (C2X_STRTOL)
213#if __GLIBC_USE (C23_STRTOL)
214214# ifdef __REDIRECT
215215extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
216216 char **__restrict __endptr,
......@@ -274,7 +274,7 @@ extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,
274274#endif
275275
276276/* Convert a floating-point number to a string. */
277#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
277#if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
278278extern int strfromd (char *__dest, size_t __size, const char *__format,
279279 double __f)
280280 __THROW __nonnull ((3));
......@@ -360,7 +360,7 @@ extern unsigned long long int strtoull_l (const char *__restrict __nptr,
360360
361361/* Versions of the above functions that handle '0b' and '0B' prefixes
362362 in base 0 or 2. */
363# if __GLIBC_USE (C2X_STRTOL)
363# if __GLIBC_USE (C23_STRTOL)
364364# ifdef __REDIRECT
365365extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,
366366 char **__restrict __endptr,
lib/libc/glibc/sysdeps/htl/pthread.h+11
......@@ -891,6 +891,17 @@ extern int pthread_setschedparam (pthread_t __thr, int __policy,
891891/* Set thread THREAD's scheduling priority. */
892892extern int pthread_setschedprio (pthread_t __thr, int __prio) __THROW;
893893
894#ifdef __USE_GNU
895/* Get thread name visible in the kernel and its interfaces. */
896extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
897 size_t __buflen)
898 __THROW __nonnull ((2)) __attr_access ((__write_only__, 2));
899
900/* Set thread name visible in the kernel and its interfaces. */
901extern int pthread_setname_np (pthread_t __target_thread, const char *__name)
902 __THROW __nonnull ((2)) __attr_access ((__read_only__, 2));
903#endif
904
894905#ifdef __USE_GNU
895906/* Yield the processor to another thread or process.
896907 This function is similar to the POSIX `sched_yield' function but
lib/libc/glibc/sysdeps/nptl/pthread.h+9-9
......@@ -223,7 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return);
223223 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
224224extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
225225
226# ifndef __USE_TIME_BITS64
226# ifndef __USE_TIME64_REDIRECTS
227227/* Make calling thread wait for termination of the thread TH, but only
228228 until TIMEOUT. The exit status of the thread is stored in
229229 *THREAD_RETURN, if THREAD_RETURN is not NULL.
......@@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
796796
797797#ifdef __USE_XOPEN2K
798798/* Wait until lock becomes available, or specified time passes. */
799# ifndef __USE_TIME_BITS64
799# ifndef __USE_TIME64_REDIRECTS
800800extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
801801 const struct timespec *__restrict
802802 __abstime) __THROWNL __nonnull ((1, 2));
......@@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
813813#endif
814814
815815#ifdef __USE_GNU
816# ifndef __USE_TIME_BITS64
816# ifndef __USE_TIME64_REDIRECTS
817817extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
818818 clockid_t __clockid,
819819 const struct timespec *__restrict
......@@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
982982
983983# ifdef __USE_XOPEN2K
984984/* Try to acquire read lock for RWLOCK or return after specified time. */
985# ifndef __USE_TIME_BITS64
985# ifndef __USE_TIME64_REDIRECTS
986986extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
987987 const struct timespec *__restrict
988988 __abstime) __THROWNL __nonnull ((1, 2));
......@@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
10001000# endif
10011001
10021002# ifdef __USE_GNU
1003# ifndef __USE_TIME_BITS64
1003# ifndef __USE_TIME64_REDIRECTS
10041004extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
10051005 clockid_t __clockid,
10061006 const struct timespec *__restrict
......@@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
10291029
10301030# ifdef __USE_XOPEN2K
10311031/* Try to acquire write lock for RWLOCK or return after specified time. */
1032# ifndef __USE_TIME_BITS64
1032# ifndef __USE_TIME64_REDIRECTS
10331033extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
10341034 const struct timespec *__restrict
10351035 __abstime) __THROWNL __nonnull ((1, 2));
......@@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
10471047# endif
10481048
10491049# ifdef __USE_GNU
1050# ifndef __USE_TIME_BITS64
1050# ifndef __USE_TIME64_REDIRECTS
10511051extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
10521052 clockid_t __clockid,
10531053 const struct timespec *__restrict
......@@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
11411141
11421142 This function is a cancellation point and therefore not marked with
11431143 __THROW. */
1144# ifndef __USE_TIME_BITS64
1144# ifndef __USE_TIME64_REDIRECTS
11451145extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
11461146 pthread_mutex_t *__restrict __mutex,
11471147 const struct timespec *__restrict __abstime)
......@@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait,
11671167
11681168 This function is a cancellation point and therefore not marked with
11691169 __THROW. */
1170# ifndef __USE_TIME_BITS64
1170# ifndef __USE_TIME64_REDIRECTS
11711171extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
11721172 pthread_mutex_t *__restrict __mutex,
11731173 __clockid_t __clock_id,
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h+1-1
......@@ -25,7 +25,7 @@
2525
2626struct timex
2727{
28# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32)
28# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32)
2929 unsigned int modes; /* mode selector */
3030 int :32; /* pad */
3131 long long offset; /* time offset (usec) */
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h+9
......@@ -468,6 +468,15 @@ L(pre_end): ASM_LINE_SEP \
468468#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
469469#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"
470470
471#define VDSO_NAME "LINUX_6.11"
472#define VDSO_HASH 182951793
473
474#ifdef __LP64__
475# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
476#else
477# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
478#endif /* __LP64__ */
479
471480#endif /* __ASSEMBLER__ */
472481
473482#endif /* _LINUX_HPPA_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h+1
......@@ -156,6 +156,7 @@
156156/* List of system calls which are supported as vsyscalls (for RV32 and
157157 RV64). */
158158# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
159# define HAVE_RISCV_HWPROBE "__vdso_riscv_hwprobe"
159160
160161# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
161162# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h+1-1
......@@ -54,7 +54,7 @@ struct ntptimeval
5454
5555__BEGIN_DECLS
5656
57#ifndef __USE_TIME_BITS64
57#ifndef __USE_TIME64_REDIRECTS
5858extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1));
5959extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1));
6060
lib/libc/glibc/sysdeps/x86/bits/wordsize.h+2-3
......@@ -8,10 +8,9 @@
88#define __WORDSIZE32_PTRDIFF_LONG 0
99#endif
1010
11#define __WORDSIZE_TIME64_COMPAT32 1
12
1113#ifdef __x86_64__
12# define __WORDSIZE_TIME64_COMPAT32 1
1314/* Both x86-64 and x32 use the 64-bit system call interface. */
1415# define __SYSCALL_WORDSIZE 64
15#else
16# define __WORDSIZE_TIME64_COMPAT32 0
1716#endif
lib/libc/glibc/sysdeps/x86/sysdep.h+109-5
......@@ -21,14 +21,118 @@
2121
2222#include <sysdeps/generic/sysdep.h>
2323
24/* The extended state feature IDs in the state component bitmap. */
25#define X86_XSTATE_X87_ID 0
26#define X86_XSTATE_SSE_ID 1
27#define X86_XSTATE_AVX_ID 2
28#define X86_XSTATE_BNDREGS_ID 3
29#define X86_XSTATE_BNDCFG_ID 4
30#define X86_XSTATE_K_ID 5
31#define X86_XSTATE_ZMM_H_ID 6
32#define X86_XSTATE_ZMM_ID 7
33#define X86_XSTATE_PKRU_ID 9
34#define X86_XSTATE_TILECFG_ID 17
35#define X86_XSTATE_TILEDATA_ID 18
36#define X86_XSTATE_APX_F_ID 19
37
38#ifdef __x86_64__
2439/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need
2540 space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be
26 aligned to 16 bytes for fxsave and 64 bytes for xsave. */
27#define STATE_SAVE_OFFSET (8 * 7 + 8)
41 aligned to 16 bytes for fxsave and 64 bytes for xsave. It is non-zero
42 because MOV, instead of PUSH, is used to save registers onto stack.
43
44 +==================+<- stack frame start aligned at 8 or 16 bytes
45 | |<- paddings for stack realignment of 64 bytes
46 |------------------|<- xsave buffer end aligned at 64 bytes
47 | |<-
48 | |<-
49 | |<-
50 |------------------|<- xsave buffer start at STATE_SAVE_OFFSET(%rsp)
51 | |<- 8-byte padding for 64-byte alignment
52 | |<- R9
53 | |<- R8
54 | |<- RDI
55 | |<- RSI
56 | |<- RDX
57 | |<- RCX
58 | |<- RAX
59 +==================+<- RSP aligned at 64 bytes
60
61 */
62# define STATE_SAVE_OFFSET (8 * 7 + 8)
63
64/* _dl_tlsdesc_dynamic preserves RDI, RSI and RBX before realigning
65 stack. After realigning stack, it saves RCX, RDX, R8, R9, R10 and
66 R11. Allocate space for RDI, RSI and RBX to avoid clobbering saved
67 RDI, RSI and RBX values on stack by xsave.
68
69 +==================+<- stack frame start aligned at 8 or 16 bytes
70 | |<- RDI saved in the red zone
71 | |<- RSI saved in the red zone
72 | |<- RBX saved in the red zone
73 | |<- paddings for stack realignment of 64 bytes
74 |------------------|<- xsave buffer end aligned at 64 bytes
75 | |<-
76 | |<-
77 | |<-
78 |------------------|<- xsave buffer start at STATE_SAVE_OFFSET(%rsp)
79 | |<- 8-byte padding for 64-byte alignment
80 | |<- 8-byte padding for 64-byte alignment
81 | |<- R11
82 | |<- R10
83 | |<- R9
84 | |<- R8
85 | |<- RDX
86 | |<- RCX
87 +==================+<- RSP aligned at 64 bytes
88
89 Define the total register save area size for all integer registers by
90 adding 24 to STATE_SAVE_OFFSET since RDI, RSI and RBX are saved onto
91 stack without adjusting stack pointer first, using the red-zone. */
92# define TLSDESC_CALL_REGISTER_SAVE_AREA (STATE_SAVE_OFFSET + 24)
93
94/* Save SSE, AVX, AVX512, mask, bound and APX registers. Bound and APX
95 registers are mutually exclusive. */
96# define STATE_SAVE_MASK \
97 ((1 << X86_XSTATE_SSE_ID) \
98 | (1 << X86_XSTATE_AVX_ID) \
99 | (1 << X86_XSTATE_BNDREGS_ID) \
100 | (1 << X86_XSTATE_K_ID) \
101 | (1 << X86_XSTATE_ZMM_H_ID) \
102 | (1 << X86_XSTATE_ZMM_ID) \
103 | (1 << X86_XSTATE_APX_F_ID))
104
105/* AMX state mask. */
106# define AMX_STATE_SAVE_MASK \
107 ((1 << X86_XSTATE_TILECFG_ID) | (1 << X86_XSTATE_TILEDATA_ID))
108
109/* States to be included in xsave_state_full_size. */
110# define FULL_STATE_SAVE_MASK \
111 (STATE_SAVE_MASK | AMX_STATE_SAVE_MASK)
112#else
113/* Offset for fxsave/xsave area used by _dl_tlsdesc_dynamic. Since i386
114 uses PUSH to save registers onto stack, use 0 here. */
115# define STATE_SAVE_OFFSET 0
116# define TLSDESC_CALL_REGISTER_SAVE_AREA 0
117
118/* Save SSE, AVX, AXV512, mask and bound registers. */
119# define STATE_SAVE_MASK \
120 ((1 << X86_XSTATE_SSE_ID) \
121 | (1 << X86_XSTATE_AVX_ID) \
122 | (1 << X86_XSTATE_BNDREGS_ID) \
123 | (1 << X86_XSTATE_K_ID) \
124 | (1 << X86_XSTATE_ZMM_H_ID))
125
126/* States to be included in xsave_state_size. */
127# define FULL_STATE_SAVE_MASK STATE_SAVE_MASK
128#endif
28129
29/* Save SSE, AVX, AVX512, mask and bound registers. */
30#define STATE_SAVE_MASK \
31 ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
130/* States which should be saved for TLSDESC_CALL and TLS_DESC_CALL.
131 Compiler assumes that all registers, including AMX and x87 FPU
132 stack registers, are unchanged after CALL, except for EFLAGS and
133 RAX/EAX. */
134#define TLSDESC_CALL_STATE_SAVE_MASK \
135 (FULL_STATE_SAVE_MASK | (1 << X86_XSTATE_X87_ID))
32136
33137/* Constants for bits in __x86_string_control: */
34138
lib/libc/glibc/time/bits/types/struct_timespec.h+2-2
......@@ -10,14 +10,14 @@
1010 has nanoseconds instead of microseconds. */
1111struct timespec
1212{
13#ifdef __USE_TIME_BITS64
13#ifdef __USE_TIME64_REDIRECTS
1414 __time64_t tv_sec; /* Seconds. */
1515#else
1616 __time_t tv_sec; /* Seconds. */
1717#endif
1818#if __WORDSIZE == 64 \
1919 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
20 || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
20 || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS)
2121 __syscall_slong_t tv_nsec; /* Nanoseconds. */
2222#else
2323# if __BYTE_ORDER == __BIG_ENDIAN
lib/libc/glibc/time/bits/types/struct_timeval.h+1-1
......@@ -7,7 +7,7 @@
77 microsecond but also has a range of years. */
88struct timeval
99{
10#ifdef __USE_TIME_BITS64
10#ifdef __USE_TIME64_REDIRECTS
1111 __time64_t tv_sec; /* Seconds. */
1212 __suseconds64_t tv_usec; /* Microseconds. */
1313#else
lib/libc/glibc/time/bits/types/time_t.h+1-1
......@@ -4,7 +4,7 @@
44#include <bits/types.h>
55
66/* Returned by `time'. */
7#ifdef __USE_TIME_BITS64
7#ifdef __USE_TIME64_REDIRECTS
88typedef __time64_t time_t;
99#else
1010typedef __time_t time_t;