Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/libc/glibc/abilists
Binary file not shown.
33 changes: 11 additions & 22 deletions lib/libc/glibc/elf/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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. */
Expand Down
13 changes: 13 additions & 0 deletions lib/libc/glibc/include/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions lib/libc/glibc/include/libc-symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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#\""
Expand Down Expand Up @@ -280,7 +280,7 @@ for linking")


/*

*/

#ifdef HAVE_GNU_RETAIN
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions lib/libc/glibc/include/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions lib/libc/glibc/io/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/libc/glibc/posix/bits/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/libc/glibc/stdlib/stdlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
24 changes: 7 additions & 17 deletions lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 17 additions & 8 deletions lib/libc/glibc/sysdeps/aarch64/start-2.33.S
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ _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

#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
Expand All @@ -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,
Expand Down
14 changes: 8 additions & 6 deletions lib/libc/glibc/sysdeps/aarch64/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,25 @@ 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

#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. */
Expand All @@ -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)
Expand Down
Loading