authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-10 16:39:02-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-10 16:40:54-04:00
log7101e583d6a752fa1145c13c6e1a58f36bd35f2d
tree530056de9ddc6c4f8ebb06ead523bc47afa53bcb
parenta165cc05359114dc20af90232184a1af75dc9795
signaturelock-open Commit is signed but in an unrecognized format.

update glibc src files to 2.30


33 files changed, 288 insertions(+), 182 deletions(-)

lib/libc/glibc/elf/elf.h+30-2
......@@ -360,7 +360,7 @@ typedef struct
360360#define EM_RISCV 243 /* RISC-V */
361361
362362#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
363#define EM_CSKY 252 /* C_SKY */
363#define EM_CSKY 252 /* C-SKY */
364364
365365#define EM_NUM 253
366366
......@@ -809,9 +809,16 @@ typedef struct
809809#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
810810#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
811811 registers */
812#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication
813 code masks. */
814#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication
815 address keys. */
816#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
817 generic key. */
812818#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
813819#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
814820#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
821#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
815822
816823/* Legal values for the note segment descriptor types for object files. */
817824
......@@ -987,6 +994,9 @@ typedef struct
987994#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
988995#define DF_1_STUB 0x04000000
989996#define DF_1_PIE 0x08000000
997#define DF_1_KMOD 0x10000000
998#define DF_1_WEAKFILTER 0x20000000
999#define DF_1_NOCOMMON 0x40000000
9901000
9911001/* Flags for the feature selection in DT_FEATURE_1. */
9921002#define DTF_1_PARINIT 0x00000001
......@@ -2854,6 +2864,13 @@ enum
28542864#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
28552865#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
28562866
2867/* AArch64 specific values for the Dyn d_tag field. */
2868#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
2869#define DT_AARCH64_NUM 6
2870
2871/* AArch64 specific values for the st_other field. */
2872#define STO_AARCH64_VARIANT_PCS 0x80
2873
28572874/* ARM relocs. */
28582875
28592876#define R_ARM_NONE 0 /* No reloc */
......@@ -3022,7 +3039,7 @@ enum
30223039/* Keep this the last entry. */
30233040#define R_ARM_NUM 256
30243041
3025/* csky */
3042/* C-SKY */
30263043#define R_CKCORE_NONE 0 /* no reloc */
30273044#define R_CKCORE_ADDR32 1 /* direct 32 bit (S + A) */
30283045#define R_CKCORE_PCRELIMM8BY4 2 /* disp ((S + A - P) >> 2) & 0xff */
......@@ -3086,6 +3103,17 @@ enum
30863103#define R_CKCORE_TLS_DTPOFF32 57
30873104#define R_CKCORE_TLS_TPOFF32 58
30883105
3106/* C-SKY elf header definition. */
3107#define EF_CSKY_ABIMASK 0XF0000000
3108#define EF_CSKY_OTHER 0X0FFF0000
3109#define EF_CSKY_PROCESSOR 0X0000FFFF
3110
3111#define EF_CSKY_ABIV1 0X10000000
3112#define EF_CSKY_ABIV2 0X20000000
3113
3114/* C-SKY attributes section. */
3115#define SHT_CSKY_ATTRIBUTES (SHT_LOPROC + 1)
3116
30893117/* IA-64 specific declarations. */
30903118
30913119/* Processor specific flags for the Ehdr e_flags field. */
lib/libc/glibc/include/elf.h+1-1
......@@ -23,7 +23,7 @@
2323# endif
2424# define DT_1_SUPPORTED_MASK \
2525 (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
26 | DF_1_ORIGIN | DF_1_NODEFLIB)
26 | DF_1_ORIGIN | DF_1_NODEFLIB | DF_1_PIE)
2727
2828#endif /* !_ISOMAC */
2929#endif /* elf.h */
lib/libc/glibc/include/features.h+5-5
......@@ -414,10 +414,10 @@
414414 instance, with GCC, -std=gnu11 will have C99-compliant scanf with
415415 or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the
416416 old extension. */
417#if defined __USE_GNU && \
418 (defined __cplusplus \
419 ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
420 : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L))
417#if (defined __USE_GNU \
418 && (defined __cplusplus \
419 ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \
420 : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L)))
421421# define __GLIBC_USE_DEPRECATED_SCANF 1
422422#else
423423# define __GLIBC_USE_DEPRECATED_SCANF 0
......@@ -439,7 +439,7 @@
439439/* Major and minor version number of the GNU C library package. Use
440440 these macros to test for features in specific releases. */
441441#define __GLIBC__ 2
442#define __GLIBC_MINOR__ 29
442#define __GLIBC_MINOR__ 30
443443
444444#define __GLIBC_PREREQ(maj, min) \
445445 ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
lib/libc/glibc/include/stap-probe.h+6-5
......@@ -21,6 +21,7 @@
2121
2222#ifdef USE_STAP_PROBE
2323
24# include <stap-probe-machine.h>
2425# include <sys/sdt.h>
2526
2627/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
......@@ -59,11 +60,11 @@
5960/* Evaluate all the arguments and verify that N matches their number. */
6061# define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__)
6162
62# define STAP_PROBE0()
63# define STAP_PROBE1(a1)
64# define STAP_PROBE2(a1, a2)
65# define STAP_PROBE3(a1, a2, a3)
66# define STAP_PROBE4(a1, a2, a3, a4)
63# define STAP_PROBE0() do {} while (0)
64# define STAP_PROBE1(a1) do {} while (0)
65# define STAP_PROBE2(a1, a2) do {} while (0)
66# define STAP_PROBE3(a1, a2, a3) do {} while (0)
67# define STAP_PROBE4(a1, a2, a3, a4) do {} while (0)
6768
6869# else
6970# define LIBC_PROBE(name, n, ...) /* Nothing. */
lib/libc/glibc/io/bits/statx.h+4-69
......@@ -1,4 +1,4 @@
1/* statx-related definitions and declarations.
1/* statx-related definitions and declarations. Generic version.
22 Copyright (C) 2018-2019 Free Software Foundation, Inc.
33 This file is part of the GNU C Library.
44
......@@ -19,73 +19,8 @@
1919/* This interface is based on <linux/stat.h> in Linux. */
2020
2121#ifndef _SYS_STAT_H
22# error Never include <bits/stat.x.h> directly, include <sys/stat.h> instead.
22# error Never include <bits/statx.h> directly, include <sys/stat.h> instead.
2323#endif
2424
25struct statx_timestamp
26{
27 __int64_t tv_sec;
28 __uint32_t tv_nsec;
29 __int32_t __statx_timestamp_pad1[1];
30};
31
32/* Warning: The kernel may add additional fields to this struct in the
33 future. Only use this struct for calling the statx function, not
34 for storing data. (Expansion will be controlled by the mask
35 argument of the statx function.) */
36struct statx
37{
38 __uint32_t stx_mask;
39 __uint32_t stx_blksize;
40 __uint64_t stx_attributes;
41 __uint32_t stx_nlink;
42 __uint32_t stx_uid;
43 __uint32_t stx_gid;
44 __uint16_t stx_mode;
45 __uint16_t __statx_pad1[1];
46 __uint64_t stx_ino;
47 __uint64_t stx_size;
48 __uint64_t stx_blocks;
49 __uint64_t stx_attributes_mask;
50 struct statx_timestamp stx_atime;
51 struct statx_timestamp stx_btime;
52 struct statx_timestamp stx_ctime;
53 struct statx_timestamp stx_mtime;
54 __uint32_t stx_rdev_major;
55 __uint32_t stx_rdev_minor;
56 __uint32_t stx_dev_major;
57 __uint32_t stx_dev_minor;
58 __uint64_t __statx_pad2[14];
59};
60
61#define STATX_TYPE 0x0001U
62#define STATX_MODE 0x0002U
63#define STATX_NLINK 0x0004U
64#define STATX_UID 0x0008U
65#define STATX_GID 0x0010U
66#define STATX_ATIME 0x0020U
67#define STATX_MTIME 0x0040U
68#define STATX_CTIME 0x0080U
69#define STATX_INO 0x0100U
70#define STATX_SIZE 0x0200U
71#define STATX_BLOCKS 0x0400U
72#define STATX_BASIC_STATS 0x07ffU
73#define STATX_ALL 0x0fffU
74#define STATX_BTIME 0x0800U
75#define STATX__RESERVED 0x80000000U
76
77#define STATX_ATTR_COMPRESSED 0x0004
78#define STATX_ATTR_IMMUTABLE 0x0010
79#define STATX_ATTR_APPEND 0x0020
80#define STATX_ATTR_NODUMP 0x0040
81#define STATX_ATTR_ENCRYPTED 0x0800
82#define STATX_ATTR_AUTOMOUNT 0x1000
83
84__BEGIN_DECLS
85
86/* Fill *BUF with information about PATH in DIRFD. */
87int statx (int __dirfd, const char *__restrict __path, int __flags,
88 unsigned int __mask, struct statx *__restrict __buf)
89 __THROW __nonnull ((2, 5));
90
91__END_DECLS
25/* Use the generic definitions. */
26#include <bits/statx-generic.h>
lib/libc/glibc/misc/sys/cdefs.h+10-2
......@@ -256,8 +256,8 @@
256256/* Since version 4.5, gcc also allows one to specify the message printed
257257 when a deprecated function is used. clang claims to be gcc 4.2, but
258258 may also support this feature. */
259#if __GNUC_PREREQ (4,5) || \
260 __glibc_clang_has_extension (__attribute_deprecated_with_message__)
259#if __GNUC_PREREQ (4,5) \
260 || __glibc_clang_has_extension (__attribute_deprecated_with_message__)
261261# define __attribute_deprecated_msg__(msg) \
262262 __attribute__ ((__deprecated__ (msg)))
263263#else
......@@ -412,6 +412,14 @@
412412# define __glibc_has_attribute(attr) 0
413413#endif
414414
415#ifdef __has_include
416/* Do not use a function-like macro, so that __has_include can inhibit
417 macro expansion. */
418# define __glibc_has_include __has_include
419#else
420# define __glibc_has_include(header) 0
421#endif
422
415423#if (!defined _Noreturn \
416424 && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
417425 && !__GNUC_PREREQ (4,7))
lib/libc/glibc/posix/bits/types.h+11-8
......@@ -87,7 +87,7 @@ __extension__ typedef unsigned long long int __uintmax_t;
8787 32 -- "natural" 32-bit type (always int)
8888 64 -- "natural" 64-bit type (long or long long)
8989 LONG32 -- 32-bit type, traditionally long
90 QUAD -- 64-bit type, always long long
90 QUAD -- 64-bit type, traditionally long long
9191 WORD -- natural type of __WORDSIZE bits (int or long)
9292 LONGWORD -- type of __WORDSIZE bits, traditionally long
9393
......@@ -113,14 +113,14 @@ __extension__ typedef unsigned long long int __uintmax_t;
113113#define __SLONGWORD_TYPE long int
114114#define __ULONGWORD_TYPE unsigned long int
115115#if __WORDSIZE == 32
116# define __SQUAD_TYPE __quad_t
117# define __UQUAD_TYPE __u_quad_t
116# define __SQUAD_TYPE __int64_t
117# define __UQUAD_TYPE __uint64_t
118118# define __SWORD_TYPE int
119119# define __UWORD_TYPE unsigned int
120120# define __SLONG32_TYPE long int
121121# define __ULONG32_TYPE unsigned long int
122# define __S64_TYPE __quad_t
123# define __U64_TYPE __u_quad_t
122# define __S64_TYPE __int64_t
123# define __U64_TYPE __uint64_t
124124/* We want __extension__ before typedef's that use nonstandard base types
125125 such as `long long' in C89 mode. */
126126# define __STD_TYPE __extension__ typedef
......@@ -213,10 +213,13 @@ __STD_TYPE __U32_TYPE __socklen_t;
213213 It is not currently necessary for this to be machine-specific. */
214214typedef int __sig_atomic_t;
215215
216#if __TIMESIZE == 64
216/* Seconds since the Epoch, visible to user code when time_t is too
217 narrow only for consistency with the old way of widening too-narrow
218 types. User code should never use __time64_t. */
219#if __TIMESIZE == 64 && defined __LIBC
217220# define __time64_t __time_t
218#else
219__STD_TYPE __TIME64_T_TYPE __time64_t; /* Seconds since the Epoch. */
221#elif __TIMESIZE != 64
222__STD_TYPE __TIME64_T_TYPE __time64_t;
220223#endif
221224
222225#undef __STD_TYPE
lib/libc/glibc/posix/sys/types.h+8-25
......@@ -154,37 +154,20 @@ typedef unsigned int uint;
154154
155155#include <bits/stdint-intn.h>
156156
157#if !__GNUC_PREREQ (2, 7)
158
159157/* These were defined by ISO C without the first `_'. */
160typedef unsigned char u_int8_t;
161typedef unsigned short int u_int16_t;
162typedef unsigned int u_int32_t;
163# if __WORDSIZE == 64
164typedef unsigned long int u_int64_t;
165# else
166__extension__ typedef unsigned long long int u_int64_t;
167# endif
168
169typedef int register_t;
170
171#else
172
173/* For GCC 2.7 and later, we can use specific type-size attributes. */
174# define __u_intN_t(N, MODE) \
175 typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
176
177__u_intN_t (8, __QI__);
178__u_intN_t (16, __HI__);
179__u_intN_t (32, __SI__);
180__u_intN_t (64, __DI__);
158typedef __uint8_t u_int8_t;
159typedef __uint16_t u_int16_t;
160typedef __uint32_t u_int32_t;
161typedef __uint64_t u_int64_t;
181162
163#if __GNUC_PREREQ (2, 7)
182164typedef int register_t __attribute__ ((__mode__ (__word__)));
183
165#else
166typedef int register_t;
167#endif
184168
185169/* Some code from BIND tests this macro to see if the types above are
186170 defined. */
187#endif
188171#define __BIT_TYPES_DEFINED__ 1
189172
190173
lib/libc/glibc/signal/signal.h+3
......@@ -370,6 +370,9 @@ extern int __libc_current_sigrtmax (void) __THROW;
370370#define SIGRTMIN (__libc_current_sigrtmin ())
371371#define SIGRTMAX (__libc_current_sigrtmax ())
372372
373/* System-specific extensions. */
374#include <bits/signal_ext.h>
375
373376__END_DECLS
374377
375378#endif /* not signal.h */
lib/libc/glibc/stdlib/stdlib.h+8-5
......@@ -536,10 +536,11 @@ extern int lcong48_r (unsigned short int __param[7],
536536#endif /* Use misc or X/Open. */
537537
538538/* Allocate SIZE bytes of memory. */
539extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
539extern void *malloc (size_t __size) __THROW __attribute_malloc__
540 __attribute_alloc_size__ ((1)) __wur;
540541/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
541542extern void *calloc (size_t __nmemb, size_t __size)
542 __THROW __attribute_malloc__ __wur;
543 __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
543544
544545/* Re-allocate the previously allocated block
545546 in PTR, making the new block SIZE bytes long. */
......@@ -547,7 +548,7 @@ extern void *calloc (size_t __nmemb, size_t __size)
547548 the same pointer that was passed to it, aliasing needs to be allowed
548549 between objects pointed by the old and new pointers. */
549550extern void *realloc (void *__ptr, size_t __size)
550 __THROW __attribute_warn_unused_result__;
551 __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
551552
552553#ifdef __USE_MISC
553554/* Re-allocate the previously allocated block in PTR, making the new
......@@ -556,7 +557,8 @@ extern void *realloc (void *__ptr, size_t __size)
556557 the same pointer that was passed to it, aliasing needs to be allowed
557558 between objects pointed by the old and new pointers. */
558559extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
559 __THROW __attribute_warn_unused_result__;
560 __THROW __attribute_warn_unused_result__
561 __attribute_alloc_size__ ((2, 3));
560562#endif
561563
562564/* Free a block allocated by `malloc', `realloc' or `calloc'. */
......@@ -569,7 +571,8 @@ extern void free (void *__ptr) __THROW;
569571#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
570572 || defined __USE_MISC
571573/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
572extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
574extern void *valloc (size_t __size) __THROW __attribute_malloc__
575 __attribute_alloc_size__ ((1)) __wur;
573576#endif
574577
575578#ifdef __USE_XOPEN2K
lib/libc/glibc/sysdeps/arm/sysdep.h+2-2
......@@ -295,8 +295,8 @@
295295#endif
296296
297297/* Pointer mangling support. */
298#if (IS_IN (rtld) || \
299 (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
298#if (IS_IN (rtld) \
299 || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread))))
300300# ifdef __ASSEMBLER__
301301# define PTR_MANGLE_LOAD(guard, tmp) \
302302 LDR_HIDDEN (guard, tmp, C_SYMBOL_NAME(__pointer_chk_guard_local), 0)
lib/libc/glibc/sysdeps/generic/single-thread.h created+24
......@@ -0,0 +1,24 @@
1/* Single thread optimization, generic version.
2 Copyright (C) 2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _SINGLE_THREAD_H
20#define _SINGLE_THREAD_H
21
22#define SINGLE_THREAD_P (0)
23
24#endif /* _SINGLE_THREAD_H */
lib/libc/glibc/sysdeps/generic/symbol-hacks.h+2-2
......@@ -11,8 +11,8 @@ asm ("memcpy = __GI_memcpy");
1111 __stack_chk_fail itself is a global symbol, exported from libc.so,
1212 and cannot be made hidden. */
1313
14# if IS_IN (libc) && defined SHARED && \
15 defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
14# if IS_IN (libc) && defined SHARED \
15 && defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
1616asm (".hidden __stack_chk_fail_local\n"
1717 "__stack_chk_fail = __stack_chk_fail_local");
1818# endif
lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h+2-2
......@@ -218,8 +218,8 @@ struct stat64
218218#define S_IMMAP0 000100000000
219219
220220/* ALL the unused bits. */
221#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0| \
222 S_IUSEUNK|S_IUNKNOWN|07777))
221#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0 \
222 |S_IUSEUNK|S_IUNKNOWN|07777))
223223#endif
224224
225225#ifdef __USE_MISC
lib/libc/glibc/sysdeps/nptl/libc-lockP.h+3-14
......@@ -71,23 +71,12 @@ typedef pthread_key_t __libc_key_t;
7171 For the C library we take a deeper look at the initializer. For
7272 this implementation all fields are initialized to zero. Therefore
7373 we don't initialize the variable which allows putting it into the
74 BSS section. (Except on PA-RISC and other odd architectures, where
75 initialized locks must be set to one due to the lack of normal
76 atomic operations.) */
74 BSS section. */
7775
76_Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
7877#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
79#if IS_IN (libc) || IS_IN (libpthread)
80# if LLL_LOCK_INITIALIZER == 0
81# define __libc_lock_define_initialized(CLASS,NAME) \
82 CLASS __libc_lock_t NAME;
83# else
84# define __libc_lock_define_initialized(CLASS,NAME) \
85 CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER;
86# endif
87#else
88# define __libc_lock_define_initialized(CLASS,NAME) \
78#define __libc_lock_define_initialized(CLASS,NAME) \
8979 CLASS __libc_lock_t NAME;
90#endif
9180
9281#define __libc_rwlock_define_initialized(CLASS,NAME) \
9382 CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER;
lib/libc/glibc/sysdeps/nptl/pthread.h+36
......@@ -770,6 +770,13 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
770770 __abstime) __THROWNL __nonnull ((1, 2));
771771#endif
772772
773#ifdef __USE_GNU
774extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
775 clockid_t __clockid,
776 const struct timespec *__restrict
777 __abstime) __THROWNL __nonnull ((1, 3));
778#endif
779
773780/* Unlock a mutex. */
774781extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
775782 __THROWNL __nonnull ((1));
......@@ -909,6 +916,13 @@ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
909916 __abstime) __THROWNL __nonnull ((1, 2));
910917# endif
911918
919# ifdef __USE_GNU
920extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
921 clockid_t __clockid,
922 const struct timespec *__restrict
923 __abstime) __THROWNL __nonnull ((1, 3));
924# endif
925
912926/* Acquire write lock for RWLOCK. */
913927extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
914928 __THROWNL __nonnull ((1));
......@@ -924,6 +938,13 @@ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
924938 __abstime) __THROWNL __nonnull ((1, 2));
925939# endif
926940
941# ifdef __USE_GNU
942extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
943 clockid_t __clockid,
944 const struct timespec *__restrict
945 __abstime) __THROWNL __nonnull ((1, 3));
946# endif
947
927948/* Unlock RWLOCK. */
928949extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
929950 __THROWNL __nonnull ((1));
......@@ -1003,6 +1024,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
10031024 const struct timespec *__restrict __abstime)
10041025 __nonnull ((1, 2, 3));
10051026
1027# ifdef __USE_GNU
1028/* Wait for condition variable COND to be signaled or broadcast until
1029 ABSTIME measured by the specified clock. MUTEX is assumed to be
1030 locked before. CLOCK is the clock to use. ABSTIME is an absolute
1031 time specification against CLOCK's epoch.
1032
1033 This function is a cancellation point and therefore not marked with
1034 __THROW. */
1035extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
1036 pthread_mutex_t *__restrict __mutex,
1037 __clockid_t __clock_id,
1038 const struct timespec *__restrict __abstime)
1039 __nonnull ((1, 2, 4));
1040# endif
1041
10061042/* Functions for handling condition variable attributes. */
10071043
10081044/* Initialize condition variable attribute ATTR. */
lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h+1-1
......@@ -32,7 +32,7 @@
3232#define ENTRY(name) \
3333 .globl C_SYMBOL_NAME(name); \
3434 .type C_SYMBOL_NAME(name),@function; \
35 .align ALIGNARG(2); \
35 .align ALIGNARG(4); \
3636 C_LABEL(name) \
3737 cfi_startproc; \
3838 CALL_MCOUNT
lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h+1-1
......@@ -32,7 +32,7 @@
3232#define ENTRY(name) \
3333 .globl C_SYMBOL_NAME(name); \
3434 .type C_SYMBOL_NAME(name),@function; \
35 .align ALIGNARG(2); \
35 .align ALIGNARG(4); \
3636 C_LABEL(name) \
3737 cfi_startproc; \
3838 CALL_MCOUNT
lib/libc/glibc/sysdeps/unix/alpha/sysdep.h+1-1
......@@ -200,7 +200,7 @@ __LABEL(name) \
200200 no matter what the "real" sign of the 32-bit type. We want to
201201 preserve that when filling in values for the kernel. */
202202#define syscall_promote(arg) \
203 (sizeof(arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
203 (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
204204
205205/* Make sure and "use" the variable that we're not returning,
206206 in order to suppress unused variable warnings. */
lib/libc/glibc/sysdeps/unix/sysdep.h+1-1
......@@ -16,7 +16,7 @@
1616 <http://www.gnu.org/licenses/>. */
1717
1818#include <sysdeps/generic/sysdep.h>
19
19#include <single-thread.h>
2020#include <sys/syscall.h>
2121#define HAVE_SYSCALLS
2222
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h+3-3
......@@ -255,9 +255,9 @@
255255#endif /* __ASSEMBLER__ */
256256
257257/* Pointer mangling is supported for AArch64. */
258#if (IS_IN (rtld) || \
259 (!defined SHARED && (IS_IN (libc) \
260 || IS_IN (libpthread))))
258#if (IS_IN (rtld) \
259 || (!defined SHARED && (IS_IN (libc) \
260 || IS_IN (libpthread))))
261261# ifdef __ASSEMBLER__
262262/* Note, dst, src, guard, and tmp are all register numbers rather than
263263 register names so they will work with both ILP32 and LP64. */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h+9-6
......@@ -22,12 +22,16 @@
2222
2323#include_next <kernel-features.h>
2424
25/* There never has been support for fstat64. */
26#undef __ASSUME_STATFS64
27#define __ASSUME_STATFS64 0
25/* Support for statfs64 was added in 5.1. */
26#if __LINUX_KERNEL_VERSION < 0x050100
27# undef __ASSUME_STATFS64
28# define __ASSUME_STATFS64 0
29#endif
2830
29/* Alpha defines SysV ipc shmat syscall with a different name. */
30#define __NR_shmat __NR_osf_shmat
31/* Alpha used to define SysV ipc shmat syscall with a different name. */
32#ifndef __NR_shmat
33# define __NR_shmat __NR_osf_shmat
34#endif
3135
3236#define __ASSUME_RECV_SYSCALL 1
3337#define __ASSUME_SEND_SYSCALL 1
......@@ -45,7 +49,6 @@
4549/* Support for copy_file_range, statx was added in kernel 4.13. */
4650#if __LINUX_KERNEL_VERSION < 0x040D00
4751# undef __ASSUME_MLOCK2
48# undef __ASSUME_COPY_FILE_RANGE
4952# undef __ASSUME_STATX
5053#endif
5154
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h+3-1
......@@ -51,7 +51,9 @@
5151 * Some syscalls no Linux program should know about:
5252 */
5353#define __NR_osf_sigprocmask 48
54#define __NR_osf_shmat 209
54#ifndef __NR_osf_shmat
55# define __NR_osf_shmat 209
56#endif
5557#define __NR_osf_getsysinfo 256
5658#define __NR_osf_setsysinfo 257
5759
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h-1
......@@ -45,7 +45,6 @@
4545 present in 32-bit kernels from 4.4 and 4.5 respectively. */
4646#if __LINUX_KERNEL_VERSION < 0x040700
4747# undef __ASSUME_MLOCK2
48# undef __ASSUME_COPY_FILE_RANGE
4948#endif
5049
5150#undef __ASSUME_CLONE_DEFAULT
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h+2-2
......@@ -104,7 +104,7 @@ struct timex
104104#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
105105
106106/* Read-only bits */
107#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
108 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
107#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER \
108 | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
109109
110110#endif /* bits/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h+36
......@@ -746,6 +746,13 @@ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
746746 __abstime) __THROWNL __nonnull ((1, 2));
747747#endif
748748
749#ifdef __USE_GNU
750extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
751 clockid_t __clockid,
752 const struct timespec *__restrict
753 __abstime) __THROWNL __nonnull ((1, 3));
754#endif
755
749756/* Unlock a mutex. */
750757extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
751758 __THROWNL __nonnull ((1));
......@@ -885,6 +892,13 @@ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
885892 __abstime) __THROWNL __nonnull ((1, 2));
886893# endif
887894
895# ifdef __USE_GNU
896extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
897 clockid_t __clockid,
898 const struct timespec *__restrict
899 __abstime) __THROWNL __nonnull ((1, 3));
900# endif
901
888902/* Acquire write lock for RWLOCK. */
889903extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
890904 __THROWNL __nonnull ((1));
......@@ -900,6 +914,13 @@ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
900914 __abstime) __THROWNL __nonnull ((1, 2));
901915# endif
902916
917# ifdef __USE_GNU
918extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
919 clockid_t __clockid,
920 const struct timespec *__restrict
921 __abstime) __THROWNL __nonnull ((1, 3));
922# endif
923
903924/* Unlock RWLOCK. */
904925extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
905926 __THROWNL __nonnull ((1));
......@@ -979,6 +1000,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
9791000 const struct timespec *__restrict __abstime)
9801001 __nonnull ((1, 2, 3));
9811002
1003# ifdef __USE_GNU
1004/* Wait for condition variable COND to be signaled or broadcast until
1005 ABSTIME measured by the specified clock. MUTEX is assumed to be
1006 locked before. CLOCK is the clock to use. ABSTIME is an absolute
1007 time specification against CLOCK's epoch.
1008
1009 This function is a cancellation point and therefore not marked with
1010 __THROW. */
1011extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
1012 pthread_mutex_t *__restrict __mutex,
1013 __clockid_t __clock_id,
1014 const struct timespec *__restrict __abstime)
1015 __nonnull ((1, 2, 4));
1016# endif
1017
9821018/* Functions for handling condition variable attributes. */
9831019
9841020/* Initialize condition variable attribute ATTR. */
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h+4-2
......@@ -26,8 +26,10 @@
2626#define __ASSUME_SEND_SYSCALL 1
2727#define __ASSUME_ACCEPT4_SYSCALL 1
2828
29/* No statx system call on ia64 yet. */
30#undef __ASSUME_STATX
29/* Support for statx was added in 5.1. */
30#if __LINUX_KERNEL_VERSION < 0x050100
31# undef __ASSUME_STATX
32#endif
3133
3234#undef __ASSUME_CLONE_DEFAULT
3335#define __ASSUME_CLONE2
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h-7
......@@ -57,9 +57,6 @@
5757 2.6.27. */
5858#define __ASSUME_IN_NONBLOCK 1
5959
60/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
61#define __ASSUME_FUTEX_CLOCK_REALTIME 1
62
6360/* Support for preadv and pwritev was added in 2.6.30. */
6461#define __ASSUME_PREADV 1
6562#define __ASSUME_PWRITEV 1
......@@ -103,10 +100,6 @@
103100# define __ASSUME_MLOCK2 1
104101#endif
105102
106#if __LINUX_KERNEL_VERSION >= 0x040500
107# define __ASSUME_COPY_FILE_RANGE 1
108#endif
109
110103/* Support for statx was added in kernel 4.11. */
111104#if __LINUX_KERNEL_VERSION >= 0x040B00
112105# define __ASSUME_STATX 1
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h-5
......@@ -60,11 +60,6 @@
6060# undef __ASSUME_MLOCK2
6161#endif
6262
63/* Support for the copy_file_range syscall was added in 4.10. */
64#if __LINUX_KERNEL_VERSION < 0x040A00
65# undef __ASSUME_COPY_FILE_RANGE
66#endif
67
6863/* Support for statx was added in kernel 4.12. */
6964#if __LINUX_KERNEL_VERSION < 0X040C00
7065# undef __ASSUME_STATX
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h+3-3
......@@ -233,9 +233,9 @@
233233
234234#undef INTERNAL_SYSCALL
235235#define INTERNAL_SYSCALL(name, err, nr, args...) \
236 (((__NR_##name) < 256) ? \
237 INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \
238 INTERNAL_SYSCALL_SVC0(name, err,nr, args))
236 (((__NR_##name) < 256) \
237 ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
238 : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
239239
240240#undef INTERNAL_SYSCALL_ERROR_P
241241#define INTERNAL_SYSCALL_ERROR_P(val, err) \
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h+3-3
......@@ -239,9 +239,9 @@
239239
240240#undef INTERNAL_SYSCALL
241241#define INTERNAL_SYSCALL(name, err, nr, args...) \
242 (((__NR_##name) < 256) ? \
243 INTERNAL_SYSCALL_DIRECT(name, err, nr, args) : \
244 INTERNAL_SYSCALL_SVC0(name, err,nr, args))
242 (((__NR_##name) < 256) \
243 ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
244 : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
245245
246246#undef INTERNAL_SYSCALL_ERROR_P
247247#define INTERNAL_SYSCALL_ERROR_P(val, err) \
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h+4-3
......@@ -49,10 +49,11 @@
4949# undef __ASSUME_RENAMEAT2
5050# undef __ASSUME_EXECVEAT
5151# undef __ASSUME_MLOCK2
52# undef __ASSUME_COPY_FILE_RANGE
5352#endif
5453
55/* sh does not support the statx system call. */
56#undef __ASSUME_STATX
54/* sh does not support the statx system call before 5.1. */
55#if __LINUX_KERNEL_VERSION < 0x050100
56# undef __ASSUME_STATX
57#endif
5758
5859#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h created+62
......@@ -0,0 +1,62 @@
1/* Single thread optimization, Linux version.
2 Copyright (C) 2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _SINGLE_THREAD_H
20#define _SINGLE_THREAD_H
21
22/* The default way to check if the process is single thread is by using the
23 pthread_t 'multiple_threads' field. However, for some architectures it is
24 faster to either use an extra field on TCB or global variables (the TCB
25 field is also used on x86 for some single-thread atomic optimizations).
26
27 The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
28 check to use global variables instead of the pthread_t field. */
29
30#ifdef SINGLE_THREAD_BY_GLOBAL
31# if IS_IN (libc)
32extern int __libc_multiple_threads;
33# define SINGLE_THREAD_P \
34 __glibc_likely (__libc_multiple_threads == 0)
35# elif IS_IN (libpthread)
36extern int __pthread_multiple_threads;
37# define SINGLE_THREAD_P \
38 __glibc_likely (__pthread_multiple_threads == 0)
39# elif IS_IN (librt)
40# define SINGLE_THREAD_P \
41 __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
42 header.multiple_threads) == 0)
43# else
44/* For rtld, et cetera. */
45# define SINGLE_THREAD_P (1)
46# endif
47#else /* SINGLE_THREAD_BY_GLOBAL */
48# if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt)
49# define SINGLE_THREAD_P \
50 __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
51 header.multiple_threads) == 0)
52# else
53/* For rtld, et cetera. */
54# define SINGLE_THREAD_P (1)
55# endif
56#endif /* SINGLE_THREAD_BY_GLOBAL */
57
58#define RTLD_SINGLE_THREAD_P \
59 __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
60 header.multiple_threads) == 0)
61
62#endif /* _SINGLE_THREAD_H */