Commit 675b1a15a1
Changed files (21)
lib
libc
glibc
elf
include
io
posix
bits
stdlib
sysdeps
aarch64
generic
htl
mach
nptl
unix
sysv
linux
x86
lib/libc/glibc/elf/elf.h
@@ -837,12 +837,15 @@ typedef struct
#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */
#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */
#define NT_ARM_POE 0x40f /* ARM POE registers. */
+#define NT_ARM_GCS 0x410 /* ARM GCS state. */
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
+#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged
+ address control */
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and
status registers. */
@@ -2906,19 +2909,6 @@ enum
#define R_AARCH64_NONE 0 /* No relocation. */
-/* ILP32 AArch64 relocs. */
-#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
-#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
-#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
-#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
-#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
-#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
-#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
-#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
-#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
-#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
-
-/* LP64 AArch64 relocs. */
#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
@@ -4091,6 +4081,7 @@ enum
#define R_RISCV_TLS_DTPREL64 9
#define R_RISCV_TLS_TPREL32 10
#define R_RISCV_TLS_TPREL64 11
+#define R_RISCV_TLSDESC 12
#define R_RISCV_BRANCH 16
#define R_RISCV_JAL 17
#define R_RISCV_CALL 18
@@ -4116,16 +4107,10 @@ enum
#define R_RISCV_SUB16 38
#define R_RISCV_SUB32 39
#define R_RISCV_SUB64 40
-#define R_RISCV_GNU_VTINHERIT 41
-#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_GOT32_PCREL 41
#define R_RISCV_ALIGN 43
#define R_RISCV_RVC_BRANCH 44
#define R_RISCV_RVC_JUMP 45
-#define R_RISCV_RVC_LUI 46
-#define R_RISCV_GPREL_I 47
-#define R_RISCV_GPREL_S 48
-#define R_RISCV_TPREL_I 49
-#define R_RISCV_TPREL_S 50
#define R_RISCV_RELAX 51
#define R_RISCV_SUB6 52
#define R_RISCV_SET6 53
@@ -4137,8 +4122,12 @@ enum
#define R_RISCV_PLT32 59
#define R_RISCV_SET_ULEB128 60
#define R_RISCV_SUB_ULEB128 61
+#define R_RISCV_TLSDESC_HI20 62
+#define R_RISCV_TLSDESC_LOAD_LO12 63
+#define R_RISCV_TLSDESC_ADD_LO12 64
+#define R_RISCV_TLSDESC_CALL 65
-#define R_RISCV_NUM 62
+#define R_RISCV_NUM 66
/* RISC-V specific values for the st_other field. */
#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
@@ -4147,7 +4136,7 @@ enum
/* 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. */
+/* RISC-V specific values for the p_type field (deprecated). */
#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
/* RISC-V specific values for the d_tag field. */
lib/libc/glibc/include/elf.h
@@ -15,6 +15,19 @@
# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))
+# ifdef HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
+# define DL_ADDRESS_WITHOUT_RELOC(expr) (expr)
+# else
+/* Evaluate EXPR without run-time relocation for it. EXPR should be an
+ array, an address of an object, or a string literal. */
+# define DL_ADDRESS_WITHOUT_RELOC(expr) \
+ ({ \
+ __auto_type _result = (expr); \
+ asm ("" : "+r" (_result)); \
+ _result; \
+ })
+# endif
+
/* Some information which is not meant for the public and therefore not
in <elf.h>. */
# include <dl-dtprocnum.h>
lib/libc/glibc/include/libc-symbols.h
@@ -155,7 +155,7 @@
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
__attribute_copy__ (name);
-/* Zig patch. weak_hidden_alias was removed from glibc v2.36 (v2.37?), Zig
+/* zig patch: weak_hidden_alias was removed from glibc v2.36 (v2.37?), Zig
needs it for the v2.32 and earlier {f,l,}stat wrappers, so only include
in this header for 2.32 and earlier. */
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 32) || __GLIBC__ < 2
@@ -220,7 +220,7 @@
#define __make_section_unallocated(section_string) \
asm (".section " section_string "\n\t.previous");
-/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
+/* Tacking on "\n\t#" to the section name makes gcc put its bogus
section attributes on what looks like a comment to the assembler. */
#ifdef HAVE_SECTION_QUOTES
# define __sec_comment "\"\n\t#\""
@@ -280,7 +280,7 @@ for linking")
/*
-
+
*/
#ifdef HAVE_GNU_RETAIN
@@ -807,7 +807,7 @@ for linking")
#define libm_ifunc_init()
#define libm_ifunc(name, expr) \
__ifunc (name, name, expr, void, libm_ifunc_init)
-
+
/* These macros facilitate sharing source files with gnulib.
They are here instead of sys/cdefs.h because they should not be
lib/libc/glibc/include/stdlib.h
@@ -368,6 +368,21 @@ struct abort_msg_s
extern struct abort_msg_s *__abort_msg;
libc_hidden_proto (__abort_msg)
+enum readonly_error_type
+{
+ readonly_noerror,
+ readonly_area_writable,
+ readonly_procfs_inaccessible,
+ readonly_procfs_open_fail,
+};
+
+extern enum readonly_error_type __readonly_area (const void *ptr,
+ size_t size)
+ attribute_hidden;
+extern enum readonly_error_type __readonly_area_fallback (const void *ptr,
+ size_t size)
+ attribute_hidden;
+
# if IS_IN (rtld)
extern __typeof (unsetenv) unsetenv attribute_hidden;
extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
lib/libc/glibc/io/fcntl.h
@@ -168,7 +168,7 @@ typedef __pid_t pid_t;
#endif
-/* fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards
+/* zig patch: 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.
@@ -288,16 +288,17 @@ extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
# define F_TEST 3 /* Test a region for other processes locks. */
# ifndef __USE_FILE_OFFSET64
-extern int lockf (int __fd, int __cmd, off_t __len);
+extern int lockf (int __fd, int __cmd, off_t __len) __wur;
# else
# ifdef __REDIRECT
-extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
+extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len),
+ lockf64) __wur;
# else
# define lockf lockf64
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int lockf64 (int __fd, int __cmd, off64_t __len);
+extern int lockf64 (int __fd, int __cmd, off64_t __len) __wur;
# endif
#endif
lib/libc/glibc/posix/bits/types.h
@@ -217,7 +217,7 @@ typedef int __sig_atomic_t;
/* Seconds since the Epoch, visible to user code when time_t is too
narrow only for consistency with the old way of widening too-narrow
types. User code should never use __time64_t. */
-/* Zig patch: Don't check __LIBC here because it breaks fstatat.c on x86. */
+/* zig patch: Don't check __LIBC here because it breaks fstatat.c on x86. */
#if __TIMESIZE == 64
# define __time64_t __time_t
#elif __TIMESIZE != 64
lib/libc/glibc/stdlib/stdlib.h
@@ -985,6 +985,12 @@ __extension__ extern long long int llabs (long long int __x)
__THROW __attribute__ ((__const__)) __wur;
#endif
+#if __GLIBC_USE (ISOC2Y)
+extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur;
+extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur;
+__extension__ extern unsigned long long int ullabs (long long int __x)
+ __THROW __attribute__ ((__const__)) __wur;
+#endif
/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
of the value of NUMER over DENOM. */
lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -21,23 +21,13 @@
#include <bits/endian.h>
-#ifdef __ILP32__
-# define __SIZEOF_PTHREAD_ATTR_T 32
-# define __SIZEOF_PTHREAD_MUTEX_T 32
-# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_CONDATTR_T 4
-# define __SIZEOF_PTHREAD_RWLOCK_T 48
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-#else
-# define __SIZEOF_PTHREAD_ATTR_T 64
-# define __SIZEOF_PTHREAD_MUTEX_T 48
-# define __SIZEOF_PTHREAD_MUTEXATTR_T 8
-# define __SIZEOF_PTHREAD_CONDATTR_T 8
-# define __SIZEOF_PTHREAD_RWLOCK_T 56
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 8
-#endif
+#define __SIZEOF_PTHREAD_ATTR_T 64
+#define __SIZEOF_PTHREAD_MUTEX_T 48
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 8
+#define __SIZEOF_PTHREAD_CONDATTR_T 8
+#define __SIZEOF_PTHREAD_RWLOCK_T 56
+#define __SIZEOF_PTHREAD_BARRIER_T 32
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 8
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
lib/libc/glibc/sysdeps/aarch64/start-2.33.S
@@ -54,8 +54,8 @@ _start:
mov x5, x0
/* Load argc and a pointer to argv */
- ldr PTR_REG (1), [sp, #0]
- add x2, sp, #PTR_SIZE
+ ldr x1, [sp, #0]
+ add x2, sp, 8
/* Setup stack limit in argument register */
mov x6, sp
@@ -63,13 +63,13 @@ _start:
#ifdef PIC
# ifdef SHARED
adrp x0, :got:main
- ldr PTR_REG (0), [x0, #:got_lo12:main]
+ ldr x0, [x0, #:got_lo12:main]
adrp x3, :got:__libc_csu_init
- ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
+ ldr x3, [x3, #:got_lo12:__libc_csu_init]
adrp x4, :got:__libc_csu_fini
- ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
+ ldr x4, [x4, #:got_lo12:__libc_csu_fini]
# else
adrp x0, __wrap_main
add x0, x0, :lo12:__wrap_main
@@ -80,9 +80,18 @@ _start:
# endif
#else
/* Set up the other arguments in registers */
- MOVL (0, main)
- MOVL (3, __libc_csu_init)
- MOVL (4, __libc_csu_fini)
+ movz x0, :abs_g3:main
+ movk x0, :abs_g2_nc:main
+ movk x0, :abs_g1_nc:main
+ movk x0, :abs_g0_nc:main
+ movz x3, :abs_g3:__libc_csu_init
+ movk x3, :abs_g2_nc:__libc_csu_init
+ movk x3, :abs_g1_nc:__libc_csu_init
+ movk x3, :abs_g0_nc:__libc_csu_init
+ movz x4, :abs_g3:__libc_csu_fini
+ movk x4, :abs_g2_nc:__libc_csu_fini
+ movk x4, :abs_g1_nc:__libc_csu_fini
+ movk x4, :abs_g0_nc:__libc_csu_fini
#endif
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
lib/libc/glibc/sysdeps/aarch64/start.S
@@ -70,8 +70,8 @@ ENTRY(_start)
mov x5, x0
/* Load argc and a pointer to argv */
- ldr PTR_REG (1), [sp, #0]
- add x2, sp, #PTR_SIZE
+ ldr x1, [sp, #0]
+ add x2, sp, 8
/* Setup stack limit in argument register */
mov x6, sp
@@ -79,14 +79,16 @@ ENTRY(_start)
#ifdef PIC
# ifdef SHARED
adrp x0, :got:main
- ldr PTR_REG (0), [x0, #:got_lo12:main]
+ ldr x0, [x0, #:got_lo12:main]
# else
adrp x0, __wrap_main
add x0, x0, :lo12:__wrap_main
# endif
#else
- /* Set up the other arguments in registers */
- MOVL (0, main)
+ movz x0, :abs_g3:main
+ movk x0, :abs_g2_nc:main
+ movk x0, :abs_g1_nc:main
+ movk x0, :abs_g0_nc:main
#endif
mov x3, #0 /* Used to be init. */
mov x4, #0 /* Used to be fini. */
@@ -106,7 +108,7 @@ ENTRY(_start)
because crt1.o and rcrt1.o share code and the later must avoid the
use of GOT relocations before __libc_start_main is called. */
__wrap_main:
- BTI_C
+ bti c
b main
#endif
END(_start)
lib/libc/glibc/sysdeps/aarch64/sysdep.h
@@ -21,59 +21,15 @@
#include <sysdeps/generic/sysdep.h>
-#ifdef __LP64__
-# define AARCH64_R(NAME) R_AARCH64_ ## NAME
-# define PTR_REG(n) x##n
-# define PTR_LOG_SIZE 3
-# define PTR_ARG(n)
-# define SIZE_ARG(n)
-#else
-# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
-# define PTR_REG(n) w##n
-# define PTR_LOG_SIZE 2
-# define PTR_ARG(n) mov w##n, w##n
-# define SIZE_ARG(n) mov w##n, w##n
-#endif
-
-#define PTR_SIZE (1<<PTR_LOG_SIZE)
-
-#ifndef __ASSEMBLER__
-/* Strip pointer authentication code from pointer p. */
-static inline void *
-strip_pac (void *p)
-{
- register void *ra asm ("x30") = (p);
- asm ("hint 7 // xpaclri" : "+r"(ra));
- return ra;
-}
-
-/* This is needed when glibc is built with -mbranch-protection=pac-ret
- with a gcc that is affected by PR target/94891. */
-# if HAVE_AARCH64_PAC_RET
-# undef RETURN_ADDRESS
-# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n))
-# endif
-#endif
-
#ifdef __ASSEMBLER__
+/* CFI directive for return address. */
+#define cfi_negate_ra_state .cfi_negate_ra_state
+
/* Syntactic details of assembler. */
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
-/* Branch Target Identitication support. */
-#if HAVE_AARCH64_BTI
-# define BTI_C hint 34
-# define BTI_J hint 36
-#else
-# define BTI_C nop
-# define BTI_J nop
-#endif
-
-/* Return address signing support (pac-ret). */
-#define PACIASP hint 25
-#define AUTIASP hint 29
-
/* Guarded Control Stack support. */
#define CHKFEAT_X16 hint 40
#define MRS_GCSPR(x) mrs x, s3_3_c2_c5_1
@@ -103,11 +59,7 @@ strip_pac (void *p)
/* Add GNU property note with the supported features to all asm code
where sysdep.h is included. */
-#if HAVE_AARCH64_BTI && HAVE_AARCH64_PAC_RET
GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC|FEATURE_1_GCS)
-#elif HAVE_AARCH64_BTI
-GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
-#endif
/* Define an entry point visible from C. */
#define ENTRY(name) \
@@ -116,7 +68,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
.p2align 6; \
C_LABEL(name) \
cfi_startproc; \
- BTI_C; \
+ bti c; \
CALL_MCOUNT
/* Define an entry point visible from C. */
@@ -126,7 +78,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
.p2align align; \
C_LABEL(name) \
cfi_startproc; \
- BTI_C; \
+ bti c; \
CALL_MCOUNT
/* Define an entry point visible from C with a specified alignment and
@@ -143,7 +95,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
.endr; \
C_LABEL(name) \
cfi_startproc; \
- BTI_C; \
+ bti c; \
CALL_MCOUNT
#undef END
@@ -195,33 +147,6 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
# define L(name) .L##name
#endif
-/* Load or store to/from a pc-relative EXPR into/from R, using T.
- Note R and T are register numbers and not register names. */
-#define LDST_PCREL(OP, R, T, EXPR) \
- adrp x##T, EXPR; \
- OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
-
-/* Load or store to/from a got-relative EXPR into/from R, using T.
- Note R and T are register numbers and not register names. */
-#define LDST_GLOBAL(OP, R, T, EXPR) \
- adrp x##T, :got:EXPR; \
- ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
- OP PTR_REG (R), [x##T];
-
-/* Load an immediate into R.
- Note R is a register number and not a register name. */
-#ifdef __LP64__
-# define MOVL(R, NAME) \
- movz PTR_REG (R), #:abs_g3:NAME; \
- movk PTR_REG (R), #:abs_g2_nc:NAME; \
- movk PTR_REG (R), #:abs_g1_nc:NAME; \
- movk PTR_REG (R), #:abs_g0_nc:NAME;
-#else
-# define MOVL(R, NAME) \
- movz PTR_REG (R), #:abs_g1:NAME; \
- movk PTR_REG (R), #:abs_g0_nc:NAME;
-#endif
-
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
lib/libc/glibc/sysdeps/generic/sysdep.h
@@ -45,6 +45,7 @@
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
# define cfi_offset(reg, off) .cfi_offset reg, off
# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
+# define cfi_val_offset(reg, off) .cfi_val_offset reg, off
# define cfi_register(r1, r2) .cfi_register r1, r2
# define cfi_return_column(reg) .cfi_return_column reg
# define cfi_restore(reg) .cfi_restore reg
@@ -74,6 +75,8 @@
".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
# define CFI_REL_OFFSET(reg, off) \
".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
+# define CFI_VAL_OFFSET(reg, off) \
+ ".cfi_val_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
# define CFI_REGISTER(r1, r2) \
".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
# define CFI_RETURN_COLUMN(reg) \
lib/libc/glibc/sysdeps/htl/libc-lockP.h
@@ -75,7 +75,6 @@
extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
const pthread_mutexattr_t *__mutex_attr);
-
extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
libc_hidden_proto (__pthread_mutex_destroy)
@@ -91,75 +90,47 @@ libc_hidden_proto (__pthread_mutexattr_init)
extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
libc_hidden_proto (__pthread_mutexattr_destroy)
-extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
- int __kind);
-
extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
const pthread_rwlockattr_t *__attr);
+libc_hidden_proto (__pthread_rwlock_init)
extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_destroy)
extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_rdlock)
extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_tryrdlock)
extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_wrlock)
extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_trywrlock)
extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_unlock)
extern int __pthread_once (pthread_once_t *__once_control,
void (*__init_routine) (void));
+libc_hidden_proto (__pthread_once);
extern int __pthread_atfork (void (*__prepare) (void),
void (*__parent) (void),
void (*__child) (void));
+extern int __pthread_setcancelstate (int state, int *oldstate);
+libc_hidden_proto (__pthread_setcancelstate)
/* Make the pthread functions weak so that we can elide them from
single-threaded processes. */
#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
# ifdef weak_extern
-weak_extern (__pthread_mutex_init)
-weak_extern (__pthread_mutex_destroy)
-weak_extern (__pthread_mutex_lock)
-weak_extern (__pthread_mutex_trylock)
-weak_extern (__pthread_mutex_unlock)
-weak_extern (__pthread_mutexattr_settype)
-weak_extern (__pthread_rwlock_init)
-weak_extern (__pthread_rwlock_destroy)
-weak_extern (__pthread_rwlock_rdlock)
-weak_extern (__pthread_rwlock_tryrdlock)
-weak_extern (__pthread_rwlock_wrlock)
-weak_extern (__pthread_rwlock_trywrlock)
-weak_extern (__pthread_rwlock_unlock)
-weak_extern (__pthread_key_create)
-weak_extern (__pthread_setspecific)
-weak_extern (__pthread_getspecific)
-weak_extern (__pthread_once)
weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
-weak_extern (__pthread_setcancelstate)
# else
-# pragma weak __pthread_mutex_init
-# pragma weak __pthread_mutex_destroy
-# pragma weak __pthread_mutex_lock
-# pragma weak __pthread_mutex_trylock
-# pragma weak __pthread_mutex_unlock
-# pragma weak __pthread_mutexattr_settype
-# pragma weak __pthread_rwlock_destroy
-# pragma weak __pthread_rwlock_rdlock
-# pragma weak __pthread_rwlock_tryrdlock
-# pragma weak __pthread_rwlock_wrlock
-# pragma weak __pthread_rwlock_trywrlock
-# pragma weak __pthread_rwlock_unlock
-# pragma weak __pthread_key_create
-# pragma weak __pthread_setspecific
-# pragma weak __pthread_getspecific
-# pragma weak __pthread_once
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
-# pragma weak __pthread_setcancelstate
# endif
#endif
lib/libc/glibc/sysdeps/mach/sysdep.h
@@ -20,6 +20,11 @@
/* Get the Mach definitions of ENTRY and kernel_trap. */
#include <mach/machine/syscall_sw.h>
+/* This macro is defined in Mach system headers, but string functions use it
+ with different definitions depending on whether being compiled for
+ wide-characters or not. */
+#undef P2ALIGN
+
/* The Mach definitions assume underscores should be prepended to
symbol names. Redefine them to do so only when appropriate. */
#undef EXT
lib/libc/glibc/sysdeps/nptl/pthread.h
@@ -1317,6 +1317,11 @@ extern int pthread_getcpuclockid (pthread_t __thread_id,
__THROW __nonnull ((2));
#endif
+#ifdef __USE_GNU
+/* Return the Linux TID for THREAD_ID. Returns -1 on failure. */
+extern pid_t pthread_gettid_np (pthread_t __thread_id);
+#endif
+
/* Install handlers to be called when a new process is created with FORK.
The PREPARE handler is called in the parent process just before performing
lib/libc/glibc/sysdeps/sparc/sparc32/start.S
@@ -35,6 +35,7 @@
#include <sysdep.h>
+#define FRAME_SIZE 104
.section ".text"
.align 4
@@ -48,12 +49,12 @@ _start:
/* Terminate the stack frame, and reserve space for functions to
drop their arguments. */
mov %g0, %fp
- sub %sp, 6*4, %sp
+ sub %sp, FRAME_SIZE, %sp
/* Extract the arguments and environment as encoded on the stack. The
argument info starts after one register window (16 words) past the SP. */
- ld [%sp+22*4], %o1
- add %sp, 23*4, %o2
+ ld [%sp+168], %o1
+ add %sp, 172, %o2
/* Load the addresses of the user entry points. */
#ifndef PIC
@@ -73,6 +74,10 @@ _start:
be NULL. */
mov %g1, %o5
+ /* Provide the highest stack address to update the __libc_stack_end (used
+ to enable executable stacks if required). */
+ st %sp, [%sp+23*4]
+
/* Let libc do the rest of the initialization, and call main. */
call __libc_start_main
nop
lib/libc/glibc/sysdeps/sparc/sparc64/start.S
@@ -74,6 +74,10 @@ _start:
be NULL. */
mov %g1, %o5
+ /* Provide the highest stack address to update the __libc_stack_end (used
+ to enable executable stacks if required). */
+ stx %sp, [%sp+STACK_BIAS+22*8]
+
/* Let libc do the rest of the initialization, and call main. */
call __libc_start_main
nop
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -152,13 +152,8 @@
#else /* not __ASSEMBLER__ */
-# ifdef __LP64__
-# define VDSO_NAME "LINUX_2.6.39"
-# define VDSO_HASH 123718537
-# else
-# define VDSO_NAME "LINUX_4.9"
-# define VDSO_HASH 61765625
-# endif
+# define VDSO_NAME "LINUX_2.6.39"
+# define VDSO_HASH 123718537
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -145,11 +145,12 @@
# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
+# define HAVE_GETRANDOM_VSYSCALL "__vdso_getrandom"
# else
# define VDSO_NAME "LINUX_5.4"
# define VDSO_HASH 61765876
-/* RV32 does not support the gettime VDSO syscalls. */
+/* RV32 does not support the gettime and getrandom VDSO syscalls. */
# endif
# define HAVE_CLONE3_WRAPPER 1
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h
@@ -54,6 +54,10 @@
configurations). */
#define __ASSUME_SET_ROBUST_LIST 1
+/* The termios2 interface was introduced across all architectures except
+ Alpha in kernel 2.6.22. */
+#define __ASSUME_TERMIOS2 1
+
/* Support for various CLOEXEC and NONBLOCK flags was added in
2.6.27. */
#define __ASSUME_IN_NONBLOCK 1
lib/libc/glibc/sysdeps/x86/sysdep.h
@@ -102,6 +102,9 @@
| (1 << X86_XSTATE_ZMM_ID) \
| (1 << X86_XSTATE_APX_F_ID))
+/* The maximum supported xstate ID. */
+# define X86_XSTATE_MAX_ID X86_XSTATE_APX_F_ID
+
/* AMX state mask. */
# define AMX_STATE_SAVE_MASK \
((1 << X86_XSTATE_TILECFG_ID) | (1 << X86_XSTATE_TILEDATA_ID))
@@ -123,6 +126,9 @@
| (1 << X86_XSTATE_K_ID) \
| (1 << X86_XSTATE_ZMM_H_ID))
+/* The maximum supported xstate ID. */
+# define X86_XSTATE_MAX_ID X86_XSTATE_ZMM_H_ID
+
/* States to be included in xsave_state_size. */
# define FULL_STATE_SAVE_MASK STATE_SAVE_MASK
#endif
@@ -177,6 +183,29 @@
#define atom_text_section .section ".text.atom", "ax"
+#ifndef DL_STACK_ALIGNMENT
+/* Due to GCC bug:
+
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
+
+ __tls_get_addr may be called with 8-byte/4-byte stack alignment.
+ Although this bug has been fixed in GCC 4.9.4, 5.3 and 6, we can't
+ assume that stack will be always aligned at 16 bytes. */
+# ifdef __x86_64__
+# define DL_STACK_ALIGNMENT 8
+# define MINIMUM_ALIGNMENT 16
+# else
+# define DL_STACK_ALIGNMENT 4
+# endif
+#endif
+
+/* True if _dl_runtime_resolve/_dl_tlsdesc_dynamic should align stack for
+ STATE_SAVE or align stack to MINIMUM_ALIGNMENT bytes before calling
+ _dl_fixup/__tls_get_addr. */
+#define DL_RUNTIME_RESOLVE_REALIGN_STACK \
+ (STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \
+ || MINIMUM_ALIGNMENT > DL_STACK_ALIGNMENT)
+
#endif /* __ASSEMBLER__ */
#endif /* _X86_SYSDEP_H */