diff --git a/lib/libc/glibc/abilists b/lib/libc/glibc/abilists index 303f84023351..d8a3ab654eba 100644 Binary files a/lib/libc/glibc/abilists and b/lib/libc/glibc/abilists differ diff --git a/lib/libc/glibc/elf/elf.h b/lib/libc/glibc/elf/elf.h index 96df2eec01eb..2f29a47c0bb8 100644 --- a/lib/libc/glibc/elf/elf.h +++ b/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. */ diff --git a/lib/libc/glibc/include/elf.h b/lib/libc/glibc/include/elf.h index 14ed67ff67d3..1424982bb590 100644 --- a/lib/libc/glibc/include/elf.h +++ b/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 . */ # include diff --git a/lib/libc/glibc/include/libc-symbols.h b/lib/libc/glibc/include/libc-symbols.h index b11460131dd5..7f2c8938b6cd 100644 --- a/lib/libc/glibc/include/libc-symbols.h +++ b/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 diff --git a/lib/libc/glibc/include/stdlib.h b/lib/libc/glibc/include/stdlib.h index 57f4ab854502..b7147ba59071 100644 --- a/lib/libc/glibc/include/stdlib.h +++ b/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; diff --git a/lib/libc/glibc/io/fcntl.h b/lib/libc/glibc/io/fcntl.h index 2e07f8fc4b2c..d99dc68a8874 100644 --- a/lib/libc/glibc/io/fcntl.h +++ b/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 diff --git a/lib/libc/glibc/posix/bits/types.h b/lib/libc/glibc/posix/bits/types.h index 97d2b1be3566..a6638467c8bc 100644 --- a/lib/libc/glibc/posix/bits/types.h +++ b/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 diff --git a/lib/libc/glibc/stdlib/stdlib.h b/lib/libc/glibc/stdlib/stdlib.h index 975f5aeb0b26..cd4503c76188 100644 --- a/lib/libc/glibc/stdlib/stdlib.h +++ b/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. */ diff --git a/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h index 7f11e82ff572..c2825603353e 100644 --- a/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h @@ -21,23 +21,13 @@ #include -#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 diff --git a/lib/libc/glibc/sysdeps/aarch64/start-2.33.S b/lib/libc/glibc/sysdeps/aarch64/start-2.33.S index d96cf57e2da9..6d8d49ce2390 100644 --- a/lib/libc/glibc/sysdeps/aarch64/start-2.33.S +++ b/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, diff --git a/lib/libc/glibc/sysdeps/aarch64/start.S b/lib/libc/glibc/sysdeps/aarch64/start.S index ef6b5ad686c8..694c338c8be3 100644 --- a/lib/libc/glibc/sysdeps/aarch64/start.S +++ b/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) diff --git a/lib/libc/glibc/sysdeps/aarch64/sysdep.h b/lib/libc/glibc/sysdeps/aarch64/sysdep.h index 036eb125274e..f5e28cb2427e 100644 --- a/lib/libc/glibc/sysdeps/aarch64/sysdep.h +++ b/lib/libc/glibc/sysdeps/aarch64/sysdep.h @@ -21,59 +21,15 @@ #include -#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< +/* 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 diff --git a/lib/libc/glibc/sysdeps/nptl/pthread.h b/lib/libc/glibc/sysdeps/nptl/pthread.h index 9ad36cabe92e..92957a620d95 100644 --- a/lib/libc/glibc/sysdeps/nptl/pthread.h +++ b/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 diff --git a/lib/libc/glibc/sysdeps/sparc/sparc32/start.S b/lib/libc/glibc/sysdeps/sparc/sparc32/start.S index 694b020ce0de..8393760da684 100644 --- a/lib/libc/glibc/sysdeps/sparc/sparc32/start.S +++ b/lib/libc/glibc/sysdeps/sparc/sparc32/start.S @@ -35,6 +35,7 @@ #include +#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 diff --git a/lib/libc/glibc/sysdeps/sparc/sparc64/start.S b/lib/libc/glibc/sysdeps/sparc/sparc64/start.S index c9c25c2e4794..08e1e7721054 100644 --- a/lib/libc/glibc/sysdeps/sparc/sparc64/start.S +++ b/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 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h index b81380593125..f0e8d64eefac 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/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" diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h index 86b2d3ce5125..a49a9159cfa7 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h +++ b/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 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h index ee015dfeb65b..05e0e0523d3f 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/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 diff --git a/lib/libc/glibc/sysdeps/x86/sysdep.h b/lib/libc/glibc/sysdeps/x86/sysdep.h index 541393f1dc3e..b8e963b654c4 100644 --- a/lib/libc/glibc/sysdeps/x86/sysdep.h +++ b/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 */ diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h index aaecf2bbc045..52dee64f6f1d 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h @@ -25,17 +25,11 @@ #define __O_NOFOLLOW 0100000 #define __O_DIRECT 0200000 -#ifdef __ILP32__ -# define __O_LARGEFILE 0400000 -#else -# define __O_LARGEFILE 0 -#endif +#define __O_LARGEFILE 0 -#ifdef __LP64__ -# define F_GETLK64 5 -# define F_SETLK64 6 -# define F_SETLKW64 7 -#endif +#define F_GETLK64 5 +#define F_SETLK64 6 +#define F_SETLKW64 7 struct flock { diff --git a/lib/libc/include/aarch64-linux-gnu/bits/math-vector.h b/lib/libc/include/aarch64-linux-gnu/bits/math-vector.h index 95d52f96fc41..c45062287965 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/math-vector.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/math-vector.h @@ -37,6 +37,10 @@ # define __DECL_SIMD_acosh __DECL_SIMD_aarch64 # undef __DECL_SIMD_acoshf # define __DECL_SIMD_acoshf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_acospi +# define __DECL_SIMD_acospi __DECL_SIMD_aarch64 +# undef __DECL_SIMD_acospif +# define __DECL_SIMD_acospif __DECL_SIMD_aarch64 # undef __DECL_SIMD_asin # define __DECL_SIMD_asin __DECL_SIMD_aarch64 # undef __DECL_SIMD_asinf @@ -45,6 +49,10 @@ # define __DECL_SIMD_asinh __DECL_SIMD_aarch64 # undef __DECL_SIMD_asinhf # define __DECL_SIMD_asinhf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_asinpi +# define __DECL_SIMD_asinpi __DECL_SIMD_aarch64 +# undef __DECL_SIMD_asinpif +# define __DECL_SIMD_asinpif __DECL_SIMD_aarch64 # undef __DECL_SIMD_atan # define __DECL_SIMD_atan __DECL_SIMD_aarch64 # undef __DECL_SIMD_atanf @@ -53,10 +61,18 @@ # define __DECL_SIMD_atanh __DECL_SIMD_aarch64 # undef __DECL_SIMD_atanhf # define __DECL_SIMD_atanhf __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atanpi +# define __DECL_SIMD_atanpi __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atanpif +# define __DECL_SIMD_atanpif __DECL_SIMD_aarch64 # undef __DECL_SIMD_atan2 # define __DECL_SIMD_atan2 __DECL_SIMD_aarch64 # undef __DECL_SIMD_atan2f # define __DECL_SIMD_atan2f __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atan2pi +# define __DECL_SIMD_atan2pi __DECL_SIMD_aarch64 +# undef __DECL_SIMD_atan2pif +# define __DECL_SIMD_atan2pif __DECL_SIMD_aarch64 # undef __DECL_SIMD_cbrt # define __DECL_SIMD_cbrt __DECL_SIMD_aarch64 # undef __DECL_SIMD_cbrtf @@ -176,12 +192,16 @@ typedef __SVBool_t __sv_bool_t; # define __vpcs __attribute__ ((__aarch64_vector_pcs__)) __vpcs __f32x4_t _ZGVnN4vv_atan2f (__f32x4_t, __f32x4_t); +__vpcs __f32x4_t _ZGVnN4vv_atan2pif (__f32x4_t, __f32x4_t); __vpcs __f32x4_t _ZGVnN4v_acosf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_acoshf (__f32x4_t); +__vpcs __f32x4_t _ZGVnN4v_acospif (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_asinf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_asinhf (__f32x4_t); +__vpcs __f32x4_t _ZGVnN4v_asinpif (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_atanf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_atanhf (__f32x4_t); +__vpcs __f32x4_t _ZGVnN4v_atanpif (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_cbrtf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_cosf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_coshf (__f32x4_t); @@ -207,12 +227,16 @@ __vpcs __f32x4_t _ZGVnN4v_tanhf (__f32x4_t); __vpcs __f32x4_t _ZGVnN4v_tanpif (__f32x4_t); __vpcs __f64x2_t _ZGVnN2vv_atan2 (__f64x2_t, __f64x2_t); +__vpcs __f64x2_t _ZGVnN2vv_atan2pi (__f64x2_t, __f64x2_t); __vpcs __f64x2_t _ZGVnN2v_acos (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_acosh (__f64x2_t); +__vpcs __f64x2_t _ZGVnN2v_acospi (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_asin (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_asinh (__f64x2_t); +__vpcs __f64x2_t _ZGVnN2v_asinpi (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_atan (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_atanh (__f64x2_t); +__vpcs __f64x2_t _ZGVnN2v_atanpi (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_cbrt (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_cos (__f64x2_t); __vpcs __f64x2_t _ZGVnN2v_cosh (__f64x2_t); @@ -243,12 +267,16 @@ __vpcs __f64x2_t _ZGVnN2v_tanpi (__f64x2_t); #ifdef __SVE_VEC_MATH_SUPPORTED __sv_f32_t _ZGVsMxvv_atan2f (__sv_f32_t, __sv_f32_t, __sv_bool_t); +__sv_f32_t _ZGVsMxvv_atan2pif (__sv_f32_t, __sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_acosf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_acoshf (__sv_f32_t, __sv_bool_t); +__sv_f32_t _ZGVsMxv_acospif (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_asinf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_asinhf (__sv_f32_t, __sv_bool_t); +__sv_f32_t _ZGVsMxv_asinpif (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_atanf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_atanhf (__sv_f32_t, __sv_bool_t); +__sv_f32_t _ZGVsMxv_atanpif (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_cbrtf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_cosf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_coshf (__sv_f32_t, __sv_bool_t); @@ -274,12 +302,16 @@ __sv_f32_t _ZGVsMxv_tanhf (__sv_f32_t, __sv_bool_t); __sv_f32_t _ZGVsMxv_tanpif (__sv_f32_t, __sv_bool_t); __sv_f64_t _ZGVsMxvv_atan2 (__sv_f64_t, __sv_f64_t, __sv_bool_t); +__sv_f64_t _ZGVsMxvv_atan2pi (__sv_f64_t, __sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_acos (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_acosh (__sv_f64_t, __sv_bool_t); +__sv_f64_t _ZGVsMxv_acospi (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_asin (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_asinh (__sv_f64_t, __sv_bool_t); +__sv_f64_t _ZGVsMxv_asinpi (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_atan (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_atanh (__sv_f64_t, __sv_bool_t); +__sv_f64_t _ZGVsMxv_atanpi (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_cbrt (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_cos (__sv_f64_t, __sv_bool_t); __sv_f64_t _ZGVsMxv_cosh (__sv_f64_t, __sv_bool_t); diff --git a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h index bee5cc5acf9d..2dbe12da0ca4 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h @@ -21,23 +21,13 @@ #include -#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 diff --git a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h index 256f68bbfc75..7d3d93431e67 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h @@ -20,13 +20,7 @@ # error "Never use directly; include instead." #endif - -#ifdef __ILP32__ -# define __SIZEOF_SEM_T 16 -#else -# define __SIZEOF_SEM_T 32 -#endif - +#define __SIZEOF_SEM_T 32 /* Value returned if `sem_open' failed. */ #define SEM_FAILED ((sem_t *) 0) diff --git a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h index 30b14a9b640f..3f84507cc16e 100644 --- a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h +++ b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h @@ -17,12 +17,5 @@ License along with the GNU C Library; if not, see . */ -#ifdef __LP64__ -# define __WORDSIZE 64 -#else -# define __WORDSIZE 32 -# define __WORDSIZE32_SIZE_ULONG 1 -# define __WORDSIZE32_PTRDIFF_LONG 1 -#endif - +#define __WORDSIZE 64 #define __WORDSIZE_TIME64_COMPAT32 0 \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/arpa/inet.h b/lib/libc/include/generic-glibc/arpa/inet.h index 8d6490ef478c..84602130a935 100644 --- a/lib/libc/include/generic-glibc/arpa/inet.h +++ b/lib/libc/include/generic-glibc/arpa/inet.h @@ -101,6 +101,11 @@ extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp, char *__buf) __THROW; #endif +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Include functions with security checks. */ +# include +#endif + __END_DECLS #endif /* arpa/inet.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/fcntl-linux.h b/lib/libc/include/generic-glibc/bits/fcntl-linux.h index 8ebc3319b61e..56169a7ba490 100644 --- a/lib/libc/include/generic-glibc/bits/fcntl-linux.h +++ b/lib/libc/include/generic-glibc/bits/fcntl-linux.h @@ -379,6 +379,8 @@ struct file_handle identity and may not be usable to open_by_handle_at. */ +# define AT_HANDLE_MNT_ID_UNIQUE 1 /* Return the 64-bit unique mount + ID. */ #endif __BEGIN_DECLS diff --git a/lib/libc/include/generic-glibc/bits/inet-fortified-decl.h b/lib/libc/include/generic-glibc/bits/inet-fortified-decl.h new file mode 100644 index 000000000000..a77a0477cda6 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/inet-fortified-decl.h @@ -0,0 +1,42 @@ +/* Declarations of checking macros for inet functions. + Copyright (C) 2025 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 + . */ + +#ifndef _BITS_INET_FORTIFIED_DEC_H +#define _BITS_INET_FORTIFIED_DEC_H 1 + +#ifndef _ARPA_INET_H +# error "Never include directly; use instead." +#endif + +extern const char *__inet_ntop_chk (int, const void *, char *, socklen_t, size_t); + +extern const char *__REDIRECT_FORTIFY_NTH (__inet_ntop_alias, + (int, const void *, char *, socklen_t), inet_ntop); +extern const char *__REDIRECT_NTH (__inet_ntop_chk_warn, + (int, const void *, char *, socklen_t, size_t), __inet_ntop_chk) + __warnattr ("inet_ntop called with bigger length than " + "size of destination buffer"); + +extern int __inet_pton_chk (int, const char *, void *, size_t); + +extern int __REDIRECT_FORTIFY_NTH (__inet_pton_alias, + (int, const char *, void *), inet_pton); +extern int __REDIRECT_NTH (__inet_pton_chk_warn, + (int, const char *, void *, size_t), __inet_pton_chk) + __warnattr ("inet_pton called with a destination buffer size too small"); +#endif /* bits/inet-fortified-decl.h. */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/inet-fortified.h b/lib/libc/include/generic-glibc/bits/inet-fortified.h new file mode 100644 index 000000000000..88aafbe8b20b --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/inet-fortified.h @@ -0,0 +1,61 @@ +/* Checking macros for inet functions. + Copyright (C) 2025 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 + . */ + +#ifndef _BITS_INET_FORTIFIED_H +#define _BITS_INET_FORTIFIED_H 1 + +#ifndef _ARPA_INET_H +# error "Never include directly; use instead." +#endif + +#include + +__fortify_function __attribute_overloadable__ const char * +__NTH (inet_ntop (int __af, + __fortify_clang_overload_arg (const void *, __restrict, __src), + char *__restrict __dst, socklen_t __dst_size)) + __fortify_clang_warning_only_if_bos_lt (__dst_size, __dst, + "inet_ntop called with bigger length " + "than size of destination buffer") +{ + return __glibc_fortify (inet_ntop, __dst_size, sizeof (char), + __glibc_objsize (__dst), + __af, __src, __dst, __dst_size); +}; + +__fortify_function __attribute_overloadable__ int +__NTH (inet_pton (int __af, + const char *__restrict __src, + __fortify_clang_overload_arg (void *, __restrict, __dst))) + __fortify_clang_warning_only_if_bos0_lt + (4, __dst, "inet_pton called with destination buffer size less than 4") +{ + size_t sz = 0; + if (__af == AF_INET) + sz = sizeof (struct in_addr); + else if (__af == AF_INET6) + sz = sizeof (struct in6_addr); + else + return __inet_pton_alias (__af, __src, __dst); + + return __glibc_fortify (inet_pton, sz, sizeof (char), + __glibc_objsize (__dst), + __af, __src, __dst); +}; + +#endif /* bits/inet-fortified.h. */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/ioctl-types.h b/lib/libc/include/generic-glibc/bits/ioctl-types.h index 08562e7ba199..13c5bc0d455f 100644 --- a/lib/libc/include/generic-glibc/bits/ioctl-types.h +++ b/lib/libc/include/generic-glibc/bits/ioctl-types.h @@ -32,17 +32,6 @@ struct winsize unsigned short int ws_ypixel; }; -#define NCC 8 -struct termio - { - unsigned short int c_iflag; /* input mode flags */ - unsigned short int c_oflag; /* output mode flags */ - unsigned short int c_cflag; /* control mode flags */ - unsigned short int c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 diff --git a/lib/libc/include/generic-glibc/bits/ioctls.h b/lib/libc/include/generic-glibc/bits/ioctls.h index 915563810f35..84594dd23947 100644 --- a/lib/libc/include/generic-glibc/bits/ioctls.h +++ b/lib/libc/include/generic-glibc/bits/ioctls.h @@ -22,87 +22,4 @@ /* Use the definitions from the kernel header files. */ #include -/* Routing table calls. */ -#define SIOCADDRT 0x890B /* add routing table entry */ -#define SIOCDELRT 0x890C /* delete routing table entry */ -#define SIOCRTMSG 0x890D /* call to routing system */ - -/* Socket configuration controls. */ -#define SIOCGIFNAME 0x8910 /* get iface name */ -#define SIOCSIFLINK 0x8911 /* set iface channel */ -#define SIOCGIFCONF 0x8912 /* get iface list */ -#define SIOCGIFFLAGS 0x8913 /* get flags */ -#define SIOCSIFFLAGS 0x8914 /* set flags */ -#define SIOCGIFADDR 0x8915 /* get PA address */ -#define SIOCSIFADDR 0x8916 /* set PA address */ -#define SIOCGIFDSTADDR 0x8917 /* get remote PA address */ -#define SIOCSIFDSTADDR 0x8918 /* set remote PA address */ -#define SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ -#define SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ -#define SIOCGIFNETMASK 0x891b /* get network PA mask */ -#define SIOCSIFNETMASK 0x891c /* set network PA mask */ -#define SIOCGIFMETRIC 0x891d /* get metric */ -#define SIOCSIFMETRIC 0x891e /* set metric */ -#define SIOCGIFMEM 0x891f /* get memory address (BSD) */ -#define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ -#define SIOCGIFMTU 0x8921 /* get MTU size */ -#define SIOCSIFMTU 0x8922 /* set MTU size */ -#define SIOCSIFNAME 0x8923 /* set interface name */ -#define SIOCSIFHWADDR 0x8924 /* set hardware address */ -#define SIOCGIFENCAP 0x8925 /* get/set encapsulations */ -#define SIOCSIFENCAP 0x8926 -#define SIOCGIFHWADDR 0x8927 /* Get hardware address */ -#define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ -#define SIOCSIFSLAVE 0x8930 -#define SIOCADDMULTI 0x8931 /* Multicast address lists */ -#define SIOCDELMULTI 0x8932 -#define SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ -#define SIOGIFINDEX SIOCGIFINDEX /* misprint compatibility :-) */ -#define SIOCSIFPFLAGS 0x8934 /* set/get extended flags set */ -#define SIOCGIFPFLAGS 0x8935 -#define SIOCDIFADDR 0x8936 /* delete PA address */ -#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ -#define SIOCGIFCOUNT 0x8938 /* get number of devices */ - -#define SIOCGIFBR 0x8940 /* Bridging support */ -#define SIOCSIFBR 0x8941 /* Set bridging options */ - -#define SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ -#define SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ - - -/* ARP cache control calls. */ - /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ -#define SIOCDARP 0x8953 /* delete ARP table entry */ -#define SIOCGARP 0x8954 /* get ARP table entry */ -#define SIOCSARP 0x8955 /* set ARP table entry */ - -/* RARP cache control calls. */ -#define SIOCDRARP 0x8960 /* delete RARP table entry */ -#define SIOCGRARP 0x8961 /* get RARP table entry */ -#define SIOCSRARP 0x8962 /* set RARP table entry */ - -/* Driver configuration calls */ - -#define SIOCGIFMAP 0x8970 /* Get device parameters */ -#define SIOCSIFMAP 0x8971 /* Set device parameters */ - -/* DLCI configuration calls */ - -#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ -#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ - -/* Device private ioctl calls. */ - -/* These 16 ioctls are available to devices via the do_ioctl() device - vector. Each device should include this file and redefine these - names as their own. Because these are device dependent it is a good - idea _NOT_ to issue them to random objects and hope. */ - -#define SIOCDEVPRIVATE 0x89F0 /* to 89FF */ - -/* - * These 16 ioctl calls are protocol private - */ - -#define SIOCPROTOPRIVATE 0x89E0 /* to 89EF */ \ No newline at end of file +#include \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h index 436770e11f0a..15df4ea88fd1 100644 --- a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h +++ b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h @@ -373,4 +373,48 @@ #define __DECL_SIMD_tanpif32x #define __DECL_SIMD_tanpif64x #define __DECL_SIMD_tanpif128x + +#define __DECL_SIMD_acospi +#define __DECL_SIMD_acospif +#define __DECL_SIMD_acospil +#define __DECL_SIMD_acospif16 +#define __DECL_SIMD_acospif32 +#define __DECL_SIMD_acospif64 +#define __DECL_SIMD_acospif128 +#define __DECL_SIMD_acospif32x +#define __DECL_SIMD_acospif64x +#define __DECL_SIMD_acospif128x + +#define __DECL_SIMD_asinpi +#define __DECL_SIMD_asinpif +#define __DECL_SIMD_asinpil +#define __DECL_SIMD_asinpif16 +#define __DECL_SIMD_asinpif32 +#define __DECL_SIMD_asinpif64 +#define __DECL_SIMD_asinpif128 +#define __DECL_SIMD_asinpif32x +#define __DECL_SIMD_asinpif64x +#define __DECL_SIMD_asinpif128x + +#define __DECL_SIMD_atanpi +#define __DECL_SIMD_atanpif +#define __DECL_SIMD_atanpil +#define __DECL_SIMD_atanpif16 +#define __DECL_SIMD_atanpif32 +#define __DECL_SIMD_atanpif64 +#define __DECL_SIMD_atanpif128 +#define __DECL_SIMD_atanpif32x +#define __DECL_SIMD_atanpif64x +#define __DECL_SIMD_atanpif128x + +#define __DECL_SIMD_atan2pi +#define __DECL_SIMD_atan2pif +#define __DECL_SIMD_atan2pil +#define __DECL_SIMD_atan2pif16 +#define __DECL_SIMD_atan2pif32 +#define __DECL_SIMD_atan2pif64 +#define __DECL_SIMD_atan2pif128 +#define __DECL_SIMD_atan2pif32x +#define __DECL_SIMD_atan2pif64x +#define __DECL_SIMD_atan2pif128x #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/mathcalls-macros.h b/lib/libc/include/generic-glibc/bits/mathcalls-macros.h index 6c29a7785c1a..d5b71472bb53 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls-macros.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls-macros.h @@ -34,7 +34,7 @@ #define __MATHCALLX(function,suffix, args, attrib) \ __MATHDECLX (_Mdouble_,function,suffix, args, attrib) #define __MATHDECLX(type, function,suffix, args, attrib) \ - __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); + __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib) #define __MATHDECL_1_IMPL(type, function, suffix, args) \ extern type __MATH_PRECNAME(function,suffix) args __THROW #define __MATHDECL_1(type, function, suffix, args) \ diff --git a/lib/libc/include/generic-glibc/bits/mathcalls.h b/lib/libc/include/generic-glibc/bits/mathcalls.h index 4f93b693d825..265c1b867503 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls.h @@ -68,12 +68,16 @@ __MATHCALL_VEC (tan,, (_Mdouble_ __x)); #if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23) /* Arc cosine of X, divided by pi. */ __MATHCALL (acospi,, (_Mdouble_ __x)); +__MATHCALL_VEC (acospi,, (_Mdouble_ __x)); /* Arc sine of X, divided by pi. */ __MATHCALL (asinpi,, (_Mdouble_ __x)); +__MATHCALL_VEC (asinpi,, (_Mdouble_ __x)); /* Arc tangent of X, divided by pi. */ __MATHCALL (atanpi,, (_Mdouble_ __x)); +__MATHCALL_VEC (atanpi,, (_Mdouble_ __x)); /* Arc tangent of Y/X, divided by pi. */ __MATHCALL (atan2pi,, (_Mdouble_ __y, _Mdouble_ __x)); +__MATHCALL_VEC (atan2pi,, (_Mdouble_ __y, _Mdouble_ __x)); /* Cosine of pi * X. */ __MATHCALL_VEC (cospi,, (_Mdouble_ __x)); @@ -185,6 +189,23 @@ __MATHCALL_VEC (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); __MATHCALL_VEC (cbrt,, (_Mdouble_ __x)); #endif +#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23) +/* Return 1+X to the Y power. */ +__MATHCALL (compoundn,, (_Mdouble_ __x, long long int __y)); + +/* Return X to the Y power. */ +__MATHCALL (pown,, (_Mdouble_ __x, long long int __y)); + +/* Return X to the Y power. */ +__MATHCALL (powr,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return the Yth root of X. */ +__MATHCALL (rootn,, (_Mdouble_ __x, long long int __y)); + +/* Return the reciprocal of the square root of X. */ +__MATHCALL (rsqrt,, (_Mdouble_ __x)); +#endif + /* Nearest integer, absolute value, and remainder functions. */ diff --git a/lib/libc/include/generic-glibc/bits/mman-linux.h b/lib/libc/include/generic-glibc/bits/mman-linux.h index 58ea3d02c80a..2dbd4d3a06f7 100644 --- a/lib/libc/include/generic-glibc/bits/mman-linux.h +++ b/lib/libc/include/generic-glibc/bits/mman-linux.h @@ -113,6 +113,8 @@ locked pages too. */ # define MADV_COLLAPSE 25 /* Synchronous hugepage collapse. */ # define MADV_HWPOISON 100 /* Poison a page for testing. */ +# define MADV_GUARD_INSTALL 102 /* Fatal signal on access to range */ +# define MADV_GUARD_REMOVE 103 /* Unguard range */ #endif /* The POSIX people had to invent similar names for the same things. */ diff --git a/lib/libc/include/generic-glibc/bits/mman-shared.h b/lib/libc/include/generic-glibc/bits/mman-shared.h index a43ef000be1a..39e82407cd5a 100644 --- a/lib/libc/include/generic-glibc/bits/mman-shared.h +++ b/lib/libc/include/generic-glibc/bits/mman-shared.h @@ -43,10 +43,9 @@ # endif /* Access restrictions for pkey_alloc. */ -# ifndef PKEY_DISABLE_ACCESS -# define PKEY_DISABLE_ACCESS 0x1 -# define PKEY_DISABLE_WRITE 0x2 -# endif +# define PKEY_UNRESTRICTED 0x0 +# define PKEY_DISABLE_ACCESS 0x1 +# define PKEY_DISABLE_WRITE 0x2 __BEGIN_DECLS diff --git a/lib/libc/include/generic-glibc/bits/sched.h b/lib/libc/include/generic-glibc/bits/sched.h index 3ac3e6c15330..c0e7cd3ead06 100644 --- a/lib/libc/include/generic-glibc/bits/sched.h +++ b/lib/libc/include/generic-glibc/bits/sched.h @@ -152,7 +152,7 @@ int sched_setattr (pid_t tid, struct sched_attr *attr, unsigned int flags) store it in *ATTR. */ int sched_getattr (pid_t tid, struct sched_attr *attr, unsigned int size, unsigned int flags) - __THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3)); + __THROW __nonnull ((2)); #endif diff --git a/lib/libc/include/generic-glibc/bits/string_fortified.h b/lib/libc/include/generic-glibc/bits/string_fortified.h index 076ca3942d41..9c36d02fb1c8 100644 --- a/lib/libc/include/generic-glibc/bits/string_fortified.h +++ b/lib/libc/include/generic-glibc/bits/string_fortified.h @@ -151,7 +151,7 @@ __NTH (strncat (__fortify_clang_overload_arg (char *, __restrict, __dest), } /* - * strlcpy and strlcat introduced in glibc 2.38 + * zig patch: strlcpy and strlcat introduced in glibc 2.38 * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2 diff --git a/lib/libc/include/generic-glibc/bits/syscall.h b/lib/libc/include/generic-glibc/bits/syscall.h index 4594b36b79d5..3c70ff32d493 100644 --- a/lib/libc/include/generic-glibc/bits/syscall.h +++ b/lib/libc/include/generic-glibc/bits/syscall.h @@ -1,11 +1,11 @@ /* Generated at libc build time from syscall list. */ -/* The system call list corresponds to kernel 6.12. */ +/* The system call list corresponds to kernel 6.15. */ #ifndef _SYSCALL_H # error "Never use directly; include instead." #endif -#define __GLIBC_LINUX_VERSION_CODE 396288 +#define __GLIBC_LINUX_VERSION_CODE 397056 #ifdef __NR_FAST_atomic_update # define SYS_FAST_atomic_update __NR_FAST_atomic_update @@ -703,6 +703,10 @@ # define SYS_getxattr __NR_getxattr #endif +#ifdef __NR_getxattrat +# define SYS_getxattrat __NR_getxattrat +#endif + #ifdef __NR_getxgid # define SYS_getxgid __NR_getxgid #endif @@ -875,6 +879,10 @@ # define SYS_listxattr __NR_listxattr #endif +#ifdef __NR_listxattrat +# define SYS_listxattrat __NR_listxattrat +#endif + #ifdef __NR_llistxattr # define SYS_llistxattr __NR_llistxattr #endif @@ -1167,6 +1175,10 @@ # define SYS_open_tree __NR_open_tree #endif +#ifdef __NR_open_tree_attr +# define SYS_open_tree_attr __NR_open_tree_attr +#endif + #ifdef __NR_openat # define SYS_openat __NR_openat #endif @@ -1839,6 +1851,10 @@ # define SYS_removexattr __NR_removexattr #endif +#ifdef __NR_removexattrat +# define SYS_removexattrat __NR_removexattrat +#endif + #ifdef __NR_rename # define SYS_rename __NR_rename #endif @@ -2199,6 +2215,10 @@ # define SYS_setxattr __NR_setxattr #endif +#ifdef __NR_setxattrat +# define SYS_setxattrat __NR_setxattrat +#endif + #ifdef __NR_sgetmask # define SYS_sgetmask __NR_sgetmask #endif diff --git a/lib/libc/include/generic-glibc/bits/termios-baud.h b/lib/libc/include/generic-glibc/bits/termios-baud.h index dcd8be77901a..cd11a7e55b5d 100644 --- a/lib/libc/include/generic-glibc/bits/termios-baud.h +++ b/lib/libc/include/generic-glibc/bits/termios-baud.h @@ -1,4 +1,4 @@ -/* termios baud rate selection definitions. Linux/generic version. +/* termios baud rate selection definitions. Universal version for sane speed_t. Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,29 +20,56 @@ # error "Never include directly; use instead." #endif -#ifdef __USE_MISC -# define CBAUD 000000010017 /* Baud speed mask (not in POSIX). */ -# define CBAUDEX 000000010000 /* Extra baud speed mask, included in CBAUD. - (not in POSIX). */ -# define CIBAUD 002003600000 /* Input baud rate (not used). */ -# define CMSPAR 010000000000 /* Mark or space (stick) parity. */ -# define CRTSCTS 020000000000 /* Flow control. */ +/* POSIX required baud rates */ +#define B0 0U /* Hang up or ispeed == ospeed */ +#define B50 50U +#define B75 75U +#define B110 110U +#define B134 134U /* Really 134.5 baud by POSIX spec */ +#define B150 150U +#define B200 200U +#define B300 300U +#define B600 600U +#define B1200 1200U +#define B1800 1800U +#define B2400 2400U +#define B4800 4800U +#define B9600 9600U +#define B19200 19200U +#define B38400 38400U +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 #endif -/* Extra output baud rates (not in POSIX). */ -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 -#define __MAX_BAUD B4000000 \ No newline at end of file +/* Other baud rates, "nonstandard" but known to be used */ +#define B7200 7200U +#define B14400 14400U +#define B28800 28800U +#define B33600 33600U +#define B57600 57600U +#define B76800 76800U +#define B115200 115200U +#define B153600 153600U +#define B230400 230400U +#define B307200 307200U +#define B460800 460800U +#define B500000 500000U +#define B576000 576000U +#define B614400 614400U +#define B921600 921600U +#define B1000000 1000000U +#define B1152000 1152000U +#define B1500000 1500000U +#define B2000000 2000000U +#define B2500000 2500000U +#define B3000000 3000000U +#define B3500000 3500000U +#define B4000000 4000000U +#define B5000000 5000000U +#define B10000000 10000000U + +#ifdef __USE_GNU +#define SPEED_MAX 4294967295U /* maximum valid speed_t value */ +#endif +#define __MAX_BAUD 4294967295U /* legacy alias for SPEED_MAX */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/termios-c_cflag.h b/lib/libc/include/generic-glibc/bits/termios-c_cflag.h index 0b0e40cd8a96..7a4c0a53fe34 100644 --- a/lib/libc/include/generic-glibc/bits/termios-c_cflag.h +++ b/lib/libc/include/generic-glibc/bits/termios-c_cflag.h @@ -34,5 +34,7 @@ #define CLOCAL 0004000 #ifdef __USE_MISC -# define ADDRB 04000000000 +# define ADDRB 04000000000 +# define CMSPAR 010000000000 /* Mark or space (stick) parity. */ +# define CRTSCTS 020000000000 /* Flow control. */ #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/termios-cbaud.h b/lib/libc/include/generic-glibc/bits/termios-cbaud.h new file mode 100644 index 000000000000..38bf2ec1aae0 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/termios-cbaud.h @@ -0,0 +1,47 @@ +/* termios baud rate selection definitions. Linux/generic version. + Copyright (C) 2019-2025 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#ifdef __USE_MISC +# define CBAUD 000000010017 /* Baud speed mask (not in POSIX). */ +# define CBAUDEX 000000010000 /* Extra baud speed mask, included in CBAUD. + (not in POSIX). */ +# define CIBAUD 002003600000 /* Input baud rate. */ +# define IBSHIFT 16 +#endif + +/* Extra output baud rates (not in POSIX). */ +#define __BOTHER 0010000 +#define __B57600 0010001 +#define __B115200 0010002 +#define __B230400 0010003 +#define __B460800 0010004 +#define __B500000 0010005 +#define __B576000 0010006 +#define __B921600 0010007 +#define __B1000000 0010010 +#define __B1152000 0010011 +#define __B1500000 0010012 +#define __B2000000 0010013 +#define __B2500000 0010014 +#define __B3000000 0010015 +#define __B3500000 0010016 +#define __B4000000 0010017 \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/termios-struct.h b/lib/libc/include/generic-glibc/bits/termios-struct.h index 51dda8eda38e..40d20e442d49 100644 --- a/lib/libc/include/generic-glibc/bits/termios-struct.h +++ b/lib/libc/include/generic-glibc/bits/termios-struct.h @@ -29,8 +29,15 @@ struct termios tcflag_t c_lflag; /* local mode flags */ cc_t c_line; /* line discipline */ cc_t c_cc[NCCS]; /* control characters */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ + /* Input and output baud rates. */ + __extension__ union { + speed_t __ispeed; + speed_t c_ispeed; + }; #define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 + __extension__ union { + speed_t __ospeed; + speed_t c_ospeed; + }; #define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 }; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/termios.h b/lib/libc/include/generic-glibc/bits/termios.h index 5433d2d4554f..4af6204a30b0 100644 --- a/lib/libc/include/generic-glibc/bits/termios.h +++ b/lib/libc/include/generic-glibc/bits/termios.h @@ -24,35 +24,41 @@ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; -#include +#ifdef _TERMIOS_H +# include +#endif + #include #include #include /* c_cflag bit meaning */ -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 +#include + #ifdef __USE_MISC -# define EXTA B19200 -# define EXTB B38400 +#define __B0 0000000 /* hang up */ +#define __B50 0000001 +#define __B75 0000002 +#define __B110 0000003 +#define __B134 0000004 +#define __B150 0000005 +#define __B200 0000006 +#define __B300 0000007 +#define __B600 0000010 +#define __B1200 0000011 +#define __B1800 0000012 +#define __B2400 0000013 +#define __B4800 0000014 +#define __B9600 0000015 +#define __B19200 0000016 +#define __B38400 0000017 +#include + +# define __EXTA __B19200 +# define __EXTB __B38400 +# define BOTHER __BOTHER #endif -#include -#include #include #ifdef __USE_MISC @@ -73,4 +79,6 @@ typedef unsigned int tcflag_t; #include -#include \ No newline at end of file +#include + +#include \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_FILE.h b/lib/libc/include/generic-glibc/bits/types/struct_FILE.h index 9dfac48cb75b..b02bb0c15400 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_FILE.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_FILE.h @@ -32,6 +32,7 @@ #endif #include +#include struct _IO_FILE; struct _IO_marker; @@ -97,8 +98,15 @@ struct _IO_FILE_complete void *_freeres_buf; struct _IO_FILE **_prevchain; int _mode; +#if __WORDSIZE == 64 + int _unused3; +#endif + __uint64_t _total_written; +#if __WORDSIZE == 32 + int _unused3; +#endif /* Make sure we don't get into trouble again. */ - char _unused2[15 * sizeof (int) - 5 * sizeof (void *)]; + char _unused2[12 * sizeof (int) - 5 * sizeof (void *)]; }; /* These macros are used by bits/stdio.h and internal headers. */ diff --git a/lib/libc/include/generic-glibc/dlfcn.h b/lib/libc/include/generic-glibc/dlfcn.h index d1e540fc8aab..fe5059b8d53f 100644 --- a/lib/libc/include/generic-glibc/dlfcn.h +++ b/lib/libc/include/generic-glibc/dlfcn.h @@ -217,15 +217,21 @@ struct dl_find_object int dlfo_eh_count; /* Number of exception handling entries. */ unsigned int __dlfo_eh_count_pad; # endif - __extension__ unsigned long long int __dflo_reserved[7]; + void *dlfo_sframe; /* SFrame stack trace data of the object. */ +#if __WORDSIZE == 32 + unsigned int __dlfo_sframe_pad; +#endif + __extension__ unsigned long long int __dlfo_reserved[6]; }; /* If ADDRESS is found in an object, fill in *RESULT and return 0. Otherwise, return -1. */ int _dl_find_object (void *__address, struct dl_find_object *__result) __THROW; -#endif /* __USE_GNU */ +/* SFrame stack trace data is valid. */ +#define DLFO_FLAG_SFRAME (1ULL << 0) +#endif /* __USE_GNU */ __END_DECLS diff --git a/lib/libc/include/generic-glibc/elf.h b/lib/libc/include/generic-glibc/elf.h index 690b047978d0..11dc6453b50e 100644 --- a/lib/libc/include/generic-glibc/elf.h +++ b/lib/libc/include/generic-glibc/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. */ diff --git a/lib/libc/include/generic-glibc/fcntl.h b/lib/libc/include/generic-glibc/fcntl.h index 117f1c3647ce..51add4e1464e 100644 --- a/lib/libc/include/generic-glibc/fcntl.h +++ b/lib/libc/include/generic-glibc/fcntl.h @@ -168,7 +168,7 @@ typedef __pid_t pid_t; #endif -/* fcntl was a simple symbol until glibc 2.27 inclusive. +/* zig patch: fcntl was a simple symbol until glibc 2.27 inclusive. * glibc 2.28 onwards converted it to a macro when compiled with * USE_LARGEFILE64. */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2 @@ -289,16 +289,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 @@ -351,4 +352,4 @@ extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len); __END_DECLS -#endif /* fcntl.h */ \ No newline at end of file +#endif /* fcntl.h */ diff --git a/lib/libc/include/generic-glibc/features.h b/lib/libc/include/generic-glibc/features.h index 7a830cdbac96..8a918c60176d 100644 --- a/lib/libc/include/generic-glibc/features.h +++ b/lib/libc/include/generic-glibc/features.h @@ -491,7 +491,7 @@ or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the old extension. */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) -/* support for ISOC99 was added in glibc-2.7 */ +/* zig patch: support for ISOC99 was added in glibc-2.7 */ # define __GLIBC_USE_DEPRECATED_SCANF 1 #elif (defined __USE_GNU \ && (defined __cplusplus \ @@ -503,7 +503,7 @@ #endif -/* support for ISO C2X strtol was added in 2.38 +/* zig patch: support for ISO C2X strtol was added in 2.38 * glibc commit 64924422a99690d147a166b4de3103f3bf3eaf6c */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2 @@ -564,4 +564,4 @@ #include -#endif /* features.h */ \ No newline at end of file +#endif /* features.h */ diff --git a/lib/libc/include/generic-glibc/glob.h b/lib/libc/include/generic-glibc/glob.h index 3577c9c7c4fe..14340f5fae38 100644 --- a/lib/libc/include/generic-glibc/glob.h +++ b/lib/libc/include/generic-glibc/glob.h @@ -195,7 +195,8 @@ extern void globfree64 (glob64_t *__pglob) __THROW; This function is not part of the interface specified by POSIX.2 but several programs want to use it. */ -extern int glob_pattern_p (const char *__pattern, int __quote) __THROW; +extern int glob_pattern_p (const char *__pattern, int __quote) __THROW + __nonnull ((1)); #endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/inttypes.h b/lib/libc/include/generic-glibc/inttypes.h index 3127d5637e15..be384f223e52 100644 --- a/lib/libc/include/generic-glibc/inttypes.h +++ b/lib/libc/include/generic-glibc/inttypes.h @@ -350,6 +350,11 @@ typedef struct /* Compute absolute value of N. */ extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); + +#if __GLIBC_USE (ISOC2Y) +extern uintmax_t uimaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); +#endif + /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) __THROW __attribute__ ((__const__)); diff --git a/lib/libc/include/generic-glibc/malloc.h b/lib/libc/include/generic-glibc/malloc.h index a24d43c295d2..187457d42131 100644 --- a/lib/libc/include/generic-glibc/malloc.h +++ b/lib/libc/include/generic-glibc/malloc.h @@ -52,7 +52,7 @@ extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); /* - * reallocarray introduced in glibc 2.26 + * zig patch: reallocarray introduced in glibc 2.26 * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || __GLIBC__ > 2 @@ -164,4 +164,4 @@ extern void malloc_stats (void) __THROW; extern int malloc_info (int __options, FILE *__fp) __THROW; __END_DECLS -#endif /* malloc.h */ \ No newline at end of file +#endif /* malloc.h */ diff --git a/lib/libc/include/generic-glibc/netinet/tcp.h b/lib/libc/include/generic-glibc/netinet/tcp.h index 65ee87a04126..357da4371277 100644 --- a/lib/libc/include/generic-glibc/netinet/tcp.h +++ b/lib/libc/include/generic-glibc/netinet/tcp.h @@ -212,6 +212,9 @@ enum # define TCPI_OPT_ECN 8 /* ECN was negotiated at TCP session init */ # define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ # define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ +# define TCPI_OPT_USEC_TS 64 /* usec timestamps */ +# define TCPI_OPT_TFO_CHILD 128 /* child from a Fast Open option on SYN */ + /* Values for tcpi_state. */ enum tcp_ca_state diff --git a/lib/libc/include/generic-glibc/pthread.h b/lib/libc/include/generic-glibc/pthread.h index 1c7bf92e8cca..cfce06cef914 100644 --- a/lib/libc/include/generic-glibc/pthread.h +++ b/lib/libc/include/generic-glibc/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 diff --git a/lib/libc/include/generic-glibc/resolv.h b/lib/libc/include/generic-glibc/resolv.h index 9bdbc09e1d6c..206ff771fb87 100644 --- a/lib/libc/include/generic-glibc/resolv.h +++ b/lib/libc/include/generic-glibc/resolv.h @@ -171,7 +171,7 @@ __END_DECLS #define res_init __res_init #define res_isourserver __res_isourserver -/* In glibc 2.33 and earlier res_search, res_nsearch, res_query, res_nquery, +/* zig patch: In glibc 2.33 and earlier res_search, res_nsearch, res_query, res_nquery, * res_querydomain, res_nquerydomain, dn_skipname, dn_comp, dn_expand were * #define'd to __res_search, __res_nsearch, etc. glibc 2.34 onwards removes * the macros and exposes the symbols directly. New glibc exposes compat @@ -336,4 +336,4 @@ void res_nclose (res_state) __THROW; __END_DECLS -#endif /* !_RESOLV_H_ */ \ No newline at end of file +#endif /* !_RESOLV_H_ */ diff --git a/lib/libc/include/generic-glibc/stdio.h b/lib/libc/include/generic-glibc/stdio.h index ad7dd9eb8e49..e80e85755094 100644 --- a/lib/libc/include/generic-glibc/stdio.h +++ b/lib/libc/include/generic-glibc/stdio.h @@ -168,8 +168,11 @@ extern int renameat (int __oldfd, const char *__old, int __newfd, #ifdef __USE_GNU /* Flags for renameat2. */ # define RENAME_NOREPLACE (1 << 0) +# define AT_RENAME_NOREPLACE RENAME_NOREPLACE # define RENAME_EXCHANGE (1 << 1) +# define AT_RENAME_EXCHANGE RENAME_EXCHANGE # define RENAME_WHITEOUT (1 << 2) +# define AT_RENAME_WHITEOUT RENAME_WHITEOUT /* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with additional flags. */ @@ -604,9 +607,6 @@ extern int fgetc_unlocked (FILE *__stream) __nonnull ((1)); /* Write a character to STREAM. These functions are possible cancellation points and therefore not - marked with __THROW. - - These functions is a possible cancellation point and therefore not marked with __THROW. */ extern int fputc (int __c, FILE *__stream) __nonnull ((2)); extern int putc (int __c, FILE *__stream) __nonnull ((2)); diff --git a/lib/libc/include/generic-glibc/stdio_ext.h b/lib/libc/include/generic-glibc/stdio_ext.h index 37c30ce0fa59..35ba67d43e00 100644 --- a/lib/libc/include/generic-glibc/stdio_ext.h +++ b/lib/libc/include/generic-glibc/stdio_ext.h @@ -43,43 +43,43 @@ __BEGIN_DECLS /* Return the size of the buffer of FP in bytes currently in use by the given stream. */ -extern size_t __fbufsize (FILE *__fp) __THROW; +extern size_t __fbufsize (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is opened readonly, or if the last operation on the stream was a read operation. */ -extern int __freading (FILE *__fp) __THROW; +extern int __freading (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is opened write-only or append-only, or if the last operation on the stream was a write operation. */ -extern int __fwriting (FILE *__fp) __THROW; +extern int __fwriting (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff stream FP is not opened write-only or append-only. */ -extern int __freadable (FILE *__fp) __THROW; +extern int __freadable (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff stream FP is not opened read-only. */ -extern int __fwritable (FILE *__fp) __THROW; +extern int __fwritable (FILE *__fp) __THROW __nonnull ((1)); /* Return non-zero value iff the stream FP is line-buffered. */ -extern int __flbf (FILE *__fp) __THROW; +extern int __flbf (FILE *__fp) __THROW __nonnull ((1)); /* Discard all pending buffered I/O on the stream FP. */ -extern void __fpurge (FILE *__fp) __THROW; +extern void __fpurge (FILE *__fp) __THROW __nonnull ((1)); /* Return amount of output in bytes pending on a stream FP. */ -extern size_t __fpending (FILE *__fp) __THROW; +extern size_t __fpending (FILE *__fp) __THROW __nonnull ((1)); /* Flush all line-buffered files. */ extern void _flushlbf (void); /* Set locking status of stream FP to TYPE. */ -extern int __fsetlocking (FILE *__fp, int __type) __THROW; +extern int __fsetlocking (FILE *__fp, int __type) __THROW __nonnull ((1)); __END_DECLS diff --git a/lib/libc/include/generic-glibc/stdlib.h b/lib/libc/include/generic-glibc/stdlib.h index 7ae0c0f7e996..b6b4ff601ff8 100644 --- a/lib/libc/include/generic-glibc/stdlib.h +++ b/lib/libc/include/generic-glibc/stdlib.h @@ -654,7 +654,7 @@ extern int lcong48_r (unsigned short int __param[7], __THROW __nonnull ((1, 2)); /* - * arc4random* symbols introduced in glibc 2.36: + * zig patch: arc4random* symbols introduced in glibc 2.36: * https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=8420a65cd06874ee09518366b8fba746a557212a;hb=6f4e0fcfa2d2b0915816a3a3a1d48b4763a7dee2 */ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 @@ -693,7 +693,7 @@ extern void *realloc (void *__ptr, size_t __size) extern void free (void *__ptr) __THROW; /* - * reallocarray introduced in glibc 2.26 + * zig patch: reallocarray introduced in glibc 2.26 * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 26) || __GLIBC__ > 2 @@ -997,6 +997,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. */ @@ -1178,4 +1184,4 @@ extern int ttyslot (void) __THROW; __END_DECLS -#endif /* stdlib.h */ \ No newline at end of file +#endif /* stdlib.h */ diff --git a/lib/libc/include/generic-glibc/string.h b/lib/libc/include/generic-glibc/string.h index 68f695cc425c..d6794d21d176 100644 --- a/lib/libc/include/generic-glibc/string.h +++ b/lib/libc/include/generic-glibc/string.h @@ -502,7 +502,7 @@ extern char *stpncpy (char *__restrict __dest, #endif /* - * strlcpy and strlcat introduced in glibc 2.38 + * zig patch: strlcpy and strlcat introduced in glibc 2.38 * https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da */ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2 @@ -557,4 +557,4 @@ extern char *basename (const char *__filename) __THROW __nonnull ((1)); __END_DECLS -#endif /* string.h */ \ No newline at end of file +#endif /* string.h */ diff --git a/lib/libc/include/generic-glibc/sys/hwprobe.h b/lib/libc/include/generic-glibc/sys/hwprobe.h index 63986df08f2f..056a98dc5182 100644 --- a/lib/libc/include/generic-glibc/sys/hwprobe.h +++ b/lib/libc/include/generic-glibc/sys/hwprobe.h @@ -21,6 +21,7 @@ #define _SYS_HWPROBE_H 1 #include +#include #include #include #ifdef __has_include @@ -63,22 +64,39 @@ struct riscv_hwprobe { __BEGIN_DECLS -extern int __riscv_hwprobe (struct riscv_hwprobe *__pairs, size_t __pair_count, - size_t __cpu_count, unsigned long int *__cpus, +#if defined __cplusplus || !__GNUC_PREREQ (2, 7) +# define __RISCV_HWPROBE_CPUS_TYPE cpu_set_t * +#else +/* The fourth argument to __riscv_hwprobe should be a null pointer or a + pointer to a cpu_set_t (either the fixed-size type or allocated with + CPU_ALLOC). However, early versions of this header file used the + argument type unsigned long int *. The transparent union allows + the argument to be either cpu_set_t * or unsigned long int * for + compatibility. The older header file requiring unsigned long int * + can be identified by the lack of the __RISCV_HWPROBE_CPUS_TYPE macro. + In C++ and with compilers that do not support transparent unions, the + argument type must be cpu_set_t *. */ +typedef union { + cpu_set_t *__cs; + unsigned long int *__ul; +} __RISCV_HWPROBE_CPUS_TYPE __attribute__ ((__transparent_union__)); +# define __RISCV_HWPROBE_CPUS_TYPE __RISCV_HWPROBE_CPUS_TYPE +#endif + +extern int __riscv_hwprobe (struct riscv_hwprobe *__pairs, + size_t __pair_count, size_t __cpusetsize, + __RISCV_HWPROBE_CPUS_TYPE __cpus, unsigned int __flags) - __nonnull ((1)) __wur - __fortified_attr_access (__read_write__, 1, 2) - __fortified_attr_access (__read_only__, 4, 3); + __THROW __nonnull ((1)) __attr_access ((__read_write__, 1, 2)); -/* A pointer to the __riscv_hwprobe vDSO function is passed as the second +/* A pointer to the __riscv_hwprobe function is passed as the second argument to ifunc selector routines. Include a function pointer type for convenience in calling the function in those settings. */ -typedef int (*__riscv_hwprobe_t) (struct riscv_hwprobe *__pairs, size_t __pair_count, - size_t __cpu_count, unsigned long int *__cpus, +typedef int (*__riscv_hwprobe_t) (struct riscv_hwprobe *__pairs, + size_t __pair_count, size_t __cpusetsize, + __RISCV_HWPROBE_CPUS_TYPE __cpus, unsigned int __flags) - __nonnull ((1)) __wur - __fortified_attr_access (__read_write__, 1, 2) - __fortified_attr_access (__read_only__, 4, 3); + __nonnull ((1)) __attr_access ((__read_write__, 1, 2)); /* Helper function usable from ifunc selectors that probes a single key. */ static __inline int diff --git a/lib/libc/include/generic-glibc/sys/ifunc.h b/lib/libc/include/generic-glibc/sys/ifunc.h index d86de9707de2..c4ca0a983ccc 100644 --- a/lib/libc/include/generic-glibc/sys/ifunc.h +++ b/lib/libc/include/generic-glibc/sys/ifunc.h @@ -19,24 +19,77 @@ #ifndef _SYS_IFUNC_H #define _SYS_IFUNC_H +#include + /* A second argument is passed to the ifunc resolver. */ #define _IFUNC_ARG_HWCAP (1ULL << 62) -/* The prototype of a gnu indirect function resolver on AArch64 is +/* Maximum number of HWCAP elements that are currently supported. */ +#define _IFUNC_HWCAP_MAX 4 + +/* The prototype of a GNU indirect function resolver on AArch64 is + + ElfW(Addr) ifunc_resolver (uint64_t, const uint64_t *); + + The following prototype is also compatible: ElfW(Addr) ifunc_resolver (uint64_t, const __ifunc_arg_t *); - the first argument should have the _IFUNC_ARG_HWCAP bit set and - the remaining bits should match the AT_HWCAP settings. */ + The first argument might have the _IFUNC_ARG_HWCAP bit set and + the remaining bits should match the AT_HWCAP settings. + + If the _IFUNC_ARG_HWCAP bit is set in the first argument, then + the second argument is passed to the resolver function. In + this case, the second argument is a const pointer to a buffer + that allows to access all available HWCAP elements. + + This buffer has its size in bytes at offset 0. The HWCAP elements + are available at offsets 8, 16, 24, 32... respectively for AT_HWCAP, + AT_HWCAP2, AT_HWCAP3, AT_HWCAP4... (these offsets are multiples of + sizeof (unsigned long)). + + Indirect function resolvers must check availability of HWCAP + elements at runtime before accessing them using the size of the + buffer. */ -/* Second argument to an ifunc resolver. */ struct __ifunc_arg_t { - unsigned long _size; /* Size of the struct, so it can grow. */ + unsigned long _size; /* Size of the struct, so it can grow. */ unsigned long _hwcap; - unsigned long _hwcap2; + unsigned long _hwcap2; /* End of 1st published struct. */ + unsigned long _hwcap3; + unsigned long _hwcap4; /* End of 2nd published struct. */ }; typedef struct __ifunc_arg_t __ifunc_arg_t; +/* Constants for IDs of HWCAP elements to be used with the + __ifunc_hwcap function below. */ +enum +{ + _IFUNC_ARG_AT_HWCAP = 1, + _IFUNC_ARG_AT_HWCAP2 = 2, + _IFUNC_ARG_AT_HWCAP3 = 3, + _IFUNC_ARG_AT_HWCAP4 = 4, +}; + +/* A helper function to obtain HWCAP element by its ID from the + parameters ARG0 and ARG1 passed to the ifunc resolver. Note that + ID 1 corresponds to AT_HWCAP, ID 2 corresponds to AT_HWCAP2, etc. + If there is no element available for the requested ID then 0 is + returned. If ID doesn't much any supported AT_HWCAP{,2,...} value, + then 0 is also returned. */ +static __inline unsigned long __attribute__ ((unused, always_inline)) +__ifunc_hwcap (unsigned long __id, + unsigned long __arg0, const unsigned long *__arg1) +{ + if (__glibc_likely (__arg0 & _IFUNC_ARG_HWCAP)) + { + const unsigned long size = __arg1[0]; + const unsigned long offset = __id * sizeof (unsigned long); + return offset < size && __id > 0 ? __arg1[__id] : 0; + } + return __id == 1 ? __arg0 : 0; +} + #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/sys/mount.h b/lib/libc/include/generic-glibc/sys/mount.h index b3f0cd64ecab..fbb157810e24 100644 --- a/lib/libc/include/generic-glibc/sys/mount.h +++ b/lib/libc/include/generic-glibc/sys/mount.h @@ -121,7 +121,7 @@ enum MS_ACTIVE = 1 << 30, #define MS_ACTIVE MS_ACTIVE #undef MS_NOUSER - MS_NOUSER = 1 << 31 + MS_NOUSER = 1U << 31 #define MS_NOUSER MS_NOUSER }; diff --git a/lib/libc/include/generic-glibc/sys/ttychars.h b/lib/libc/include/generic-glibc/sys/ttychars.h index 492732666731..c187c170c65a 100644 --- a/lib/libc/include/generic-glibc/sys/ttychars.h +++ b/lib/libc/include/generic-glibc/sys/ttychars.h @@ -54,8 +54,4 @@ struct ttychars { char tc_lnextc; /* literal next character */ }; -#ifdef __USE_OLD_TTY -#include /* to pick up character defaults */ -#endif - #endif /* sys/ttychars.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/termio.h b/lib/libc/include/generic-glibc/termio.h deleted file mode 100644 index a3f32a79f55c..000000000000 --- a/lib/libc/include/generic-glibc/termio.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Compatible for old `struct termio' ioctl interface. - This is obsolete; use the POSIX.1 `struct termios' interface - defined in instead. */ - -#include -#include \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/termios.h b/lib/libc/include/generic-glibc/termios.h index 94624586e7b4..ef7b166b4c42 100644 --- a/lib/libc/include/generic-glibc/termios.h +++ b/lib/libc/include/generic-glibc/termios.h @@ -61,6 +61,26 @@ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; #endif +#ifdef __USE_GNU +/* Interfaces that are explicitly numeric representations of baud rates */ +typedef speed_t baud_t; +#define BAUD_MAX SPEED_MAX + +/* Return the output baud rate stored in *TERMIOS_P. */ +extern baud_t cfgetobaud (const struct termios *__termios_p) __THROW; + +/* Return the input baud rate stored in *TERMIOS_P. */ +extern baud_t cfgetibaud (const struct termios *__termios_p) __THROW; + +/* Set the output baud rate stored in *TERMIOS_P to BAUD. */ +extern int cfsetobaud (struct termios *__termios_p, baud_t __baud) __THROW; + +/* Set the input baud rate stored in *TERMIOS_P to BAUD. */ +extern int cfsetibaud (struct termios *__termios_p, baud_t __baud) __THROW; + +/* Set both the input and output baud rates in *TERMIOS_OP to BAUD. */ +extern int cfsetbaud (struct termios *__termios_p, baud_t __baud) __THROW; +#endif /* Put the state of FD into *TERMIOS_P. */ extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; diff --git a/lib/libc/include/generic-glibc/tgmath.h b/lib/libc/include/generic-glibc/tgmath.h index c90b783891bf..4eae43da5e04 100644 --- a/lib/libc/include/generic-glibc/tgmath.h +++ b/lib/libc/include/generic-glibc/tgmath.h @@ -923,6 +923,24 @@ /* Return the cube root of X. */ #define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt) +#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23) +/* Return 1+X to the Y power. */ +# define compoundn(Val1, Val2) \ + __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, compoundn) + +/* Return X to the Y power. */ +# define pown(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, pown) + +/* Return X to the Y power. */ +# define powr(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, powr) + +/* Return the Yth root of X. */ +# define rootn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, rootn) + +/* Return 1/sqrt(X). */ +# define rsqrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, rsqrt) +#endif + /* Nearest integer, absolute value, and remainder functions. */ diff --git a/lib/libc/include/generic-glibc/unistd.h b/lib/libc/include/generic-glibc/unistd.h index 7bc48ec48bde..6aaa1bfa90b3 100644 --- a/lib/libc/include/generic-glibc/unistd.h +++ b/lib/libc/include/generic-glibc/unistd.h @@ -1231,4 +1231,4 @@ extern int close_range (unsigned int __fd, unsigned int __max_fd, __END_DECLS -#endif /* unistd.h */ +#endif /* unistd.h */ \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h b/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h index 0b157b683cf8..511fe1c96b30 100644 --- a/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h @@ -31,18 +31,6 @@ struct winsize unsigned short int ws_ypixel; }; -#define NCC 8 -struct termio - { - unsigned short int c_iflag; /* input mode flags */ - unsigned short int c_oflag; /* output mode flags */ - unsigned short int c_cflag; /* control mode flags */ - unsigned short int c_lflag; /* local mode flags */ - char c_line; /* line discipline */ - /* Yes, this is really NCCS. */ - unsigned char c_cc[32 /* NCCS */]; /* control characters */ - }; - /* modem lines */ #define TIOCM_LE 0x001 /* line enable */ #define TIOCM_DTR 0x002 /* data terminal ready */ diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-struct.h b/lib/libc/include/mips-linux-gnu/bits/termios-struct.h deleted file mode 100644 index f6dd2de6185b..000000000000 --- a/lib/libc/include/mips-linux-gnu/bits/termios-struct.h +++ /dev/null @@ -1,34 +0,0 @@ -/* struct termios definition. Linux/mips version. - Copyright (C) 2019-2025 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 - . */ - -#ifndef _TERMIOS_H -# error "Never include directly; use instead." -#endif - -#define NCCS 32 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 - }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h b/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h index 1744e55f3e05..ecb6295b249b 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h @@ -32,17 +32,6 @@ struct winsize unsigned short int ws_ypixel; }; -#define NCC 10 -struct termio - { - unsigned short int c_iflag; /* input mode flags */ - unsigned short int c_oflag; /* output mode flags */ - unsigned short int c_cflag; /* control mode flags */ - unsigned short int c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h index 1532bbe4a7f1..86d5639c460e 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h @@ -35,5 +35,7 @@ #define CLOCAL 00100000 #ifdef __USE_MISC -# define ADDRB 04000000000 +# define ADDRB 04000000000 +# define CMSPAR 010000000000 /* Mark or space (stick) parity. */ +# define CRTSCTS 020000000000 /* Flow control. */ #endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h b/lib/libc/include/powerpc-linux-gnu/bits/termios-cbaud.h similarity index 58% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h rename to lib/libc/include/powerpc-linux-gnu/bits/termios-cbaud.h index b61756d302d4..6e0257e59d42 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/powerpc-linux-gnu/bits/termios-cbaud.h @@ -17,29 +17,29 @@ . */ #ifndef _TERMIOS_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif #ifdef __USE_MISC -# define CBAUD 0000377 -# define CBAUDEX 0000020 -# define CMSPAR 010000000000 /* mark or space (stick) parity */ -# define CRTSCTS 020000000000 /* flow control */ +# define CBAUD 000000377 +# define CBAUDEX 000000020 +# define CIBAUD 077600000 +# define IBSHIFT 16 #endif -#define B57600 00020 -#define B115200 00021 -#define B230400 00022 -#define B460800 00023 -#define B500000 00024 -#define B576000 00025 -#define B921600 00026 -#define B1000000 00027 -#define B1152000 00030 -#define B1500000 00031 -#define B2000000 00032 -#define B2500000 00033 -#define B3000000 00034 -#define B3500000 00035 -#define B4000000 00036 -#define __MAX_BAUD B4000000 \ No newline at end of file +#define __B57600 00020 +#define __B115200 00021 +#define __B230400 00022 +#define __B460800 00023 +#define __B500000 00024 +#define __B576000 00025 +#define __B921600 00026 +#define __B1000000 00027 +#define __B1152000 00030 +#define __B1500000 00031 +#define __B2000000 00032 +#define __B2500000 00033 +#define __B3000000 00034 +#define __B3500000 00035 +#define __B4000000 00036 +#define __BOTHER 00037 \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h b/lib/libc/include/sparc-linux-gnu/bits/termios-cbaud.h similarity index 58% rename from lib/libc/include/sparc-linux-gnu/bits/termios-baud.h rename to lib/libc/include/sparc-linux-gnu/bits/termios-cbaud.h index 465e9bbb0065..e848a18538c9 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-baud.h +++ b/lib/libc/include/sparc-linux-gnu/bits/termios-cbaud.h @@ -17,30 +17,29 @@ . */ #ifndef _TERMIOS_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif #ifdef __USE_MISC # define CBAUD 0x0000100f # define CBAUDEX 0x00001000 -# define CIBAUD 0x100f0000 /* input baud rate (not used) */ -# define CMSPAR 0x40000000 /* mark or space (stick) parity */ -# define CRTSCTS 0x80000000 /* flow control */ +# define CIBAUD 0x100f0000 /* input baud rate */ +# define IBSHIFT 16 #endif -#define B57600 0x00001001 -#define B115200 0x00001002 -#define B230400 0x00001003 -#define B460800 0x00001004 -#define B76800 0x00001005 -#define B153600 0x00001006 -#define B307200 0x00001007 -#define B614400 0x00001008 -#define B921600 0x00001009 -#define B500000 0x0000100a -#define B576000 0x0000100b -#define B1000000 0x0000100c -#define B1152000 0x0000100d -#define B1500000 0x0000100e -#define B2000000 0x0000100f -#define __MAX_BAUD B2000000 \ No newline at end of file +#define __B57600 0x00001001 +#define __B115200 0x00001002 +#define __B230400 0x00001003 +#define __B460800 0x00001004 +#define __B76800 0x00001005 +#define __B153600 0x00001006 +#define __B307200 0x00001007 +#define __B614400 0x00001008 +#define __B921600 0x00001009 +#define __B500000 0x0000100a +#define __B576000 0x0000100b +#define __B1000000 0x0000100c +#define __B1152000 0x0000100d +#define __B1500000 0x0000100e +#define __B2000000 0x0000100f +#define __BOTHER 0x00001000 \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h b/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h deleted file mode 100644 index 815227e7d415..000000000000 --- a/lib/libc/include/sparc-linux-gnu/bits/termios-struct.h +++ /dev/null @@ -1,34 +0,0 @@ -/* struct termios definition. Linux/sparc version. - Copyright (C) 2019-2025 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 - . */ - -#ifndef _TERMIOS_H -# error "Never include directly; use instead." -#endif - -#define NCCS 17 -struct termios - { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 -#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 - }; \ No newline at end of file diff --git a/lib/libc/include/x86-linux-gnu/bits/floatn.h b/lib/libc/include/x86-linux-gnu/bits/floatn.h index b2716390f8c5..b0bab474a1aa 100644 --- a/lib/libc/include/x86-linux-gnu/bits/floatn.h +++ b/lib/libc/include/x86-linux-gnu/bits/floatn.h @@ -25,11 +25,15 @@ floating-point type with the IEEE 754 binary128 format, and this glibc includes corresponding *f128 interfaces for it. The required libgcc support was added some time after the basic compiler - support, for x86_64 and x86. */ + support, for x86_64 and x86. Intel SYCL compiler doesn't support + _Float128: https://github.com/intel/llvm/issues/16903 + */ #if (defined __x86_64__ \ ? __GNUC_PREREQ (4, 3) \ : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \ - || __glibc_clang_prereq (3, 4) + || (__glibc_clang_prereq (3, 9) \ + && (!defined __INTEL_LLVM_COMPILER \ + || !defined SYCL_LANGUAGE_VERSION)) # define __HAVE_FLOAT128 1 #else # define __HAVE_FLOAT128 0 @@ -89,7 +93,7 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); /* The type _Float128 exists only since GCC 7.0. */ # if !__GNUC_PREREQ (7, 0) \ || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \ - || __glibc_clang_prereq (3, 4) + || __glibc_clang_prereq (3, 9) typedef __float128 _Float128; # endif