authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-07-31 22:08:36+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-01 09:00:27+02:00
log675b1a15a17d796fa9e48902047c3c7b350a1d7e
treefc3cd1f7ad755033f6c9e0f57c61b784866703af
parent1804251dfb5b1a5699371735aac138b3a2d6c3f6
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

glibc: update crt0 code to 2.42


21 files changed, 165 insertions(+), 193 deletions(-)

lib/libc/glibc/elf/elf.h+11-22
...@@ -837,12 +837,15 @@ typedef struct...@@ -837,12 +837,15 @@ typedef struct
837#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */837#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */
838#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */838#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */
839#define NT_ARM_POE 0x40f /* ARM POE registers. */839#define NT_ARM_POE 0x40f /* ARM POE registers. */
840#define NT_ARM_GCS 0x410 /* ARM GCS state. */
840#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */841#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
841#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */842#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
842#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */843#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
843#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */844#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
844#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */845#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
845#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */846#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
847#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged
848 address control */
846#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */849#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */
847#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and850#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and
848 status registers. */851 status registers. */
...@@ -2906,19 +2909,6 @@ enum...@@ -2906,19 +2909,6 @@ enum
29062909
2907#define R_AARCH64_NONE 0 /* No relocation. */2910#define R_AARCH64_NONE 0 /* No relocation. */
29082911
2909/* ILP32 AArch64 relocs. */
2910#define R_AARCH64_P32_ABS32 1 /* Direct 32 bit. */
2911#define R_AARCH64_P32_COPY 180 /* Copy symbol at runtime. */
2912#define R_AARCH64_P32_GLOB_DAT 181 /* Create GOT entry. */
2913#define R_AARCH64_P32_JUMP_SLOT 182 /* Create PLT entry. */
2914#define R_AARCH64_P32_RELATIVE 183 /* Adjust by program base. */
2915#define R_AARCH64_P32_TLS_DTPMOD 184 /* Module number, 32 bit. */
2916#define R_AARCH64_P32_TLS_DTPREL 185 /* Module-relative offset, 32 bit. */
2917#define R_AARCH64_P32_TLS_TPREL 186 /* TP-relative offset, 32 bit. */
2918#define R_AARCH64_P32_TLSDESC 187 /* TLS Descriptor. */
2919#define R_AARCH64_P32_IRELATIVE 188 /* STT_GNU_IFUNC relocation. */
2920
2921/* LP64 AArch64 relocs. */
2922#define R_AARCH64_ABS64 257 /* Direct 64 bit. */2912#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
2923#define R_AARCH64_ABS32 258 /* Direct 32 bit. */2913#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
2924#define R_AARCH64_ABS16 259 /* Direct 16-bit. */2914#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
...@@ -4091,6 +4081,7 @@ enum...@@ -4091,6 +4081,7 @@ enum
4091#define R_RISCV_TLS_DTPREL64 94081#define R_RISCV_TLS_DTPREL64 9
4092#define R_RISCV_TLS_TPREL32 104082#define R_RISCV_TLS_TPREL32 10
4093#define R_RISCV_TLS_TPREL64 114083#define R_RISCV_TLS_TPREL64 11
4084#define R_RISCV_TLSDESC 12
4094#define R_RISCV_BRANCH 164085#define R_RISCV_BRANCH 16
4095#define R_RISCV_JAL 174086#define R_RISCV_JAL 17
4096#define R_RISCV_CALL 184087#define R_RISCV_CALL 18
...@@ -4116,16 +4107,10 @@ enum...@@ -4116,16 +4107,10 @@ enum
4116#define R_RISCV_SUB16 384107#define R_RISCV_SUB16 38
4117#define R_RISCV_SUB32 394108#define R_RISCV_SUB32 39
4118#define R_RISCV_SUB64 404109#define R_RISCV_SUB64 40
4119#define R_RISCV_GNU_VTINHERIT 414110#define R_RISCV_GOT32_PCREL 41
4120#define R_RISCV_GNU_VTENTRY 42
4121#define R_RISCV_ALIGN 434111#define R_RISCV_ALIGN 43
4122#define R_RISCV_RVC_BRANCH 444112#define R_RISCV_RVC_BRANCH 44
4123#define R_RISCV_RVC_JUMP 454113#define R_RISCV_RVC_JUMP 45
4124#define R_RISCV_RVC_LUI 46
4125#define R_RISCV_GPREL_I 47
4126#define R_RISCV_GPREL_S 48
4127#define R_RISCV_TPREL_I 49
4128#define R_RISCV_TPREL_S 50
4129#define R_RISCV_RELAX 514114#define R_RISCV_RELAX 51
4130#define R_RISCV_SUB6 524115#define R_RISCV_SUB6 52
4131#define R_RISCV_SET6 534116#define R_RISCV_SET6 53
...@@ -4137,8 +4122,12 @@ enum...@@ -4137,8 +4122,12 @@ enum
4137#define R_RISCV_PLT32 594122#define R_RISCV_PLT32 59
4138#define R_RISCV_SET_ULEB128 604123#define R_RISCV_SET_ULEB128 60
4139#define R_RISCV_SUB_ULEB128 614124#define R_RISCV_SUB_ULEB128 61
4125#define R_RISCV_TLSDESC_HI20 62
4126#define R_RISCV_TLSDESC_LOAD_LO12 63
4127#define R_RISCV_TLSDESC_ADD_LO12 64
4128#define R_RISCV_TLSDESC_CALL 65
41404129
4141#define R_RISCV_NUM 624130#define R_RISCV_NUM 66
41424131
4143/* RISC-V specific values for the st_other field. */4132/* RISC-V specific values for the st_other field. */
4144#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling4133#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
...@@ -4147,7 +4136,7 @@ enum...@@ -4147,7 +4136,7 @@ enum
4147/* RISC-V specific values for the sh_type field. */4136/* RISC-V specific values for the sh_type field. */
4148#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)4137#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
41494138
4150/* RISC-V specific values for the p_type field. */4139/* RISC-V specific values for the p_type field (deprecated). */
4151#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)4140#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
41524141
4153/* RISC-V specific values for the d_tag field. */4142/* RISC-V specific values for the d_tag field. */
lib/libc/glibc/include/elf.h+13
...@@ -15,6 +15,19 @@...@@ -15,6 +15,19 @@
15# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \15# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
16 ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))16 ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))
1717
18# ifdef HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
19# define DL_ADDRESS_WITHOUT_RELOC(expr) (expr)
20# else
21/* Evaluate EXPR without run-time relocation for it. EXPR should be an
22 array, an address of an object, or a string literal. */
23# define DL_ADDRESS_WITHOUT_RELOC(expr) \
24 ({ \
25 __auto_type _result = (expr); \
26 asm ("" : "+r" (_result)); \
27 _result; \
28 })
29# endif
30
18/* Some information which is not meant for the public and therefore not31/* Some information which is not meant for the public and therefore not
19 in <elf.h>. */32 in <elf.h>. */
20# include <dl-dtprocnum.h>33# include <dl-dtprocnum.h>
lib/libc/glibc/include/libc-symbols.h+4-4
...@@ -155,7 +155,7 @@...@@ -155,7 +155,7 @@
155 extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \155 extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
156 __attribute_copy__ (name);156 __attribute_copy__ (name);
157157
158/* Zig patch. weak_hidden_alias was removed from glibc v2.36 (v2.37?), Zig158/* zig patch: weak_hidden_alias was removed from glibc v2.36 (v2.37?), Zig
159 needs it for the v2.32 and earlier {f,l,}stat wrappers, so only include159 needs it for the v2.32 and earlier {f,l,}stat wrappers, so only include
160 in this header for 2.32 and earlier. */160 in this header for 2.32 and earlier. */
161#if (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 32) || __GLIBC__ < 2161#if (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 32) || __GLIBC__ < 2
...@@ -220,7 +220,7 @@...@@ -220,7 +220,7 @@
220#define __make_section_unallocated(section_string) \220#define __make_section_unallocated(section_string) \
221 asm (".section " section_string "\n\t.previous");221 asm (".section " section_string "\n\t.previous");
222222
223/* Tacking on "\n\t#" to the section name makes gcc put it's bogus223/* Tacking on "\n\t#" to the section name makes gcc put its bogus
224 section attributes on what looks like a comment to the assembler. */224 section attributes on what looks like a comment to the assembler. */
225#ifdef HAVE_SECTION_QUOTES225#ifdef HAVE_SECTION_QUOTES
226# define __sec_comment "\"\n\t#\""226# define __sec_comment "\"\n\t#\""
...@@ -280,7 +280,7 @@ for linking")...@@ -280,7 +280,7 @@ for linking")
280280
281281
282/*282/*
283 283
284*/284*/
285285
286#ifdef HAVE_GNU_RETAIN286#ifdef HAVE_GNU_RETAIN
...@@ -807,7 +807,7 @@ for linking")...@@ -807,7 +807,7 @@ for linking")
807#define libm_ifunc_init()807#define libm_ifunc_init()
808#define libm_ifunc(name, expr) \808#define libm_ifunc(name, expr) \
809 __ifunc (name, name, expr, void, libm_ifunc_init)809 __ifunc (name, name, expr, void, libm_ifunc_init)
810 810
811/* These macros facilitate sharing source files with gnulib.811/* These macros facilitate sharing source files with gnulib.
812812
813 They are here instead of sys/cdefs.h because they should not be813 They are here instead of sys/cdefs.h because they should not be
lib/libc/glibc/include/stdlib.h+15
...@@ -368,6 +368,21 @@ struct abort_msg_s...@@ -368,6 +368,21 @@ struct abort_msg_s
368extern struct abort_msg_s *__abort_msg;368extern struct abort_msg_s *__abort_msg;
369libc_hidden_proto (__abort_msg)369libc_hidden_proto (__abort_msg)
370370
371enum readonly_error_type
372{
373 readonly_noerror,
374 readonly_area_writable,
375 readonly_procfs_inaccessible,
376 readonly_procfs_open_fail,
377};
378
379extern enum readonly_error_type __readonly_area (const void *ptr,
380 size_t size)
381 attribute_hidden;
382extern enum readonly_error_type __readonly_area_fallback (const void *ptr,
383 size_t size)
384 attribute_hidden;
385
371# if IS_IN (rtld)386# if IS_IN (rtld)
372extern __typeof (unsetenv) unsetenv attribute_hidden;387extern __typeof (unsetenv) unsetenv attribute_hidden;
373extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;388extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
lib/libc/glibc/io/fcntl.h+5-4
...@@ -168,7 +168,7 @@ typedef __pid_t pid_t;...@@ -168,7 +168,7 @@ typedef __pid_t pid_t;
168#endif168#endif
169169
170170
171/* fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards171/* zig patch: fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards
172 * re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */172 * re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */
173#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2173#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
174/* Do the file control operation described by CMD on FD.174/* 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));...@@ -288,16 +288,17 @@ extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
288# define F_TEST 3 /* Test a region for other processes locks. */288# define F_TEST 3 /* Test a region for other processes locks. */
289289
290# ifndef __USE_FILE_OFFSET64290# ifndef __USE_FILE_OFFSET64
291extern int lockf (int __fd, int __cmd, off_t __len);291extern int lockf (int __fd, int __cmd, off_t __len) __wur;
292# else292# else
293# ifdef __REDIRECT293# ifdef __REDIRECT
294extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);294extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len),
295 lockf64) __wur;
295# else296# else
296# define lockf lockf64297# define lockf lockf64
297# endif298# endif
298# endif299# endif
299# ifdef __USE_LARGEFILE64300# ifdef __USE_LARGEFILE64
300extern int lockf64 (int __fd, int __cmd, off64_t __len);301extern int lockf64 (int __fd, int __cmd, off64_t __len) __wur;
301# endif302# endif
302#endif303#endif
303304
lib/libc/glibc/posix/bits/types.h+1-1
...@@ -217,7 +217,7 @@ typedef int __sig_atomic_t;...@@ -217,7 +217,7 @@ typedef int __sig_atomic_t;
217/* Seconds since the Epoch, visible to user code when time_t is too217/* Seconds since the Epoch, visible to user code when time_t is too
218 narrow only for consistency with the old way of widening too-narrow218 narrow only for consistency with the old way of widening too-narrow
219 types. User code should never use __time64_t. */219 types. User code should never use __time64_t. */
220/* Zig patch: Don't check __LIBC here because it breaks fstatat.c on x86. */220/* zig patch: Don't check __LIBC here because it breaks fstatat.c on x86. */
221#if __TIMESIZE == 64221#if __TIMESIZE == 64
222# define __time64_t __time_t222# define __time64_t __time_t
223#elif __TIMESIZE != 64223#elif __TIMESIZE != 64
lib/libc/glibc/stdlib/stdlib.h+6
...@@ -985,6 +985,12 @@ __extension__ extern long long int llabs (long long int __x)...@@ -985,6 +985,12 @@ __extension__ extern long long int llabs (long long int __x)
985 __THROW __attribute__ ((__const__)) __wur;985 __THROW __attribute__ ((__const__)) __wur;
986#endif986#endif
987987
988#if __GLIBC_USE (ISOC2Y)
989extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur;
990extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur;
991__extension__ extern unsigned long long int ullabs (long long int __x)
992 __THROW __attribute__ ((__const__)) __wur;
993#endif
988994
989/* Return the `div_t', `ldiv_t' or `lldiv_t' representation995/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
990 of the value of NUMER over DENOM. */996 of the value of NUMER over DENOM. */
lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h+7-17
...@@ -21,23 +21,13 @@...@@ -21,23 +21,13 @@
2121
22#include <bits/endian.h>22#include <bits/endian.h>
2323
24#ifdef __ILP32__24#define __SIZEOF_PTHREAD_ATTR_T 64
25# define __SIZEOF_PTHREAD_ATTR_T 3225#define __SIZEOF_PTHREAD_MUTEX_T 48
26# define __SIZEOF_PTHREAD_MUTEX_T 3226#define __SIZEOF_PTHREAD_MUTEXATTR_T 8
27# define __SIZEOF_PTHREAD_MUTEXATTR_T 427#define __SIZEOF_PTHREAD_CONDATTR_T 8
28# define __SIZEOF_PTHREAD_CONDATTR_T 428#define __SIZEOF_PTHREAD_RWLOCK_T 56
29# define __SIZEOF_PTHREAD_RWLOCK_T 4829#define __SIZEOF_PTHREAD_BARRIER_T 32
30# define __SIZEOF_PTHREAD_BARRIER_T 2030#define __SIZEOF_PTHREAD_BARRIERATTR_T 8
31# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
32#else
33# define __SIZEOF_PTHREAD_ATTR_T 64
34# define __SIZEOF_PTHREAD_MUTEX_T 48
35# define __SIZEOF_PTHREAD_MUTEXATTR_T 8
36# define __SIZEOF_PTHREAD_CONDATTR_T 8
37# define __SIZEOF_PTHREAD_RWLOCK_T 56
38# define __SIZEOF_PTHREAD_BARRIER_T 32
39# define __SIZEOF_PTHREAD_BARRIERATTR_T 8
40#endif
41#define __SIZEOF_PTHREAD_COND_T 4831#define __SIZEOF_PTHREAD_COND_T 48
42#define __SIZEOF_PTHREAD_RWLOCKATTR_T 832#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
4333
lib/libc/glibc/sysdeps/aarch64/start-2.33.S+17-8
...@@ -54,8 +54,8 @@ _start:...@@ -54,8 +54,8 @@ _start:
54 mov x5, x054 mov x5, x0
5555
56 /* Load argc and a pointer to argv */56 /* Load argc and a pointer to argv */
57 ldr PTR_REG (1), [sp, #0]57 ldr x1, [sp, #0]
58 add x2, sp, #PTR_SIZE58 add x2, sp, 8
5959
60 /* Setup stack limit in argument register */60 /* Setup stack limit in argument register */
61 mov x6, sp61 mov x6, sp
...@@ -63,13 +63,13 @@ _start:...@@ -63,13 +63,13 @@ _start:
63#ifdef PIC63#ifdef PIC
64# ifdef SHARED64# ifdef SHARED
65 adrp x0, :got:main65 adrp x0, :got:main
66 ldr PTR_REG (0), [x0, #:got_lo12:main]66 ldr x0, [x0, #:got_lo12:main]
6767
68 adrp x3, :got:__libc_csu_init68 adrp x3, :got:__libc_csu_init
69 ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]69 ldr x3, [x3, #:got_lo12:__libc_csu_init]
7070
71 adrp x4, :got:__libc_csu_fini71 adrp x4, :got:__libc_csu_fini
72 ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]72 ldr x4, [x4, #:got_lo12:__libc_csu_fini]
73# else73# else
74 adrp x0, __wrap_main74 adrp x0, __wrap_main
75 add x0, x0, :lo12:__wrap_main75 add x0, x0, :lo12:__wrap_main
...@@ -80,9 +80,18 @@ _start:...@@ -80,9 +80,18 @@ _start:
80# endif80# endif
81#else81#else
82 /* Set up the other arguments in registers */82 /* Set up the other arguments in registers */
83 MOVL (0, main)83 movz x0, :abs_g3:main
84 MOVL (3, __libc_csu_init)84 movk x0, :abs_g2_nc:main
85 MOVL (4, __libc_csu_fini)85 movk x0, :abs_g1_nc:main
86 movk x0, :abs_g0_nc:main
87 movz x3, :abs_g3:__libc_csu_init
88 movk x3, :abs_g2_nc:__libc_csu_init
89 movk x3, :abs_g1_nc:__libc_csu_init
90 movk x3, :abs_g0_nc:__libc_csu_init
91 movz x4, :abs_g3:__libc_csu_fini
92 movk x4, :abs_g2_nc:__libc_csu_fini
93 movk x4, :abs_g1_nc:__libc_csu_fini
94 movk x4, :abs_g0_nc:__libc_csu_fini
86#endif95#endif
8796
88 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,97 /* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
lib/libc/glibc/sysdeps/aarch64/start.S+8-6
...@@ -70,8 +70,8 @@ ENTRY(_start)...@@ -70,8 +70,8 @@ ENTRY(_start)
70 mov x5, x070 mov x5, x0
7171
72 /* Load argc and a pointer to argv */72 /* Load argc and a pointer to argv */
73 ldr PTR_REG (1), [sp, #0]73 ldr x1, [sp, #0]
74 add x2, sp, #PTR_SIZE74 add x2, sp, 8
7575
76 /* Setup stack limit in argument register */76 /* Setup stack limit in argument register */
77 mov x6, sp77 mov x6, sp
...@@ -79,14 +79,16 @@ ENTRY(_start)...@@ -79,14 +79,16 @@ ENTRY(_start)
79#ifdef PIC79#ifdef PIC
80# ifdef SHARED80# ifdef SHARED
81 adrp x0, :got:main81 adrp x0, :got:main
82 ldr PTR_REG (0), [x0, #:got_lo12:main]82 ldr x0, [x0, #:got_lo12:main]
83# else83# else
84 adrp x0, __wrap_main84 adrp x0, __wrap_main
85 add x0, x0, :lo12:__wrap_main85 add x0, x0, :lo12:__wrap_main
86# endif86# endif
87#else87#else
88 /* Set up the other arguments in registers */88 movz x0, :abs_g3:main
89 MOVL (0, main)89 movk x0, :abs_g2_nc:main
90 movk x0, :abs_g1_nc:main
91 movk x0, :abs_g0_nc:main
90#endif92#endif
91 mov x3, #0 /* Used to be init. */93 mov x3, #0 /* Used to be init. */
92 mov x4, #0 /* Used to be fini. */94 mov x4, #0 /* Used to be fini. */
...@@ -106,7 +108,7 @@ ENTRY(_start)...@@ -106,7 +108,7 @@ ENTRY(_start)
106 because crt1.o and rcrt1.o share code and the later must avoid the108 because crt1.o and rcrt1.o share code and the later must avoid the
107 use of GOT relocations before __libc_start_main is called. */109 use of GOT relocations before __libc_start_main is called. */
108__wrap_main:110__wrap_main:
109 BTI_C111 bti c
110 b main112 b main
111#endif113#endif
112END(_start)114END(_start)
lib/libc/glibc/sysdeps/aarch64/sysdep.h+6-81
...@@ -21,59 +21,15 @@...@@ -21,59 +21,15 @@
2121
22#include <sysdeps/generic/sysdep.h>22#include <sysdeps/generic/sysdep.h>
2323
24#ifdef __LP64__
25# define AARCH64_R(NAME) R_AARCH64_ ## NAME
26# define PTR_REG(n) x##n
27# define PTR_LOG_SIZE 3
28# define PTR_ARG(n)
29# define SIZE_ARG(n)
30#else
31# define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
32# define PTR_REG(n) w##n
33# define PTR_LOG_SIZE 2
34# define PTR_ARG(n) mov w##n, w##n
35# define SIZE_ARG(n) mov w##n, w##n
36#endif
37
38#define PTR_SIZE (1<<PTR_LOG_SIZE)
39
40#ifndef __ASSEMBLER__
41/* Strip pointer authentication code from pointer p. */
42static inline void *
43strip_pac (void *p)
44{
45 register void *ra asm ("x30") = (p);
46 asm ("hint 7 // xpaclri" : "+r"(ra));
47 return ra;
48}
49
50/* This is needed when glibc is built with -mbranch-protection=pac-ret
51 with a gcc that is affected by PR target/94891. */
52# if HAVE_AARCH64_PAC_RET
53# undef RETURN_ADDRESS
54# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n))
55# endif
56#endif
57
58#ifdef __ASSEMBLER__24#ifdef __ASSEMBLER__
5925
26/* CFI directive for return address. */
27#define cfi_negate_ra_state .cfi_negate_ra_state
28
60/* Syntactic details of assembler. */29/* Syntactic details of assembler. */
6130
62#define ASM_SIZE_DIRECTIVE(name) .size name,.-name31#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
6332
64/* Branch Target Identitication support. */
65#if HAVE_AARCH64_BTI
66# define BTI_C hint 34
67# define BTI_J hint 36
68#else
69# define BTI_C nop
70# define BTI_J nop
71#endif
72
73/* Return address signing support (pac-ret). */
74#define PACIASP hint 25
75#define AUTIASP hint 29
76
77/* Guarded Control Stack support. */33/* Guarded Control Stack support. */
78#define CHKFEAT_X16 hint 4034#define CHKFEAT_X16 hint 40
79#define MRS_GCSPR(x) mrs x, s3_3_c2_c5_135#define MRS_GCSPR(x) mrs x, s3_3_c2_c5_1
...@@ -103,11 +59,7 @@ strip_pac (void *p)...@@ -103,11 +59,7 @@ strip_pac (void *p)
10359
104/* Add GNU property note with the supported features to all asm code60/* Add GNU property note with the supported features to all asm code
105 where sysdep.h is included. */61 where sysdep.h is included. */
106#if HAVE_AARCH64_BTI && HAVE_AARCH64_PAC_RET
107GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC|FEATURE_1_GCS)62GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC|FEATURE_1_GCS)
108#elif HAVE_AARCH64_BTI
109GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
110#endif
11163
112/* Define an entry point visible from C. */64/* Define an entry point visible from C. */
113#define ENTRY(name) \65#define ENTRY(name) \
...@@ -116,7 +68,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)...@@ -116,7 +68,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
116 .p2align 6; \68 .p2align 6; \
117 C_LABEL(name) \69 C_LABEL(name) \
118 cfi_startproc; \70 cfi_startproc; \
119 BTI_C; \71 bti c; \
120 CALL_MCOUNT72 CALL_MCOUNT
12173
122/* Define an entry point visible from C. */74/* Define an entry point visible from C. */
...@@ -126,7 +78,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)...@@ -126,7 +78,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
126 .p2align align; \78 .p2align align; \
127 C_LABEL(name) \79 C_LABEL(name) \
128 cfi_startproc; \80 cfi_startproc; \
129 BTI_C; \81 bti c; \
130 CALL_MCOUNT82 CALL_MCOUNT
13183
132/* Define an entry point visible from C with a specified alignment and84/* Define an entry point visible from C with a specified alignment and
...@@ -143,7 +95,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)...@@ -143,7 +95,7 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
143 .endr; \95 .endr; \
144 C_LABEL(name) \96 C_LABEL(name) \
145 cfi_startproc; \97 cfi_startproc; \
146 BTI_C; \98 bti c; \
147 CALL_MCOUNT99 CALL_MCOUNT
148100
149#undef END101#undef END
...@@ -195,33 +147,6 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)...@@ -195,33 +147,6 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_GCS)
195# define L(name) .L##name147# define L(name) .L##name
196#endif148#endif
197149
198/* Load or store to/from a pc-relative EXPR into/from R, using T.
199 Note R and T are register numbers and not register names. */
200#define LDST_PCREL(OP, R, T, EXPR) \
201 adrp x##T, EXPR; \
202 OP PTR_REG (R), [x##T, #:lo12:EXPR]; \
203
204/* Load or store to/from a got-relative EXPR into/from R, using T.
205 Note R and T are register numbers and not register names. */
206#define LDST_GLOBAL(OP, R, T, EXPR) \
207 adrp x##T, :got:EXPR; \
208 ldr PTR_REG (T), [x##T, #:got_lo12:EXPR]; \
209 OP PTR_REG (R), [x##T];
210
211/* Load an immediate into R.
212 Note R is a register number and not a register name. */
213#ifdef __LP64__
214# define MOVL(R, NAME) \
215 movz PTR_REG (R), #:abs_g3:NAME; \
216 movk PTR_REG (R), #:abs_g2_nc:NAME; \
217 movk PTR_REG (R), #:abs_g1_nc:NAME; \
218 movk PTR_REG (R), #:abs_g0_nc:NAME;
219#else
220# define MOVL(R, NAME) \
221 movz PTR_REG (R), #:abs_g1:NAME; \
222 movk PTR_REG (R), #:abs_g0_nc:NAME;
223#endif
224
225/* Since C identifiers are not normally prefixed with an underscore150/* Since C identifiers are not normally prefixed with an underscore
226 on this system, the asm identifier `syscall_error' intrudes on the151 on this system, the asm identifier `syscall_error' intrudes on the
227 C name space. Make sure we use an innocuous name. */152 C name space. Make sure we use an innocuous name. */
lib/libc/glibc/sysdeps/generic/sysdep.h+3
...@@ -45,6 +45,7 @@...@@ -45,6 +45,7 @@
45# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off45# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
46# define cfi_offset(reg, off) .cfi_offset reg, off46# define cfi_offset(reg, off) .cfi_offset reg, off
47# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off47# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
48# define cfi_val_offset(reg, off) .cfi_val_offset reg, off
48# define cfi_register(r1, r2) .cfi_register r1, r249# define cfi_register(r1, r2) .cfi_register r1, r2
49# define cfi_return_column(reg) .cfi_return_column reg50# define cfi_return_column(reg) .cfi_return_column reg
50# define cfi_restore(reg) .cfi_restore reg51# define cfi_restore(reg) .cfi_restore reg
...@@ -74,6 +75,8 @@...@@ -74,6 +75,8 @@
74 ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)75 ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
75# define CFI_REL_OFFSET(reg, off) \76# define CFI_REL_OFFSET(reg, off) \
76 ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)77 ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
78# define CFI_VAL_OFFSET(reg, off) \
79 ".cfi_val_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
77# define CFI_REGISTER(r1, r2) \80# define CFI_REGISTER(r1, r2) \
78 ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)81 ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
79# define CFI_RETURN_COLUMN(reg) \82# define CFI_RETURN_COLUMN(reg) \
lib/libc/glibc/sysdeps/htl/libc-lockP.h+10-39
...@@ -75,7 +75,6 @@...@@ -75,7 +75,6 @@
7575
76extern int __pthread_mutex_init (pthread_mutex_t *__mutex,76extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
77 const pthread_mutexattr_t *__mutex_attr);77 const pthread_mutexattr_t *__mutex_attr);
78
79extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);78extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
80libc_hidden_proto (__pthread_mutex_destroy)79libc_hidden_proto (__pthread_mutex_destroy)
8180
...@@ -91,75 +90,47 @@ libc_hidden_proto (__pthread_mutexattr_init)...@@ -91,75 +90,47 @@ libc_hidden_proto (__pthread_mutexattr_init)
91extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);90extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
92libc_hidden_proto (__pthread_mutexattr_destroy)91libc_hidden_proto (__pthread_mutexattr_destroy)
9392
94extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
95 int __kind);
96
97extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,93extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
98 const pthread_rwlockattr_t *__attr);94 const pthread_rwlockattr_t *__attr);
95libc_hidden_proto (__pthread_rwlock_init)
9996
100extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);97extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
98libc_hidden_proto (__pthread_rwlock_destroy)
10199
102extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);100extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
101libc_hidden_proto (__pthread_rwlock_rdlock)
103102
104extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);103extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
104libc_hidden_proto (__pthread_rwlock_tryrdlock)
105105
106extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);106extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
107libc_hidden_proto (__pthread_rwlock_wrlock)
107108
108extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);109extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
110libc_hidden_proto (__pthread_rwlock_trywrlock)
109111
110extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);112extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
113libc_hidden_proto (__pthread_rwlock_unlock)
111114
112extern int __pthread_once (pthread_once_t *__once_control,115extern int __pthread_once (pthread_once_t *__once_control,
113 void (*__init_routine) (void));116 void (*__init_routine) (void));
117libc_hidden_proto (__pthread_once);
114118
115extern int __pthread_atfork (void (*__prepare) (void),119extern int __pthread_atfork (void (*__prepare) (void),
116 void (*__parent) (void),120 void (*__parent) (void),
117 void (*__child) (void));121 void (*__child) (void));
118122
123extern int __pthread_setcancelstate (int state, int *oldstate);
124libc_hidden_proto (__pthread_setcancelstate)
119/* Make the pthread functions weak so that we can elide them from125/* Make the pthread functions weak so that we can elide them from
120 single-threaded processes. */126 single-threaded processes. */
121#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)127#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
122# ifdef weak_extern128# ifdef weak_extern
123weak_extern (__pthread_mutex_init)
124weak_extern (__pthread_mutex_destroy)
125weak_extern (__pthread_mutex_lock)
126weak_extern (__pthread_mutex_trylock)
127weak_extern (__pthread_mutex_unlock)
128weak_extern (__pthread_mutexattr_settype)
129weak_extern (__pthread_rwlock_init)
130weak_extern (__pthread_rwlock_destroy)
131weak_extern (__pthread_rwlock_rdlock)
132weak_extern (__pthread_rwlock_tryrdlock)
133weak_extern (__pthread_rwlock_wrlock)
134weak_extern (__pthread_rwlock_trywrlock)
135weak_extern (__pthread_rwlock_unlock)
136weak_extern (__pthread_key_create)
137weak_extern (__pthread_setspecific)
138weak_extern (__pthread_getspecific)
139weak_extern (__pthread_once)
140weak_extern (__pthread_initialize)129weak_extern (__pthread_initialize)
141weak_extern (__pthread_atfork)130weak_extern (__pthread_atfork)
142weak_extern (__pthread_setcancelstate)
143# else131# else
144# pragma weak __pthread_mutex_init
145# pragma weak __pthread_mutex_destroy
146# pragma weak __pthread_mutex_lock
147# pragma weak __pthread_mutex_trylock
148# pragma weak __pthread_mutex_unlock
149# pragma weak __pthread_mutexattr_settype
150# pragma weak __pthread_rwlock_destroy
151# pragma weak __pthread_rwlock_rdlock
152# pragma weak __pthread_rwlock_tryrdlock
153# pragma weak __pthread_rwlock_wrlock
154# pragma weak __pthread_rwlock_trywrlock
155# pragma weak __pthread_rwlock_unlock
156# pragma weak __pthread_key_create
157# pragma weak __pthread_setspecific
158# pragma weak __pthread_getspecific
159# pragma weak __pthread_once
160# pragma weak __pthread_initialize132# pragma weak __pthread_initialize
161# pragma weak __pthread_atfork133# pragma weak __pthread_atfork
162# pragma weak __pthread_setcancelstate
163# endif134# endif
164#endif135#endif
165136
lib/libc/glibc/sysdeps/mach/sysdep.h+5
...@@ -20,6 +20,11 @@...@@ -20,6 +20,11 @@
20/* Get the Mach definitions of ENTRY and kernel_trap. */20/* Get the Mach definitions of ENTRY and kernel_trap. */
21#include <mach/machine/syscall_sw.h>21#include <mach/machine/syscall_sw.h>
2222
23/* This macro is defined in Mach system headers, but string functions use it
24 with different definitions depending on whether being compiled for
25 wide-characters or not. */
26#undef P2ALIGN
27
23/* The Mach definitions assume underscores should be prepended to28/* The Mach definitions assume underscores should be prepended to
24 symbol names. Redefine them to do so only when appropriate. */29 symbol names. Redefine them to do so only when appropriate. */
25#undef EXT30#undef EXT
lib/libc/glibc/sysdeps/nptl/pthread.h+5
...@@ -1317,6 +1317,11 @@ extern int pthread_getcpuclockid (pthread_t __thread_id,...@@ -1317,6 +1317,11 @@ extern int pthread_getcpuclockid (pthread_t __thread_id,
1317 __THROW __nonnull ((2));1317 __THROW __nonnull ((2));
1318#endif1318#endif
13191319
1320#ifdef __USE_GNU
1321/* Return the Linux TID for THREAD_ID. Returns -1 on failure. */
1322extern pid_t pthread_gettid_np (pthread_t __thread_id);
1323#endif
1324
13201325
1321/* Install handlers to be called when a new process is created with FORK.1326/* Install handlers to be called when a new process is created with FORK.
1322 The PREPARE handler is called in the parent process just before performing1327 The PREPARE handler is called in the parent process just before performing
lib/libc/glibc/sysdeps/sparc/sparc32/start.S+8-3
...@@ -35,6 +35,7 @@...@@ -35,6 +35,7 @@
3535
36#include <sysdep.h>36#include <sysdep.h>
3737
38#define FRAME_SIZE 104
3839
39 .section ".text"40 .section ".text"
40 .align 441 .align 4
...@@ -48,12 +49,12 @@ _start:...@@ -48,12 +49,12 @@ _start:
48 /* Terminate the stack frame, and reserve space for functions to49 /* Terminate the stack frame, and reserve space for functions to
49 drop their arguments. */50 drop their arguments. */
50 mov %g0, %fp51 mov %g0, %fp
51 sub %sp, 6*4, %sp52 sub %sp, FRAME_SIZE, %sp
5253
53 /* Extract the arguments and environment as encoded on the stack. The54 /* Extract the arguments and environment as encoded on the stack. The
54 argument info starts after one register window (16 words) past the SP. */55 argument info starts after one register window (16 words) past the SP. */
55 ld [%sp+22*4], %o156 ld [%sp+168], %o1
56 add %sp, 23*4, %o257 add %sp, 172, %o2
5758
58 /* Load the addresses of the user entry points. */59 /* Load the addresses of the user entry points. */
59#ifndef PIC60#ifndef PIC
...@@ -73,6 +74,10 @@ _start:...@@ -73,6 +74,10 @@ _start:
73 be NULL. */74 be NULL. */
74 mov %g1, %o575 mov %g1, %o5
7576
77 /* Provide the highest stack address to update the __libc_stack_end (used
78 to enable executable stacks if required). */
79 st %sp, [%sp+23*4]
80
76 /* Let libc do the rest of the initialization, and call main. */81 /* Let libc do the rest of the initialization, and call main. */
77 call __libc_start_main82 call __libc_start_main
78 nop83 nop
lib/libc/glibc/sysdeps/sparc/sparc64/start.S+4
...@@ -74,6 +74,10 @@ _start:...@@ -74,6 +74,10 @@ _start:
74 be NULL. */74 be NULL. */
75 mov %g1, %o575 mov %g1, %o5
7676
77 /* Provide the highest stack address to update the __libc_stack_end (used
78 to enable executable stacks if required). */
79 stx %sp, [%sp+STACK_BIAS+22*8]
80
77 /* Let libc do the rest of the initialization, and call main. */81 /* Let libc do the rest of the initialization, and call main. */
78 call __libc_start_main82 call __libc_start_main
79 nop83 nop
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h+2-7
...@@ -152,13 +152,8 @@...@@ -152,13 +152,8 @@
152152
153#else /* not __ASSEMBLER__ */153#else /* not __ASSEMBLER__ */
154154
155# ifdef __LP64__155# define VDSO_NAME "LINUX_2.6.39"
156# define VDSO_NAME "LINUX_2.6.39"156# define VDSO_HASH 123718537
157# define VDSO_HASH 123718537
158# else
159# define VDSO_NAME "LINUX_4.9"
160# define VDSO_HASH 61765625
161# endif
162157
163/* List of system calls which are supported as vsyscalls. */158/* List of system calls which are supported as vsyscalls. */
164# define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"159# define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres"
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h+4
...@@ -54,6 +54,10 @@...@@ -54,6 +54,10 @@
54 configurations). */54 configurations). */
55#define __ASSUME_SET_ROBUST_LIST 155#define __ASSUME_SET_ROBUST_LIST 1
5656
57/* The termios2 interface was introduced across all architectures except
58 Alpha in kernel 2.6.22. */
59#define __ASSUME_TERMIOS2 1
60
57/* Support for various CLOEXEC and NONBLOCK flags was added in61/* Support for various CLOEXEC and NONBLOCK flags was added in
58 2.6.27. */62 2.6.27. */
59#define __ASSUME_IN_NONBLOCK 163#define __ASSUME_IN_NONBLOCK 1
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h+2-1
...@@ -145,11 +145,12 @@...@@ -145,11 +145,12 @@
145# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"145# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
146# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"146# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
147# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"147# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
148# define HAVE_GETRANDOM_VSYSCALL "__vdso_getrandom"
148# else149# else
149# define VDSO_NAME "LINUX_5.4"150# define VDSO_NAME "LINUX_5.4"
150# define VDSO_HASH 61765876151# define VDSO_HASH 61765876
151152
152/* RV32 does not support the gettime VDSO syscalls. */153/* RV32 does not support the gettime and getrandom VDSO syscalls. */
153# endif154# endif
154# define HAVE_CLONE3_WRAPPER 1155# define HAVE_CLONE3_WRAPPER 1
155156
lib/libc/glibc/sysdeps/x86/sysdep.h+29
...@@ -102,6 +102,9 @@...@@ -102,6 +102,9 @@
102 | (1 << X86_XSTATE_ZMM_ID) \102 | (1 << X86_XSTATE_ZMM_ID) \
103 | (1 << X86_XSTATE_APX_F_ID))103 | (1 << X86_XSTATE_APX_F_ID))
104104
105/* The maximum supported xstate ID. */
106# define X86_XSTATE_MAX_ID X86_XSTATE_APX_F_ID
107
105/* AMX state mask. */108/* AMX state mask. */
106# define AMX_STATE_SAVE_MASK \109# define AMX_STATE_SAVE_MASK \
107 ((1 << X86_XSTATE_TILECFG_ID) | (1 << X86_XSTATE_TILEDATA_ID))110 ((1 << X86_XSTATE_TILECFG_ID) | (1 << X86_XSTATE_TILEDATA_ID))
...@@ -123,6 +126,9 @@...@@ -123,6 +126,9 @@
123 | (1 << X86_XSTATE_K_ID) \126 | (1 << X86_XSTATE_K_ID) \
124 | (1 << X86_XSTATE_ZMM_H_ID))127 | (1 << X86_XSTATE_ZMM_H_ID))
125128
129/* The maximum supported xstate ID. */
130# define X86_XSTATE_MAX_ID X86_XSTATE_ZMM_H_ID
131
126/* States to be included in xsave_state_size. */132/* States to be included in xsave_state_size. */
127# define FULL_STATE_SAVE_MASK STATE_SAVE_MASK133# define FULL_STATE_SAVE_MASK STATE_SAVE_MASK
128#endif134#endif
...@@ -177,6 +183,29 @@...@@ -177,6 +183,29 @@
177183
178#define atom_text_section .section ".text.atom", "ax"184#define atom_text_section .section ".text.atom", "ax"
179185
186#ifndef DL_STACK_ALIGNMENT
187/* Due to GCC bug:
188
189 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066
190
191 __tls_get_addr may be called with 8-byte/4-byte stack alignment.
192 Although this bug has been fixed in GCC 4.9.4, 5.3 and 6, we can't
193 assume that stack will be always aligned at 16 bytes. */
194# ifdef __x86_64__
195# define DL_STACK_ALIGNMENT 8
196# define MINIMUM_ALIGNMENT 16
197# else
198# define DL_STACK_ALIGNMENT 4
199# endif
200#endif
201
202/* True if _dl_runtime_resolve/_dl_tlsdesc_dynamic should align stack for
203 STATE_SAVE or align stack to MINIMUM_ALIGNMENT bytes before calling
204 _dl_fixup/__tls_get_addr. */
205#define DL_RUNTIME_RESOLVE_REALIGN_STACK \
206 (STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \
207 || MINIMUM_ALIGNMENT > DL_STACK_ALIGNMENT)
208
180#endif /* __ASSEMBLER__ */209#endif /* __ASSEMBLER__ */
181210
182#endif /* _X86_SYSDEP_H */211#endif /* _X86_SYSDEP_H */