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 @@...@@ -44,23 +44,23 @@
4444
45/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__45/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
46 macro. Most but not all symbols enabled by that macro in TS46 macro. Most but not all symbols enabled by that macro in TS
47 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in47 18661-1 are enabled unconditionally in C23. In C23, the symbols in
48 Annex F still require a new feature test macro48 Annex F still require a new feature test macro
49 __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define49 __STDC_WANT_IEC_60559_EXT__ instead (C23 does not define
50 __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS50 __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
51 18661-1 are not included in C2X (and thus should depend on51 18661-1 are not included in C23 (and thus should depend on
52 __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are52 __STDC_WANT_IEC_60559_BFP_EXT__ even when C23 features are
53 enabled).53 enabled).
5454
55 __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS55 __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 TS58 __GLIBC_USE (IEC_60559_BFP_EXT_C23) controls those features from TS
59 18661-1 that are also included in C2X (with no feature test macro59 18661-1 that are also included in C23 (with no feature test macro
60 required in C2X).60 required in C23).
6161
62 __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-162 __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
63 that are included in C2X but conditional on63 that are included in C23 but conditional on
64 __STDC_WANT_IEC_60559_EXT__. (There are currently no features64 __STDC_WANT_IEC_60559_EXT__. (There are currently no features
65 conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS65 conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
66 18661-1.) */66 18661-1.) */
...@@ -70,11 +70,11 @@...@@ -70,11 +70,11 @@
70#else70#else
71# define __GLIBC_USE_IEC_60559_BFP_EXT 071# define __GLIBC_USE_IEC_60559_BFP_EXT 0
72#endif72#endif
73#undef __GLIBC_USE_IEC_60559_BFP_EXT_C2X73#undef __GLIBC_USE_IEC_60559_BFP_EXT_C23
74#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)74#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC23)
75# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 175# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 1
76#else76#else
77# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 077# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 0
78#endif78#endif
79#undef __GLIBC_USE_IEC_60559_EXT79#undef __GLIBC_USE_IEC_60559_EXT
80#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__80#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
...@@ -86,18 +86,18 @@...@@ -86,18 +86,18 @@
86/* ISO/IEC TS 18661-4:2015 defines the86/* ISO/IEC TS 18661-4:2015 defines the
87 __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction87 __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
88 functions, the symbols from this TS are enabled unconditionally in88 functions, the symbols from this TS are enabled unconditionally in
89 C2X. */89 C23. */
90#undef __GLIBC_USE_IEC_60559_FUNCS_EXT90#undef __GLIBC_USE_IEC_60559_FUNCS_EXT
91#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__91#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
92# define __GLIBC_USE_IEC_60559_FUNCS_EXT 192# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
93#else93#else
94# define __GLIBC_USE_IEC_60559_FUNCS_EXT 094# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
95#endif95#endif
96#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X96#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C23
97#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)97#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC23)
98# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 198# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 1
99#else99#else
100# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0100# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 0
101#endif101#endif
102102
103/* ISO/IEC TS 18661-3:2015 defines the103/* ISO/IEC TS 18661-3:2015 defines the
lib/libc/glibc/elf/elf.h+32-1
...@@ -831,6 +831,10 @@ typedef struct...@@ -831,6 +831,10 @@ typedef struct
831 control. */831 control. */
832#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication832#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication
833 enabled keys. */833 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. */
834#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */838#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
835#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */839#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
836#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */840#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
...@@ -1234,6 +1238,10 @@ typedef struct...@@ -1234,6 +1238,10 @@ typedef struct
1234#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */1238#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */
1235#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment. */1239#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
1237#define AT_EXECFN 31 /* Filename of executable. */1245#define AT_EXECFN 31 /* Filename of executable. */
12381246
1239/* Pointer to the global system page used for system calls and other1247/* Pointer to the global system page used for system calls and other
...@@ -1333,9 +1341,13 @@ typedef struct...@@ -1333,9 +1341,13 @@ typedef struct
1333#define NT_GNU_PROPERTY_TYPE_0 51341#define NT_GNU_PROPERTY_TYPE_0 5
13341342
1335/* Packaging metadata as defined on1343/* Packaging metadata as defined on
1336 https://systemd.io/COREDUMP_PACKAGE_METADATA/ */1344 https://systemd.io/ELF_PACKAGE_METADATA/ */
1337#define NT_FDO_PACKAGING_METADATA 0xcafe1a7e1345#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
1339/* Note section name of program property. */1351/* Note section name of program property. */
1340#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"1352#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
13411353
...@@ -4237,6 +4249,8 @@ enum...@@ -4237,6 +4249,8 @@ enum
4237#define R_LARCH_TLS_TPREL32 104249#define R_LARCH_TLS_TPREL32 10
4238#define R_LARCH_TLS_TPREL64 114250#define R_LARCH_TLS_TPREL64 11
4239#define R_LARCH_IRELATIVE 124251#define R_LARCH_IRELATIVE 12
4252#define R_LARCH_TLS_DESC32 13
4253#define R_LARCH_TLS_DESC64 14
42404254
4241/* Reserved for future relocs that the dynamic linker must understand. */4255/* Reserved for future relocs that the dynamic linker must understand. */
42424256
...@@ -4331,6 +4345,23 @@ enum...@@ -4331,6 +4345,23 @@ enum
4331#define R_LARCH_ADD_ULEB128 1074345#define R_LARCH_ADD_ULEB128 107
4332#define R_LARCH_SUB_ULEB128 1084346#define R_LARCH_SUB_ULEB128 108
4333#define R_LARCH_64_PCREL 1094347#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
4335/* ARC specific declarations. */4366/* ARC specific declarations. */
43364367
lib/libc/glibc/include/libc-symbols.h+17-11
...@@ -679,9 +679,9 @@ for linking")...@@ -679,9 +679,9 @@ for linking")
679#endif679#endif
680680
681/* Helper / base macros for indirect function symbols. */681/* 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, ...) \
683 classifier inhibit_stack_protector \683 classifier inhibit_stack_protector \
684 __typeof (type_name) *name##_ifunc (arg) \684 __typeof (type_name) *name##_ifunc (__VA_ARGS__) \
685 { \685 { \
686 init (); \686 init (); \
687 __typeof (type_name) *res = expr; \687 __typeof (type_name) *res = expr; \
...@@ -689,13 +689,13 @@ for linking")...@@ -689,13 +689,13 @@ for linking")
689 }689 }
690690
691#ifdef HAVE_GCC_IFUNC691#ifdef HAVE_GCC_IFUNC
692# define __ifunc(type_name, name, expr, arg, init) \692# define __ifunc_args(type_name, name, expr, init, ...) \
693 extern __typeof (type_name) name __attribute__ \693 extern __typeof (type_name) name __attribute__ \
694 ((ifunc (#name "_ifunc"))); \694 ((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) \697# define __ifunc_args_hidden(type_name, name, expr, init, ...) \
698 __ifunc (type_name, name, expr, arg, init)698 __ifunc_args (type_name, name, expr, init, __VA_ARGS__)
699#else699#else
700/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour700/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
701 as fallback. But keep in mind that the debug information for the ifunc701 as fallback. But keep in mind that the debug information for the ifunc
...@@ -706,18 +706,24 @@ for linking")...@@ -706,18 +706,24 @@ for linking")
706 different signatures. (Gcc support is disabled at least on a ppc64le706 different signatures. (Gcc support is disabled at least on a ppc64le
707 Ubuntu 14.04 system.) */707 Ubuntu 14.04 system.) */
708708
709# define __ifunc(type_name, name, expr, arg, init) \709# define __ifunc_args(type_name, name, expr, init, ...) \
710 extern __typeof (type_name) name; \710 extern __typeof (type_name) name; \
711 __typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \711 __typeof (type_name) *name##_ifunc (__VA_ARGS__) __asm__ (#name); \
712 __ifunc_resolver (type_name, name, expr, arg, init,) \712 __ifunc_resolver (type_name, name, expr, init, , __VA_ARGS__) \
713 __asm__ (".type " #name ", %gnu_indirect_function");713 __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, ...) \
716 extern __typeof (type_name) __libc_##name; \716 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) \
718 strong_alias (__libc_##name, name);718 strong_alias (__libc_##name, name);
719#endif /* !HAVE_GCC_IFUNC */719#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
721/* The following macros are used for indirect function symbols in libc.so.727/* The following macros are used for indirect function symbols in libc.so.
722 First of all, you need to have the function prototyped somewhere,728 First of all, you need to have the function prototyped somewhere,
723 say in foo.h:729 say in foo.h:
lib/libc/glibc/include/stdlib.h+2-2
...@@ -53,8 +53,8 @@ libc_hidden_proto (__isoc23_strtoul_l)...@@ -53,8 +53,8 @@ libc_hidden_proto (__isoc23_strtoul_l)
53libc_hidden_proto (__isoc23_strtoll_l)53libc_hidden_proto (__isoc23_strtoll_l)
54libc_hidden_proto (__isoc23_strtoull_l)54libc_hidden_proto (__isoc23_strtoull_l)
5555
56#if __GLIBC_USE (C2X_STRTOL)56#if __GLIBC_USE (C23_STRTOL)
57/* Redirect internal uses of these functions to the C2X versions; the57/* Redirect internal uses of these functions to the C23 versions; the
58 redirection in the installed header does not work with58 redirection in the installed header does not work with
59 libc_hidden_proto. */59 libc_hidden_proto. */
60# undef strtol60# undef strtol
lib/libc/glibc/io/fcntl.h+3-4
...@@ -176,7 +176,7 @@ typedef __pid_t pid_t;...@@ -176,7 +176,7 @@ typedef __pid_t pid_t;
176176
177 This function is a cancellation point and therefore not marked with177 This function is a cancellation point and therefore not marked with
178 __THROW. */178 __THROW. */
179#ifndef __USE_TIME_BITS64179#ifndef __USE_TIME64_REDIRECTS
180# ifndef __USE_FILE_OFFSET64180# ifndef __USE_FILE_OFFSET64
181extern int fcntl (int __fd, int __cmd, ...);181extern int fcntl (int __fd, int __cmd, ...);
182# else182# else
...@@ -189,7 +189,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);...@@ -189,7 +189,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
189# ifdef __USE_LARGEFILE64189# ifdef __USE_LARGEFILE64
190extern int fcntl64 (int __fd, int __cmd, ...);190extern int fcntl64 (int __fd, int __cmd, ...);
191# endif191# endif
192#else /* __USE_TIME_BITS64 */192#else /* __USE_TIME64_REDIRECTS */
193# ifdef __REDIRECT193# ifdef __REDIRECT
194extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),194extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
195 __fcntl_time64);195 __fcntl_time64);
...@@ -344,8 +344,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);...@@ -344,8 +344,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
344344
345345
346/* Define some inlines helping to catch common problems. */346/* Define some inlines helping to catch common problems. */
347#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \347#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
348 && defined __va_arg_pack_len
349# include <bits/fcntl2.h>348# include <bits/fcntl2.h>
350#endif349#endif
351350
lib/libc/glibc/io/sys/stat.h+8-8
...@@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file,...@@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file,
209 that file descriptor FD is open on and put them in BUF. */209 that file descriptor FD is open on and put them in BUF. */
210extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));210extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
211#else211#else
212# ifdef __USE_TIME_BITS64212# ifdef __USE_TIME64_REDIRECTS
213# ifdef __REDIRECT_NTH213# ifdef __REDIRECT_NTH
214extern int __REDIRECT_NTH (stat, (const char *__restrict __file,214extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
215 struct stat *__restrict __buf),215 struct stat *__restrict __buf),
...@@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)...@@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
236# endif236# endif
237#endif237#endif
238#ifdef __USE_LARGEFILE64238#ifdef __USE_LARGEFILE64
239# ifndef __USE_TIME_BITS64239# ifndef __USE_TIME64_REDIRECTS
240extern int stat64 (const char *__restrict __file,240extern int stat64 (const char *__restrict __file,
241 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));241 struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
242extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));242extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
...@@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file,...@@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file,
265 struct stat *__restrict __buf, int __flag)265 struct stat *__restrict __buf, int __flag)
266 __THROW __nonnull ((2, 3));266 __THROW __nonnull ((2, 3));
267# else267# else
268# ifdef __USE_TIME_BITS64268# ifdef __USE_TIME64_REDIRECTS
269# ifdef __REDIRECT_NTH269# ifdef __REDIRECT_NTH
270extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,270extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
271 struct stat *__restrict __buf,271 struct stat *__restrict __buf,
...@@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,...@@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
287# endif287# endif
288288
289# ifdef __USE_LARGEFILE64289# ifdef __USE_LARGEFILE64
290# ifndef __USE_TIME_BITS64290# ifndef __USE_TIME64_REDIRECTS
291extern int fstatat64 (int __fd, const char *__restrict __file,291extern int fstatat64 (int __fd, const char *__restrict __file,
292 struct stat64 *__restrict __buf, int __flag)292 struct stat64 *__restrict __buf, int __flag)
293 __THROW __nonnull ((2, 3));293 __THROW __nonnull ((2, 3));
...@@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,...@@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
313extern int lstat (const char *__restrict __file,313extern int lstat (const char *__restrict __file,
314 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));314 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
315# else315# else
316# ifdef __USE_TIME_BITS64316# ifdef __USE_TIME64_REDIRECTS
317# ifdef __REDIRECT_NTH317# ifdef __REDIRECT_NTH
318extern int __REDIRECT_NTH (lstat,318extern int __REDIRECT_NTH (lstat,
319 (const char *__restrict __file,319 (const char *__restrict __file,
...@@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat,...@@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat,
334# endif334# endif
335# endif335# endif
336# ifdef __USE_LARGEFILE64336# ifdef __USE_LARGEFILE64
337# ifndef __USE_TIME_BITS64337# ifndef __USE_TIME64_REDIRECTS
338extern int lstat64 (const char *__restrict __file,338extern int lstat64 (const char *__restrict __file,
339 struct stat64 *__restrict __buf)339 struct stat64 *__restrict __buf)
340 __THROW __nonnull ((1, 2));340 __THROW __nonnull ((1, 2));
...@@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)...@@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
427#endif427#endif
428 428
429#ifdef __USE_ATFILE429#ifdef __USE_ATFILE
430# ifndef __USE_TIME_BITS64430# ifndef __USE_TIME64_REDIRECTS
431/* Set file access and modification times relative to directory file431/* Set file access and modification times relative to directory file
432 descriptor. */432 descriptor. */
433extern int utimensat (int __fd, const char *__path,433extern int utimensat (int __fd, const char *__path,
...@@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,...@@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
447#endif447#endif
448448
449#ifdef __USE_XOPEN2K8449#ifdef __USE_XOPEN2K8
450# ifndef __USE_TIME_BITS64450# ifndef __USE_TIME64_REDIRECTS
451/* Set file access and modification times of the file associated with FD. */451/* Set file access and modification times of the file associated with FD. */
452extern int futimens (int __fd, const struct timespec __times[2]) __THROW;452extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
453453
lib/libc/glibc/misc/sys/cdefs.h+168-5
...@@ -145,6 +145,14 @@...@@ -145,6 +145,14 @@
145#endif145#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
148/* Fortify support. */156/* Fortify support. */
149#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)157#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
150#define __bos0(ptr) __builtin_object_size (ptr, 0)158#define __bos0(ptr) __builtin_object_size (ptr, 0)
...@@ -187,27 +195,173 @@...@@ -187,27 +195,173 @@
187 __s, __osz)) \195 __s, __osz)) \
188 && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))196 && !__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
190/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be329/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be
191 declared. */330 declared. */
192331
193#define __glibc_fortify(f, __l, __s, __osz, ...) \332#if !__fortify_use_clang
333# define __glibc_fortify(f, __l, __s, __osz, ...) \
194 (__glibc_safe_or_unknown_len (__l, __s, __osz) \334 (__glibc_safe_or_unknown_len (__l, __s, __osz) \
195 ? __ ## f ## _alias (__VA_ARGS__) \335 ? __ ## f ## _alias (__VA_ARGS__) \
196 : (__glibc_unsafe_len (__l, __s, __osz) \336 : (__glibc_unsafe_len (__l, __s, __osz) \
197 ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \337 ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
198 : __ ## f ## _chk (__VA_ARGS__, __osz)))338 : __ ## 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
200/* Fortify function f, where object size argument passed to f is the number of346/* Fortify function f, where object size argument passed to f is the number of
201 elements and not total size. */347 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, ...) \
204 (__glibc_safe_or_unknown_len (__l, __s, __osz) \351 (__glibc_safe_or_unknown_len (__l, __s, __osz) \
205 ? __ ## f ## _alias (__VA_ARGS__) \352 ? __ ## f ## _alias (__VA_ARGS__) \
206 : (__glibc_unsafe_len (__l, __s, __osz) \353 : (__glibc_unsafe_len (__l, __s, __osz) \
207 ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \354 ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
208 : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))355 : __ ## 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))
209#endif361#endif
210362
363#endif /* __USE_FORTIFY_LEVEL > 0 */
364
211#if __GNUC_PREREQ (4,3)365#if __GNUC_PREREQ (4,3)
212# define __warnattr(msg) __attribute__((__warning__ (msg)))366# define __warnattr(msg) __attribute__((__warning__ (msg)))
213# define __errordecl(name, msg) \367# define __errordecl(name, msg) \
...@@ -683,10 +837,10 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf...@@ -683,10 +837,10 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
683# define __attr_access(x) __attribute__ ((__access__ x))837# define __attr_access(x) __attribute__ ((__access__ x))
684/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may838/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
685 use the access attribute to get object sizes from function definition839 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 object840 arguments, so we can't use them on functions we fortify. Drop the access
687 size hints for such functions. */841 attribute for such functions. */
688# if __USE_FORTIFY_LEVEL == 3842# 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)
690# else844# else
691# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))845# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
692# endif846# endif
...@@ -720,4 +874,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf...@@ -720,4 +874,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
720# define __attribute_returns_twice__ /* Ignore. */874# define __attribute_returns_twice__ /* Ignore. */
721#endif875#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
723#endif /* sys/cdefs.h */886#endif /* sys/cdefs.h */
lib/libc/glibc/misc/sys/select.h+2-2
...@@ -98,7 +98,7 @@ __BEGIN_DECLS...@@ -98,7 +98,7 @@ __BEGIN_DECLS
9898
99 This function is a cancellation point and therefore not marked with99 This function is a cancellation point and therefore not marked with
100 __THROW. */100 __THROW. */
101#ifndef __USE_TIME_BITS64101#ifndef __USE_TIME64_REDIRECTS
102extern int select (int __nfds, fd_set *__restrict __readfds,102extern int select (int __nfds, fd_set *__restrict __readfds,
103 fd_set *__restrict __writefds,103 fd_set *__restrict __writefds,
104 fd_set *__restrict __exceptfds,104 fd_set *__restrict __exceptfds,
...@@ -123,7 +123,7 @@ extern int __REDIRECT (select,...@@ -123,7 +123,7 @@ extern int __REDIRECT (select,
123123
124 This function is a cancellation point and therefore not marked with124 This function is a cancellation point and therefore not marked with
125 __THROW. */125 __THROW. */
126# ifndef __USE_TIME_BITS64126# ifndef __USE_TIME64_REDIRECTS
127extern int pselect (int __nfds, fd_set *__restrict __readfds,127extern int pselect (int __nfds, fd_set *__restrict __readfds,
128 fd_set *__restrict __writefds,128 fd_set *__restrict __writefds,
129 fd_set *__restrict __exceptfds,129 fd_set *__restrict __exceptfds,
lib/libc/glibc/signal/signal.h+1-1
...@@ -269,7 +269,7 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,...@@ -269,7 +269,7 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,
269269
270 This function is a cancellation point and therefore not marked with270 This function is a cancellation point and therefore not marked with
271 __THROW. */271 __THROW. */
272# ifndef __USE_TIME_BITS64272# ifndef __USE_TIME64_REDIRECTS
273extern int sigtimedwait (const sigset_t *__restrict __set,273extern int sigtimedwait (const sigset_t *__restrict __set,
274 siginfo_t *__restrict __info,274 siginfo_t *__restrict __info,
275 const struct timespec *__restrict __timeout)275 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,...@@ -210,7 +210,7 @@ extern unsigned long long int strtoull (const char *__restrict __nptr,
210210
211/* Versions of the above functions that handle '0b' and '0B' prefixes211/* Versions of the above functions that handle '0b' and '0B' prefixes
212 in base 0 or 2. */212 in base 0 or 2. */
213#if __GLIBC_USE (C2X_STRTOL)213#if __GLIBC_USE (C23_STRTOL)
214# ifdef __REDIRECT214# ifdef __REDIRECT
215extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,215extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
216 char **__restrict __endptr,216 char **__restrict __endptr,
...@@ -274,7 +274,7 @@ extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,...@@ -274,7 +274,7 @@ extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,
274#endif274#endif
275275
276/* Convert a floating-point number to a string. */276/* 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)
278extern int strfromd (char *__dest, size_t __size, const char *__format,278extern int strfromd (char *__dest, size_t __size, const char *__format,
279 double __f)279 double __f)
280 __THROW __nonnull ((3));280 __THROW __nonnull ((3));
...@@ -360,7 +360,7 @@ extern unsigned long long int strtoull_l (const char *__restrict __nptr,...@@ -360,7 +360,7 @@ extern unsigned long long int strtoull_l (const char *__restrict __nptr,
360360
361/* Versions of the above functions that handle '0b' and '0B' prefixes361/* Versions of the above functions that handle '0b' and '0B' prefixes
362 in base 0 or 2. */362 in base 0 or 2. */
363# if __GLIBC_USE (C2X_STRTOL)363# if __GLIBC_USE (C23_STRTOL)
364# ifdef __REDIRECT364# ifdef __REDIRECT
365extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,365extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,
366 char **__restrict __endptr,366 char **__restrict __endptr,
lib/libc/glibc/sysdeps/htl/pthread.h+11
...@@ -891,6 +891,17 @@ extern int pthread_setschedparam (pthread_t __thr, int __policy,...@@ -891,6 +891,17 @@ extern int pthread_setschedparam (pthread_t __thr, int __policy,
891/* Set thread THREAD's scheduling priority. */891/* Set thread THREAD's scheduling priority. */
892extern int pthread_setschedprio (pthread_t __thr, int __prio) __THROW;892extern 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
894#ifdef __USE_GNU905#ifdef __USE_GNU
895/* Yield the processor to another thread or process.906/* Yield the processor to another thread or process.
896 This function is similar to the POSIX `sched_yield' function but907 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);...@@ -223,7 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return);
223 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */223 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
224extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;224extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
225225
226# ifndef __USE_TIME_BITS64226# ifndef __USE_TIME64_REDIRECTS
227/* Make calling thread wait for termination of the thread TH, but only227/* Make calling thread wait for termination of the thread TH, but only
228 until TIMEOUT. The exit status of the thread is stored in228 until TIMEOUT. The exit status of the thread is stored in
229 *THREAD_RETURN, if THREAD_RETURN is not NULL.229 *THREAD_RETURN, if THREAD_RETURN is not NULL.
...@@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)...@@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
796796
797#ifdef __USE_XOPEN2K797#ifdef __USE_XOPEN2K
798/* Wait until lock becomes available, or specified time passes. */798/* Wait until lock becomes available, or specified time passes. */
799# ifndef __USE_TIME_BITS64799# ifndef __USE_TIME64_REDIRECTS
800extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,800extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
801 const struct timespec *__restrict801 const struct timespec *__restrict
802 __abstime) __THROWNL __nonnull ((1, 2));802 __abstime) __THROWNL __nonnull ((1, 2));
...@@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,...@@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
813#endif813#endif
814814
815#ifdef __USE_GNU815#ifdef __USE_GNU
816# ifndef __USE_TIME_BITS64816# ifndef __USE_TIME64_REDIRECTS
817extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,817extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
818 clockid_t __clockid,818 clockid_t __clockid,
819 const struct timespec *__restrict819 const struct timespec *__restrict
...@@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)...@@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
982982
983# ifdef __USE_XOPEN2K983# ifdef __USE_XOPEN2K
984/* Try to acquire read lock for RWLOCK or return after specified time. */984/* Try to acquire read lock for RWLOCK or return after specified time. */
985# ifndef __USE_TIME_BITS64985# ifndef __USE_TIME64_REDIRECTS
986extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,986extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
987 const struct timespec *__restrict987 const struct timespec *__restrict
988 __abstime) __THROWNL __nonnull ((1, 2));988 __abstime) __THROWNL __nonnull ((1, 2));
...@@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,...@@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
1000# endif1000# endif
10011001
1002# ifdef __USE_GNU1002# ifdef __USE_GNU
1003# ifndef __USE_TIME_BITS641003# ifndef __USE_TIME64_REDIRECTS
1004extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,1004extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
1005 clockid_t __clockid,1005 clockid_t __clockid,
1006 const struct timespec *__restrict1006 const struct timespec *__restrict
...@@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)...@@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
10291029
1030# ifdef __USE_XOPEN2K1030# ifdef __USE_XOPEN2K
1031/* Try to acquire write lock for RWLOCK or return after specified time. */1031/* Try to acquire write lock for RWLOCK or return after specified time. */
1032# ifndef __USE_TIME_BITS641032# ifndef __USE_TIME64_REDIRECTS
1033extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,1033extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1034 const struct timespec *__restrict1034 const struct timespec *__restrict
1035 __abstime) __THROWNL __nonnull ((1, 2));1035 __abstime) __THROWNL __nonnull ((1, 2));
...@@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,...@@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
1047# endif1047# endif
10481048
1049# ifdef __USE_GNU1049# ifdef __USE_GNU
1050# ifndef __USE_TIME_BITS641050# ifndef __USE_TIME64_REDIRECTS
1051extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,1051extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
1052 clockid_t __clockid,1052 clockid_t __clockid,
1053 const struct timespec *__restrict1053 const struct timespec *__restrict
...@@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,...@@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
11411141
1142 This function is a cancellation point and therefore not marked with1142 This function is a cancellation point and therefore not marked with
1143 __THROW. */1143 __THROW. */
1144# ifndef __USE_TIME_BITS641144# ifndef __USE_TIME64_REDIRECTS
1145extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,1145extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1146 pthread_mutex_t *__restrict __mutex,1146 pthread_mutex_t *__restrict __mutex,
1147 const struct timespec *__restrict __abstime)1147 const struct timespec *__restrict __abstime)
...@@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait,...@@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait,
11671167
1168 This function is a cancellation point and therefore not marked with1168 This function is a cancellation point and therefore not marked with
1169 __THROW. */1169 __THROW. */
1170# ifndef __USE_TIME_BITS641170# ifndef __USE_TIME64_REDIRECTS
1171extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,1171extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
1172 pthread_mutex_t *__restrict __mutex,1172 pthread_mutex_t *__restrict __mutex,
1173 __clockid_t __clock_id,1173 __clockid_t __clock_id,
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h+1-1
...@@ -25,7 +25,7 @@...@@ -25,7 +25,7 @@
2525
26struct timex26struct timex
27{27{
28# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32)28# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32)
29 unsigned int modes; /* mode selector */29 unsigned int modes; /* mode selector */
30 int :32; /* pad */30 int :32; /* pad */
31 long long offset; /* time offset (usec) */31 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 \...@@ -468,6 +468,15 @@ L(pre_end): ASM_LINE_SEP \
468#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"468#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
469#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"469#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
471#endif /* __ASSEMBLER__ */480#endif /* __ASSEMBLER__ */
472481
473#endif /* _LINUX_HPPA_SYSDEP_H */482#endif /* _LINUX_HPPA_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h+1
...@@ -156,6 +156,7 @@...@@ -156,6 +156,7 @@
156/* List of system calls which are supported as vsyscalls (for RV32 and156/* List of system calls which are supported as vsyscalls (for RV32 and
157 RV64). */157 RV64). */
158# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"158# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
159# define HAVE_RISCV_HWPROBE "__vdso_riscv_hwprobe"
159160
160# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL161# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
161# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1162# 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...@@ -54,7 +54,7 @@ struct ntptimeval
5454
55__BEGIN_DECLS55__BEGIN_DECLS
5656
57#ifndef __USE_TIME_BITS6457#ifndef __USE_TIME64_REDIRECTS
58extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1));58extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1));
59extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1));59extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1));
6060
lib/libc/glibc/sysdeps/x86/bits/wordsize.h+2-3
...@@ -8,10 +8,9 @@...@@ -8,10 +8,9 @@
8#define __WORDSIZE32_PTRDIFF_LONG 08#define __WORDSIZE32_PTRDIFF_LONG 0
9#endif9#endif
1010
11#define __WORDSIZE_TIME64_COMPAT32 1
12
11#ifdef __x86_64__13#ifdef __x86_64__
12# define __WORDSIZE_TIME64_COMPAT32 1
13/* Both x86-64 and x32 use the 64-bit system call interface. */14/* Both x86-64 and x32 use the 64-bit system call interface. */
14# define __SYSCALL_WORDSIZE 6415# define __SYSCALL_WORDSIZE 64
15#else
16# define __WORDSIZE_TIME64_COMPAT32 0
17#endif16#endif
lib/libc/glibc/sysdeps/x86/sysdep.h+109-5
...@@ -21,14 +21,118 @@...@@ -21,14 +21,118 @@
2121
22#include <sysdeps/generic/sysdep.h>22#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__
24/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need39/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need
25 space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be40 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. */41 aligned to 16 bytes for fxsave and 64 bytes for xsave. It is non-zero
27#define STATE_SAVE_OFFSET (8 * 7 + 8)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. */130/* States which should be saved for TLSDESC_CALL and TLS_DESC_CALL.
30#define STATE_SAVE_MASK \131 Compiler assumes that all registers, including AMX and x87 FPU
31 ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))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
33/* Constants for bits in __x86_string_control: */137/* Constants for bits in __x86_string_control: */
34138
lib/libc/glibc/time/bits/types/struct_timespec.h+2-2
...@@ -10,14 +10,14 @@...@@ -10,14 +10,14 @@
10 has nanoseconds instead of microseconds. */10 has nanoseconds instead of microseconds. */
11struct timespec11struct timespec
12{12{
13#ifdef __USE_TIME_BITS6413#ifdef __USE_TIME64_REDIRECTS
14 __time64_t tv_sec; /* Seconds. */14 __time64_t tv_sec; /* Seconds. */
15#else15#else
16 __time_t tv_sec; /* Seconds. */16 __time_t tv_sec; /* Seconds. */
17#endif17#endif
18#if __WORDSIZE == 64 \18#if __WORDSIZE == 64 \
19 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \19 || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
20 || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)20 || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS)
21 __syscall_slong_t tv_nsec; /* Nanoseconds. */21 __syscall_slong_t tv_nsec; /* Nanoseconds. */
22#else22#else
23# if __BYTE_ORDER == __BIG_ENDIAN23# if __BYTE_ORDER == __BIG_ENDIAN
lib/libc/glibc/time/bits/types/struct_timeval.h+1-1
...@@ -7,7 +7,7 @@...@@ -7,7 +7,7 @@
7 microsecond but also has a range of years. */7 microsecond but also has a range of years. */
8struct timeval8struct timeval
9{9{
10#ifdef __USE_TIME_BITS6410#ifdef __USE_TIME64_REDIRECTS
11 __time64_t tv_sec; /* Seconds. */11 __time64_t tv_sec; /* Seconds. */
12 __suseconds64_t tv_usec; /* Microseconds. */12 __suseconds64_t tv_usec; /* Microseconds. */
13#else13#else
lib/libc/glibc/time/bits/types/time_t.h+1-1
...@@ -4,7 +4,7 @@...@@ -4,7 +4,7 @@
4#include <bits/types.h>4#include <bits/types.h>
55
6/* Returned by `time'. */6/* Returned by `time'. */
7#ifdef __USE_TIME_BITS647#ifdef __USE_TIME64_REDIRECTS
8typedef __time64_t time_t;8typedef __time64_t time_t;
9#else9#else
10typedef __time_t time_t;10typedef __time_t time_t;