Skip to content

Commit

Permalink
Update glibc start files to 2.40.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrp committed Aug 8, 2024
1 parent 0b76be3 commit 21ff355
Show file tree
Hide file tree
Showing 21 changed files with 401 additions and 78 deletions.
36 changes: 18 additions & 18 deletions lib/libc/glibc/bits/libc-header-start.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@

/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
macro. Most but not all symbols enabled by that macro in TS
18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
18661-1 are enabled unconditionally in C23. In C23, the symbols in
Annex F still require a new feature test macro
__STDC_WANT_IEC_60559_EXT__ instead (C2X does not define
__STDC_WANT_IEC_60559_EXT__ instead (C23 does not define
__STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
18661-1 are not included in C2X (and thus should depend on
__STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are
18661-1 are not included in C23 (and thus should depend on
__STDC_WANT_IEC_60559_BFP_EXT__ even when C23 features are
enabled).
__GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
18661-1 not included in C2X.
18661-1 not included in C23.
__GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS
18661-1 that are also included in C2X (with no feature test macro
required in C2X).
__GLIBC_USE (IEC_60559_BFP_EXT_C23) controls those features from TS
18661-1 that are also included in C23 (with no feature test macro
required in C23).
__GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
that are included in C2X but conditional on
that are included in C23 but conditional on
__STDC_WANT_IEC_60559_EXT__. (There are currently no features
conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
18661-1.) */
Expand All @@ -70,11 +70,11 @@
#else
# define __GLIBC_USE_IEC_60559_BFP_EXT 0
#endif
#undef __GLIBC_USE_IEC_60559_BFP_EXT_C2X
#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 1
#undef __GLIBC_USE_IEC_60559_BFP_EXT_C23
#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC23)
# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 1
#else
# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 0
#endif
#undef __GLIBC_USE_IEC_60559_EXT
#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
Expand All @@ -86,18 +86,18 @@
/* ISO/IEC TS 18661-4:2015 defines the
__STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
functions, the symbols from this TS are enabled unconditionally in
C2X. */
C23. */
#undef __GLIBC_USE_IEC_60559_FUNCS_EXT
#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
#else
# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
#endif
#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 1
#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C23
#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC23)
# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 1
#else
# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0
# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 0
#endif

/* ISO/IEC TS 18661-3:2015 defines the
Expand Down
33 changes: 32 additions & 1 deletion lib/libc/glibc/elf/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@ typedef struct
control. */
#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication
enabled keys. */
#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers. */
#define NT_ARM_ZA 0x40c /* ARM SME ZA registers. */
#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */
#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
Expand Down Expand Up @@ -1234,6 +1238,10 @@ typedef struct
#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */
#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment. */

/* More machine-dependent hints about processor capabilities. */
#define AT_HWCAP3 29 /* extension of AT_HWCAP. */
#define AT_HWCAP4 30 /* extension of AT_HWCAP. */

#define AT_EXECFN 31 /* Filename of executable. */

/* Pointer to the global system page used for system calls and other
Expand Down Expand Up @@ -1333,9 +1341,13 @@ typedef struct
#define NT_GNU_PROPERTY_TYPE_0 5

/* Packaging metadata as defined on
https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
https://systemd.io/ELF_PACKAGE_METADATA/ */
#define NT_FDO_PACKAGING_METADATA 0xcafe1a7e

/* dlopen metadata as defined on
https://systemd.io/ELF_DLOPEN_METADATA/ */
#define NT_FDO_DLOPEN_METADATA 0x407c0c0a

/* Note section name of program property. */
#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"

Expand Down Expand Up @@ -4237,6 +4249,8 @@ enum
#define R_LARCH_TLS_TPREL32 10
#define R_LARCH_TLS_TPREL64 11
#define R_LARCH_IRELATIVE 12
#define R_LARCH_TLS_DESC32 13
#define R_LARCH_TLS_DESC64 14

/* Reserved for future relocs that the dynamic linker must understand. */

Expand Down Expand Up @@ -4331,6 +4345,23 @@ enum
#define R_LARCH_ADD_ULEB128 107
#define R_LARCH_SUB_ULEB128 108
#define R_LARCH_64_PCREL 109
#define R_LARCH_CALL36 110
#define R_LARCH_TLS_DESC_PC_HI20 111
#define R_LARCH_TLS_DESC_PC_LO12 112
#define R_LARCH_TLS_DESC64_PC_LO20 113
#define R_LARCH_TLS_DESC64_PC_HI12 114
#define R_LARCH_TLS_DESC_HI20 115
#define R_LARCH_TLS_DESC_LO12 116
#define R_LARCH_TLS_DESC64_LO20 117
#define R_LARCH_TLS_DESC64_HI12 118
#define R_LARCH_TLS_DESC_LD 119
#define R_LARCH_TLS_DESC_CALL 120
#define R_LARCH_TLS_LE_HI20_R 121
#define R_LARCH_TLS_LE_ADD_R 122
#define R_LARCH_TLS_LE_LO12_R 123
#define R_LARCH_TLS_LD_PCREL20_S2 124
#define R_LARCH_TLS_GD_PCREL20_S2 125
#define R_LARCH_TLS_DESC_PCREL20_S2 126

/* ARC specific declarations. */

Expand Down
28 changes: 17 additions & 11 deletions lib/libc/glibc/include/libc-symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -679,23 +679,23 @@ for linking")
#endif

/* Helper / base macros for indirect function symbols. */
#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
#define __ifunc_resolver(type_name, name, expr, init, classifier, ...) \
classifier inhibit_stack_protector \
__typeof (type_name) *name##_ifunc (arg) \
__typeof (type_name) *name##_ifunc (__VA_ARGS__) \
{ \
init (); \
__typeof (type_name) *res = expr; \
return res; \
}

#ifdef HAVE_GCC_IFUNC
# define __ifunc(type_name, name, expr, arg, init) \
# define __ifunc_args(type_name, name, expr, init, ...) \
extern __typeof (type_name) name __attribute__ \
((ifunc (#name "_ifunc"))); \
__ifunc_resolver (type_name, name, expr, arg, init, static)
__ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__)

# define __ifunc_hidden(type_name, name, expr, arg, init) \
__ifunc (type_name, name, expr, arg, init)
# define __ifunc_args_hidden(type_name, name, expr, init, ...) \
__ifunc_args (type_name, name, expr, init, __VA_ARGS__)
#else
/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
as fallback. But keep in mind that the debug information for the ifunc
Expand All @@ -706,18 +706,24 @@ for linking")
different signatures. (Gcc support is disabled at least on a ppc64le
Ubuntu 14.04 system.) */

# define __ifunc(type_name, name, expr, arg, init) \
# define __ifunc_args(type_name, name, expr, init, ...) \
extern __typeof (type_name) name; \
__typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \
__ifunc_resolver (type_name, name, expr, arg, init,) \
__typeof (type_name) *name##_ifunc (__VA_ARGS__) __asm__ (#name); \
__ifunc_resolver (type_name, name, expr, init, , __VA_ARGS__) \
__asm__ (".type " #name ", %gnu_indirect_function");

# define __ifunc_hidden(type_name, name, expr, arg, init) \
# define __ifunc_args_hidden(type_name, name, expr, init, ...) \
extern __typeof (type_name) __libc_##name; \
__ifunc (type_name, __libc_##name, expr, arg, init) \
__ifunc (type_name, __libc_##name, expr, __VA_ARGS__, init) \
strong_alias (__libc_##name, name);
#endif /* !HAVE_GCC_IFUNC */

#define __ifunc(type_name, name, expr, arg, init) \
__ifunc_args (type_name, name, expr, init, arg)

#define __ifunc_hidden(type_name, name, expr, arg, init) \
__ifunc_args_hidden (type_name, name, expr, init, arg)

/* The following macros are used for indirect function symbols in libc.so.
First of all, you need to have the function prototyped somewhere,
say in foo.h:
Expand Down
4 changes: 2 additions & 2 deletions lib/libc/glibc/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ libc_hidden_proto (__isoc23_strtoul_l)
libc_hidden_proto (__isoc23_strtoll_l)
libc_hidden_proto (__isoc23_strtoull_l)

#if __GLIBC_USE (C2X_STRTOL)
/* Redirect internal uses of these functions to the C2X versions; the
#if __GLIBC_USE (C23_STRTOL)
/* Redirect internal uses of these functions to the C23 versions; the
redirection in the installed header does not work with
libc_hidden_proto. */
# undef strtol
Expand Down
7 changes: 3 additions & 4 deletions lib/libc/glibc/io/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ typedef __pid_t pid_t;
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_TIME_BITS64
#ifndef __USE_TIME64_REDIRECTS
# ifndef __USE_FILE_OFFSET64
extern int fcntl (int __fd, int __cmd, ...);
# else
Expand All @@ -189,7 +189,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
# ifdef __USE_LARGEFILE64
extern int fcntl64 (int __fd, int __cmd, ...);
# endif
#else /* __USE_TIME_BITS64 */
#else /* __USE_TIME64_REDIRECTS */
# ifdef __REDIRECT
extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
__fcntl_time64);
Expand Down Expand Up @@ -344,8 +344,7 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);


/* Define some inlines helping to catch common problems. */
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
&& defined __va_arg_pack_len
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/fcntl2.h>
#endif

Expand Down
16 changes: 8 additions & 8 deletions lib/libc/glibc/io/sys/stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file,
that file descriptor FD is open on and put them in BUF. */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
# ifdef __USE_TIME_BITS64
# ifdef __USE_TIME64_REDIRECTS
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf),
Expand All @@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
# endif
#endif
#ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
# ifndef __USE_TIME64_REDIRECTS
extern int stat64 (const char *__restrict __file,
struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
Expand Down Expand Up @@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
# else
# ifdef __USE_TIME_BITS64
# ifdef __USE_TIME64_REDIRECTS
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
Expand All @@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
# endif

# ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
# ifndef __USE_TIME64_REDIRECTS
extern int fstatat64 (int __fd, const char *__restrict __file,
struct stat64 *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
Expand All @@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd,
extern int lstat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
# else
# ifdef __USE_TIME_BITS64
# ifdef __USE_TIME64_REDIRECTS
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
Expand All @@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat,
# endif
# endif
# ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
# ifndef __USE_TIME64_REDIRECTS
extern int lstat64 (const char *__restrict __file,
struct stat64 *__restrict __buf)
__THROW __nonnull ((1, 2));
Expand Down Expand Up @@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
#endif

#ifdef __USE_ATFILE
# ifndef __USE_TIME_BITS64
# ifndef __USE_TIME64_REDIRECTS
/* Set file access and modification times relative to directory file
descriptor. */
extern int utimensat (int __fd, const char *__path,
Expand All @@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
#endif

#ifdef __USE_XOPEN2K8
# ifndef __USE_TIME_BITS64
# ifndef __USE_TIME64_REDIRECTS
/* Set file access and modification times of the file associated with FD. */
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;

Expand Down
Loading

0 comments on commit 21ff355

Please sign in to comment.