update glibc start files to 2.38

I went ahead and left the README.md file deleted because it had broken
git hashes. Better to use `git log -- lib/libc/glibc/` to find out the
patches.
This commit is contained in:
Andrew Kelley 2023-10-11 19:54:18 -07:00
parent 87b3e23172
commit 2314051aca
264 changed files with 1248 additions and 1997 deletions

View file

@ -1,9 +0,0 @@
glibc headers are slightly patched for backwards compatibility. This is not
good, because it requires to maintain our patchset whlist upgrading glibc.
Until universal headers are real and this file can be removed, these commits
need to be cherry-picked in the future glibc header upgrades:
- 39083c31a550ed80f369f60d35791e98904b8096
- a89813ef282c092a9caf699731c7faaf485acabe
- 3eaca9bbc6fee4b6be0f22b844f7d3214222f434

View file

@ -1,5 +1,5 @@
/* Macros and inline functions to swap the order of bytes in integer values. /* Macros and inline functions to swap the order of bytes in integer values.
Copyright (C) 1997-2021 Free Software Foundation, Inc. Copyright (C) 1997-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/* Macros to control TS 18661-3 glibc features where the same /* Macros to control TS 18661-3 glibc features where the same
definitions are appropriate for all platforms. definitions are appropriate for all platforms.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -78,7 +78,7 @@
or _FloatNx types, if __HAVE_<type> is 1. The corresponding or _FloatNx types, if __HAVE_<type> is 1. The corresponding
literal suffixes exist since GCC 7, for C only. */ literal suffixes exist since GCC 7, for C only. */
# if __HAVE_FLOAT16 # if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
/* No corresponding suffix available for this type. */ /* No corresponding suffix available for this type. */
# define __f16(x) ((_Float16) x##f) # define __f16(x) ((_Float16) x##f)
# else # else
@ -87,7 +87,7 @@
# endif # endif
# if __HAVE_FLOAT32 # if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __f32(x) x##f # define __f32(x) x##f
# else # else
# define __f32(x) x##f32 # define __f32(x) x##f32
@ -95,7 +95,7 @@
# endif # endif
# if __HAVE_FLOAT64 # if __HAVE_FLOAT64
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# ifdef __NO_LONG_DOUBLE_MATH # ifdef __NO_LONG_DOUBLE_MATH
# define __f64(x) x##l # define __f64(x) x##l
# else # else
@ -107,7 +107,7 @@
# endif # endif
# if __HAVE_FLOAT32X # if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __f32x(x) x # define __f32x(x) x
# else # else
# define __f32x(x) x##f32x # define __f32x(x) x##f32x
@ -115,7 +115,7 @@
# endif # endif
# if __HAVE_FLOAT64X # if __HAVE_FLOAT64X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# if __HAVE_FLOAT64X_LONG_DOUBLE # if __HAVE_FLOAT64X_LONG_DOUBLE
# define __f64x(x) x##l # define __f64x(x) x##l
# else # else
@ -127,7 +127,7 @@
# endif # endif
# if __HAVE_FLOAT128X # if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128X supported but no constant suffix" # error "_Float128X supported but no constant suffix"
# else # else
# define __f128x(x) x##f128x # define __f128x(x) x##f128x
@ -136,7 +136,7 @@
/* Defined to a complex type if __HAVE_<type> is 1. */ /* Defined to a complex type if __HAVE_<type> is 1. */
# if __HAVE_FLOAT16 # if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__))); typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# define __CFLOAT16 __cfloat16 # define __CFLOAT16 __cfloat16
# else # else
@ -145,7 +145,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# endif # endif
# if __HAVE_FLOAT32 # if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __CFLOAT32 _Complex float # define __CFLOAT32 _Complex float
# else # else
# define __CFLOAT32 _Complex _Float32 # define __CFLOAT32 _Complex _Float32
@ -153,7 +153,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# endif # endif
# if __HAVE_FLOAT64 # if __HAVE_FLOAT64
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# ifdef __NO_LONG_DOUBLE_MATH # ifdef __NO_LONG_DOUBLE_MATH
# define __CFLOAT64 _Complex long double # define __CFLOAT64 _Complex long double
# else # else
@ -165,7 +165,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# endif # endif
# if __HAVE_FLOAT32X # if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __CFLOAT32X _Complex double # define __CFLOAT32X _Complex double
# else # else
# define __CFLOAT32X _Complex _Float32x # define __CFLOAT32X _Complex _Float32x
@ -173,7 +173,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# endif # endif
# if __HAVE_FLOAT64X # if __HAVE_FLOAT64X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# if __HAVE_FLOAT64X_LONG_DOUBLE # if __HAVE_FLOAT64X_LONG_DOUBLE
# define __CFLOAT64X _Complex long double # define __CFLOAT64X _Complex long double
# else # else
@ -185,7 +185,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# endif # endif
# if __HAVE_FLOAT128X # if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128X supported but no complex type" # error "_Float128X supported but no complex type"
# else # else
# define __CFLOAT128X _Complex _Float128x # define __CFLOAT128X _Complex _Float128x
@ -195,7 +195,7 @@ typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
/* The remaining of this file provides support for older compilers. */ /* The remaining of this file provides support for older compilers. */
# if __HAVE_FLOAT16 # if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef float _Float16 __attribute__ ((__mode__ (__HF__))); typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
# endif # endif
@ -210,7 +210,7 @@ typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
# if __HAVE_FLOAT32 # if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef float _Float32; typedef float _Float32;
# endif # endif
@ -234,7 +234,7 @@ typedef float _Float32;
# ifdef __NO_LONG_DOUBLE_MATH # ifdef __NO_LONG_DOUBLE_MATH
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef long double _Float64; typedef long double _Float64;
# endif # endif
@ -247,7 +247,7 @@ typedef long double _Float64;
# else # else
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef double _Float64; typedef double _Float64;
# endif # endif
@ -264,7 +264,7 @@ typedef double _Float64;
# if __HAVE_FLOAT32X # if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef double _Float32x; typedef double _Float32x;
# endif # endif
@ -281,7 +281,7 @@ typedef double _Float32x;
# if __HAVE_FLOAT64X_LONG_DOUBLE # if __HAVE_FLOAT64X_LONG_DOUBLE
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef long double _Float64x; typedef long double _Float64x;
# endif # endif
@ -294,7 +294,7 @@ typedef long double _Float64x;
# else # else
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef _Float128 _Float64x; typedef _Float128 _Float64x;
# endif # endif
@ -311,7 +311,7 @@ typedef _Float128 _Float64x;
# if __HAVE_FLOAT128X # if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus # if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128x supported but no type" # error "_Float128x supported but no type"
# endif # endif

View file

@ -1,5 +1,5 @@
/* Handle feature test macros at the start of a header. /* Handle feature test macros at the start of a header.
Copyright (C) 2016-2021 Free Software Foundation, Inc. Copyright (C) 2016-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Properties of long double type. /* Properties of long double type.
Copyright (C) 2016-2021 Free Software Foundation, Inc. Copyright (C) 2016-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2021 Free Software Foundation, Inc. /* Copyright (C) 1997-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Signal number constants. Generic template. /* Signal number constants. Generic template.
Copyright (C) 1991-2021 Free Software Foundation, Inc. Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1992-2021 Free Software Foundation, Inc. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Define intN_t types. /* Define intN_t types.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Perform binary search - inline version. /* Perform binary search - inline version.
Copyright (C) 1991-2021 Free Software Foundation, Inc. Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -29,14 +29,23 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
while (__l < __u) while (__l < __u)
{ {
__idx = (__l + __u) / 2; __idx = (__l + __u) / 2;
__p = (void *) (((const char *) __base) + (__idx * __size)); __p = (const void *) (((const char *) __base) + (__idx * __size));
__comparison = (*__compar) (__key, __p); __comparison = (*__compar) (__key, __p);
if (__comparison < 0) if (__comparison < 0)
__u = __idx; __u = __idx;
else if (__comparison > 0) else if (__comparison > 0)
__l = __idx + 1; __l = __idx + 1;
else else
{
#if __GNUC_PREREQ(4, 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-qual"
#endif
return (void *) __p; return (void *) __p;
#if __GNUC_PREREQ(4, 6)
# pragma GCC diagnostic pop
#endif
}
} }
return NULL; return NULL;

View file

@ -1,5 +1,5 @@
/* bits/time64.h -- underlying types for __time64_t. Generic version. /* bits/time64.h -- underlying types for __time64_t. Generic version.
Copyright (C) 2018-2021 Free Software Foundation, Inc. Copyright (C) 2018-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Bit size of the time_t type at glibc build time, general case. /* Bit size of the time_t type at glibc build time, general case.
Copyright (C) 2018-2021 Free Software Foundation, Inc. Copyright (C) 2018-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,5 @@
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#include <bits/wordsize.h>
/* Size in bits of the 'time_t' type of the default ABI. */ /* Size in bits of the 'time_t' type of the default ABI. */
#define __TIMESIZE __WORDSIZE #define __TIMESIZE 64

View file

@ -1,5 +1,5 @@
/* Sched parameter structure. Generic version. /* Sched parameter structure. Generic version.
Copyright (C) 1996-2021 Free Software Foundation, Inc. Copyright (C) 1996-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Generic version. /* bits/typesizes.h -- underlying types for *_t. Generic version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Inline functions to return unsigned integer values unchanged. /* Inline functions to return unsigned integer values unchanged.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Definitions of flag bits for `waitpid' et al. /* Definitions of flag bits for `waitpid' et al.
Copyright (C) 1992-2021 Free Software Foundation, Inc. Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Definitions of status bits for `wait' et al. /* Definitions of status bits for `wait' et al.
Copyright (C) 1992-2021 Free Software Foundation, Inc. Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Definition of `errno' variable. Canonical version. /* Definition of `errno' variable. Canonical version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2005-2021 Free Software Foundation, Inc. /* Copyright (C) 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros. /* This file defines standard ELF types, structures, and macros.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -210,7 +210,7 @@ typedef struct
#define EM_68HC12 53 /* Motorola M68HC12 */ #define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
#define EM_PCP 55 /* Siemens PCP */ #define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ #define EM_NCPU 56 /* Sony nCPU embedded RISC */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */ #define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Start*Core processor */ #define EM_STARCORE 58 /* Motorola Start*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */ #define EM_ME16 59 /* Toyota ME16 processor */
@ -358,8 +358,9 @@ typedef struct
#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */ #define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
#define EM_CSKY 252 /* C-SKY */ #define EM_CSKY 252 /* C-SKY */
#define EM_LOONGARCH 258 /* LoongArch */
#define EM_NUM 253 #define EM_NUM 259
/* Old spellings/synonyms. */ /* Old spellings/synonyms. */
@ -443,7 +444,8 @@ typedef struct
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */ #define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */ #define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
#define SHT_NUM 19 /* Number of defined types. */ #define SHT_RELR 19 /* RELR relative relocations */
#define SHT_NUM 20 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific. */ #define SHT_LOOS 0x60000000 /* Start OS-specific. */
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
@ -504,6 +506,7 @@ typedef struct
/* Legal values for ch_type (compression algorithm). */ /* Legal values for ch_type (compression algorithm). */
#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */ #define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */
#define ELFCOMPRESS_ZSTD 2 /* Zstandard algorithm. */
#define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */ #define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */
#define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */ #define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */
#define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */ #define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */
@ -556,7 +559,7 @@ typedef struct
/* Possible bitmasks for si_flags. */ /* Possible bitmasks for si_flags. */
#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */ #define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */ #define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-through symbol for translator */
#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */ #define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy #define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
loaded */ loaded */
@ -662,6 +665,11 @@ typedef struct
Elf64_Sxword r_addend; /* Addend */ Elf64_Sxword r_addend; /* Addend */
} Elf64_Rela; } Elf64_Rela;
/* RELR relocation table entry */
typedef Elf32_Word Elf32_Relr;
typedef Elf64_Xword Elf64_Relr;
/* How to extract and insert information held in the r_info field. */ /* How to extract and insert information held in the r_info field. */
#define ELF32_R_SYM(val) ((val) >> 8) #define ELF32_R_SYM(val) ((val) >> 8)
@ -720,6 +728,7 @@ typedef struct
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */ #define PT_GNU_PROPERTY 0x6474e553 /* GNU property */
#define PT_GNU_SFRAME 0x6474e554 /* SFrame segment. */
#define PT_LOSUNW 0x6ffffffa #define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
@ -801,6 +810,7 @@ typedef struct
#define NT_S390_GS_BC 0x30c /* s390 guarded storage #define NT_S390_GS_BC 0x30c /* s390 guarded storage
broadcast control block. */ broadcast control block. */
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */ #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */
#define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data. */
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
#define NT_ARM_TLS 0x401 /* ARM TLS register */ #define NT_ARM_TLS 0x401 /* ARM TLS register */
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
@ -822,6 +832,15 @@ typedef struct
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */ #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */ #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */ #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and
status registers. */
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD
Extension registers. */
#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced
SIMD Extension registers. */
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary
Translation registers. */
/* Legal values for the note segment descriptor types for object files. */ /* Legal values for the note segment descriptor types for object files. */
@ -887,7 +906,10 @@ typedef struct
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */ #define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */
#define DT_NUM 35 /* Number used */ #define DT_RELRSZ 35 /* Total size of RELR relative relocations */
#define DT_RELR 36 /* Address of RELR relative relocations */
#define DT_RELRENT 37 /* Size of one RELR relative relocaction */
#define DT_NUM 38 /* Number used */
#define DT_LOOS 0x6000000d /* Start of OS-specific */ #define DT_LOOS 0x6000000d /* Start of OS-specific */
#define DT_HIOS 0x6ffff000 /* End of OS-specific */ #define DT_HIOS 0x6ffff000 /* End of OS-specific */
#define DT_LOPROC 0x70000000 /* Start of processor-specific */ #define DT_LOPROC 0x70000000 /* Start of processor-specific */
@ -1044,7 +1066,8 @@ typedef struct
/* Legal values for vd_flags (version information flags). */ /* Legal values for vd_flags (version information flags). */
#define VER_FLG_BASE 0x1 /* Version definition of file itself */ #define VER_FLG_BASE 0x1 /* Version definition of file itself */
#define VER_FLG_WEAK 0x2 /* Weak version identifier */ #define VER_FLG_WEAK 0x2 /* Weak version identifier. Also
used by vna_flags below. */
/* Versym symbol index values. */ /* Versym symbol index values. */
#define VER_NDX_LOCAL 0 /* Symbol is local. */ #define VER_NDX_LOCAL 0 /* Symbol is local. */
@ -1122,10 +1145,6 @@ typedef struct
} Elf64_Vernaux; } Elf64_Vernaux;
/* Legal values for vna_flags. */
#define VER_FLG_WEAK 0x2 /* Weak version identifier */
/* Auxiliary vector. */ /* Auxiliary vector. */
/* This vector is normally only used by the program interpreter. The /* This vector is normally only used by the program interpreter. The
@ -1205,6 +1224,9 @@ typedef struct
#define AT_HWCAP2 26 /* More machine-dependent hints about #define AT_HWCAP2 26 /* More machine-dependent hints about
processor capabilities. */ processor capabilities. */
#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */
#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment. */
#define AT_EXECFN 31 /* Filename of executable. */ #define AT_EXECFN 31 /* Filename of executable. */
/* Pointer to the global system page used for system calls and other /* Pointer to the global system page used for system calls and other
@ -1231,8 +1253,7 @@ typedef struct
#define AT_L3_CACHESIZE 46 #define AT_L3_CACHESIZE 46
#define AT_L3_CACHEGEOMETRY 47 #define AT_L3_CACHEGEOMETRY 47
#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery #define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery */
(AArch64). */
/* Note section contents. Each entry in the note section begins with /* Note section contents. Each entry in the note section begins with
a header of a fixed form. */ a header of a fixed form. */
@ -1259,6 +1280,8 @@ typedef struct
/* Note entries for GNU systems have this name. */ /* Note entries for GNU systems have this name. */
#define ELF_NOTE_GNU "GNU" #define ELF_NOTE_GNU "GNU"
/* Note entries for freedesktop.org have this name. */
#define ELF_NOTE_FDO "FDO"
/* Defined types of notes for Solaris. */ /* Defined types of notes for Solaris. */
@ -1302,6 +1325,10 @@ typedef struct
/* Program property. */ /* Program property. */
#define NT_GNU_PROPERTY_TYPE_0 5 #define NT_GNU_PROPERTY_TYPE_0 5
/* Packaging metadata as defined on
https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
#define NT_FDO_PACKAGING_METADATA 0xcafe1a7e
/* Note section name of program property. */ /* Note section name of program property. */
#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property" #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
@ -1312,6 +1339,23 @@ typedef struct
/* No copy relocation on protected data symbol. */ /* No copy relocation on protected data symbol. */
#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2 #define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
/* A 4-byte unsigned integer property: A bit is set if it is set in all
relocatable inputs. */
#define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
#define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff
/* A 4-byte unsigned integer property: A bit is set if it is set in any
relocatable inputs. */
#define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
#define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff
/* The needed properties by the object file. */
#define GNU_PROPERTY_1_NEEDED GNU_PROPERTY_UINT32_OR_LO
/* Set if the object file requires canonical function pointers and
cannot be used with copy relocation. */
#define GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS (1U << 0)
/* Processor-specific semantics, lo */ /* Processor-specific semantics, lo */
#define GNU_PROPERTY_LOPROC 0xc0000000 #define GNU_PROPERTY_LOPROC 0xc0000000
/* Processor-specific semantics, hi */ /* Processor-specific semantics, hi */
@ -2871,6 +2915,9 @@ enum
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */ #define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */ #define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* MTE memory tag segment type. */
#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 2)
/* AArch64 specific values for the Dyn d_tag field. */ /* AArch64 specific values for the Dyn d_tag field. */
#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1) #define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3) #define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
@ -3896,6 +3943,8 @@ enum
#define EF_RISCV_FLOAT_ABI_SINGLE 0x0002 #define EF_RISCV_FLOAT_ABI_SINGLE 0x0002
#define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004 #define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004
#define EF_RISCV_FLOAT_ABI_QUAD 0x0006 #define EF_RISCV_FLOAT_ABI_QUAD 0x0006
#define EF_RISCV_RVE 0x0008
#define EF_RISCV_TSO 0x0010
/* RISC-V relocations. */ /* RISC-V relocations. */
#define R_RISCV_NONE 0 #define R_RISCV_NONE 0
@ -3953,8 +4002,24 @@ enum
#define R_RISCV_SET32 56 #define R_RISCV_SET32 56
#define R_RISCV_32_PCREL 57 #define R_RISCV_32_PCREL 57
#define R_RISCV_IRELATIVE 58 #define R_RISCV_IRELATIVE 58
#define R_RISCV_PLT32 59
#define R_RISCV_SET_ULEB128 60
#define R_RISCV_SUB_ULEB128 61
#define R_RISCV_NUM 59 #define R_RISCV_NUM 62
/* RISC-V specific values for the st_other field. */
#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
convention */
/* RISC-V specific values for the sh_type field. */
#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
/* RISC-V specific values for the p_type field. */
#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
/* RISC-V specific values for the d_tag field. */
#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
/* BPF specific declarations. */ /* BPF specific declarations. */
@ -4034,13 +4099,130 @@ enum
#define R_NDS32_TLS_TPOFF 102 #define R_NDS32_TLS_TPOFF 102
#define R_NDS32_TLS_DESC 119 #define R_NDS32_TLS_DESC 119
/* LoongArch ELF Flags */
#define EF_LARCH_ABI_MODIFIER_MASK 0x07
#define EF_LARCH_ABI_SOFT_FLOAT 0x01
#define EF_LARCH_ABI_SINGLE_FLOAT 0x02
#define EF_LARCH_ABI_DOUBLE_FLOAT 0x03
#define EF_LARCH_OBJABI_V1 0x40
/* LoongArch specific dynamic relocations */
#define R_LARCH_NONE 0
#define R_LARCH_32 1
#define R_LARCH_64 2
#define R_LARCH_RELATIVE 3
#define R_LARCH_COPY 4
#define R_LARCH_JUMP_SLOT 5
#define R_LARCH_TLS_DTPMOD32 6
#define R_LARCH_TLS_DTPMOD64 7
#define R_LARCH_TLS_DTPREL32 8
#define R_LARCH_TLS_DTPREL64 9
#define R_LARCH_TLS_TPREL32 10
#define R_LARCH_TLS_TPREL64 11
#define R_LARCH_IRELATIVE 12
/* Reserved for future relocs that the dynamic linker must understand. */
/* used by the static linker for relocating .text. */
#define R_LARCH_MARK_LA 20
#define R_LARCH_MARK_PCREL 21
#define R_LARCH_SOP_PUSH_PCREL 22
#define R_LARCH_SOP_PUSH_ABSOLUTE 23
#define R_LARCH_SOP_PUSH_DUP 24
#define R_LARCH_SOP_PUSH_GPREL 25
#define R_LARCH_SOP_PUSH_TLS_TPREL 26
#define R_LARCH_SOP_PUSH_TLS_GOT 27
#define R_LARCH_SOP_PUSH_TLS_GD 28
#define R_LARCH_SOP_PUSH_PLT_PCREL 29
#define R_LARCH_SOP_ASSERT 30
#define R_LARCH_SOP_NOT 31
#define R_LARCH_SOP_SUB 32
#define R_LARCH_SOP_SL 33
#define R_LARCH_SOP_SR 34
#define R_LARCH_SOP_ADD 35
#define R_LARCH_SOP_AND 36
#define R_LARCH_SOP_IF_ELSE 37
#define R_LARCH_SOP_POP_32_S_10_5 38
#define R_LARCH_SOP_POP_32_U_10_12 39
#define R_LARCH_SOP_POP_32_S_10_12 40
#define R_LARCH_SOP_POP_32_S_10_16 41
#define R_LARCH_SOP_POP_32_S_10_16_S2 42
#define R_LARCH_SOP_POP_32_S_5_20 43
#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
#define R_LARCH_SOP_POP_32_U 46
/* used by the static linker for relocating non .text. */
#define R_LARCH_ADD8 47
#define R_LARCH_ADD16 48
#define R_LARCH_ADD24 49
#define R_LARCH_ADD32 50
#define R_LARCH_ADD64 51
#define R_LARCH_SUB8 52
#define R_LARCH_SUB16 53
#define R_LARCH_SUB24 54
#define R_LARCH_SUB32 55
#define R_LARCH_SUB64 56
#define R_LARCH_GNU_VTINHERIT 57
#define R_LARCH_GNU_VTENTRY 58
/* reserved 59-63 */
#define R_LARCH_B16 64
#define R_LARCH_B21 65
#define R_LARCH_B26 66
#define R_LARCH_ABS_HI20 67
#define R_LARCH_ABS_LO12 68
#define R_LARCH_ABS64_LO20 69
#define R_LARCH_ABS64_HI12 70
#define R_LARCH_PCALA_HI20 71
#define R_LARCH_PCALA_LO12 72
#define R_LARCH_PCALA64_LO20 73
#define R_LARCH_PCALA64_HI12 74
#define R_LARCH_GOT_PC_HI20 75
#define R_LARCH_GOT_PC_LO12 76
#define R_LARCH_GOT64_PC_LO20 77
#define R_LARCH_GOT64_PC_HI12 78
#define R_LARCH_GOT_HI20 79
#define R_LARCH_GOT_LO12 80
#define R_LARCH_GOT64_LO20 81
#define R_LARCH_GOT64_HI12 82
#define R_LARCH_TLS_LE_HI20 83
#define R_LARCH_TLS_LE_LO12 84
#define R_LARCH_TLS_LE64_LO20 85
#define R_LARCH_TLS_LE64_HI12 86
#define R_LARCH_TLS_IE_PC_HI20 87
#define R_LARCH_TLS_IE_PC_LO12 88
#define R_LARCH_TLS_IE64_PC_LO20 89
#define R_LARCH_TLS_IE64_PC_HI12 90
#define R_LARCH_TLS_IE_HI20 91
#define R_LARCH_TLS_IE_LO12 92
#define R_LARCH_TLS_IE64_LO20 93
#define R_LARCH_TLS_IE64_HI12 94
#define R_LARCH_TLS_LD_PC_HI20 95
#define R_LARCH_TLS_LD_HI20 96
#define R_LARCH_TLS_GD_PC_HI20 97
#define R_LARCH_TLS_GD_HI20 98
#define R_LARCH_32_PCREL 99
#define R_LARCH_RELAX 100
/* ARC specific declarations. */
/* Processor specific flags for the Ehdr e_flags field. */
#define EF_ARC_MACH_MSK 0x000000ff
#define EF_ARC_OSABI_MSK 0x00000f00
#define EF_ARC_ALL_MSK (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
/* Processor specific values for the Shdr sh_type field. */
#define SHT_ARC_ATTRIBUTES (SHT_LOPROC + 1) /* ARC attributes section. */
/* ARCompact/ARCv2 specific relocs. */ /* ARCompact/ARCv2 specific relocs. */
#define R_ARC_NONE 0x0 #define R_ARC_NONE 0x0
#define R_ARC_8 0x1 #define R_ARC_8 0x1
#define R_ARC_16 0x2 #define R_ARC_16 0x2
#define R_ARC_24 0x3 #define R_ARC_24 0x3
#define R_ARC_32 0x4 #define R_ARC_32 0x4
#define R_ARC_B26 0x5
#define R_ARC_B22_PCREL 0x6 #define R_ARC_B22_PCREL 0x6
#define R_ARC_H30 0x7 #define R_ARC_H30 0x7
#define R_ARC_N8 0x8 #define R_ARC_N8 0x8
@ -4080,16 +4262,23 @@ enum
#define R_ARC_SECTOFF_ME_2 0x2A #define R_ARC_SECTOFF_ME_2 0x2A
#define R_ARC_SECTOFF_1 0x2B #define R_ARC_SECTOFF_1 0x2B
#define R_ARC_SECTOFF_2 0x2C #define R_ARC_SECTOFF_2 0x2C
#define R_ARC_SDA_12 0x2D
#define R_ARC_SDA16_ST2 0x30
#define R_ARC_32_PCREL 0x31
#define R_ARC_PC32 0x32 #define R_ARC_PC32 0x32
#define R_ARC_GOTPC32 0x33 #define R_ARC_GOTPC32 0x33
#define R_ARC_PLT32 0x34 #define R_ARC_PLT32 0x34
#define R_ARC_COPY 0x35 #define R_ARC_COPY 0x35
#define R_ARC_GLOB_DAT 0x36 #define R_ARC_GLOB_DAT 0x36
#define R_ARC_JUMP_SLOT 0x37 #define R_ARC_JMP_SLOT 0x37
#define R_ARC_RELATIVE 0x38 #define R_ARC_RELATIVE 0x38
#define R_ARC_GOTOFF 0x39 #define R_ARC_GOTOFF 0x39
#define R_ARC_GOTPC 0x3A #define R_ARC_GOTPC 0x3A
#define R_ARC_GOT32 0x3B #define R_ARC_GOT32 0x3B
#define R_ARC_S21W_PCREL_PLT 0x3C
#define R_ARC_S25H_PCREL_PLT 0x3D
#define R_ARC_JLI_SECTOFF 0x3F
#define R_ARC_TLS_DTPMOD 0x42 #define R_ARC_TLS_DTPMOD 0x42
#define R_ARC_TLS_DTPOFF 0x43 #define R_ARC_TLS_DTPOFF 0x43
@ -4098,8 +4287,48 @@ enum
#define R_ARC_TLS_GD_LD 0x46 #define R_ARC_TLS_GD_LD 0x46
#define R_ARC_TLS_GD_CALL 0x47 #define R_ARC_TLS_GD_CALL 0x47
#define R_ARC_TLS_IE_GOT 0x48 #define R_ARC_TLS_IE_GOT 0x48
#define R_ARC_TLS_DTPOFF_S9 0x4a #define R_ARC_TLS_DTPOFF_S9 0x49
#define R_ARC_TLS_LE_S9 0x4a #define R_ARC_TLS_LE_S9 0x4A
#define R_ARC_TLS_LE_32 0x4b #define R_ARC_TLS_LE_32 0x4B
#define R_ARC_S25W_PCREL_PLT 0x4C
#define R_ARC_S21H_PCREL_PLT 0x4D
#define R_ARC_NPS_CMEM16 0x4E
/* OpenRISC 1000 specific relocs. */
#define R_OR1K_NONE 0
#define R_OR1K_32 1
#define R_OR1K_16 2
#define R_OR1K_8 3
#define R_OR1K_LO_16_IN_INSN 4
#define R_OR1K_HI_16_IN_INSN 5
#define R_OR1K_INSN_REL_26 6
#define R_OR1K_GNU_VTENTRY 7
#define R_OR1K_GNU_VTINHERIT 8
#define R_OR1K_32_PCREL 9
#define R_OR1K_16_PCREL 10
#define R_OR1K_8_PCREL 11
#define R_OR1K_GOTPC_HI16 12
#define R_OR1K_GOTPC_LO16 13
#define R_OR1K_GOT16 14
#define R_OR1K_PLT26 15
#define R_OR1K_GOTOFF_HI16 16
#define R_OR1K_GOTOFF_LO16 17
#define R_OR1K_COPY 18
#define R_OR1K_GLOB_DAT 19
#define R_OR1K_JMP_SLOT 20
#define R_OR1K_RELATIVE 21
#define R_OR1K_TLS_GD_HI16 22
#define R_OR1K_TLS_GD_LO16 23
#define R_OR1K_TLS_LDM_HI16 24
#define R_OR1K_TLS_LDM_LO16 25
#define R_OR1K_TLS_LDO_HI16 26
#define R_OR1K_TLS_LDO_LO16 27
#define R_OR1K_TLS_IE_HI16 28
#define R_OR1K_TLS_IE_LO16 29
#define R_OR1K_TLS_LE_HI16 30
#define R_OR1K_TLS_LE_LO16 31
#define R_OR1K_TLS_TPOFF 32
#define R_OR1K_TLS_DTPOFF 33
#define R_OR1K_TLS_DTPMOD 34
#endif /* elf.h */ #endif /* elf.h */

View file

@ -1,5 +1,5 @@
/* Helper macros for pointer arithmetic. /* Helper macros for pointer arithmetic.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -60,4 +60,12 @@
#define PTR_ALIGN_UP(base, size) \ #define PTR_ALIGN_UP(base, size) \
((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size))) ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
/* Check if BASE is aligned on SIZE */
#define PTR_IS_ALIGNED(base, size) \
((((uintptr_t) (base)) & (size - 1)) == 0)
/* Returns the ptrdiff_t difference between P1 and P2. */
#define PTR_DIFF(p1, p2) \
((ptrdiff_t)((uintptr_t)(p1) - (uintptr_t)(p2)))
#endif #endif

View file

@ -1,6 +1,6 @@
/* Support macros for making weak and strong aliases for symbols, /* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld. and for using symbol sets and linker warnings with GNU ld.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -155,14 +155,6 @@
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
__attribute_copy__ (name); __attribute_copy__ (name);
/* Same as WEAK_ALIAS, but mark symbol as hidden. */
# define weak_hidden_alias(name, aliasname) \
_weak_hidden_alias (name, aliasname)
# define _weak_hidden_alias(name, aliasname) \
extern __typeof (name) aliasname \
__attribute__ ((weak, alias (#name), __visibility__ ("hidden"))) \
__attribute_copy__ (name);
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */ /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (weak symbol) # define weak_extern(symbol) _weak_extern (weak symbol)
# define _weak_extern(expr) _Pragma (#expr) # define _weak_extern(expr) _Pragma (#expr)
@ -245,105 +237,32 @@ requires at runtime the shared libraries from the glibc version used \
for linking") for linking")
#endif #endif
/* Resource Freeing Hooks:
Normally a process exits and the OS cleans up any allocated
memory. However, when tooling like mtrace or valgrind is monitoring
the process we need to free all resources that are part of the
process in order to provide the consistency required to track
memory leaks.
A single public API exists and is __libc_freeres(), and this is used
by applications like valgrind to freee resouces.
There are 3 cases:
(a) __libc_freeres
In this case all you need to do is define the freeing routine:
foo.c:
libfoo_freeres_fn (foo_freeres)
{
complex_free (mem);
}
This ensures the function is called at the right point to free
resources.
(b) __libc_freeres_ptr
The framework for (a) iterates over the list of pointers-to-free
in (b) and frees them.
foo.c:
libc_freeres_ptr (static char *foo_buffer);
Freeing these resources alaways happens last and is equivalent
to registering a function that does 'free (foo_buffer)'.
(c) Explicit lists of free routines to call or objects to free.
It is the intended goal to remove (a) and (b) which have some
non-determinism based on link order, and instead use explicit
lists of functions and frees to resolve cleanup ordering issues
and make it easy to debug and maintain.
As of today the following subsystems use (c):
Per-thread cleanup:
* malloc/thread-freeres.c
libdl cleanup:
* dlfcn/dlfreeres.c
libpthread cleanup:
* nptl/nptlfreeres.c
So if you need any shutdown routines to run you should add them
directly to the appropriate subsystem's shutdown list. */
/* Resource pointers to free in libc.so. */
#define libc_freeres_ptr(decl) \
__make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
/* Resource freeing functions from libc.so go in this section. */
#define __libc_freeres_fn_section \
__attribute__ ((__used__, section ("__libc_freeres_fn")))
/* Resource freeing functions for libc.so. */
#define libc_freeres_fn(name) \
static void name (void) __attribute_used__ __libc_freeres_fn_section; \
text_set_element (__libc_subfreeres, name); \
static void name (void)
/* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
alias to ORIGINAL, when the assembler supports such declarations alias to ORIGINAL, when the assembler supports such declarations
(such as in ELF). (such as in ELF).
This is only necessary when defining something in assembly, or playing This is only necessary when defining something in assembly, or playing
funny alias games where the size should be other than what the compiler funny alias games where the size should be other than what the compiler
thinks it is. */ thinks it is. */
#define declare_symbol_alias(symbol, original, type, size) \ #define declare_object_symbol_alias(symbol, original, size) \
declare_symbol_alias_1 (symbol, original, type, size) declare_object_symbol_alias_1 (symbol, original, size)
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
# define declare_symbol_alias_1(symbol, original, type, size) \ # define declare_object_symbol_alias_1(symbol, original, s_size) \
strong_alias (original, symbol); \ strong_alias (original, symbol) ASM_LINE_SEP \
.type C_SYMBOL_NAME (symbol), %##type; \ .type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
.size C_SYMBOL_NAME (symbol), size .size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
#else /* Not __ASSEMBLER__. */ #else /* Not __ASSEMBLER__. */
# define declare_symbol_alias_1(symbol, original, type, size) \
asm (".globl " __SYMBOL_PREFIX #symbol \
"\n\t" declare_symbol_alias_1_alias (symbol, original) \
"\n\t.type " __SYMBOL_PREFIX #symbol ", " \
"%" #type \
"\n\t.size " __SYMBOL_PREFIX #symbol ", " #size);
# ifdef HAVE_ASM_SET_DIRECTIVE # ifdef HAVE_ASM_SET_DIRECTIVE
# define declare_symbol_alias_1_alias(symbol, original) \ # define declare_object_symbol_alias_1(symbol, original, size) \
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original asm (".global " __SYMBOL_PREFIX # symbol "\n" \
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX original "\n" \
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# else # else
# define declare_symbol_alias_1_alias(symbol, original) \ # define declare_object_symbol_alias_1(symbol, original, size) \
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original asm (".global " __SYMBOL_PREFIX # symbol "\n" \
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX original "\n" \
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# endif /* HAVE_ASM_SET_DIRECTIVE */ # endif /* HAVE_ASM_SET_DIRECTIVE */
#endif /* __ASSEMBLER__ */ #endif /* __ASSEMBLER__ */
@ -419,7 +338,7 @@ for linking")
_set_symbol_version (real, #name "@@" #version) _set_symbol_version (real, #name "@@" #version)
# endif # endif
/* Evalutes to a string literal for VERSION in LIB. */ /* Evaluates to a string literal for VERSION in LIB. */
# define symbol_version_string(lib, version) \ # define symbol_version_string(lib, version) \
_symbol_version_stringify_1 (VERSION_##lib##_##version) _symbol_version_stringify_1 (VERSION_##lib##_##version)
# define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg) # define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg)
@ -532,11 +451,15 @@ for linking")
__attribute__ ((visibility ("hidden"), ##attrs)) __attribute__ ((visibility ("hidden"), ##attrs))
# define hidden_proto(name, attrs...) \ # define hidden_proto(name, attrs...) \
__hidden_proto (name, , __GI_##name, ##attrs) __hidden_proto (name, , __GI_##name, ##attrs)
# define hidden_proto_alias(name, alias, attrs...) \
__hidden_proto_alias (name, , alias, ##attrs)
# define hidden_tls_proto(name, attrs...) \ # define hidden_tls_proto(name, attrs...) \
__hidden_proto (name, __thread, __GI_##name, ##attrs) __hidden_proto (name, __thread, __GI_##name, ##attrs)
# define __hidden_proto(name, thread, internal, attrs...) \ # define __hidden_proto(name, thread, internal, attrs...) \
extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \ extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
__hidden_proto_hiddenattr (attrs); __hidden_proto_hiddenattr (attrs);
# define __hidden_proto_alias(name, thread, internal, attrs...) \
extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
# define __hidden_asmname(name) \ # define __hidden_asmname(name) \
__hidden_asmname1 (__USER_LABEL_PREFIX__, name) __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name) # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
@ -550,9 +473,11 @@ for linking")
__attribute__((alias (__hidden_asmname (#local)))) \ __attribute__((alias (__hidden_asmname (#local)))) \
__attribute_copy__ (name) __attribute_copy__ (name)
# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name); # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
# define hidden_data_ver(local, name) hidden_ver(local, name)
# define hidden_def(name) __hidden_ver1(__GI_##name, name, name); # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
# define hidden_def_alias(name, internal) \
strong_alias (name, internal)
# define hidden_data_def(name) hidden_def(name) # define hidden_data_def(name) hidden_def(name)
# define hidden_data_def_alias(name, alias) hidden_def_alias(name, alias)
# define hidden_tls_def(name) \ # define hidden_tls_def(name) \
__hidden_ver2 (__thread, __GI_##name, name, name); __hidden_ver2 (__thread, __GI_##name, name, name);
# define hidden_weak(name) \ # define hidden_weak(name) \
@ -579,12 +504,13 @@ for linking")
hidden_proto doesn't make sense for assembly but the equivalent hidden_proto doesn't make sense for assembly but the equivalent
is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */ is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
# define hidden_def(name) strong_alias (name, __GI_##name) # define hidden_def(name) strong_alias (name, __GI_##name)
# define hidden_def_alias(name, alias) strong_alias (name, alias)
# define hidden_weak(name) hidden_def (name) # define hidden_weak(name) hidden_def (name)
# define hidden_ver(local, name) strong_alias (local, __GI_##name) # define hidden_ver(local, name) strong_alias (local, __GI_##name)
# define hidden_data_def(name) strong_data_alias (name, __GI_##name) # define hidden_data_def(name) strong_data_alias (name, __GI_##name)
# define hidden_data_def_alias(name, alias) strong_data_alias (name, alias)
# define hidden_tls_def(name) hidden_data_def (name) # define hidden_tls_def(name) hidden_data_def (name)
# define hidden_data_weak(name) hidden_data_def (name) # define hidden_data_weak(name) hidden_data_def (name)
# define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
# define HIDDEN_JUMPTARGET(name) __GI_##name # define HIDDEN_JUMPTARGET(name) __GI_##name
# endif # endif
#else #else
@ -596,12 +522,17 @@ for linking")
__attribute__ ((visibility ("hidden"), ##attrs)) __attribute__ ((visibility ("hidden"), ##attrs))
# define hidden_proto(name, attrs...) \ # define hidden_proto(name, attrs...) \
__hidden_proto (name, , name, ##attrs) __hidden_proto (name, , name, ##attrs)
# define hidden_proto_alias(name, alias, attrs...) \
__hidden_proto_alias (name, , alias, ##attrs)
# define hidden_tls_proto(name, attrs...) \ # define hidden_tls_proto(name, attrs...) \
__hidden_proto (name, __thread, name, ##attrs) __hidden_proto (name, __thread, name, ##attrs)
# define __hidden_proto(name, thread, internal, attrs...) \ # define __hidden_proto(name, thread, internal, attrs...) \
extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs); extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
# define __hidden_proto_alias(name, thread, internal, attrs...) \
extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
# else # else
# define hidden_proto(name, attrs...) # define hidden_proto(name, attrs...)
# define hidden_proto_alias(name, alias, attrs...)
# define hidden_tls_proto(name, attrs...) # define hidden_tls_proto(name, attrs...)
# endif # endif
# else # else
@ -609,256 +540,116 @@ for linking")
# endif /* Not __ASSEMBLER__ */ # endif /* Not __ASSEMBLER__ */
# define hidden_weak(name) # define hidden_weak(name)
# define hidden_def(name) # define hidden_def(name)
# define hidden_def_alias(name, alias)
# define hidden_ver(local, name) # define hidden_ver(local, name)
# define hidden_data_weak(name) # define hidden_data_weak(name)
# define hidden_data_def(name) # define hidden_data_def(name)
# define hidden_data_def_alias(name, alias)
# define hidden_tls_def(name) # define hidden_tls_def(name)
# define hidden_data_ver(local, name)
# define hidden_nolink(name, lib, version) # define hidden_nolink(name, lib, version)
#endif #endif
#if IS_IN (libc) #if IS_IN (libc)
# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libc_hidden_proto_alias(name, alias, attrs...) \
hidden_proto_alias (name, alias, ##attrs)
# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (name) # define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name) # define libc_hidden_weak(name) hidden_weak (name)
# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
# define libc_hidden_ver(local, name) hidden_ver (local, name) # define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name) # define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_data_def_alias(name, alias) hidden_data_def_alias (name, alias)
# define libc_hidden_tls_def(name) hidden_tls_def (name) # define libc_hidden_tls_def(name) hidden_tls_def (name)
# define libc_hidden_data_weak(name) hidden_data_weak (name) # define libc_hidden_data_weak(name) hidden_data_weak (name)
# define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libc_hidden_proto(name, attrs...) # define libc_hidden_proto(name, attrs...)
# define libc_hidden_proto_alias(name, alias, attrs...)
# define libc_hidden_tls_proto(name, attrs...) # define libc_hidden_tls_proto(name, attrs...)
# define libc_hidden_def(name) # define libc_hidden_def(name)
# define libc_hidden_weak(name) # define libc_hidden_weak(name)
# define libc_hidden_ver(local, name) # define libc_hidden_ver(local, name)
# define libc_hidden_data_def(name) # define libc_hidden_data_def(name)
# define libc_hidden_data_def_alias(name, alias)
# define libc_hidden_tls_def(name) # define libc_hidden_tls_def(name)
# define libc_hidden_data_weak(name) # define libc_hidden_data_weak(name)
# define libc_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (rtld) #if IS_IN (rtld)
# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define rtld_hidden_def(name) hidden_def (name) # define rtld_hidden_def(name) hidden_def (name)
# define rtld_hidden_weak(name) hidden_weak (name) # define rtld_hidden_weak(name) hidden_weak (name)
# define rtld_hidden_ver(local, name) hidden_ver (local, name)
# define rtld_hidden_data_def(name) hidden_data_def (name) # define rtld_hidden_data_def(name) hidden_data_def (name)
# define rtld_hidden_tls_def(name) hidden_tls_def (name)
# define rtld_hidden_data_weak(name) hidden_data_weak (name)
# define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define rtld_hidden_proto(name, attrs...) # define rtld_hidden_proto(name, attrs...)
# define rtld_hidden_tls_proto(name, attrs...)
# define rtld_hidden_def(name) # define rtld_hidden_def(name)
# define rtld_hidden_weak(name) # define rtld_hidden_weak(name)
# define rtld_hidden_ver(local, name)
# define rtld_hidden_data_def(name) # define rtld_hidden_data_def(name)
# define rtld_hidden_tls_def(name)
# define rtld_hidden_data_weak(name)
# define rtld_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (libm) #if IS_IN (libm)
# define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define libm_hidden_def(name) hidden_def (name) # define libm_hidden_def(name) hidden_def (name)
# define libm_hidden_weak(name) hidden_weak (name) # define libm_hidden_weak(name) hidden_weak (name)
# define libm_hidden_ver(local, name) hidden_ver (local, name) # define libm_hidden_ver(local, name) hidden_ver (local, name)
# define libm_hidden_data_def(name) hidden_data_def (name)
# define libm_hidden_tls_def(name) hidden_tls_def (name)
# define libm_hidden_data_weak(name) hidden_data_weak (name)
# define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libm_hidden_proto(name, attrs...) # define libm_hidden_proto(name, attrs...)
# define libm_hidden_tls_proto(name, attrs...)
# define libm_hidden_def(name) # define libm_hidden_def(name)
# define libm_hidden_weak(name) # define libm_hidden_weak(name)
# define libm_hidden_ver(local, name) # define libm_hidden_ver(local, name)
# define libm_hidden_data_def(name)
# define libm_hidden_tls_def(name)
# define libm_hidden_data_weak(name)
# define libm_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (libmvec) #if IS_IN (libmvec)
# define libmvec_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libmvec_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define libmvec_hidden_def(name) hidden_def (name) # define libmvec_hidden_def(name) hidden_def (name)
# define libmvec_hidden_weak(name) hidden_weak (name)
# define libmvec_hidden_ver(local, name) hidden_ver (local, name)
# define libmvec_hidden_data_def(name) hidden_data_def (name)
# define libmvec_hidden_tls_def(name) hidden_tls_def (name)
# define libmvec_hidden_data_weak(name) hidden_data_weak (name)
# define libmvec_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libmvec_hidden_proto(name, attrs...)
# define libmvec_hidden_tls_proto(name, attrs...)
# define libmvec_hidden_def(name) # define libmvec_hidden_def(name)
# define libmvec_hidden_weak(name)
# define libmvec_hidden_ver(local, name)
# define libmvec_hidden_data_def(name)
# define libmvec_hidden_tls_def(name)
# define libmvec_hidden_data_weak(name)
# define libmvec_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (libresolv) #if IS_IN (libresolv)
# define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libresolv_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define libresolv_hidden_def(name) hidden_def (name) # define libresolv_hidden_def(name) hidden_def (name)
# define libresolv_hidden_weak(name) hidden_weak (name)
# define libresolv_hidden_ver(local, name) hidden_ver (local, name)
# define libresolv_hidden_data_def(name) hidden_data_def (name) # define libresolv_hidden_data_def(name) hidden_data_def (name)
# define libresolv_hidden_tls_def(name) hidden_tls_def (name)
# define libresolv_hidden_data_weak(name) hidden_data_weak (name)
# define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libresolv_hidden_proto(name, attrs...) # define libresolv_hidden_proto(name, attrs...)
# define libresolv_hidden_tls_proto(name, attrs...)
# define libresolv_hidden_def(name) # define libresolv_hidden_def(name)
# define libresolv_hidden_weak(name)
# define libresolv_hidden_ver(local, name)
# define libresolv_hidden_data_def(name) # define libresolv_hidden_data_def(name)
# define libresolv_hidden_tls_def(name)
# define libresolv_hidden_data_weak(name)
# define libresolv_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (libpthread) #if IS_IN (libpthread)
# define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libpthread_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define libpthread_hidden_def(name) hidden_def (name) # define libpthread_hidden_def(name) hidden_def (name)
# define libpthread_hidden_weak(name) hidden_weak (name)
# define libpthread_hidden_ver(local, name) hidden_ver (local, name)
# define libpthread_hidden_data_def(name) hidden_data_def (name)
# define libpthread_hidden_tls_def(name) hidden_tls_def (name)
# define libpthread_hidden_data_weak(name) hidden_data_weak (name)
# define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libpthread_hidden_proto(name, attrs...) # define libpthread_hidden_proto(name, attrs...)
# define libpthread_hidden_tls_proto(name, attrs...)
# define libpthread_hidden_def(name) # define libpthread_hidden_def(name)
# define libpthread_hidden_weak(name)
# define libpthread_hidden_ver(local, name)
# define libpthread_hidden_data_def(name)
# define libpthread_hidden_tls_def(name)
# define libpthread_hidden_data_weak(name)
# define libpthread_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (librt) #if IS_IN (librt)
# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define librt_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define librt_hidden_def(name) hidden_def (name)
# define librt_hidden_weak(name) hidden_weak (name)
# define librt_hidden_ver(local, name) hidden_ver (local, name) # define librt_hidden_ver(local, name) hidden_ver (local, name)
# define librt_hidden_data_def(name) hidden_data_def (name)
# define librt_hidden_tls_def(name) hidden_tls_def (name)
# define librt_hidden_data_weak(name) hidden_data_weak (name)
# define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define librt_hidden_proto(name, attrs...) # define librt_hidden_proto(name, attrs...)
# define librt_hidden_tls_proto(name, attrs...)
# define librt_hidden_def(name)
# define librt_hidden_weak(name)
# define librt_hidden_ver(local, name) # define librt_hidden_ver(local, name)
# define librt_hidden_data_def(name)
# define librt_hidden_tls_def(name)
# define librt_hidden_data_weak(name)
# define librt_hidden_data_ver(local, name)
#endif
#if IS_IN (libdl)
# define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libdl_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define libdl_hidden_def(name) hidden_def (name)
# define libdl_hidden_weak(name) hidden_weak (name)
# define libdl_hidden_ver(local, name) hidden_ver (local, name)
# define libdl_hidden_data_def(name) hidden_data_def (name)
# define libdl_hidden_tls_def(name) hidden_tls_def (name)
# define libdl_hidden_data_weak(name) hidden_data_weak (name)
# define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
# define libdl_hidden_proto(name, attrs...)
# define libdl_hidden_tls_proto(name, attrs...)
# define libdl_hidden_def(name)
# define libdl_hidden_weak(name)
# define libdl_hidden_ver(local, name)
# define libdl_hidden_data_def(name)
# define libdl_hidden_tls_def(name)
# define libdl_hidden_data_weak(name)
# define libdl_hidden_data_ver(local, name)
#endif #endif
#if IS_IN (libnsl) #if IS_IN (libnsl)
# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libnsl_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version) # define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
# define libnsl_hidden_weak(name) hidden_weak (name)
# define libnsl_hidden_ver(local, name) hidden_ver (local, name)
# define libnsl_hidden_data_def(name) hidden_data_def (name)
# define libnsl_hidden_tls_def(name) hidden_tls_def (name)
# define libnsl_hidden_data_weak(name) hidden_data_weak (name)
# define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else #else
# define libnsl_hidden_proto(name, attrs...) # define libnsl_hidden_proto(name, attrs...)
# define libnsl_hidden_tls_proto(name, attrs...)
# define libnsl_hidden_weak(name)
# define libnsl_hidden_ver(local, name)
# define libnsl_hidden_data_def(name)
# define libnsl_hidden_tls_def(name)
# define libnsl_hidden_data_weak(name)
# define libnsl_hidden_data_ver(local, name)
#endif #endif
#define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs) #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#define libc_hidden_builtin_def(name) libc_hidden_def (name) #define libc_hidden_builtin_def(name) libc_hidden_def (name)
#define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
#define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
#define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs) #define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
# define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name) # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
#endif #endif
#if IS_IN (libutil)
# define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libutil_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
# define libutil_hidden_def(name) hidden_def (name)
# define libutil_hidden_weak(name) hidden_weak (name)
# define libutil_hidden_ver(local, name) hidden_ver (local, name)
# define libutil_hidden_data_def(name) hidden_data_def (name)
# define libutil_hidden_tls_def(name) hidden_tls_def (name)
# define libutil_hidden_data_weak(name) hidden_data_weak (name)
# define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
# define libutil_hidden_proto(name, attrs...)
# define libutil_hidden_tls_proto(name, attrs...)
# define libutil_hidden_def(name)
# define libutil_hidden_weak(name)
# define libutil_hidden_ver(local, name)
# define libutil_hidden_data_def(name)
# define libutil_hidden_tls_def(name)
# define libutil_hidden_data_weak(name)
# define libutil_hidden_data_ver(local, name)
#endif
#if IS_IN (libanl) #if IS_IN (libanl)
# define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libanl_hidden_def(name) hidden_def (name)
#else #else
# define libanl_hidden_proto(name, attrs...) # define libanl_hidden_proto(name, attrs...)
# define libanl_hidden_def(name)
#endif #endif
/* Get some dirty hacks. */ /* Get some dirty hacks. */
@ -869,11 +660,8 @@ for linking")
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
# define attribute_compat_text_section \ # define attribute_compat_text_section \
__attribute__ ((section (".text.compat"))) __attribute__ ((section (".text.compat")))
# define attribute_compat_data_section \
__attribute__ ((section (".data.compat")))
#else #else
# define compat_text_section .section ".text.compat", "ax"; # define compat_text_section .section ".text.compat", "ax";
# define compat_data_section .section ".data.compat", "aw";
#endif #endif
/* Helper / base macros for indirect function symbols. */ /* Helper / base macros for indirect function symbols. */
@ -924,7 +712,7 @@ for linking")
If you have an implementation for foo which e.g. uses a special hardware If you have an implementation for foo which e.g. uses a special hardware
feature which isn't available on all machines where this libc.so will be feature which isn't available on all machines where this libc.so will be
used but decideable if available at runtime e.g. via hwcaps, you can provide used but decidable if available at runtime e.g. via hwcaps, you can provide
two or multiple implementations of foo: two or multiple implementations of foo:
int __foo_default (int __bar) int __foo_default (int __bar)
@ -977,7 +765,7 @@ for linking")
: __foo_default); : __foo_default);
This will define the ifunc'ed symbol foo like above. The redirection of foo This will define the ifunc'ed symbol foo like above. The redirection of foo
in header file is needed to omit an additional defintion of __GI_foo which in header file is needed to omit an additional definition of __GI_foo which
would end in a linker error while linking libc.so. You have to specify would end in a linker error while linking libc.so. You have to specify
__redirect_foo as first parameter which is used within libc_ifunc_redirected __redirect_foo as first parameter which is used within libc_ifunc_redirected
macro in conjunction with typeof to define the ifunc'ed symbol foo. macro in conjunction with typeof to define the ifunc'ed symbol foo.

View file

@ -14,10 +14,8 @@ libc_hidden_proto (__sigpause)
libc_hidden_proto (raise) libc_hidden_proto (raise)
libc_hidden_proto (__libc_current_sigrtmin) libc_hidden_proto (__libc_current_sigrtmin)
libc_hidden_proto (__libc_current_sigrtmax) libc_hidden_proto (__libc_current_sigrtmax)
extern const char * const __sys_siglist[_NSIG]; extern const char * const __sys_siglist[_NSIG] attribute_hidden;
libc_hidden_proto (__sys_siglist) extern const char * const __sys_sigabbrev[_NSIG] attribute_hidden;
extern const char * const __sys_sigabbrev[_NSIG];
libc_hidden_proto (__sys_sigabbrev)
/* Now define the internal interfaces. */ /* Now define the internal interfaces. */
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler); extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);

View file

@ -1,5 +1,5 @@
/* Macros for defining Systemtap <sys/sdt.h> static probe points. /* Macros for defining Systemtap <sys/sdt.h> static probe points.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,7 @@
#ifndef _STDLIB_H #ifndef _STDLIB_H
#ifndef _ISOMAC #ifndef _ISOMAC
# include <stdbool.h>
# include <stddef.h> # include <stddef.h>
#endif #endif
@ -35,6 +36,45 @@ libc_hidden_proto (__strtod_l)
libc_hidden_proto (__strtof_l) libc_hidden_proto (__strtof_l)
libc_hidden_proto (__strtold_l) libc_hidden_proto (__strtold_l)
extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
libc_hidden_proto (__isoc23_strtol)
libc_hidden_proto (__isoc23_strtoul)
libc_hidden_proto (__isoc23_strtoll)
libc_hidden_proto (__isoc23_strtoull)
libc_hidden_proto (__isoc23_strtol_l)
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
redirection in the installed header does not work with
libc_hidden_proto. */
# undef strtol
# define strtol __isoc23_strtol
# undef strtoul
# define strtoul __isoc23_strtoul
# undef strtoll
# define strtoll __isoc23_strtoll
# undef strtoull
# define strtoull __isoc23_strtoull
# undef strtol_l
# define strtol_l __isoc23_strtol_l
# undef strtoul_l
# define strtoul_l __isoc23_strtoul_l
# undef strtoll_l
# define strtoll_l __isoc23_strtoll_l
# undef strtoull_l
# define strtoull_l __isoc23_strtoull_l
#endif
libc_hidden_proto (exit) libc_hidden_proto (exit)
libc_hidden_proto (abort) libc_hidden_proto (abort)
libc_hidden_proto (getenv) libc_hidden_proto (getenv)
@ -144,6 +184,15 @@ libc_hidden_proto (__ptsname_r)
libc_hidden_proto (grantpt) libc_hidden_proto (grantpt)
libc_hidden_proto (unlockpt) libc_hidden_proto (unlockpt)
__typeof (arc4random) __arc4random;
libc_hidden_proto (__arc4random);
__typeof (arc4random_buf) __arc4random_buf;
libc_hidden_proto (__arc4random_buf);
__typeof (arc4random_uniform) __arc4random_uniform;
libc_hidden_proto (__arc4random_uniform);
extern void __arc4random_buf_internal (void *buffer, size_t len)
attribute_hidden;
extern double __strtod_internal (const char *__restrict __nptr, extern double __strtod_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group) char **__restrict __endptr, int __group)
__THROW __nonnull ((1)) __wur; __THROW __nonnull ((1)) __wur;
@ -193,23 +242,25 @@ extern long double ____strtold_l_internal (const char *__restrict __nptr,
extern long int ____strtol_l_internal (const char *__restrict __nptr, extern long int ____strtol_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, char **__restrict __endptr,
int __base, int __group, int __base, int __group,
locale_t __loc); bool __bin_cst, locale_t __loc);
extern unsigned long int ____strtoul_l_internal (const char * extern unsigned long int ____strtoul_l_internal (const char *
__restrict __nptr, __restrict __nptr,
char **__restrict __endptr, char **__restrict __endptr,
int __base, int __group, int __base, int __group,
bool __bin_cst,
locale_t __loc); locale_t __loc);
__extension__ __extension__
extern long long int ____strtoll_l_internal (const char *__restrict __nptr, extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, char **__restrict __endptr,
int __base, int __group, int __base, int __group,
locale_t __loc); bool __bin_cst, locale_t __loc);
__extension__ __extension__
extern unsigned long long int ____strtoull_l_internal (const char * extern unsigned long long int ____strtoull_l_internal (const char *
__restrict __nptr, __restrict __nptr,
char ** char **
__restrict __endptr, __restrict __endptr,
int __base, int __group, int __base, int __group,
bool __bin_cst,
locale_t __loc); locale_t __loc);
libc_hidden_proto (____strtof_l_internal) libc_hidden_proto (____strtof_l_internal)

View file

@ -1,5 +1,12 @@
#ifndef _SYS_CDEFS_H #ifndef _SYS_CDEFS_H
/* This is outside of _ISOMAC to enforce that _Static_assert always
uses the two-argument form. This can be removed once the minimum
GCC version used to compile glibc is GCC 9.1. */
#ifndef __cplusplus
# define _Static_assert(expr, diagnostic) _Static_assert (expr, diagnostic)
#endif
#include <misc/sys/cdefs.h> #include <misc/sys/cdefs.h>
#ifndef _ISOMAC #ifndef _ISOMAC
@ -33,6 +40,20 @@ rtld_hidden_proto (__chk_fail)
#endif #endif
#if defined SHARED
#if IS_IN (libc) && __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
#undef __REDIRECT_FORTIFY
#define __REDIRECT_FORTIFY(name, proto, alias) \
__REDIRECT(name, proto, __GI_##alias)
#undef __REDIRECT_FORTIFY_NTH
#define __REDIRECT_FORTIFY_NTH(name, proto, alias) \
__REDIRECT_NTH(name, proto, __GI_##alias)
#endif
#endif /* defined SHARED */
#endif /* !defined _ISOMAC */ #endif /* !defined _ISOMAC */
#endif #endif

View file

@ -3,6 +3,10 @@
#ifndef _ISOMAC #ifndef _ISOMAC
/* Now define the internal interfaces. */ /* Now define the internal interfaces. */
#include <bits/select-decl.h>
libc_hidden_proto (__fdelt_chk)
# if __TIMESIZE == 64 # if __TIMESIZE == 64
# define __pselect64 __pselect # define __pselect64 __pselect
# define __select64 __select # define __select64 __select

View file

@ -66,10 +66,12 @@ hidden_proto (__fstatat64_time64);
extern int __chmod (const char *__file, __mode_t __mode); extern int __chmod (const char *__file, __mode_t __mode);
libc_hidden_proto (__chmod) libc_hidden_proto (__chmod)
extern int __fchmod (int __fd, __mode_t __mode); extern int __fchmod (int __fd, __mode_t __mode);
extern int __fchmodat (int __fd, const char *__file, mode_t __mode, int __flag);
libc_hidden_proto (fchmodat) libc_hidden_proto (fchmodat)
extern __mode_t __umask (__mode_t __mask); extern __mode_t __umask (__mode_t __mask);
extern int __mkdir (const char *__path, __mode_t __mode); extern int __mkdir (const char *__path, __mode_t __mode);
libc_hidden_proto (__mkdir) libc_hidden_proto (__mkdir)
extern int __mkdirat (int __fd, const char *__path, mode_t __mode);
extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev); extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev);
libc_hidden_proto (__mknodat); libc_hidden_proto (__mknodat);

View file

@ -1,5 +1,5 @@
/* statx-related definitions and declarations. Generic version. /* statx-related definitions and declarations. Generic version.
Copyright (C) 2018-2021 Free Software Foundation, Inc. Copyright (C) 2018-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -167,10 +167,6 @@ typedef __pid_t pid_t;
effective IDs, not real IDs. */ effective IDs, not real IDs. */
#endif #endif
/* fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards
* re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
/* Do the file control operation described by CMD on FD. /* Do the file control operation described by CMD on FD.
The remaining arguments are interpreted depending on CMD. The remaining arguments are interpreted depending on CMD.
@ -191,19 +187,16 @@ extern int fcntl64 (int __fd, int __cmd, ...);
# endif # endif
#else /* __USE_TIME_BITS64 */ #else /* __USE_TIME_BITS64 */
# ifdef __REDIRECT # ifdef __REDIRECT
extern int __REDIRECT (fcntl, (int __fd, int __request, ...), extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
__fcntl_time64) __THROW; __fcntl_time64);
extern int __REDIRECT (fcntl64, (int __fd, int __request, ...), extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
__fcntl_time64) __THROW; __fcntl_time64);
# else # else
extern int __fcntl_time64 (int __fd, int __request, ...) __THROW; extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
# define fcntl64 __fcntl_time64 # define fcntl64 __fcntl_time64
# define fcntl __fcntl_time64 # define fcntl __fcntl_time64
# endif # endif
#endif #endif
#else /* glibc 2.27 or lower */
extern int fcntl (int __fd, int __cmd, ...);
#endif
/* Open FILE and return a new file descriptor for it, or -1 on error. /* Open FILE and return a new file descriptor for it, or -1 on error.
OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995-2021 Free Software Foundation, Inc. /* Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,7 +1,6 @@
/* Definition of struct __locale_struct and __locale_t. /* Definition of struct __locale_struct and __locale_t.
Copyright (C) 1997-2021 Free Software Foundation, Inc. Copyright (C) 1997-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View file

@ -1,5 +1,5 @@
/* Definition of locale_t. /* Definition of locale_t.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1992-2021 Free Software Foundation, Inc. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -26,8 +27,8 @@
/* The GNU libc does not support any K&R compilers or the traditional mode /* The GNU libc does not support any K&R compilers or the traditional mode
of ISO C compilers anymore. Check for some of the combinations not of ISO C compilers anymore. Check for some of the combinations not
supported anymore. */ supported anymore. */
#if defined __GNUC__ && !defined __STDC__ #if defined __GNUC__ && !defined __STDC__ && !defined __cplusplus
# error "You need a ISO C conforming compiler to use the glibc headers" # error "You need a ISO C or C++ conforming compiler to use the glibc headers"
#endif #endif
/* Some user header file might have defined this before. */ /* Some user header file might have defined this before. */
@ -80,7 +81,7 @@
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else # else
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# if __cplusplus >= 201103L # if __cplusplus >= 201103L
# define __THROW noexcept (true) # define __THROW noexcept (true)
# else # else
@ -97,6 +98,12 @@
# endif # endif
# endif # endif
# if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__)
# define __COLD __attribute__ ((__cold__))
# else
# define __COLD
# endif
#else /* Not GCC or clang. */ #else /* Not GCC or clang. */
# if (defined __cplusplus \ # if (defined __cplusplus \
@ -109,6 +116,7 @@
# define __THROW # define __THROW
# define __THROWNL # define __THROWNL
# define __NTH(fct) fct # define __NTH(fct) fct
# define __COLD
#endif /* GCC || clang. */ #endif /* GCC || clang. */
@ -142,7 +150,8 @@
#define __bos0(ptr) __builtin_object_size (ptr, 0) #define __bos0(ptr) __builtin_object_size (ptr, 0)
/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) #if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \
|| __GNUC_PREREQ (12, 0))
# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) # define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) # define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
#else #else
@ -150,6 +159,55 @@
# define __glibc_objsize(__o) __bos (__o) # define __glibc_objsize(__o) __bos (__o)
#endif #endif
#if __USE_FORTIFY_LEVEL > 0
/* Compile time conditions to choose between the regular, _chk and _chk_warn
variants. These conditions should get evaluated to constant and optimized
away. */
#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s))
#define __glibc_unsigned_or_positive(__l) \
((__typeof (__l)) 0 < (__typeof (__l)) -1 \
|| (__builtin_constant_p (__l) && (__l) > 0))
/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
condition can be folded to a constant and if it is true, or unknown (-1) */
#define __glibc_safe_or_unknown_len(__l, __s, __osz) \
((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \
|| (__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
(__s), (__osz))) \
&& __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz))))
/* Conversely, we know at compile time that the length is unsafe if the
__L * __S <= __OBJSZ condition can be folded to a constant and if it is
false. */
#define __glibc_unsafe_len(__l, __s, __osz) \
(__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
__s, __osz)) \
&& !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be
declared. */
#define __glibc_fortify(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
: __ ## f ## _chk (__VA_ARGS__, __osz)))
/* Fortify function f, where object size argument passed to f is the number of
elements and not total size. */
#define __glibc_fortify_n(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
: __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))
#endif
#if __GNUC_PREREQ (4,3) #if __GNUC_PREREQ (4,3)
# define __warnattr(msg) __attribute__((__warning__ (msg))) # define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \ # define __errordecl(name, msg) \
@ -210,6 +268,14 @@
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname # define __ASMNAME2(prefix, cname) __STRING (prefix) cname
#ifndef __REDIRECT_FORTIFY
#define __REDIRECT_FORTIFY __REDIRECT
#endif
#ifndef __REDIRECT_FORTIFY_NTH
#define __REDIRECT_FORTIFY_NTH __REDIRECT_NTH
#endif
/* /*
#elif __SOME_OTHER_COMPILER__ #elif __SOME_OTHER_COMPILER__
@ -243,6 +309,15 @@
# define __attribute_alloc_size__(params) /* Ignore. */ # define __attribute_alloc_size__(params) /* Ignore. */
#endif #endif
/* Tell the compiler which argument to an allocation function
indicates the alignment of the allocation. */
#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__)
# define __attribute_alloc_align__(param) \
__attribute__ ((__alloc_align__ param))
#else
# define __attribute_alloc_align__(param) /* Ignore. */
#endif
/* At some point during the gcc 2.96 development the `pure' attribute /* At some point during the gcc 2.96 development the `pure' attribute
for functions was introduced. We don't want to use it unconditionally for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */ (although this would be possible) since it generates warnings. */
@ -318,16 +393,18 @@
#endif #endif
/* The nonnull function attribute marks pointer parameters that /* The nonnull function attribute marks pointer parameters that
must not be NULL. */ must not be NULL. This has the name __nonnull in glibc,
#ifndef __nonnull and __attribute_nonnull__ in files shared with Gnulib to avoid
collision with a different __nonnull in DragonFlyBSD 5.9. */
#ifndef __attribute_nonnull__
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) # if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
# define __nonnull(params) __attribute__ ((__nonnull__ params)) # define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
# else # else
# define __nonnull(params) # define __attribute_nonnull__(params)
# endif # endif
#elif !defined __GLIBC__ #endif
# undef __nonnull #ifndef __nonnull
# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) # define __nonnull(params) __attribute_nonnull__ (params)
#endif #endif
/* The returns_nonnull function attribute marks the return type of the function /* The returns_nonnull function attribute marks the return type of the function
@ -493,9 +570,9 @@
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif #endif
/* The #ifndef lets Gnulib avoid including these on non-glibc /* Gnulib avoids including these, as they don't work on non-glibc or
platforms, where the includes typically do not exist. */ older glibc platforms. */
#ifdef __GLIBC__ #ifndef __GNULIB_CDEFS
# include <bits/wordsize.h> # include <bits/wordsize.h>
# include <bits/long-double.h> # include <bits/long-double.h>
#endif #endif
@ -507,6 +584,8 @@
# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
# define __LDBL_REDIR_DECL(name) \ # define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
# define __REDIRECT_LDBL(name, proto, alias) \
name proto __asm (__ASMNAME ("__" #alias "ieee128"))
/* Alias name defined automatically, with leading underscores. */ /* Alias name defined automatically, with leading underscores. */
# define __LDBL_REDIR2_DECL(name) \ # define __LDBL_REDIR2_DECL(name) \
@ -524,7 +603,6 @@
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
/* Unused. */ /* Unused. */
# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
# else # else
@ -603,12 +681,22 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
size-index is not provided: size-index is not provided:
access (access-mode, <ref-index> [, <size-index>]) */ access (access-mode, <ref-index> [, <size-index>]) */
# define __attr_access(x) __attribute__ ((__access__ x)) # define __attr_access(x) __attribute__ ((__access__ x))
/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
use the access attribute to get object sizes from function definition
arguments, so we can't use them on functions we fortify. Drop the object
size hints for such functions. */
# if __USE_FORTIFY_LEVEL == 3
# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o)))
# else
# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
# endif
# if __GNUC_PREREQ (11, 0) # if __GNUC_PREREQ (11, 0)
# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) # define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
# else # else
# define __attr_access_none(argno) # define __attr_access_none(argno)
# endif # endif
#else #else
# define __fortified_attr_access(a, o, s)
# define __attr_access(x) # define __attr_access(x)
# define __attr_access_none(argno) # define __attr_access_none(argno)
#endif #endif

View file

@ -1,5 +1,5 @@
/* `fd_set' type and related macros, and `select'/`pselect' declarations. /* `fd_set' type and related macros, and `select'/`pselect' declarations.
Copyright (C) 1996-2021 Free Software Foundation, Inc. Copyright (C) 1996-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 /* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
scheduling interface. scheduling interface.
Copyright (C) 1996-2021 Free Software Foundation, Inc. Copyright (C) 1996-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* bits/types.h -- definitions of __*_t types underlying *_t types. /* bits/types.h -- definitions of __*_t types underlying *_t types.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1992-2021 Free Software Foundation, Inc. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Floating-point inline functions for stdlib.h. /* Floating-point inline functions for stdlib.h.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1991-2021 Free Software Foundation, Inc. /* Copyright (C) 1991-2023 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -207,6 +208,71 @@ extern unsigned long long int strtoull (const char *__restrict __nptr,
__THROW __nonnull ((1)); __THROW __nonnull ((1));
#endif /* ISO C99 or use MISC. */ #endif /* ISO C99 or use MISC. */
/* Versions of the above functions that handle '0b' and '0B' prefixes
in base 0 or 2. */
#if __GLIBC_USE (C2X_STRTOL)
# ifdef __REDIRECT
extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtol)
__nonnull ((1));
extern unsigned long int __REDIRECT_NTH (strtoul,
(const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtoul)
__nonnull ((1));
# ifdef __USE_MISC
__extension__
extern long long int __REDIRECT_NTH (strtoq, (const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtoll)
__nonnull ((1));
__extension__
extern unsigned long long int __REDIRECT_NTH (strtouq,
(const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtoull)
__nonnull ((1));
# endif
__extension__
extern long long int __REDIRECT_NTH (strtoll, (const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtoll)
__nonnull ((1));
__extension__
extern unsigned long long int __REDIRECT_NTH (strtoull,
(const char *__restrict __nptr,
char **__restrict __endptr,
int __base), __isoc23_strtoull)
__nonnull ((1));
# else
extern long int __isoc23_strtol (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
extern unsigned long int __isoc23_strtoul (const char *__restrict __nptr,
char **__restrict __endptr,
int __base)
__THROW __nonnull ((1));
__extension__
extern long long int __isoc23_strtoll (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1));
__extension__
extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,
char **__restrict __endptr,
int __base)
__THROW __nonnull ((1));
# define strtol __isoc23_strtol
# define strtoul __isoc23_strtoul
# ifdef __USE_MISC
# define strtoq __isoc23_strtoll
# define strtouq __isoc23_strtoull
# endif
# define strtoll __isoc23_strtoll
# define strtoull __isoc23_strtoull
# endif
#endif
/* Convert a floating-point number to a string. */ /* Convert a floating-point number to a string. */
#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) #if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
extern int strfromd (char *__dest, size_t __size, const char *__format, extern int strfromd (char *__dest, size_t __size, const char *__format,
@ -292,6 +358,60 @@ extern unsigned long long int strtoull_l (const char *__restrict __nptr,
int __base, locale_t __loc) int __base, locale_t __loc)
__THROW __nonnull ((1, 4)); __THROW __nonnull ((1, 4));
/* Versions of the above functions that handle '0b' and '0B' prefixes
in base 0 or 2. */
# if __GLIBC_USE (C2X_STRTOL)
# ifdef __REDIRECT
extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc),
__isoc23_strtol_l)
__nonnull ((1, 4));
extern unsigned long int __REDIRECT_NTH (strtoul_l,
(const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc),
__isoc23_strtoul_l)
__nonnull ((1, 4));
__extension__
extern long long int __REDIRECT_NTH (strtoll_l, (const char *__restrict __nptr,
char **__restrict __endptr,
int __base,
locale_t __loc),
__isoc23_strtoll_l)
__nonnull ((1, 4));
__extension__
extern unsigned long long int __REDIRECT_NTH (strtoull_l,
(const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc),
__isoc23_strtoull_l)
__nonnull ((1, 4));
# else
extern long int __isoc23_strtol_l (const char *__restrict __nptr,
char **__restrict __endptr, int __base,
locale_t __loc) __THROW __nonnull ((1, 4));
extern unsigned long int __isoc23_strtoul_l (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc)
__THROW __nonnull ((1, 4));
__extension__
extern long long int __isoc23_strtoll_l (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc)
__THROW __nonnull ((1, 4));
__extension__
extern unsigned long long int __isoc23_strtoull_l (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, locale_t __loc)
__THROW __nonnull ((1, 4));
# define strtol_l __isoc23_strtol_l
# define strtoul_l __isoc23_strtoul_l
# define strtoll_l __isoc23_strtoll_l
# define strtoull_l __isoc23_strtoull_l
# endif
# endif
extern double strtod_l (const char *__restrict __nptr, extern double strtod_l (const char *__restrict __nptr,
char **__restrict __endptr, locale_t __loc) char **__restrict __endptr, locale_t __loc)
__THROW __nonnull ((1, 3)); __THROW __nonnull ((1, 3));
@ -532,6 +652,19 @@ extern int seed48_r (unsigned short int __seed16v[3],
extern int lcong48_r (unsigned short int __param[7], extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) struct drand48_data *__buffer)
__THROW __nonnull ((1, 2)); __THROW __nonnull ((1, 2));
/* Return a random integer between zero and 2**32-1 (inclusive). */
extern __uint32_t arc4random (void)
__THROW __wur;
/* Fill the buffer with random data. */
extern void arc4random_buf (void *__buf, size_t __size)
__THROW __nonnull ((1));
/* Return a random number between zero (inclusive) and the specified
limit (exclusive). */
extern __uint32_t arc4random_uniform (__uint32_t __upper_bound)
__THROW __wur;
# endif /* Use misc. */ # endif /* Use misc. */
#endif /* Use misc or X/Open. */ #endif /* Use misc or X/Open. */
@ -589,7 +722,8 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
#ifdef __USE_ISOC11 #ifdef __USE_ISOC11
/* ISO C variant of aligned allocation. */ /* ISO C variant of aligned allocation. */
extern void *aligned_alloc (size_t __alignment, size_t __size) extern void *aligned_alloc (size_t __alignment, size_t __size)
__THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur; __THROW __attribute_malloc__ __attribute_alloc_align__ ((1))
__attribute_alloc_size__ ((2)) __wur;
#endif #endif
/* Abort execution and generate a core-dump. */ /* Abort execution and generate a core-dump. */
@ -943,7 +1077,8 @@ extern size_t mbstowcs (wchar_t *__restrict __pwcs,
extern size_t wcstombs (char *__restrict __s, extern size_t wcstombs (char *__restrict __s,
const wchar_t *__restrict __pwcs, size_t __n) const wchar_t *__restrict __pwcs, size_t __n)
__THROW __THROW
__attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2)); __fortified_attr_access (__write_only__, 1, 3)
__attr_access ((__read_only__, 2));
#ifdef __USE_MISC #ifdef __USE_MISC
/* Determine whether the string value of RESPONSE matches the affirmation /* Determine whether the string value of RESPONSE matches the affirmation
@ -997,7 +1132,7 @@ extern char *ptsname (int __fd) __THROW __wur;
terminal associated with the master FD is open on in BUF. terminal associated with the master FD is open on in BUF.
Return 0 on success, otherwise an error number. */ Return 0 on success, otherwise an error number. */
extern int ptsname_r (int __fd, char *__buf, size_t __buflen) extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
__THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3)); __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3);
/* Open a master pseudo terminal and return its file descriptor. */ /* Open a master pseudo terminal and return its file descriptor. */
extern int getpt (void); extern int getpt (void);

View file

@ -1,5 +1,5 @@
/* Endian macros for string.h functions /* Endian macros for string.h functions
Copyright (C) 1992-2021 Free Software Foundation, Inc. Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1992-2021 Free Software Foundation, Inc. /* Copyright (C) 1992-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for AArch64. /* Special .init and .fini section support for AArch64.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for AArch64. /* Special .init and .fini section support for AArch64.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.

View file

@ -1,25 +0,0 @@
/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include_next <dl-sysdep.h>
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1
#define DL_EXTERN_PROTECTED_DATA

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2002-2021 Free Software Foundation, Inc. /* Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.

View file

@ -1,11 +1,28 @@
/* Copyright (C) 1995-2021 Free Software Foundation, Inc. /* Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as modify it under the terms of the GNU Lesser General Public
published by the Free Software Foundation; either version 2.1 of the License as published by the Free Software Foundation; either
License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -13,7 +30,7 @@
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#include <sysdep.h> #include <sysdep.h>

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2021 Free Software Foundation, Inc. /* Copyright (C) 1997-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for Alpha. /* Special .init and .fini section support for Alpha.
Copyright (C) 2001-2021 Free Software Foundation, Inc. Copyright (C) 2001-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for Alpha. /* Special .init and .fini section support for Alpha.
Copyright (C) 2001-2021 Free Software Foundation, Inc. Copyright (C) 2001-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,23 +0,0 @@
/* System-specific settings for dynamic linker code. Alpha version.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
#include_next <dl-sysdep.h>
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1

View file

@ -1,7 +1,6 @@
/* Startup code for Alpha/ELF. /* Startup code for Alpha/ELF.
Copyright (C) 1993-2021 Free Software Foundation, Inc. Copyright (C) 1993-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View file

@ -1,5 +1,5 @@
/* Assembler macros for ARC. /* Assembler macros for ARC.
Copyright (C) 2020-2021 Free Software Foundation, Inc. Copyright (C) 2020-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Macros to test for CPU features on ARM. Generic ARM version. /* Macros to test for CPU features on ARM. Generic ARM version.
Copyright (C) 2012-2022 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM. /* Special .init and .fini section support for ARM.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM. /* Special .init and .fini section support for ARM.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,25 +0,0 @@
/* System-specific settings for dynamic linker code. Alpha version.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
#include_next <dl-sysdep.h>
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1
#define DL_EXTERN_PROTECTED_DATA

View file

@ -1,5 +1,5 @@
/* Startup code for ARM & ELF /* Startup code for ARM & ELF
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Assembler macros for ARM. /* Assembler macros for ARM.
Copyright (C) 1997-2021 Free Software Foundation, Inc. Copyright (C) 1997-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -293,47 +293,3 @@
#else #else
# define PC_OFS 8 # define PC_OFS 8
#endif #endif
/* Pointer mangling support. */
#if (IS_IN (rtld) \
|| (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
# ifdef __ASSEMBLER__
# define PTR_MANGLE_LOAD(guard, tmp) \
LDR_HIDDEN (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local), 0)
# define PTR_MANGLE(dst, src, guard, tmp) \
PTR_MANGLE_LOAD(guard, tmp); \
PTR_MANGLE2(dst, src, guard)
/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
# define PTR_MANGLE2(dst, src, guard) \
eor dst, src, guard
# define PTR_DEMANGLE(dst, src, guard, tmp) \
PTR_MANGLE (dst, src, guard, tmp)
# define PTR_DEMANGLE2(dst, src, guard) \
PTR_MANGLE2 (dst, src, guard)
# else
extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
# define PTR_MANGLE(var) \
(var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#else
# ifdef __ASSEMBLER__
# define PTR_MANGLE_LOAD(guard, tmp) \
LDR_GLOBAL (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard), 0);
# define PTR_MANGLE(dst, src, guard, tmp) \
PTR_MANGLE_LOAD(guard, tmp); \
PTR_MANGLE2(dst, src, guard)
/* Use PTR_MANGLE2 for efficiency if guard is already loaded. */
# define PTR_MANGLE2(dst, src, guard) \
eor dst, src, guard
# define PTR_DEMANGLE(dst, src, guard, tmp) \
PTR_MANGLE (dst, src, guard, tmp)
# define PTR_DEMANGLE2(dst, src, guard) \
PTR_MANGLE2 (dst, src, guard)
# else
extern uintptr_t __pointer_chk_guard attribute_relro;
# define PTR_MANGLE(var) \
(var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
# endif
#endif

View file

@ -1,5 +1,5 @@
/* Assembler macros for C-SKY. /* Assembler macros for C-SKY.
Copyright (C) 2018-2021 Free Software Foundation, Inc. Copyright (C) 2018-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Configuration of lookup functions. /* Configuration of lookup functions.
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Generic version. /* System-specific settings for dynamic linker code. Generic version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,8 +1,6 @@
/* Declarations and definitions of codes relating to the DWARF2 symbolic /* Declarations and definitions of codes relating to the DWARF2 symbolic
debugging information format. debugging information format.
Copyright (C) 1992-2021 Free Software Foundation, Inc. Copyright (C) 1992-2023 Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com). Derived from the
DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
This file is part of the GNU C Library. This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Stub version. /* libc-internal interface for mutex locks. Stub version.
Copyright (C) 1996-2021 Free Software Foundation, Inc. Copyright (C) 1996-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Symbol version management. /* Symbol version management.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Single thread optimization, generic version. /* Single thread optimization, generic version.
Copyright (C) 2019-2021 Free Software Foundation, Inc. Copyright (C) 2019-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,7 @@
/* Some compiler optimizations may transform loops into memset/memmove /* Some compiler optimizations may transform loops into memset/memmove
calls and without proper declaration it may generate PLT calls. */ calls and without proper declaration it may generate PLT calls. */
#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED #if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED \
&& !defined LIBC_NONSHARED
asm ("memmove = __GI_memmove"); asm ("memmove = __GI_memmove");
asm ("memset = __GI_memset"); asm ("memset = __GI_memset");
asm ("memcpy = __GI_memcpy"); asm ("memcpy = __GI_memcpy");

View file

@ -1,5 +1,5 @@
/* Generic asm macros used on many machines. /* Generic asm macros used on many machines.
Copyright (C) 1991-2021 Free Software Foundation, Inc. Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -35,7 +35,7 @@
# endif # endif
#endif #endif
/* Makros to generate eh_frame unwind information. */ /* Macros to generate eh_frame unwind information. */
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
# define cfi_startproc .cfi_startproc # define cfi_startproc .cfi_startproc
# define cfi_endproc .cfi_endproc # define cfi_endproc .cfi_endproc

View file

@ -1,5 +1,5 @@
/* Definition for thread-local data handling. Generic version. /* Definition for thread-local data handling. Generic version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,11 @@
/* An architecture-specific version of this file has to defined a /* An architecture-specific version of this file has to defined a
number of symbols: number of symbols:
TCB_ALIGNMENT
Alignment of THREAD_SELF (struct pthread *) and the thread
pointer.
TLS_TCB_AT_TP or TLS_DTV_AT_TP TLS_TCB_AT_TP or TLS_DTV_AT_TP
The presence of one of these symbols signals which variant of The presence of one of these symbols signals which variant of
@ -43,15 +48,6 @@
dynamic linker itself. There are no threads in use at that time. dynamic linker itself. There are no threads in use at that time.
TLS_TCB_ALIGN
Alignment requirements for the TCB structure.
TLS_INIT_TCB_ALIGN
Similarly, but for the structure used at startup time.
INSTALL_DTV(tcb, init_dtv) INSTALL_DTV(tcb, init_dtv)
This macro must install the given initial DTV into the thread control This macro must install the given initial DTV into the thread control
@ -71,10 +67,4 @@
This macro returns the address of the DTV of the current thread. This macro returns the address of the DTV of the current thread.
This normally is done using the thread register which points This normally is done using the thread register which points
to the dtv or the TCB (from which the DTV can found). to the dtv or the TCB (from which the DTV can found).
THREAD_GSCOPE_IN_TCB
This should be set to 1 if the global scope flag is stored within the TCB.
When set to 0, GL(_dl_thread_gscope_count) will be defined to store it.
*/ */

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for HPPA /* Special .init and .fini section support for HPPA
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for HPPA /* Special .init and .fini section support for HPPA
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,4 @@
#ifndef __ASSEMBLY__
extern void _start (void); extern void _start (void);
#endif
/* Lives in libgcc.so and canonicalizes function pointers for comparison. */ /* Lives in libgcc.so and canonicalizes function pointers for comparison. */
extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr); extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr);
@ -8,6 +6,3 @@ extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr);
/* The function's entry point is stored in the first word of the /* The function's entry point is stored in the first word of the
function descriptor (plabel) of _start(). */ function descriptor (plabel) of _start(). */
#define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start) #define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start)
/* We have to provide a special declaration. */
#define ENTRY_POINT_DECL(class) class void _start (void);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2005-2021 Free Software Foundation, Inc. /* Copyright (C) 2005-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* ELF startup code for HPPA. /* ELF startup code for HPPA.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,7 +1,6 @@
/* Assembler macros for HP/PA. /* Assembler macros for HP/PA.
Copyright (C) 1999-2021 Free Software Foundation, Inc. Copyright (C) 1999-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View file

@ -1,5 +1,5 @@
/* Pthread data structures. Generic version. /* Pthread data structures. Generic version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -19,7 +19,7 @@
#ifndef _BITS_PTHREAD_H #ifndef _BITS_PTHREAD_H
#define _BITS_PTHREAD_H 1 #define _BITS_PTHREAD_H 1
typedef int __pthread_t; #include <bits/types/__pthread_t.h>
/* Return true if __T1 and __T2 both name the same thread. Otherwise, /* Return true if __T1 and __T2 both name the same thread. Otherwise,
false. */ false. */

View file

@ -1,5 +1,5 @@
/* Common threading primitives definitions for both POSIX and C11. /* Common threading primitives definitions for both POSIX and C11.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -21,9 +21,9 @@
#include <bits/pthreadtypes-arch.h> #include <bits/pthreadtypes-arch.h>
#include <bits/types/struct___pthread_once.h> #include <bits/types/struct___pthread_once.h>
#include <bits/types/__thrd_t.h>
typedef int __tss_t; typedef int __tss_t;
typedef int __thrd_t;
typedef union typedef union
{ {

View file

@ -1,5 +1,5 @@
/* Private libc-internal interface for mutex locks. /* Private libc-internal interface for mutex locks.
Copyright (C) 2015-2021 Free Software Foundation, Inc. Copyright (C) 2015-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Posix threads. Hurd version. /* Posix threads. Hurd version.
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -623,7 +623,7 @@ extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__restrict
int *__restrict __pshared) int *__restrict __pshared)
__THROW __nonnull ((1, 2)); __THROW __nonnull ((1, 2));
/* Set the value of the process shared atrribute in *ATTR to /* Set the value of the process shared attribute in *ATTR to
PSHARED. */ PSHARED. */
extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
int __pshared) int __pshared)
@ -645,7 +645,7 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
# include <bits/types/struct___pthread_rwlock.h> # include <bits/types/struct___pthread_rwlock.h>
# define PTHREAD_RWLOCK_INITIALIZER __PTHREAD_RWLOCK_INITIALIZER # define PTHREAD_RWLOCK_INITIALIZER __PTHREAD_RWLOCK_INITIALIZER
/* Create a rwlock object with attributes given by ATTR and strore the /* Create a rwlock object with attributes given by ATTR and store the
result in *RWLOCK. */ result in *RWLOCK. */
extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
const pthread_rwlockattr_t *__restrict __attr) const pthread_rwlockattr_t *__restrict __attr)
@ -709,7 +709,7 @@ extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
/* Cancelation. */ /* Cancellation. */
/* Register a cleanup handler. */ /* Register a cleanup handler. */
extern void pthread_cleanup_push (void (*__routine) (void *), void *__arg); extern void pthread_cleanup_push (void (*__routine) (void *), void *__arg);
@ -769,7 +769,7 @@ extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *__restri
int *__restrict __pshared) int *__restrict __pshared)
__THROW __nonnull ((1, 2)); __THROW __nonnull ((1, 2));
/* Set the value of the process shared atrribute in *ATTR to /* Set the value of the process shared attribute in *ATTR to
PSHARED. */ PSHARED. */
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
int __pshared) int __pshared)
@ -878,12 +878,12 @@ extern int pthread_getcpuclockid (pthread_t __thr, __clockid_t *__clock)
/* Scheduling. */ /* Scheduling. */
/* Return thread THREAD's scheduling paramters. */ /* Return thread THREAD's scheduling parameters. */
extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy, extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy,
struct sched_param *__restrict __param) struct sched_param *__restrict __param)
__THROW __nonnull ((2, 3)); __THROW __nonnull ((2, 3));
/* Set thread THREAD's scheduling paramters. */ /* Set thread THREAD's scheduling parameters. */
extern int pthread_setschedparam (pthread_t __thr, int __policy, extern int pthread_setschedparam (pthread_t __thr, int __policy,
const struct sched_param *__param) const struct sched_param *__param)
__THROW __nonnull ((3)); __THROW __nonnull ((3));

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86. /* Special .init and .fini section support for x86.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86. /* Special .init and .fini section support for x86.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. Hurd i386 version. /* Machine-specific pthread type layouts. Hurd i386 version.
Copyright (C) 2002-2021 Free Software Foundation, Inc. Copyright (C) 2002-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Startup code compliant to the ELF i386 ABI. /* Startup code compliant to the ELF i386 ABI.
Copyright (C) 1995-2021 Free Software Foundation, Inc. Copyright (C) 1995-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -98,11 +98,10 @@ ENTRY (_start)
pushl main@GOT(%ebx) pushl main@GOT(%ebx)
# else # else
/* Avoid relocation in static PIE since _start is called before /* Avoid relocation in static PIE since _start is called before
it is relocated. Don't use "leal main@GOTOFF(%ebx), %eax" it is relocated. This also avoid rely on linker optimization to
since main may be in a shared object. Linker will convert transform 'movl main@GOT(%ebx), %eax' to 'leal main@GOTOFF(%ebx)'
"movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax"
if main is defined locally. */ if main is defined locally. */
movl main@GOT(%ebx), %eax leal __wrap_main@GOTOFF(%ebx), %eax
pushl %eax pushl %eax
# endif # endif
@ -130,6 +129,12 @@ ENTRY (_start)
1: movl (%esp), %ebx 1: movl (%esp), %ebx
ret ret
#endif #endif
#if defined PIC && !defined SHARED
__wrap_main:
_CET_ENDBR
jmp main@PLT
#endif
END (_start) END (_start)
/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so /* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so

View file

@ -1,5 +1,5 @@
/* Hacks needed for symbol manipulation. i386 version. /* Hacks needed for symbol manipulation. i386 version.
Copyright (C) 2017-2021 Free Software Foundation, Inc. Copyright (C) 2017-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Assembler macros for i386. /* Assembler macros for i386.
Copyright (C) 1991-2021 Free Software Foundation, Inc. Copyright (C) 1991-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for IA64. /* Special .init and .fini section support for IA64.
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM. /* Special .init and .fini section support for ARM.
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Configuration of lookup functions. IA-64 version. /* Configuration of lookup functions. IA-64 version.
Copyright (C) 2000-2021 Free Software Foundation, Inc. Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,23 +0,0 @@
/* System-specific settings for dynamic linker code. IA-64 version.
Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include_next <dl-sysdep.h>
/* _dl_argv cannot be attribute_relro, because _dl_start_user
might write into it after _dl_start returns. */
#define DL_ARGV_NOT_RELRO 1

View file

@ -1,13 +1,8 @@
#include <link.h> #include <link.h>
#include <dl-fptr.h> #include <dl-fptr.h>
#ifndef __ASSEMBLY__
extern void _start (void); extern void _start (void);
#endif
/* The function's entry point is stored in the first word of the /* The function's entry point is stored in the first word of the
function descriptor (plabel) of _start(). */ function descriptor (plabel) of _start(). */
#define ENTRY_POINT ELF_PTR_TO_FDESC (_start)->ip #define ENTRY_POINT ELF_PTR_TO_FDESC (_start)->ip
/* We have to provide a special declaration. */
#define ENTRY_POINT_DECL(class) class void _start (void);

View file

@ -1,6 +1,5 @@
/* Copyright (C) 1999-2021 Free Software Foundation, Inc. /* Copyright (C) 1999-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View file

@ -1,6 +1,5 @@
/* Copyright (C) 2000-2021 Free Software Foundation, Inc. /* Copyright (C) 2000-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View file

@ -1,5 +1,5 @@
/* Assembler macros for Coldfire. /* Assembler macros for Coldfire.
Copyright (C) 1998-2021 Free Software Foundation, Inc. Copyright (C) 1998-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for m68k. /* Special .init and .fini section support for m68k.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,5 +1,5 @@
/* Special .init and .fini section support for m68k. /* Special .init and .fini section support for m68k.
Copyright (C) 2012-2021 Free Software Foundation, Inc. Copyright (C) 2012-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

Some files were not shown because too many files have changed in this diff Show more