Commit 19ca2415f2
Changed files (292)
lib
libc
glibc
bits
elf
include
io
locale
bits
signal
sysdeps
aarch64
alpha
generic
hppa
m68k
coldfire
m680x0
nptl
mach
microblaze
mips
nptl
powerpc
nptl
pthread
riscv
nptl
s390
nptl
sh
sparc
unix
alpha
arm
i386
powerpc
sh
sysv
linux
aarch64
generic
include
sys
m68k
microblaze
mips
powerpc
s390
sparc
x86
x86_64
x86_64
wordsize-32
x86
time
src
test
tools
lib/libc/glibc/bits/types/struct_sched_param.h
@@ -1,5 +1,5 @@
/* Sched parameter structure. Generic version.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
lib/libc/glibc/bits/byteswap.h
@@ -1,5 +1,5 @@
/* Macros and inline functions to swap the order of bytes in integer values.
- Copyright (C) 1997-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 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
lib/libc/glibc/bits/floatn-common.h
@@ -1,6 +1,6 @@
/* Macros to control TS 18661-3 glibc features where the same
definitions are appropriate for all platforms.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/bits/libc-header-start.h
@@ -1,5 +1,5 @@
/* Handle feature test macros at the start of a header.
- Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ Copyright (C) 2016-2021 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
@@ -44,8 +44,26 @@
/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
macro. Most but not all symbols enabled by that macro in TS
- 18661-1 are enabled unconditionally in C2X; the symbols in Annex F
- still require that macro in C2X. */
+ 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
+ Annex F still require a new feature test macro
+ __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define
+ __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
+ 18661-1 are not included in C2X (and thus should depend on
+ __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are
+ enabled).
+
+ __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
+ 18661-1 not included in C2X.
+
+ __GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS
+ 18661-1 that are also included in C2X (with no feature test macro
+ required in C2X).
+
+ __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
+ that are included in C2X but conditional on
+ __STDC_WANT_IEC_60559_EXT__. (There are currently no features
+ conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
+ 18661-1.) */
#undef __GLIBC_USE_IEC_60559_BFP_EXT
#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
# define __GLIBC_USE_IEC_60559_BFP_EXT 1
@@ -58,6 +76,12 @@
#else
# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
#endif
+#undef __GLIBC_USE_IEC_60559_EXT
+#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
+# define __GLIBC_USE_IEC_60559_EXT 1
+#else
+# define __GLIBC_USE_IEC_60559_EXT 0
+#endif
/* ISO/IEC TS 18661-4:2015 defines the
__STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
lib/libc/glibc/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type.
- Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ Copyright (C) 2016-2021 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
@@ -37,4 +37,17 @@
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
#endif
-#define __LONG_DOUBLE_USES_FLOAT128 0
+
+/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
+ choice of the underlying ABI of long double. It will always assume
+ a constant value for each translation unit.
+
+ If the value is non-zero, any API which is parameterized by the long
+ double type (i.e the scanf/printf family of functions or the explicitly
+ parameterized math.h functions) will be redirected to a compatible
+ implementation using _Float128 ABI via symbols suffixed with ieee128.
+
+ The mechanism this macro uses to acquire may be a function
+ of architecture, or target specific options used to invoke the
+ compiler. */
+#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0
lib/libc/glibc/bits/select.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 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
lib/libc/glibc/bits/signum-generic.h
@@ -1,5 +1,5 @@
/* Signal number constants. Generic template.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 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
@@ -57,31 +57,9 @@
#define SIGQUIT 3 /* Quit. */
#define SIGTRAP 5 /* Trace/breakpoint trap. */
#define SIGKILL 9 /* Killed. */
-#define SIGBUS 10 /* Bus error. */
-#define SIGSYS 12 /* Bad system call. */
#define SIGPIPE 13 /* Broken pipe. */
#define SIGALRM 14 /* Alarm clock. */
-/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */
-#define SIGURG 16 /* Urgent data is available at a socket. */
-#define SIGSTOP 17 /* Stop, unblockable. */
-#define SIGTSTP 18 /* Keyboard stop. */
-#define SIGCONT 19 /* Continue. */
-#define SIGCHLD 20 /* Child terminated or stopped. */
-#define SIGTTIN 21 /* Background read from control terminal. */
-#define SIGTTOU 22 /* Background write to control terminal. */
-#define SIGPOLL 23 /* Pollable event occurred (System V). */
-#define SIGXCPU 24 /* CPU time limit exceeded. */
-#define SIGXFSZ 25 /* File size limit exceeded. */
-#define SIGVTALRM 26 /* Virtual timer expired. */
-#define SIGPROF 27 /* Profiling timer expired. */
-#define SIGUSR1 30 /* User-defined signal 1. */
-#define SIGUSR2 31 /* User-defined signal 2. */
-
-/* Nonstandard signals found in all modern POSIX systems
- (including both BSD and Linux). */
-#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
-
/* Archaic names for compatibility. */
#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */
@@ -93,8 +71,9 @@
but some real-time signals may be used internally by glibc. Do not
use these constants in application code; use SIGRTMIN and SIGRTMAX
(defined in signal.h) instead. */
-#define __SIGRTMIN 32
-#define __SIGRTMAX __SIGRTMIN
+
+/* Include system specific bits. */
+#include <bits/signum-arch.h>
/* Biggest signal number + 1 (including real-time signals). */
#define _NSIG (__SIGRTMAX + 1)
lib/libc/glibc/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
lib/libc/glibc/bits/stdint-intn.h
@@ -1,5 +1,5 @@
/* Define intN_t types.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/bits/stdlib-bsearch.h
@@ -1,5 +1,5 @@
/* Perform binary search - inline version.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 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
lib/libc/glibc/bits/time64.h
@@ -1,5 +1,5 @@
/* bits/time64.h -- underlying types for __time64_t. Generic version.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 2018-2021 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
lib/libc/glibc/bits/timesize.h
@@ -1,5 +1,5 @@
/* Bit size of the time_t type at glibc build time, general case.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 2018-2021 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
lib/libc/glibc/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Generic version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -50,6 +50,7 @@
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -75,10 +76,16 @@
/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 1
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
/* Number of descriptors that can fit in an `fd_set'. */
lib/libc/glibc/bits/uintn-identity.h
@@ -1,5 +1,5 @@
/* Inline functions to return unsigned integer values unchanged.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/bits/waitflags.h
@@ -1,5 +1,5 @@
/* Definitions of flag bits for `waitpid' et al.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 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
@@ -24,3 +24,11 @@
/* Bits in the third argument to `waitpid'. */
#define WNOHANG 1 /* Don't block waiting. */
#define WUNTRACED 2 /* Report status of stopped children. */
+
+/* Bits in the fourth argument to `waitid'. */
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
+# define WSTOPPED WUNTRACED /* Report stopped child. */
+# define WCONTINUED 4 /* Report continued child. */
+# define WNOWAIT 8 /* Don't reap, just poll status. */
+# define WEXITED 16 /* Report dead child. */
+#endif
lib/libc/glibc/bits/waitstatus.h
@@ -1,5 +1,5 @@
/* Definitions of status bits for `wait' et al.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 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
lib/libc/glibc/csu/elf-init.c
@@ -1,106 +0,0 @@
-/* Startup support for ELF initializers/finalizers in the main executable.
- Copyright (C) 2002-2020 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.
-
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#include <stddef.h>
-
-
-/* These magic symbols are provided by the linker. */
-extern void (*__preinit_array_start []) (int, char **, char **)
- attribute_hidden;
-extern void (*__preinit_array_end []) (int, char **, char **)
- attribute_hidden;
-extern void (*__init_array_start []) (int, char **, char **)
- attribute_hidden;
-extern void (*__init_array_end []) (int, char **, char **)
- attribute_hidden;
-extern void (*__fini_array_start []) (void) attribute_hidden;
-extern void (*__fini_array_end []) (void) attribute_hidden;
-
-
-#ifndef NO_INITFINI
-/* These function symbols are provided for the .init/.fini section entry
- points automagically by the linker. */
-extern void _init (void);
-extern void _fini (void);
-#endif
-
-
-/* These functions are passed to __libc_start_main by the startup code.
- These get statically linked into each program. For dynamically linked
- programs, this module will come from libc_nonshared.a and differs from
- the libc.a module in that it doesn't call the preinit array. */
-
-
-void
-__libc_csu_init (int argc, char **argv, char **envp)
-{
- /* For dynamically linked executables the preinit array is executed by
- the dynamic linker (before initializing any shared object). */
-
-#ifndef LIBC_NONSHARED
- /* For static executables, preinit happens right before init. */
- {
- const size_t size = __preinit_array_end - __preinit_array_start;
- size_t i;
- for (i = 0; i < size; i++)
- (*__preinit_array_start [i]) (argc, argv, envp);
- }
-#endif
-
-#ifndef NO_INITFINI
- _init ();
-#endif
-
- const size_t size = __init_array_end - __init_array_start;
- for (size_t i = 0; i < size; i++)
- (*__init_array_start [i]) (argc, argv, envp);
-}
-
-/* This function should not be used anymore. We run the executable's
- destructor now just like any other. We cannot remove the function,
- though. */
-void
-__libc_csu_fini (void)
-{
-#ifndef LIBC_NONSHARED
- size_t i = __fini_array_end - __fini_array_start;
- while (i-- > 0)
- (*__fini_array_start [i]) ();
-
-# ifndef NO_INITFINI
- _fini ();
-# endif
-#endif
-}
lib/libc/glibc/sysdeps/mach/hurd/kernel-features.h โ lib/libc/glibc/csu/errno.c
@@ -1,5 +1,5 @@
-/* Set flags signalling availability of certain operating system features.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+/* Definition of `errno' variable. Canonical version.
+ Copyright (C) 2002-2021 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
@@ -16,6 +16,20 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* This file can define __ASSUME_* macros checked by certain source files.
- Almost none of these are used outside of sysdeps/unix/sysv/linux code.
- But those referring to POSIX-level features like O_* flags can be. */
+#include <errno.h>
+#include <tls.h>
+#include <dl-sysdep.h>
+#undef errno
+
+#if RTLD_PRIVATE_ERRNO
+
+/* Code compiled for rtld refers only to this name. */
+int rtld_errno attribute_hidden;
+
+#else
+
+__thread int errno;
+extern __thread int __libc_errno __attribute__ ((alias ("errno")))
+ attribute_hidden;
+
+#endif
lib/libc/glibc/debug/stack_chk_fail_local.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2021 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
lib/libc/glibc/elf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -19,10 +19,6 @@
#ifndef _ELF_H
#define _ELF_H 1
-#include <features.h>
-
-__BEGIN_DECLS
-
/* Standard ELF types. */
#include <stdint.h>
@@ -322,7 +318,7 @@ typedef struct
/* reserved 184 */
#define EM_AVR32 185 /* Amtel 32-bit microprocessor */
#define EM_STM8 186 /* STMicroelectronics STM8 */
-#define EM_TILE64 187 /* Tileta TILE64 */
+#define EM_TILE64 187 /* Tilera TILE64 */
#define EM_TILEPRO 188 /* Tilera TILEPro */
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
#define EM_CUDA 190 /* NVIDIA CUDA */
@@ -330,7 +326,7 @@ typedef struct
#define EM_CLOUDSHIELD 192 /* CloudShield */
#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */
#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */
-#define EM_ARC_COMPACT2 195 /* Synopsys ARCompact V2 */
+#define EM_ARCV2 195 /* Synopsys ARCv2 ISA. */
#define EM_OPEN8 196 /* Open8 RISC */
#define EM_RL78 197 /* Renesas RL78 */
#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */
@@ -340,7 +336,8 @@ typedef struct
#define EM_BA2 202 /* Beyond BA2 */
#define EM_XCORE 203 /* XMOS xCORE */
#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */
- /* reserved 205-209 */
+#define EM_INTELGT 205 /* Intel Graphics Technology */
+ /* reserved 206-209 */
#define EM_KM32 210 /* KM211 KM32 */
#define EM_KMX32 211 /* KM211 KMX32 */
#define EM_EMX16 212 /* KM211 KMX16 */
@@ -445,7 +442,7 @@ typedef struct
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
-#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
+#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
#define SHT_NUM 19 /* Number of defined types. */
#define SHT_LOOS 0x60000000 /* Start OS-specific. */
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
@@ -482,6 +479,7 @@ typedef struct
#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
+#define SHF_GNU_RETAIN (1 << 21) /* Not to be GCed by linker. */
#define SHF_ORDERED (1 << 30) /* Special ordering requirement
(Solaris). */
#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
@@ -721,6 +719,7 @@ typedef struct
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
+#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
@@ -815,6 +814,10 @@ typedef struct
address keys. */
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
generic key. */
+#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* AArch64 tagged address
+ control. */
+#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication
+ enabled keys. */
#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. */
@@ -1049,7 +1052,7 @@ typedef struct
#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
-/* Auxialiary version information. */
+/* Auxiliary version information. */
typedef struct
{
@@ -1318,33 +1321,34 @@ typedef struct
/* Application-specific semantics, hi */
#define GNU_PROPERTY_HIUSER 0xffffffff
+/* AArch64 specific GNU properties. */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
+
/* The x86 instruction sets indicated by the corresponding bits are
used in program. Their support in the hardware is optional. */
-#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
/* The x86 instruction sets indicated by the corresponding bits are
used in program and they must be supported by the hardware. */
-#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
/* X86 processor-specific features used in program. */
#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
-#define GNU_PROPERTY_X86_ISA_1_486 (1U << 0)
-#define GNU_PROPERTY_X86_ISA_1_586 (1U << 1)
-#define GNU_PROPERTY_X86_ISA_1_686 (1U << 2)
-#define GNU_PROPERTY_X86_ISA_1_SSE (1U << 3)
-#define GNU_PROPERTY_X86_ISA_1_SSE2 (1U << 4)
-#define GNU_PROPERTY_X86_ISA_1_SSE3 (1U << 5)
-#define GNU_PROPERTY_X86_ISA_1_SSSE3 (1U << 6)
-#define GNU_PROPERTY_X86_ISA_1_SSE4_1 (1U << 7)
-#define GNU_PROPERTY_X86_ISA_1_SSE4_2 (1U << 8)
-#define GNU_PROPERTY_X86_ISA_1_AVX (1U << 9)
-#define GNU_PROPERTY_X86_ISA_1_AVX2 (1U << 10)
-#define GNU_PROPERTY_X86_ISA_1_AVX512F (1U << 11)
-#define GNU_PROPERTY_X86_ISA_1_AVX512CD (1U << 12)
-#define GNU_PROPERTY_X86_ISA_1_AVX512ER (1U << 13)
-#define GNU_PROPERTY_X86_ISA_1_AVX512PF (1U << 14)
-#define GNU_PROPERTY_X86_ISA_1_AVX512VL (1U << 15)
-#define GNU_PROPERTY_X86_ISA_1_AVX512DQ (1U << 16)
-#define GNU_PROPERTY_X86_ISA_1_AVX512BW (1U << 17)
+/* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld),
+ MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2. */
+#define GNU_PROPERTY_X86_ISA_1_BASELINE (1U << 0)
+/* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE,
+ CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3,
+ SSSE3, SSE4.1 and SSE4.2. */
+#define GNU_PROPERTY_X86_ISA_1_V2 (1U << 1)
+/* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1,
+ BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE. */
+#define GNU_PROPERTY_X86_ISA_1_V3 (1U << 2)
+/* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F,
+ AVX512BW, AVX512CD, AVX512DQ and AVX512VL. */
+#define GNU_PROPERTY_X86_ISA_1_V4 (1U << 3)
/* This indicates that all executable sections are compatible with
IBT. */
@@ -2136,9 +2140,9 @@ enum
#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
-/* Additional section indeces. */
+/* Additional section indices. */
-#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
+#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared
symbols in ANSI C. */
#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
@@ -2868,6 +2872,8 @@ enum
#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
/* AArch64 specific values for the Dyn d_tag field. */
+#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
+#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
#define DT_AARCH64_NUM 6
@@ -3946,8 +3952,9 @@ enum
#define R_RISCV_SET16 55
#define R_RISCV_SET32 56
#define R_RISCV_32_PCREL 57
+#define R_RISCV_IRELATIVE 58
-#define R_RISCV_NUM 58
+#define R_RISCV_NUM 59
/* BPF specific declarations. */
@@ -3964,7 +3971,7 @@ enum
#define R_METAG_RELBRANCH 4
#define R_METAG_GETSETOFF 5
-/* Backward compatability */
+/* Backward compatibility */
#define R_METAG_REG32OP1 6
#define R_METAG_REG32OP2 7
#define R_METAG_REG32OP3 8
@@ -4027,6 +4034,72 @@ enum
#define R_NDS32_TLS_TPOFF 102
#define R_NDS32_TLS_DESC 119
-__END_DECLS
+/* ARCompact/ARCv2 specific relocs. */
+#define R_ARC_NONE 0x0
+#define R_ARC_8 0x1
+#define R_ARC_16 0x2
+#define R_ARC_24 0x3
+#define R_ARC_32 0x4
+#define R_ARC_B26 0x5
+#define R_ARC_B22_PCREL 0x6
+#define R_ARC_H30 0x7
+#define R_ARC_N8 0x8
+#define R_ARC_N16 0x9
+#define R_ARC_N24 0xA
+#define R_ARC_N32 0xB
+#define R_ARC_SDA 0xC
+#define R_ARC_SECTOFF 0xD
+#define R_ARC_S21H_PCREL 0xE
+#define R_ARC_S21W_PCREL 0xF
+#define R_ARC_S25H_PCREL 0x10
+#define R_ARC_S25W_PCREL 0x11
+#define R_ARC_SDA32 0x12
+#define R_ARC_SDA_LDST 0x13
+#define R_ARC_SDA_LDST1 0x14
+#define R_ARC_SDA_LDST2 0x15
+#define R_ARC_SDA16_LD 0x16
+#define R_ARC_SDA16_LD1 0x17
+#define R_ARC_SDA16_LD2 0x18
+#define R_ARC_S13_PCREL 0x19
+#define R_ARC_W 0x1A
+#define R_ARC_32_ME 0x1B
+#define R_ARC_N32_ME 0x1C
+#define R_ARC_SECTOFF_ME 0x1D
+#define R_ARC_SDA32_ME 0x1E
+#define R_ARC_W_ME 0x1F
+#define R_ARC_H30_ME 0x20
+#define R_ARC_SECTOFF_U8 0x21
+#define R_ARC_SECTOFF_S9 0x22
+#define R_AC_SECTOFF_U8 0x23
+#define R_AC_SECTOFF_U8_1 0x24
+#define R_AC_SECTOFF_U8_2 0x25
+#define R_AC_SECTOFF_S9 0x26
+#define R_AC_SECTOFF_S9_1 0x27
+#define R_AC_SECTOFF_S9_2 0x28
+#define R_ARC_SECTOFF_ME_1 0x29
+#define R_ARC_SECTOFF_ME_2 0x2A
+#define R_ARC_SECTOFF_1 0x2B
+#define R_ARC_SECTOFF_2 0x2C
+#define R_ARC_PC32 0x32
+#define R_ARC_GOTPC32 0x33
+#define R_ARC_PLT32 0x34
+#define R_ARC_COPY 0x35
+#define R_ARC_GLOB_DAT 0x36
+#define R_ARC_JUMP_SLOT 0x37
+#define R_ARC_RELATIVE 0x38
+#define R_ARC_GOTOFF 0x39
+#define R_ARC_GOTPC 0x3A
+#define R_ARC_GOT32 0x3B
+
+#define R_ARC_TLS_DTPMOD 0x42
+#define R_ARC_TLS_DTPOFF 0x43
+#define R_ARC_TLS_TPOFF 0x44
+#define R_ARC_TLS_GD_GOT 0x45
+#define R_ARC_TLS_GD_LD 0x46
+#define R_ARC_TLS_GD_CALL 0x47
+#define R_ARC_TLS_IE_GOT 0x48
+#define R_ARC_TLS_DTPOFF_S9 0x4a
+#define R_ARC_TLS_LE_S9 0x4a
+#define R_ARC_TLS_LE_32 0x4b
#endif /* elf.h */
lib/libc/glibc/include/bits/cpu-set.h
@@ -1,1 +1,9 @@
+#ifndef _BITS_CPU_SET_H
#include <posix/bits/cpu-set.h>
+
+#ifndef _ISOMAC
+int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp);
+libc_hidden_proto (__sched_cpucount)
+#endif
+
+#endif /* _BITS_CPU_SET_H */
lib/libc/glibc/include/sys/cdefs.h
@@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
libc_hidden_proto (__chk_fail)
rtld_hidden_proto (__chk_fail)
+/* If we are using redirects internally to support long double,
+ we need to tweak some macros to ensure the PLT bypass tricks
+ continue to work in libc. */
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
+
+# undef __LDBL_REDIR_DECL
+# define __LDBL_REDIR_DECL(func) \
+ extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func));
+
+# undef libc_hidden_ldbl_proto
+# define libc_hidden_ldbl_proto(func, attrs...) \
+ extern __typeof(func) ___ieee128_ ## func; \
+ libc_hidden_proto (___ieee128_ ## func, ##attrs);
+
+# undef __LDBL_REDIR2_DECL
+# define __LDBL_REDIR2_DECL(func) \
+ extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func));
+
#endif
+#endif /* !defined _ISOMAC */
+
#endif
lib/libc/glibc/include/sys/select.h
@@ -3,6 +3,35 @@
#ifndef _ISOMAC
/* Now define the internal interfaces. */
+# if __TIMESIZE == 64
+# define __pselect64 __pselect
+# define __select64 __select
+#else
+# include <struct___timespec64.h>
+# include <struct___timeval64.h>
+
+extern int __pselect64 (int __nfds, fd_set *__readfds,
+ fd_set *__writefds, fd_set *__exceptfds,
+ const struct __timespec64 *__timeout,
+ const __sigset_t *__sigmask);
+libc_hidden_proto (__pselect64)
+
+extern int __pselect32 (int __nfds, fd_set *__readfds,
+ fd_set *__writefds, fd_set *__exceptfds,
+ const struct __timespec64 *__timeout,
+ const __sigset_t *__sigmask)
+ attribute_hidden;
+extern int __select32 (int __nfds, fd_set *__readfds,
+ fd_set *__writefds, fd_set *__exceptfds,
+ const struct __timespec64 *ts64,
+ struct __timeval64 *timeout)
+ attribute_hidden;
+
+extern int __select64 (int __nfds, fd_set *__readfds,
+ fd_set *__writefds, fd_set *__exceptfds,
+ struct __timeval64 *__timeout);
+libc_hidden_proto (__select64)
+#endif
extern int __pselect (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
const struct timespec *__timeout,
lib/libc/glibc/include/sys/stat.h
@@ -2,63 +2,97 @@
#include <io/sys/stat.h>
#ifndef _ISOMAC
+# include <xstatver.h>
+# include <struct___timespec64.h>
+# include <struct_stat_time64.h>
+# include <stdbool.h>
+
+static inline bool
+in_ino_t_range (__ino64_t v)
+{
+ __ino_t s = v;
+ return s == v;
+}
+
+static inline bool
+in_off_t_range (__off64_t v)
+{
+ __off_t s = v;
+ return s == v;
+}
+
+static inline bool
+in_blkcnt_t_range (__blkcnt64_t v)
+{
+ __blkcnt_t s = v;
+ return s == v;
+}
+
/* Now define the internal interfaces. */
extern int __stat (const char *__file, struct stat *__buf);
+extern int __stat64 (const char *__file, struct stat64 *__buf);
extern int __fstat (int __fd, struct stat *__buf);
+extern int __fstat64 (int __fd, struct stat64 *__buf);
extern int __lstat (const char *__file, struct stat *__buf);
+extern int __lstat64 (const char *__file, struct stat64 *__buf);
+extern int __fstatat (int dirfd, const char *pathname, struct stat *buf,
+ int flags);
+extern int __fstatat64 (int dirfd, const char *pathname, struct stat64 *buf,
+ int flags);
+# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
+hidden_proto (__stat64)
+hidden_proto (__fstat64)
+hidden_proto (__lstat64)
+hidden_proto (__fstatat64)
+# endif
+
+# if __TIMESIZE == 64 || defined NO_RTLD_HIDDEN
+# define __stat64_time64 __stat64
+# define __fstat64_time64 __fstat64
+# define __lstat64_time64 __lstat64
+# define __fstatat64_time64 __fstatat64
+# else
+extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf);
+hidden_proto (__stat64_time64);
+extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf);
+hidden_proto (__lstat64_time64);
+extern int __fstat64_time64 (int fd, struct __stat64_t64 *buf);
+hidden_proto (__fstat64_time64);
+extern int __fstatat64_time64 (int dirfd, const char *pathname,
+ struct __stat64_t64 *buf, int flags);
+hidden_proto (__fstatat64_time64);
+# endif
+
extern int __chmod (const char *__file, __mode_t __mode);
libc_hidden_proto (__chmod)
extern int __fchmod (int __fd, __mode_t __mode);
+libc_hidden_proto (fchmodat)
extern __mode_t __umask (__mode_t __mask);
extern int __mkdir (const char *__path, __mode_t __mode);
libc_hidden_proto (__mkdir)
+
+extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev);
+libc_hidden_proto (__mknodat);
extern int __mknod (const char *__path,
__mode_t __mode, __dev_t __dev);
-#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
-hidden_proto (__fxstat)
-hidden_proto (__fxstat64)
-hidden_proto (__lxstat)
-hidden_proto (__lxstat64)
-hidden_proto (__xstat)
-hidden_proto (__xstat64)
-#endif
-extern __inline__ int __stat (const char *__path, struct stat *__statbuf)
-{
- return __xstat (_STAT_VER, __path, __statbuf);
-}
-libc_hidden_proto (__xmknod)
-extern __inline__ int __mknod (const char *__path, __mode_t __mode,
- __dev_t __dev)
-{
- return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
-}
-libc_hidden_proto (__xmknodat)
+libc_hidden_proto (__mknod);
-libc_hidden_proto (__fxstatat)
-libc_hidden_proto (__fxstatat64)
+extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
+ __dev_t *__dev);
+extern int __xmknodat (int __ver, int __fd, const char *__path,
+ __mode_t __mode, __dev_t *__dev);
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
-extern __typeof (__fxstatat64) __fxstatat64 attribute_hidden;
-# endif
+int __fxstat (int __ver, int __fildes, struct stat *__stat_buf);
+int __xstat (int __ver, const char *__filename,
+ struct stat *__stat_buf);
+int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf);
+int __fxstatat (int __ver, int __fildes, const char *__filename,
+ struct stat *__stat_buf, int __flag);
+int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf);
+int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
+int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
+int __fxstatat64 (int ver, int __fildes, const char *__filename,
+ struct stat64 *__stat_buf, int __flag);
-/* The `stat', `fstat', `lstat' functions have to be handled special since
- even while not compiling the library with optimization calls to these
- functions in the shared library must reference the `xstat' etc functions.
- We have to use macros but we cannot define them in the normal headers
- since on user level we must use real functions. */
-#define stat(fname, buf) __xstat (_STAT_VER, fname, buf)
-#define lstat(fname, buf) __lxstat (_STAT_VER, fname, buf)
-#define __lstat(fname, buf) __lxstat (_STAT_VER, fname, buf)
-#define lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
-#define __lstat64(fname, buf) __lxstat64 (_STAT_VER, fname, buf)
-#define stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
-#define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
-#define __fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf)
-#define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
-#define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf)
-#define __fstatat(dfd, fname, buf, flag) \
- __fxstatat (_STAT_VER, dfd, fname, buf, flag)
-#define __fstatat64(dfd, fname, buf, flag) \
- __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
#endif
#endif
lib/libc/glibc/include/errno.h
@@ -0,0 +1,45 @@
+#ifndef _ERRNO_H
+#include <stdlib/errno.h>
+#if !defined _ISOMAC && !defined __ASSEMBLER__
+
+# if IS_IN (rtld)
+# include <dl-sysdep.h>
+# ifndef RTLD_PRIVATE_ERRNO
+# error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
+# endif
+# else
+# define RTLD_PRIVATE_ERRNO 0
+# endif
+
+# if RTLD_PRIVATE_ERRNO
+/* The dynamic linker uses its own private errno variable.
+ All access to errno inside the dynamic linker is serialized,
+ so a single (hidden) global variable is all it needs. */
+
+# undef errno
+# define errno rtld_errno
+extern int rtld_errno attribute_hidden;
+
+# elif IS_IN_LIB && !IS_IN (rtld)
+
+# undef errno
+# if IS_IN (libc)
+# define errno __libc_errno
+# else
+# define errno errno /* For #ifndef errno tests. */
+# endif
+extern __thread int errno attribute_tls_model_ie;
+
+# endif /* IS_IN_LIB */
+
+# define __set_errno(val) (errno = (val))
+
+extern int *__errno_location (void) __THROW __attribute_const__
+# if RTLD_PRIVATE_ERRNO
+ attribute_hidden
+# endif
+;
+libc_hidden_proto (__errno_location)
+
+#endif /* !_ISOMAC && !__ASSEMBLER__ */
+#endif /* !_ERRNO_H */
lib/libc/glibc/include/features.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
@@ -33,6 +33,8 @@
Extensions to ISO C11 from TS 18661-4:2015.
__STDC_WANT_IEC_60559_TYPES_EXT__
Extensions to ISO C11 from TS 18661-3:2015.
+ __STDC_WANT_IEC_60559_EXT__
+ ISO C2X interfaces defined only in Annex F.
_POSIX_SOURCE IEEE Std 1003.1.
_POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
@@ -48,6 +50,8 @@
_LARGEFILE64_SOURCE Additional functionality from LFS for large files.
_FILE_OFFSET_BITS=N Select default filesystem interface.
_ATFILE_SOURCE Additional *at interfaces.
+ _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant)
+ MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
_GNU_SOURCE All of the above, plus GNU extensions.
_DEFAULT_SOURCE The default set of features (taking precedence over
__STRICT_ANSI__).
@@ -94,6 +98,8 @@
__USE_FILE_OFFSET64 Define 64bit interface as default.
__USE_MISC Define things from 4.3BSD or System V Unix.
__USE_ATFILE Define *at interfaces and AT_* constants for them.
+ __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant)
+ MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN.
__USE_GNU Define GNU extensions.
__USE_FORTIFY_LEVEL Additional security measures used, according to level.
@@ -137,6 +143,7 @@
#undef __USE_FILE_OFFSET64
#undef __USE_MISC
#undef __USE_ATFILE
+#undef __USE_DYNAMIC_STACK_SIZE
#undef __USE_GNU
#undef __USE_FORTIFY_LEVEL
#undef __KERNEL_STRICT_NAMES
@@ -213,6 +220,8 @@
# define _DEFAULT_SOURCE 1
# undef _ATFILE_SOURCE
# define _ATFILE_SOURCE 1
+# undef _DYNAMIC_STACK_SIZE_SOURCE
+# define _DYNAMIC_STACK_SIZE_SOURCE 1
#endif
/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
@@ -380,6 +389,8 @@
# define __USE_FILE_OFFSET64 1
#endif
+#include <features-time64.h>
+
#if defined _DEFAULT_SOURCE
# define __USE_MISC 1
#endif
@@ -388,6 +399,10 @@
# define __USE_ATFILE 1
#endif
+#ifdef _DYNAMIC_STACK_SIZE_SOURCE
+# define __USE_DYNAMIC_STACK_SIZE 1
+#endif
+
#ifdef _GNU_SOURCE
# define __USE_GNU 1
#endif
@@ -397,7 +412,15 @@
# warning _FORTIFY_SOURCE requires compiling with optimization (-O)
# elif !__GNUC_PREREQ (4, 1)
# warning _FORTIFY_SOURCE requires GCC 4.1 or later
+# elif _FORTIFY_SOURCE > 2 && __glibc_clang_prereq (9, 0)
+# if _FORTIFY_SOURCE > 3
+# warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform
+# endif
+# define __USE_FORTIFY_LEVEL 3
# elif _FORTIFY_SOURCE > 1
+# if _FORTIFY_SOURCE > 2
+# warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
+# endif
# define __USE_FORTIFY_LEVEL 2
# else
# define __USE_FORTIFY_LEVEL 1
@@ -454,7 +477,7 @@
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
#define __GLIBC__ 2
-#define __GLIBC_MINOR__ 31
+#define __GLIBC_MINOR__ 34
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
lib/libc/glibc/include/libc-pointer-arith.h
@@ -1,5 +1,5 @@
/* Helper macros for pointer arithmetic.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
@@ -37,6 +37,9 @@
/* Cast an integer or a pointer VAL to integer with proper type. */
# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
+/* Cast an integer VAL to void * pointer. */
+# define cast_to_pointer(val) ((void *) (uintptr_t) (val))
+
/* Align a value by rounding down to closest size.
e.g. Using size of 4096, we get this behavior:
{4095, 4096, 4097} = {0, 4096, 4096}. */
lib/libc/glibc/include/libc-symbols.h
@@ -1,6 +1,6 @@
/* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -84,6 +84,9 @@
#include <config.h>
+/* Obtain the definition of symbol_version_reference. */
+#include <libc-symver.h>
+
/* When PIC is defined and SHARED isn't defined, we are building PIE
by default. */
#if defined PIC && !defined SHARED
@@ -307,7 +310,7 @@ for linking")
/* Resource freeing functions from libc.so go in this section. */
#define __libc_freeres_fn_section \
- __attribute__ ((section ("__libc_freeres_fn")))
+ __attribute__ ((__used__, section ("__libc_freeres_fn")))
/* Resource freeing functions for libc.so. */
#define libc_freeres_fn(name) \
@@ -349,6 +352,12 @@ for linking")
*/
+#ifdef HAVE_GNU_RETAIN
+# define attribute_used_retain __attribute__ ((__used__, __retain__))
+#else
+# define attribute_used_retain __attribute__ ((__used__))
+#endif
+
/* Symbol set support macros. */
/* Make SYMBOL, which is in the text segment, an element of SET. */
@@ -364,12 +373,12 @@ for linking")
/* When building a shared library, make the set section writable,
because it will need to be relocated at run time anyway. */
# define _elf_set_element(set, symbol) \
- static const void *__elf_set_##set##_element_##symbol##__ \
- __attribute__ ((used, section (#set))) = &(symbol)
+ static const void *__elf_set_##set##_element_##symbol##__ \
+ attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
#else
# define _elf_set_element(set, symbol) \
- static const void *const __elf_set_##set##_element_##symbol##__ \
- __attribute__ ((used, section (#set))) = &(symbol)
+ static const void *const __elf_set_##set##_element_##symbol##__ \
+ attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
#endif
/* Define SET as a symbol set. This may be required (it is in a.out) to
@@ -396,32 +405,27 @@ for linking")
past the last element in SET. */
#define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
-/* Use symbol_version_reference to specify the version a symbol
- reference should link to. Use symbol_version or
- default_symbol_version for the definition of a versioned symbol.
- The difference is that the latter is a no-op in non-shared
- builds. */
-#ifdef __ASSEMBLER__
-# define symbol_version_reference(real, name, version) \
- .symver real, name##@##version
-#else /* !__ASSEMBLER__ */
-# define symbol_version_reference(real, name, version) \
- __asm__ (".symver " #real "," #name "@" #version)
-#endif
-
#ifdef SHARED
# define symbol_version(real, name, version) \
symbol_version_reference(real, name, version)
# define default_symbol_version(real, name, version) \
_default_symbol_version(real, name, version)
+/* See <libc-symver.h>. */
# ifdef __ASSEMBLER__
# define _default_symbol_version(real, name, version) \
- .symver real, name##@##@##version
+ _set_symbol_version (real, name@@version)
# else
# define _default_symbol_version(real, name, version) \
- __asm__ (".symver " #real "," #name "@@" #version)
+ _set_symbol_version (real, #name "@@" #version)
# endif
-#else
+
+/* Evalutes to a string literal for VERSION in LIB. */
+# define symbol_version_string(lib, version) \
+ _symbol_version_stringify_1 (VERSION_##lib##_##version)
+# define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg)
+# define _symbol_version_stringify_2(arg) #arg
+
+#else /* !SHARED */
# define symbol_version(real, name, version)
# define default_symbol_version(real, name, version) \
strong_alias(real, name)
@@ -618,12 +622,7 @@ for linking")
# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name)
-# ifdef LINK_OBSOLETE_RPC
- /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
-# define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
-# else
-# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
-# endif
+# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
# define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_tls_def(name) hidden_tls_def (name)
@@ -641,7 +640,7 @@ for linking")
# define libc_hidden_data_ver(local, name)
#endif
-#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+#if IS_IN (rtld)
# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define rtld_hidden_def(name) hidden_def (name)
@@ -730,6 +729,29 @@ for linking")
# define libresolv_hidden_data_ver(local, name)
#endif
+#if IS_IN (libpthread)
+# define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libpthread_hidden_tls_proto(name, attrs...) \
+ hidden_tls_proto (name, ##attrs)
+# define libpthread_hidden_def(name) hidden_def (name)
+# define libpthread_hidden_weak(name) hidden_weak (name)
+# define libpthread_hidden_ver(local, name) hidden_ver (local, name)
+# define libpthread_hidden_data_def(name) hidden_data_def (name)
+# define libpthread_hidden_tls_def(name) hidden_tls_def (name)
+# define libpthread_hidden_data_weak(name) hidden_data_weak (name)
+# define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name)
+#else
+# define libpthread_hidden_proto(name, attrs...)
+# define libpthread_hidden_tls_proto(name, attrs...)
+# define libpthread_hidden_def(name)
+# define libpthread_hidden_weak(name)
+# define libpthread_hidden_ver(local, name)
+# define libpthread_hidden_data_def(name)
+# define libpthread_hidden_tls_def(name)
+# define libpthread_hidden_data_weak(name)
+# define libpthread_hidden_data_ver(local, name)
+#endif
+
#if IS_IN (librt)
# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define librt_hidden_tls_proto(name, attrs...) \
@@ -776,40 +798,11 @@ for linking")
# define libdl_hidden_data_ver(local, name)
#endif
-#if IS_IN (libnss_files)
-# define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
-# define libnss_files_hidden_tls_proto(name, attrs...) \
- hidden_tls_proto (name, ##attrs)
-# define libnss_files_hidden_def(name) hidden_def (name)
-# define libnss_files_hidden_weak(name) hidden_weak (name)
-# define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
-# define libnss_files_hidden_data_def(name) hidden_data_def (name)
-# define libnss_files_hidden_tls_def(name) hidden_tls_def (name)
-# define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
-# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
-#else
-# define libnss_files_hidden_proto(name, attrs...)
-# define libnss_files_hidden_tls_proto(name, attrs...)
-# define libnss_files_hidden_def(name)
-# define libnss_files_hidden_weak(name)
-# define libnss_files_hidden_ver(local, name)
-# define libnss_files_hidden_data_def(name)
-# define libnss_files_hidden_tls_def(name)
-# define libnss_files_hidden_data_weak(name)
-# define libnss_files_hidden_data_ver(local, name)
-#endif
-
#if IS_IN (libnsl)
# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libnsl_hidden_tls_proto(name, attrs...) \
hidden_tls_proto (name, ##attrs)
-# ifdef LINK_OBSOLETE_NSL
- /* libnsl_hidden_nolink should only get used in libnsl code. */
-# define libnsl_hidden_nolink_def(name, version) libnsl_hidden_def (name)
-# else
-# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
-# endif
-# define libnsl_hidden_def(name) hidden_def (name)
+# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
# define libnsl_hidden_weak(name) hidden_weak (name)
# define libnsl_hidden_ver(local, name) hidden_ver (local, name)
# define libnsl_hidden_data_def(name) hidden_data_def (name)
@@ -819,7 +812,6 @@ for linking")
#else
# define libnsl_hidden_proto(name, attrs...)
# define libnsl_hidden_tls_proto(name, attrs...)
-# define libnsl_hidden_def(name)
# define libnsl_hidden_weak(name)
# define libnsl_hidden_ver(local, name)
# define libnsl_hidden_data_def(name)
@@ -828,33 +820,12 @@ for linking")
# define libnsl_hidden_data_ver(local, name)
#endif
-#if IS_IN (libnss_nisplus)
-# define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
-# define libnss_nisplus_hidden_tls_proto(name, attrs...) \
- hidden_tls_proto (name, ##attrs)
-# define libnss_nisplus_hidden_def(name) hidden_def (name)
-# define libnss_nisplus_hidden_weak(name) hidden_weak (name)
-# define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
-# define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
-# define libnss_nisplus_hidden_tls_def(name) hidden_tls_def (name)
-# define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
-# define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
-#else
-# define libnss_nisplus_hidden_proto(name, attrs...)
-# define libnss_nisplus_hidden_tls_proto(name, attrs...)
-# define libnss_nisplus_hidden_def(name)
-# define libnss_nisplus_hidden_weak(name)
-# define libnss_nisplus_hidden_ver(local, name)
-# define libnss_nisplus_hidden_data_def(name)
-# define libnss_nisplus_hidden_tls_def(name)
-# define libnss_nisplus_hidden_data_weak(name)
-# define libnss_nisplus_hidden_data_ver(local, name)
-#endif
-
#define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#define libc_hidden_builtin_def(name) libc_hidden_def (name)
#define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
#define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
+
+#define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#ifdef __ASSEMBLER__
# define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
#endif
@@ -882,6 +853,14 @@ for linking")
# define libutil_hidden_data_ver(local, name)
#endif
+#if IS_IN (libanl)
+# define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libanl_hidden_def(name) hidden_def (name)
+#else
+# define libanl_hidden_proto(name, attrs...)
+# define libanl_hidden_def(name)
+#endif
+
/* Get some dirty hacks. */
#include <symbol-hacks.h>
lib/libc/glibc/include/pthread.h
@@ -8,9 +8,20 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
const pthread_barrierattr_t *__restrict
__attr, unsigned int __count)
__THROW __nonnull ((1));
+#if PTHREAD_IN_LIBC
+libc_hidden_proto (__pthread_barrier_init)
+#endif
extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
__THROWNL __nonnull ((1));
+#if PTHREAD_IN_LIBC
+libc_hidden_proto (__pthread_barrier_wait)
+#endif
/* This function is called to initialize the pthread library. */
extern void __pthread_initialize (void) __attribute__ ((weak));
+
+extern int __pthread_kill (pthread_t threadid, int signo);
+
+extern pthread_t __pthread_self (void);
+
#endif
lib/libc/glibc/include/signal.h
@@ -2,6 +2,8 @@
# include <signal/signal.h>
# ifndef _ISOMAC
+# include <sigsetops.h>
+
libc_hidden_proto (sigemptyset)
libc_hidden_proto (sigfillset)
libc_hidden_proto (sigaddset)
@@ -12,7 +14,10 @@ libc_hidden_proto (__sigpause)
libc_hidden_proto (raise)
libc_hidden_proto (__libc_current_sigrtmin)
libc_hidden_proto (__libc_current_sigrtmax)
-libc_hidden_proto (_sys_siglist)
+extern const char * const __sys_siglist[_NSIG];
+libc_hidden_proto (__sys_siglist)
+extern const char * const __sys_sigabbrev[_NSIG];
+libc_hidden_proto (__sys_sigabbrev)
/* Now define the internal interfaces. */
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
@@ -33,6 +38,14 @@ extern int __sigwait (const sigset_t *__set, int *__sig);
libc_hidden_proto (__sigwait)
extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);
libc_hidden_proto (__sigwaitinfo)
+#if __TIMESIZE == 64
+# define __sigtimedwait64 __sigtimedwait
+#else
+# include <struct___timespec64.h>
+extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info,
+ const struct __timespec64 *__timeout);
+libc_hidden_proto (__sigtimedwait64)
+#endif
extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info,
const struct timespec *__timeout);
libc_hidden_proto (__sigtimedwait)
@@ -54,7 +67,7 @@ extern int __xpg_sigpause (int sig);
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig (int __high);
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (__sigaction) __sigaction attribute_hidden;
extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
# endif
lib/libc/glibc/include/stap-probe.h
@@ -1,5 +1,5 @@
/* Macros for defining Systemtap <sys/sdt.h> static probe points.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/include/stdc-predef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/include/stdlib.h
@@ -3,12 +3,23 @@
#ifndef _ISOMAC
# include <stddef.h>
#endif
+
+/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
+#include <bits/floatn.h>
+#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
+# pragma GCC system_header
+# endif
+#endif
+
#include <stdlib/stdlib.h>
/* Now define the internal interfaces. */
#if !defined _ISOMAC
# include <sys/stat.h>
+# include <rtld-malloc.h>
+
extern __typeof (strtol_l) __strtol_l;
extern __typeof (strtoul_l) __strtoul_l;
extern __typeof (strtoll_l) __strtoll_l;
@@ -80,6 +91,7 @@ extern int __setenv (const char *__name, const char *__value, int __replace)
extern int __unsetenv (const char *__name) attribute_hidden;
extern int __clearenv (void) attribute_hidden;
extern char *__mktemp (char *__template) __THROW __nonnull ((1));
+libc_hidden_proto (__mktemp)
extern char *__canonicalize_file_name (const char *__name);
extern char *__realpath (const char *__name, char *__resolved);
libc_hidden_proto (__realpath)
@@ -125,6 +137,12 @@ libc_hidden_proto (__libc_reallocarray)
extern int __libc_system (const char *line);
+extern __typeof (getpt) __getpt;
+extern __typeof (ptsname_r) __ptsname_r;
+libc_hidden_proto (__getpt)
+libc_hidden_proto (__ptsname_r)
+libc_hidden_proto (grantpt)
+libc_hidden_proto (unlockpt)
extern double __strtod_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group)
@@ -205,7 +223,7 @@ libc_hidden_proto (____strtoull_l_internal)
#include <bits/floatn.h>
libc_hidden_proto (strtof)
libc_hidden_proto (strtod)
-#if __LONG_DOUBLE_USES_FLOAT128 == 0
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
libc_hidden_proto (strtold)
#endif
libc_hidden_proto (strtol)
@@ -288,9 +306,6 @@ libc_hidden_proto (__qfcvt_r)
# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
# endif
-extern void *__default_morecore (ptrdiff_t) __THROW;
-libc_hidden_proto (__default_morecore)
-
struct abort_msg_s
{
unsigned int size;
@@ -299,7 +314,7 @@ struct abort_msg_s
extern struct abort_msg_s *__abort_msg;
libc_hidden_proto (__abort_msg)
-# if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
+# if IS_IN (rtld)
extern __typeof (unsetenv) unsetenv attribute_hidden;
extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
# endif
lib/libc/glibc/include/struct___timespec64.h
@@ -0,0 +1,27 @@
+#ifndef _STRUCT_TIMESPEC64_H
+#define _STRUCT_TIMESPEC64_H
+
+#if __TIMESIZE == 64
+# define __timespec64 timespec
+#else
+#include <endian.h>
+/* The glibc Y2038-proof struct __timespec64 structure for a time value.
+ To keep things Posix-ish, we keep the nanoseconds field a 32-bit
+ signed long, but since the Linux field is a 64-bit signed int, we
+ pad our tv_nsec with a 32-bit unnamed bit-field padding.
+
+ As a general rule the Linux kernel is ignoring upper 32 bits of
+ tv_nsec field. */
+struct __timespec64
+{
+ __time64_t tv_sec; /* Seconds */
+# if BYTE_ORDER == BIG_ENDIAN
+ __int32_t :32; /* Padding */
+ __int32_t tv_nsec; /* Nanoseconds */
+# else
+ __int32_t tv_nsec; /* Nanoseconds */
+ __int32_t :32; /* Padding */
+# endif
+};
+#endif
+#endif /* _STRUCT_TIMESPEC64_H */
lib/libc/glibc/include/struct___timeval64.h
@@ -0,0 +1,17 @@
+#ifndef _STRUCT_TIMEVAL64_H
+#define _STRUCT_TIMEVAL64_H
+
+#if __TIMESIZE == 64
+# define __timeval64 timeval
+#else
+/* The glibc Y2038-proof struct __timeval64 structure for a time value.
+ This structure is NOT supposed to be passed to the Linux kernel.
+ Instead, it shall be converted to struct __timespec64 and time shall
+ be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */
+struct __timeval64
+{
+ __time64_t tv_sec; /* Seconds */
+ __suseconds64_t tv_usec; /* Microseconds */
+};
+#endif
+#endif /* _STRUCT_TIMEVAL64_H */
lib/libc/glibc/io/bits/statx.h
@@ -1,5 +1,5 @@
/* statx-related definitions and declarations. Generic version.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 2018-2021 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
lib/libc/glibc/io/sys/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
@@ -209,21 +209,51 @@ extern int stat (const char *__restrict __file,
that file descriptor FD is open on and put them in BUF. */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
-# ifdef __REDIRECT_NTH
+# ifdef __USE_TIME_BITS64
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
+ struct stat *__restrict __buf),
+ __stat64_time64)
+ __nonnull ((1, 2));
+extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf),
+ __fstat64_time64)
+ __nonnull ((2));
+# else
+# define stat __stat64_time64
+# define fstat __fstat64_time64
+# endif
+# else
+# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf), stat64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
__nonnull ((2));
-# else
-# define stat stat64
-# define fstat fstat64
+# else
+# define stat stat64
+# define fstat fstat64
+# endif
# endif
#endif
#ifdef __USE_LARGEFILE64
+# ifndef __USE_TIME_BITS64
extern int stat64 (const char *__restrict __file,
struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (stat64, (const char *__restrict __file,
+ struct stat64 *__restrict __buf),
+ __stat64_time64)
+ __nonnull ((1, 2));
+extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
+ __fstat64_time64)
+ __nonnull ((2));
+# else
+# define stat64 __stat64_time64
+# define fstat64 __fstat64_time
+# endif
+# endif
#endif
#ifdef __USE_ATFILE
@@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
# else
-# ifdef __REDIRECT_NTH
+# ifdef __USE_TIME_BITS64
+# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
int __flag),
- fstatat64) __nonnull ((2, 3));
+ __fstatat64_time64) __nonnull ((2, 3));
+# else
+# define fstatat __fstatat64_time64
+# endif
# else
-# define fstatat fstatat64
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
+ struct stat *__restrict __buf,
+ int __flag),
+ fstatat64) __nonnull ((2, 3));
+# else
+# define fstatat fstatat64
+# endif
# endif
# endif
# ifdef __USE_LARGEFILE64
+# ifndef __USE_TIME_BITS64
extern int fstatat64 (int __fd, const char *__restrict __file,
struct stat64 *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (fstatat64, (int __fd,
+ const char *__restrict __file,
+ struct stat64 *__restrict __buf,
+ int __flag),
+ __fstatat64_time64)
+ __nonnull ((2, 3));
+# else
+# define fstatat64 __fstatat64_time64
+# endif
+# endif
# endif
#endif
@@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file,
extern int lstat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
# else
-# ifdef __REDIRECT_NTH
+# ifdef __USE_TIME_BITS64
+# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
- struct stat *__restrict __buf), lstat64)
+ struct stat *__restrict __buf), __lstat64_time64)
__nonnull ((1, 2));
+# else
+# define lstat __lstat64_time64
+# endif
# else
-# define lstat lstat64
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (lstat,
+ (const char *__restrict __file,
+ struct stat *__restrict __buf), lstat64)
+ __nonnull ((1, 2));
+# else
+# define lstat lstat64
+# endif
# endif
# endif
# ifdef __USE_LARGEFILE64
+# ifndef __USE_TIME_BITS64
extern int lstat64 (const char *__restrict __file,
struct stat64 *__restrict __buf)
__THROW __nonnull ((1, 2));
+# else
+extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file,
+ struct stat64 *__restrict __buf),
+ __lstat64_time64)
+ __nonnull ((1, 2));
+# endif
# endif
#endif
@@ -355,182 +427,44 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
#endif
#ifdef __USE_ATFILE
+# ifndef __USE_TIME_BITS64
/* Set file access and modification times relative to directory file
descriptor. */
extern int utimensat (int __fd, const char *__path,
const struct timespec __times[2],
int __flags)
__THROW __nonnull ((2));
+# else
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
+ const struct timespec __times[2],
+ int flags),
+ __utimensat64) __nonnull ((2));
+# else
+# define utimensat __utimensat64
+# endif
+# endif
#endif
#ifdef __USE_XOPEN2K8
+# ifndef __USE_TIME_BITS64
/* Set file access and modification times of the file associated with FD. */
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
-#endif
-
-/* To allow the `struct stat' structure and the file type `mode_t'
- bits to vary without changing shared library major version number,
- the `stat' family of functions and `mknod' are in fact inline
- wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod',
- which all take a leading version-number argument designating the
- data structure and bits used. <bits/stat.h> defines _STAT_VER with
- the version number corresponding to `struct stat' as defined in
- that file; and _MKNOD_VER with the version number corresponding to
- the S_IF* macros defined therein. It is arranged that when not
- inlined these function are always statically linked; that way a
- dynamically-linked executable always encodes the version number
- corresponding to the data structures it uses, so the `x' functions
- in the shared library can adapt without needing to recompile all
- callers. */
-
-#ifndef _STAT_VER
-# define _STAT_VER 0
-#endif
-#ifndef _MKNOD_VER
-# define _MKNOD_VER 0
-#endif
-
-/* Wrappers for stat and mknod system calls. */
-#ifndef __USE_FILE_OFFSET64
-extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
- __THROW __nonnull ((3));
-extern int __xstat (int __ver, const char *__filename,
- struct stat *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __lxstat (int __ver, const char *__filename,
- struct stat *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __fxstatat (int __ver, int __fildes, const char *__filename,
- struct stat *__stat_buf, int __flag)
- __THROW __nonnull ((3, 4));
-#else
-# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
- struct stat *__stat_buf), __fxstat64)
- __nonnull ((3));
-extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename,
- struct stat *__stat_buf), __xstat64)
- __nonnull ((2, 3));
-extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename,
- struct stat *__stat_buf), __lxstat64)
- __nonnull ((2, 3));
-extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
- const char *__filename,
- struct stat *__stat_buf, int __flag),
- __fxstatat64) __nonnull ((3, 4));
# else
-# define __fxstat __fxstat64
-# define __xstat __xstat64
-# define __lxstat __lxstat64
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]),
+ __futimens64);
+# else
+# define futimens __futimens64
+# endif
# endif
#endif
-#ifdef __USE_LARGEFILE64
-extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
- __THROW __nonnull ((3));
-extern int __xstat64 (int __ver, const char *__filename,
- struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __lxstat64 (int __ver, const char *__filename,
- struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
-extern int __fxstatat64 (int __ver, int __fildes, const char *__filename,
- struct stat64 *__stat_buf, int __flag)
- __THROW __nonnull ((3, 4));
-#endif
-extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
- __dev_t *__dev) __THROW __nonnull ((2, 4));
-
-extern int __xmknodat (int __ver, int __fd, const char *__path,
- __mode_t __mode, __dev_t *__dev)
- __THROW __nonnull ((3, 5));
-
#ifdef __USE_GNU
# include <bits/statx.h>
#endif
-#ifdef __USE_EXTERN_INLINES
-/* Inlined versions of the real stat and mknod functions. */
-
-__extern_inline int
-__NTH (stat (const char *__path, struct stat *__statbuf))
-{
- return __xstat (_STAT_VER, __path, __statbuf);
-}
-
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-__extern_inline int
-__NTH (lstat (const char *__path, struct stat *__statbuf))
-{
- return __lxstat (_STAT_VER, __path, __statbuf);
-}
-# endif
-
-__extern_inline int
-__NTH (fstat (int __fd, struct stat *__statbuf))
-{
- return __fxstat (_STAT_VER, __fd, __statbuf);
-}
-
-# ifdef __USE_ATFILE
-__extern_inline int
-__NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf,
- int __flag))
-{
- return __fxstatat (_STAT_VER, __fd, __filename, __statbuf, __flag);
-}
-# endif
-
-# ifdef __USE_MISC
-__extern_inline int
-__NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev))
-{
- return __xmknod (_MKNOD_VER, __path, __mode, &__dev);
-}
-# endif
-
-# ifdef __USE_ATFILE
-__extern_inline int
-__NTH (mknodat (int __fd, const char *__path, __mode_t __mode,
- __dev_t __dev))
-{
- return __xmknodat (_MKNOD_VER, __fd, __path, __mode, &__dev);
-}
-# endif
-
-# if defined __USE_LARGEFILE64 \
- && (! defined __USE_FILE_OFFSET64 \
- || (defined __REDIRECT_NTH && defined __OPTIMIZE__))
-__extern_inline int
-__NTH (stat64 (const char *__path, struct stat64 *__statbuf))
-{
- return __xstat64 (_STAT_VER, __path, __statbuf);
-}
-
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
-__extern_inline int
-__NTH (lstat64 (const char *__path, struct stat64 *__statbuf))
-{
- return __lxstat64 (_STAT_VER, __path, __statbuf);
-}
-# endif
-
-__extern_inline int
-__NTH (fstat64 (int __fd, struct stat64 *__statbuf))
-{
- return __fxstat64 (_STAT_VER, __fd, __statbuf);
-}
-
-# ifdef __USE_ATFILE
-__extern_inline int
-__NTH (fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf,
- int __flag))
-{
- return __fxstatat64 (_STAT_VER, __fd, __filename, __statbuf, __flag);
-}
-# endif
-
-# endif
-
-#endif
-
__END_DECLS
lib/libc/glibc/io/fcntl.h
@@ -0,0 +1,347 @@
+/* Copyright (C) 1991-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+/*
+ * POSIX Standard: 6.5 File Control Operations <fcntl.h>
+ */
+
+#ifndef _FCNTL_H
+#define _FCNTL_H 1
+
+#include <features.h>
+
+/* This must be early so <bits/fcntl.h> can define types winningly. */
+__BEGIN_DECLS
+
+/* Get __mode_t, __dev_t and __off_t .*/
+#include <bits/types.h>
+
+/* Get the definitions of O_*, F_*, FD_*: all the
+ numbers and flag bits for `open', `fcntl', et al. */
+#include <bits/fcntl.h>
+
+/* Detect if open needs mode as a third argument (or for openat as a fourth
+ argument). */
+#ifdef __O_TMPFILE
+# define __OPEN_NEEDS_MODE(oflag) \
+ (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
+#else
+# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
+#endif
+
+/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
+ Earlier POSIX standards permitted any type ending in `_t' to be defined
+ by any POSIX header, so we don't conditionalize the definitions here. */
+#ifndef __mode_t_defined
+typedef __mode_t mode_t;
+# define __mode_t_defined
+#endif
+
+#ifndef __off_t_defined
+# ifndef __USE_FILE_OFFSET64
+typedef __off_t off_t;
+# else
+typedef __off64_t off_t;
+# endif
+# define __off_t_defined
+#endif
+
+#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
+typedef __off64_t off64_t;
+# define __off64_t_defined
+#endif
+
+#ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined
+#endif
+
+/* For XPG all symbols from <sys/stat.h> should also be available. */
+#ifdef __USE_XOPEN2K8
+# include <bits/types/struct_timespec.h>
+#endif
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+# include <bits/stat.h>
+
+# define S_IFMT __S_IFMT
+# define S_IFDIR __S_IFDIR
+# define S_IFCHR __S_IFCHR
+# define S_IFBLK __S_IFBLK
+# define S_IFREG __S_IFREG
+# ifdef __S_IFIFO
+# define S_IFIFO __S_IFIFO
+# endif
+# ifdef __S_IFLNK
+# define S_IFLNK __S_IFLNK
+# endif
+# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
+# define S_IFSOCK __S_IFSOCK
+# endif
+
+/* Protection bits. */
+
+# define S_ISUID __S_ISUID /* Set user ID on execution. */
+# define S_ISGID __S_ISGID /* Set group ID on execution. */
+
+# if defined __USE_MISC || defined __USE_XOPEN
+/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
+# define S_ISVTX __S_ISVTX
+# endif
+
+# define S_IRUSR __S_IREAD /* Read by owner. */
+# define S_IWUSR __S_IWRITE /* Write by owner. */
+# define S_IXUSR __S_IEXEC /* Execute by owner. */
+/* Read, write, and execute by owner. */
+# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
+
+# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
+# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
+# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
+/* Read, write, and execute by group. */
+# define S_IRWXG (S_IRWXU >> 3)
+
+# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
+# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
+# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
+/* Read, write, and execute by others. */
+# define S_IRWXO (S_IRWXG >> 3)
+#endif
+
+#ifdef __USE_MISC
+# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
+/* Values for the second argument to access.
+ These may be OR'd together. */
+# define R_OK 4 /* Test for read permission. */
+# define W_OK 2 /* Test for write permission. */
+# define X_OK 1 /* Test for execute permission. */
+# define F_OK 0 /* Test for existence. */
+# endif
+#endif /* Use misc. */
+
+/* XPG wants the following symbols. <stdio.h> has the same definitions. */
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Seek from end of file. */
+#endif /* XPG */
+
+/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS
+ is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
+ unlinkat. The two functions do completely different things and therefore,
+ the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
+ faccessat would be undefined behavior and thus treating it equivalent to
+ AT_EACCESS is valid undefined behavior. */
+#ifdef __USE_ATFILE
+# define AT_FDCWD -100 /* Special value used to indicate
+ the *at functions should use the
+ current working directory. */
+# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
+# define AT_REMOVEDIR 0x200 /* Remove directory instead of
+ unlinking file. */
+# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
+# ifdef __USE_GNU
+# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
+ traversal. */
+# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
+# define AT_STATX_SYNC_TYPE 0x6000
+# define AT_STATX_SYNC_AS_STAT 0x0000
+# define AT_STATX_FORCE_SYNC 0x2000
+# define AT_STATX_DONT_SYNC 0x4000
+# define AT_RECURSIVE 0x8000 /* Apply to the entire subtree. */
+# endif
+# define AT_EACCESS 0x200 /* Test access permitted for
+ effective IDs, not real IDs. */
+#endif
+
+/* Do the file control operation described by CMD on FD.
+ The remaining arguments are interpreted depending on CMD.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+#ifndef __USE_TIME_BITS64
+# ifndef __USE_FILE_OFFSET64
+extern int fcntl (int __fd, int __cmd, ...);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
+# else
+# define fcntl fcntl64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int fcntl64 (int __fd, int __cmd, ...);
+# endif
+#else /* __USE_TIME_BITS64 */
+# ifdef __REDIRECT
+extern int __REDIRECT (fcntl, (int __fd, int __request, ...),
+ __fcntl_time64) __THROW;
+extern int __REDIRECT (fcntl64, (int __fd, int __request, ...),
+ __fcntl_time64) __THROW;
+# else
+extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
+# define fcntl64 __fcntl_time64
+# define fcntl __fcntl_time64
+# endif
+#endif
+
+/* Open FILE and return a new file descriptor for it, or -1 on error.
+ OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set
+ in OFLAG, the third argument is taken as a `mode_t', the mode of the
+ created file.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+#ifndef __USE_FILE_OFFSET64
+extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
+ __nonnull ((1));
+# else
+# define open open64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
+#endif
+
+#ifdef __USE_ATFILE
+/* Similar to `open' but a relative path name is interpreted relative to
+ the directory for which FD is a descriptor.
+
+ NOTE: some other `openat' implementation support additional functionality
+ through this interface, especially using the O_XATTR flag. This is not
+ yet supported here.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int openat (int __fd, const char *__file, int __oflag, ...)
+ __nonnull ((2));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
+ ...), openat64) __nonnull ((2));
+# else
+# define openat openat64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int openat64 (int __fd, const char *__file, int __oflag, ...)
+ __nonnull ((2));
+# endif
+#endif
+
+/* Create and open FILE, with mode MODE. This takes an `int' MODE
+ argument because that is what `mode_t' will be widened to.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+#ifndef __USE_FILE_OFFSET64
+extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
+ creat64) __nonnull ((1));
+# else
+# define creat creat64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
+#endif
+
+#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
+ && !defined __USE_POSIX))
+/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
+ files consistent. Some systems have them there and some here, and some
+ software depends on the macros being defined without including both. */
+
+/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
+ LEN is always relative to the current file position.
+ The CMD argument is one of the following. */
+
+# define F_ULOCK 0 /* Unlock a previously locked region. */
+# define F_LOCK 1 /* Lock a region for exclusive use. */
+# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
+# 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);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
+# else
+# define lockf lockf64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int lockf64 (int __fd, int __cmd, off64_t __len);
+# endif
+#endif
+
+#ifdef __USE_XOPEN2K
+/* Advice the system about the expected behaviour of the application with
+ respect to the file associated with FD. */
+# ifndef __USE_FILE_OFFSET64
+extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
+ int __advise) __THROW;
+# else
+ # ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
+ __off64_t __len, int __advise),
+ posix_fadvise64);
+# else
+# define posix_fadvise posix_fadvise64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
+ int __advise) __THROW;
+# endif
+
+
+/* Reserve storage for the data of the file associated with FD.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
+# else
+ # ifdef __REDIRECT
+extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
+ __off64_t __len),
+ posix_fallocate64);
+# else
+# define posix_fallocate posix_fallocate64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
+# endif
+#endif
+
+
+/* Define some inlines helping to catch common problems. */
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
+ && defined __va_arg_pack_len
+# include <bits/fcntl2.h>
+#endif
+
+__END_DECLS
+
+#endif /* fcntl.h */
lib/libc/glibc/io/fstat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,23 +16,18 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef fstat
-#undef __fstat
int
-attribute_hidden
__fstat (int fd, struct stat *buf)
{
- return __fxstat (_STAT_VER, fd, buf);
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ return __fstatat (fd, "", buf, AT_EMPTY_PATH);
}
-weak_hidden_alias (__fstat, fstat)
+weak_alias (__fstat, fstat)
lib/libc/glibc/io/fstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,20 +16,18 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef fstat64
int
-attribute_hidden
-fstat64 (int fd, struct stat64 *buf)
+__fstat64 (int fd, struct stat64 *buf)
{
- return __fxstat64 (_STAT_VER, fd, buf);
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ return __fstatat64 (fd, "", buf, AT_EMPTY_PATH);
}
+hidden_def (__fstat64)
+weak_alias (__fstat64, fstat64)
lib/libc/glibc/io/fstatat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,20 +16,27 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef fstatat
int
-attribute_hidden
-fstatat (int fd, const char *file, struct stat *buf, int flag)
+__fstatat (int fd, const char *file, struct stat *buf, int flag)
{
- return __fxstatat (_STAT_VER, fd, file, buf, flag);
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == 0 || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
}
+
+weak_alias (__fstatat, fstatat)
+
+stub_warning (fstatat)
lib/libc/glibc/io/fstatat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,20 +16,27 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef fstatat64
int
-attribute_hidden
-fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
+__fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
- return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+ if (buf == 0 || (flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
}
+hidden_def (__fstatat64)
+weak_alias (__fstatat64, fstatat64)
+
+stub_warning (fstatat64)
lib/libc/glibc/io/lstat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,23 +16,12 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef lstat
-#undef __lstat
int
-attribute_hidden
__lstat (const char *file, struct stat *buf)
{
- return __lxstat (_STAT_VER, file, buf);
+ return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
}
-weak_hidden_alias (__lstat, lstat)
+weak_alias (__lstat, lstat)
lib/libc/glibc/io/lstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,20 +16,12 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef lstat64
int
-attribute_hidden
-lstat64 (const char *file, struct stat64 *buf)
+__lstat64 (const char *file, struct stat64 *buf)
{
- return __lxstat64 (_STAT_VER, file, buf);
+ return __fstatat64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
}
+hidden_def (__lstat64)
+weak_alias (__lstat64, lstat64)
lib/libc/glibc/io/mknod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -32,24 +15,13 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-
-#include <sys/types.h>
#include <sys/stat.h>
-
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
+#include <fcntl.h>
int
-attribute_hidden
__mknod (const char *path, mode_t mode, dev_t dev)
{
- return __xmknod (_MKNOD_VER, path, mode, &dev);
+ return __mknodat (AT_FDCWD, path, mode, dev);
}
-
-weak_hidden_alias (__mknod, mknod)
+libc_hidden_def (__mknod)
+weak_alias (__mknod, mknod)
lib/libc/glibc/io/mknodat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -32,22 +15,17 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-
#include <sys/types.h>
#include <sys/stat.h>
-
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
+#include <errno.h>
int
-attribute_hidden
-mknodat (int fd, const char *path, mode_t mode, dev_t dev)
+__mknodat (int fd, const char *path, mode_t mode, dev_t dev)
{
- return __xmknodat (_MKNOD_VER, fd, path, mode, &dev);
+ __set_errno (ENOSYS);
+ return -1;
}
+libc_hidden_def (__mknodat)
+weak_alias (__mknodat, mknodat)
+
+stub_warning (mknodat)
lib/libc/glibc/io/stat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,22 +16,12 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef stat
int
-attribute_hidden
__stat (const char *file, struct stat *buf)
{
- return __xstat (_STAT_VER, file, buf);
+ return __fstatat (AT_FDCWD, file, buf, 0);
}
-weak_hidden_alias (__stat, stat)
+weak_alias (__stat, stat)
lib/libc/glibc/io/stat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
@@ -6,23 +6,6 @@
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
- In addition to the permissions in the GNU Lesser General Public
- License, the Free Software Foundation gives you unlimited
- permission to link the compiled version of this file with other
- programs, and to distribute those programs without any restriction
- coming from the use of this file. (The GNU Lesser General Public
- License restrictions do apply in other respects; for example, they
- cover modification of the file, and distribution when not linked
- into another program.)
-
- Note that people who make modified versions of this file are not
- obligated to grant this special exception for their modified
- versions; it is their choice whether to do so. The GNU Lesser
- General Public License gives permission to release a modified
- version without this exception; this exception also makes it
- possible to release a modified version which carries forward this
- exception.
-
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
@@ -33,20 +16,12 @@
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
+#include <fcntl.h>
-/* This definition is only used if inlining fails for this function; see
- the last page of <sys/stat.h>. The real work is done by the `x'
- function which is passed a version number argument. We arrange in the
- makefile that when not inlined this function is always statically
- linked; that way a dynamically-linked executable always encodes the
- version number corresponding to the data structures it uses, so the `x'
- functions in the shared library can adapt without needing to recompile
- all callers. */
-
-#undef stat64
int
-attribute_hidden
-stat64 (const char *file, struct stat64 *buf)
+__stat64 (const char *file, struct stat64 *buf)
{
- return __xstat64 (_STAT_VER, file, buf);
+ return __fstatat64 (AT_FDCWD, file, buf, 0);
}
+hidden_def (__stat64)
+weak_alias (__stat64, stat64)
lib/libc/glibc/locale/bits/types/__locale_t.h
@@ -1,5 +1,5 @@
/* Definition of struct __locale_struct and __locale_t.
- Copyright (C) 1997-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
lib/libc/glibc/locale/bits/types/locale_t.h
@@ -1,5 +1,5 @@
/* Definition of locale_t.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/misc/sys/cdefs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
@@ -25,7 +25,7 @@
/* The GNU libc does not support any K&R compilers or the traditional mode
of ISO C compilers anymore. Check for some of the combinations not
- anymore supported. */
+ supported anymore. */
#if defined __GNUC__ && !defined __STDC__
# error "You need a ISO C conforming compiler to use the glibc headers"
#endif
@@ -34,7 +34,29 @@
#undef __P
#undef __PMT
-#ifdef __GNUC__
+/* Compilers that lack __has_attribute may object to
+ #if defined __has_attribute && __has_attribute (...)
+ even though they do not need to evaluate the right-hand side of the &&.
+ Similarly for __has_builtin, etc. */
+#if (defined __has_attribute \
+ && (!defined __clang_minor__ \
+ || 3 < __clang_major__ + (5 <= __clang_minor__)))
+# define __glibc_has_attribute(attr) __has_attribute (attr)
+#else
+# define __glibc_has_attribute(attr) 0
+#endif
+#ifdef __has_builtin
+# define __glibc_has_builtin(name) __has_builtin (name)
+#else
+# define __glibc_has_builtin(name) 0
+#endif
+#ifdef __has_extension
+# define __glibc_has_extension(ext) __has_extension (ext)
+#else
+# define __glibc_has_extension(ext) 0
+#endif
+
+#if defined __GNUC__ || defined __clang__
/* All functions, except those with callbacks or those that
synchronize memory, are leaf functions. */
@@ -47,21 +69,26 @@
# endif
/* GCC can always grok prototypes. For C++ programs we add throw()
- to help it optimize the function calls. But this works only with
- gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
+ to help it optimize the function calls. But this only works with
+ gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
-# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
+# if !defined __cplusplus \
+ && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__))
# define __THROW __attribute__ ((__nothrow__ __LEAF))
# define __THROWNL __attribute__ ((__nothrow__))
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
-# define __THROW throw ()
-# define __THROWNL throw ()
-# define __NTH(fct) __LEAF_ATTR fct throw ()
-# define __NTHNL(fct) fct throw ()
+# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
+# if __cplusplus >= 201103L
+# define __THROW noexcept (true)
+# else
+# define __THROW throw ()
+# endif
+# define __THROWNL __THROW
+# define __NTH(fct) __LEAF_ATTR fct __THROW
+# define __NTHNL(fct) fct __THROW
# else
# define __THROW
# define __THROWNL
@@ -70,7 +97,7 @@
# endif
# endif
-#else /* Not GCC. */
+#else /* Not GCC or clang. */
# if (defined __cplusplus \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
@@ -83,16 +110,7 @@
# define __THROWNL
# define __NTH(fct) fct
-#endif /* GCC. */
-
-/* Compilers that are not clang may object to
- #if defined __clang__ && __has_extension(...)
- even though they do not need to evaluate the right-hand side of the &&. */
-#if defined __clang__ && defined __has_extension
-# define __glibc_clang_has_extension(ext) __has_extension (ext)
-#else
-# define __glibc_clang_has_extension(ext) 0
-#endif
+#endif /* GCC || clang. */
/* These two macros are not used in glibc anymore. They are kept here
only because some other projects expect the macros to be defined. */
@@ -123,14 +141,20 @@
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
#define __bos0(ptr) __builtin_object_size (ptr, 0)
+/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
+#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0)
+# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
+# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
+#else
+# define __glibc_objsize0(__o) __bos0 (__o)
+# define __glibc_objsize(__o) __bos (__o)
+#endif
+
#if __GNUC_PREREQ (4,3)
-# define __warndecl(name, msg) \
- extern void name (void) __attribute__((__warning__ (msg)))
# define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \
extern void name (void) __attribute__((__error__ (msg)))
#else
-# define __warndecl(name, msg) extern void name (void)
# define __warnattr(msg)
# define __errordecl(name, msg) extern void name (void)
#endif
@@ -139,11 +163,11 @@
Headers that should use flexible arrays only if they're "real"
(e.g. only if they won't affect sizeof()) should test
#if __glibc_c99_flexarr_available. */
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
# define __flexarr []
# define __glibc_c99_flexarr_available 1
-#elif __GNUC_PREREQ (2,97)
-/* GCC 2.97 supports C99 flexible array members as an extension,
+#elif __GNUC_PREREQ (2,97) || defined __clang__
+/* GCC 2.97 and clang support C99 flexible array members as an extension,
even when in C89 mode or compiling C++ (any version). */
# define __flexarr []
# define __glibc_c99_flexarr_available 1
@@ -169,7 +193,7 @@
Example:
int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
-#if defined __GNUC__ && __GNUC__ >= 2
+#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
# ifdef __cplusplus
@@ -194,17 +218,17 @@
*/
#endif
-/* GCC has various useful declarations that can be made with the
- `__attribute__' syntax. All of the ways we use this do fine if
- they are omitted for compilers that don't understand it. */
-#if !defined __GNUC__ || __GNUC__ < 2
+/* GCC and clang have various useful declarations that can be made with
+ the '__attribute__' syntax. All of the ways we use this do fine if
+ they are omitted for compilers that don't understand it. */
+#if !(defined __GNUC__ || defined __clang__)
# define __attribute__(xyz) /* Ignore */
#endif
/* At some point during the gcc 2.96 development the `malloc' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
-#if __GNUC_PREREQ (2,96)
+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__)
# define __attribute_malloc__ __attribute__ ((__malloc__))
#else
# define __attribute_malloc__ /* Ignore */
@@ -222,23 +246,29 @@
/* At some point during the gcc 2.96 development the `pure' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
-#if __GNUC_PREREQ (2,96)
+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__)
# define __attribute_pure__ __attribute__ ((__pure__))
#else
# define __attribute_pure__ /* Ignore */
#endif
/* This declaration tells the compiler that the value is constant. */
-#if __GNUC_PREREQ (2,5)
+#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
# define __attribute_const__ __attribute__ ((__const__))
#else
# define __attribute_const__ /* Ignore */
#endif
+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
+# define __attribute_maybe_unused__ __attribute__ ((__unused__))
+#else
+# define __attribute_maybe_unused__ /* Ignore */
+#endif
+
/* At some point during the gcc 3.1 development the `used' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
-#if __GNUC_PREREQ (3,1)
+#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__)
# define __attribute_used__ __attribute__ ((__used__))
# define __attribute_noinline__ __attribute__ ((__noinline__))
#else
@@ -247,7 +277,7 @@
#endif
/* Since version 3.2, gcc allows marking deprecated functions. */
-#if __GNUC_PREREQ (3,2)
+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__)
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
#else
# define __attribute_deprecated__ /* Ignore */
@@ -257,7 +287,7 @@
when a deprecated function is used. clang claims to be gcc 4.2, but
may also support this feature. */
#if __GNUC_PREREQ (4,5) \
- || __glibc_clang_has_extension (__attribute_deprecated_with_message__)
+ || __glibc_has_extension (__attribute_deprecated_with_message__)
# define __attribute_deprecated_msg__(msg) \
__attribute__ ((__deprecated__ (msg)))
#else
@@ -270,7 +300,7 @@
If several `format_arg' attributes are given for the same function, in
gcc-3.0 and older, all but the last one are ignored. In newer gccs,
all designated arguments are considered. */
-#if __GNUC_PREREQ (2,8)
+#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__)
# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
#else
# define __attribute_format_arg__(x) /* Ignore */
@@ -280,27 +310,42 @@
attribute for functions was introduced. We don't want to use it
unconditionally (although this would be possible) since it
generates warnings. */
-#if __GNUC_PREREQ (2,97)
+#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__)
# define __attribute_format_strfmon__(a,b) \
__attribute__ ((__format__ (__strfmon__, a, b)))
#else
# define __attribute_format_strfmon__(a,b) /* Ignore */
#endif
-/* The nonull function attribute allows to mark pointer parameters which
+/* The nonnull function attribute marks pointer parameters that
must not be NULL. */
-#if __GNUC_PREREQ (3,3)
-# define __nonnull(params) __attribute__ ((__nonnull__ params))
-#else
-# define __nonnull(params)
+#ifndef __nonnull
+# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
+# define __nonnull(params) __attribute__ ((__nonnull__ params))
+# else
+# define __nonnull(params)
+# endif
+#elif !defined __GLIBC__
+# undef __nonnull
+# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params)
+#endif
+
+/* The returns_nonnull function attribute marks the return type of the function
+ as always being non-null. */
+#ifndef __returns_nonnull
+# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
+# define __returns_nonnull __attribute__ ((__returns_nonnull__))
+# else
+# define __returns_nonnull
+# endif
#endif
/* If fortification mode, we warn about unused results of certain
function calls which can lead to problems. */
-#if __GNUC_PREREQ (3,4)
+#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__)
# define __attribute_warn_unused_result__ \
__attribute__ ((__warn_unused_result__))
-# if __USE_FORTIFY_LEVEL > 0
+# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
# define __wur __attribute_warn_unused_result__
# endif
#else
@@ -311,7 +356,7 @@
#endif
/* Forces a function to be always inlined. */
-#if __GNUC_PREREQ (3,2)
+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__)
/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
it conflicts with this definition. Therefore undefine it first to
allow either header to be included first. */
@@ -324,7 +369,7 @@
/* Associate error messages with the source location of the call site rather
than with the source location inside the function. */
-#if __GNUC_PREREQ (4,3)
+#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__)
# define __attribute_artificial__ __attribute__ ((__artificial__))
#else
# define __attribute_artificial__ /* Ignore */
@@ -367,12 +412,14 @@
run in pedantic mode if the uses are carefully marked using the
`__extension__' keyword. But this is not generally available before
version 2.8. */
-#if !__GNUC_PREREQ (2,8)
+#if !(__GNUC_PREREQ (2,8) || defined __clang__)
# define __extension__ /* Ignore */
#endif
-/* __restrict is known in EGCS 1.2 and above. */
-#if !__GNUC_PREREQ (2,92)
+/* __restrict is known in EGCS 1.2 and above, and in clang.
+ It works also in C++ mode (outside of arrays), but only when spelled
+ as '__restrict', not 'restrict'. */
+#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3)
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __restrict restrict
# else
@@ -382,8 +429,9 @@
/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
array_name[restrict]
- GCC 3.1 supports this. */
-#if __GNUC_PREREQ (3,1) && !defined __GNUG__
+ GCC 3.1 and clang support this.
+ This syntax is not usable in C++ mode. */
+#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus
# define __restrict_arr __restrict
#else
# ifdef __GNUC__
@@ -398,7 +446,7 @@
# endif
#endif
-#if __GNUC__ >= 3
+#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect)
# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
# define __glibc_likely(cond) __builtin_expect ((cond), 1)
#else
@@ -406,15 +454,10 @@
# define __glibc_likely(cond) (cond)
#endif
-#ifdef __has_attribute
-# define __glibc_has_attribute(attr) __has_attribute (attr)
-#else
-# define __glibc_has_attribute(attr) 0
-#endif
-
#if (!defined _Noreturn \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
- && !__GNUC_PREREQ (4,7))
+ && !(__GNUC_PREREQ (4,7) \
+ || (3 < __clang_major__ + (5 <= __clang_minor__))))
# if __GNUC_PREREQ (2,8)
# define _Noreturn __attribute__ ((__noreturn__))
# else
@@ -443,16 +486,51 @@
#if (!defined _Static_assert && !defined __cplusplus \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
- && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
+ && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
+ || defined __STRICT_ANSI__))
# define _Static_assert(expr, diagnostic) \
extern int (*__Static_assert_function (void)) \
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif
-#include <bits/wordsize.h>
-#include <bits/long-double.h>
+/* The #ifndef lets Gnulib avoid including these on non-glibc
+ platforms, where the includes typically do not exist. */
+#ifdef __GLIBC__
+# include <bits/wordsize.h>
+# include <bits/long-double.h>
+#endif
+
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# ifdef __REDIRECT
+
+/* Alias name defined automatically. */
+# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
+# define __LDBL_REDIR_DECL(name) \
+ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined automatically, with leading underscores. */
+# define __LDBL_REDIR2_DECL(name) \
+ extern __typeof (__##name) __##name \
+ __asm (__ASMNAME ("__" #name "ieee128"));
+
+/* Alias name defined manually. */
+# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
+# define __LDBL_REDIR1_DECL(name, alias) \
+ extern __typeof (name) name __asm (__ASMNAME (#alias));
+
+# define __LDBL_REDIR1_NTH(name, proto, alias) \
+ __REDIRECT_NTH (name, proto, alias)
+# define __REDIRECT_NTH_LDBL(name, proto, alias) \
+ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
+
+/* Unused. */
+# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl
+# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# else
+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
+# endif
+#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
# define __LDBL_COMPAT 1
# ifdef __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
@@ -461,6 +539,8 @@
# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
# define __LDBL_REDIR_NTH(name, proto) \
__LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+# define __LDBL_REDIR2_DECL(name) \
+ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
# define __LDBL_REDIR1_DECL(name, alias) \
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
@@ -471,11 +551,13 @@
__LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
# endif
#endif
-#if !defined __LDBL_COMPAT || !defined __REDIRECT
+#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
+ || !defined __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) name proto
# define __LDBL_REDIR(name, proto) name proto
# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR2_DECL(name)
# define __LDBL_REDIR_DECL(name)
# ifdef __REDIRECT
# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
@@ -506,7 +588,7 @@
check is required to enable the use of generic selection. */
#if !defined __cplusplus \
&& (__GNUC_PREREQ (4, 9) \
- || __glibc_clang_has_extension (c_generic_selections) \
+ || __glibc_has_extension (c_generic_selections) \
|| (!defined __GNUC__ && defined __STDC_VERSION__ \
&& __STDC_VERSION__ >= 201112L))
# define __HAVE_GENERIC_SELECTION 1
@@ -514,4 +596,40 @@
# define __HAVE_GENERIC_SELECTION 0
#endif
+#if __GNUC_PREREQ (10, 0)
+/* Designates a 1-based positional argument ref-index of pointer type
+ that can be used to access size-index elements of the pointed-to
+ array according to access mode, or at least one element when
+ size-index is not provided:
+ access (access-mode, <ref-index> [, <size-index>]) */
+# define __attr_access(x) __attribute__ ((__access__ x))
+# if __GNUC_PREREQ (11, 0)
+# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
+# else
+# define __attr_access_none(argno)
+# endif
+#else
+# define __attr_access(x)
+# define __attr_access_none(argno)
+#endif
+
+#if __GNUC_PREREQ (11, 0)
+/* Designates dealloc as a function to call to deallocate objects
+ allocated by the declared function. */
+# define __attr_dealloc(dealloc, argno) \
+ __attribute__ ((__malloc__ (dealloc, argno)))
+# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)
+#else
+# define __attr_dealloc(dealloc, argno)
+# define __attr_dealloc_free
+#endif
+
+/* Specify that a function such as setjmp or vfork may return
+ twice. */
+#if __GNUC_PREREQ (4, 1)
+# define __attribute_returns_twice__ __attribute__ ((__returns_twice__))
+#else
+# define __attribute_returns_twice__ /* Ignore. */
+#endif
+
#endif /* sys/cdefs.h */
lib/libc/glibc/misc/sys/select.h
@@ -1,5 +1,5 @@
/* `fd_set' type and related macros, and `select'/`pselect' declarations.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -98,10 +98,23 @@ __BEGIN_DECLS
This function is a cancellation point and therefore not marked with
__THROW. */
+#ifndef __USE_TIME_BITS64
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout);
+#else
+# ifdef __REDIRECT
+extern int __REDIRECT (select,
+ (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ struct timeval *__restrict __timeout),
+ __select64);
+# else
+# define select __select64
+# endif
+#endif
#ifdef __USE_XOPEN2K
/* Same as above only that the TIMEOUT value is given with higher
@@ -110,11 +123,25 @@ extern int select (int __nfds, fd_set *__restrict __readfds,
This function is a cancellation point and therefore not marked with
__THROW. */
+# ifndef __USE_TIME_BITS64
extern int pselect (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
const struct timespec *__restrict __timeout,
const __sigset_t *__restrict __sigmask);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (pselect,
+ (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ const struct timespec *__restrict __timeout,
+ const __sigset_t *__restrict __sigmask),
+ __pselect64);
+# else
+# define pselect __pselect64
+# endif
+# endif
#endif
lib/libc/glibc/posix/bits/cpu-set.h
@@ -1,6 +1,6 @@
/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
lib/libc/glibc/posix/bits/types.h
@@ -1,5 +1,5 @@
/* bits/types.h -- definitions of __*_t types underlying *_t types.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -160,6 +160,7 @@ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
+__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t;
__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */
lib/libc/glibc/posix/sys/types.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/signal/signal.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
@@ -27,7 +27,7 @@
__BEGIN_DECLS
#include <bits/types.h>
-#include <bits/signum.h>
+#include <bits/signum-generic.h>
#include <bits/types/sig_atomic_t.h>
@@ -148,7 +148,8 @@ extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
#ifdef __USE_XOPEN_EXTENDED
# ifdef __GNUC__
-extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
+extern int sigpause (int __sig) __asm__ ("__xpg_sigpause")
+ __attribute_deprecated_msg__ ("Use the sigsuspend function instead");
# else
extern int __sigpause (int __sig_or_mask, int __is_sig);
/* Remove a signal from the signal mask and suspend the process. */
@@ -164,7 +165,9 @@ extern int __sigpause (int __sig_or_mask, int __is_sig);
simply do not work in many situations. Use `sigprocmask' instead. */
/* Compute mask for signal SIG. */
-# define sigmask(sig) ((int)(1u << ((sig) - 1)))
+# define sigmask(sig) \
+ __glibc_macro_warning ("sigmask is deprecated") \
+ ((int)(1u << ((sig) - 1)))
/* Block signals in MASK, returning the old mask. */
extern int sigblock (int __mask) __THROW __attribute_deprecated__;
@@ -266,10 +269,23 @@ extern int sigwaitinfo (const sigset_t *__restrict __set,
This function is a cancellation point and therefore not marked with
__THROW. */
+# ifndef __USE_TIME_BITS64
extern int sigtimedwait (const sigset_t *__restrict __set,
siginfo_t *__restrict __info,
const struct timespec *__restrict __timeout)
__nonnull ((1));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (sigtimedwait,
+ (const sigset_t *__restrict __set,
+ siginfo_t *__restrict __info,
+ const struct timespec *__restrict __timeout),
+ __sigtimedwait64)
+ __nonnull ((1));
+# else
+# define sigtimedwait __sigtimedwait64
+# endif
+# endif
/* Send signal SIG to the process PID. Associate data in VAL with the
signal. */
@@ -281,12 +297,6 @@ extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
#ifdef __USE_MISC
-/* Names of the signals. This variable exists only for compatibility.
- Use `strsignal' instead (see <string.h>). */
-extern const char *const _sys_siglist[_NSIG];
-extern const char *const sys_siglist[_NSIG];
-
-
/* Get machine-dependent `struct sigcontext' and signal subcodes. */
# include <bits/sigcontext.h>
@@ -311,9 +321,11 @@ extern int sigreturn (struct sigcontext *__scp) __THROW;
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
calls be restarted after signal SIG. */
-extern int siginterrupt (int __sig, int __interrupt) __THROW;
+extern int siginterrupt (int __sig, int __interrupt) __THROW
+ __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead");
# include <bits/sigstack.h>
+# include <bits/sigstksz.h>
# include <bits/ss_flags.h>
/* Alternate signal handler stack interface.
@@ -340,16 +352,21 @@ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
/* Simplified interface for signal management. */
/* Add SIG to the calling process' signal mask. */
-extern int sighold (int __sig) __THROW;
+extern int sighold (int __sig) __THROW
+ __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
/* Remove SIG from the calling process' signal mask. */
-extern int sigrelse (int __sig) __THROW;
+extern int sigrelse (int __sig) __THROW
+ __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
/* Set the disposition of SIG to SIG_IGN. */
-extern int sigignore (int __sig) __THROW;
+extern int sigignore (int __sig) __THROW
+ __attribute_deprecated_msg__ ("Use the signal function instead");
/* Set the disposition of SIG. */
-extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
+extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW
+ __attribute_deprecated_msg__
+ ("Use the signal and sigprocmask functions instead");
#endif
#if defined __USE_POSIX199506 || defined __USE_UNIX98
lib/libc/glibc/stdlib/bits/stdlib-float.h
@@ -1,5 +1,5 @@
/* Floating-point inline functions for stdlib.h.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/stdlib/alloca.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
@@ -25,7 +25,7 @@
__BEGIN_DECLS
-/* Remove any previous definitions. */
+/* Remove any previous definition. */
#undef alloca
/* Allocate a block that will be freed when the calling function exits. */
lib/libc/glibc/stdlib/at_quick_exit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/stdlib/atexit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/stdlib/errno.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+/*
+ * ISO C99 Standard: 7.5 Errors <errno.h>
+ */
+
+#ifndef _ERRNO_H
+#define _ERRNO_H 1
+
+#include <features.h>
+
+/* The system-specific definitions of the E* constants, as macros. */
+#include <bits/errno.h>
+
+/* When included from assembly language, this header only provides the
+ E* constants. */
+#ifndef __ASSEMBLER__
+
+__BEGIN_DECLS
+
+/* The error code set by various library functions. */
+extern int *__errno_location (void) __THROW __attribute_const__;
+# define errno (*__errno_location ())
+
+# ifdef __USE_GNU
+
+/* The full and simple forms of the name with which the program was
+ invoked. These variables are set up automatically at startup based on
+ the value of argv[0]. */
+extern char *program_invocation_name;
+extern char *program_invocation_short_name;
+
+#include <bits/types/error_t.h>
+
+# endif /* __USE_GNU */
+
+__END_DECLS
+
+#endif /* !__ASSEMBLER__ */
+#endif /* errno.h */
lib/libc/glibc/stdlib/exit.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/stdlib/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
@@ -397,7 +397,7 @@ extern long int a64l (const char *__s)
`initstate' and `setstate' functions are those from BSD Unices.
The `rand' and `srand' functions are required by the ANSI standard.
We provide both interfaces to the same random number generator. */
-/* Return a random long integer between 0 and RAND_MAX inclusive. */
+/* Return a random long integer between 0 and 2^31-1 inclusive. */
extern long int random (void) __THROW;
/* Seed the random number generator with the given number. */
@@ -550,6 +550,9 @@ extern void *calloc (size_t __nmemb, size_t __size)
extern void *realloc (void *__ptr, size_t __size)
__THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
+/* Free a block allocated by `malloc', `realloc' or `calloc'. */
+extern void free (void *__ptr) __THROW;
+
#ifdef __USE_MISC
/* Re-allocate the previously allocated block in PTR, making the new
block large enough for NMEMB elements of SIZE bytes each. */
@@ -558,11 +561,13 @@ extern void *realloc (void *__ptr, size_t __size)
between objects pointed by the old and new pointers. */
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
__THROW __attribute_warn_unused_result__
- __attribute_alloc_size__ ((2, 3));
-#endif
+ __attribute_alloc_size__ ((2, 3))
+ __attr_dealloc_free;
-/* Free a block allocated by `malloc', `realloc' or `calloc'. */
-extern void free (void *__ptr) __THROW;
+/* Add reallocarray as its own deallocator. */
+extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
+ __THROW __attr_dealloc (reallocarray, 1);
+#endif
#ifdef __USE_MISC
# include <alloca.h>
@@ -788,7 +793,8 @@ extern int system (const char *__command) __wur;
/* Return a malloc'd string containing the canonical absolute name of the
existing named file. */
extern char *canonicalize_file_name (const char *__name)
- __THROW __nonnull ((1)) __wur;
+ __THROW __nonnull ((1)) __attribute_malloc__
+ __attr_dealloc_free __wur;
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
@@ -931,12 +937,13 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW;
/* Convert a multibyte string to a wide char string. */
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
- const char *__restrict __s, size_t __n) __THROW;
+ const char *__restrict __s, size_t __n) __THROW
+ __attr_access ((__read_only__, 2));
/* Convert a wide char string to multibyte string. */
extern size_t wcstombs (char *__restrict __s,
const wchar_t *__restrict __pwcs, size_t __n)
- __THROW;
-
+ __THROW
+ __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
#ifdef __USE_MISC
/* Determine whether the string value of RESPONSE matches the affirmation
@@ -990,7 +997,7 @@ extern char *ptsname (int __fd) __THROW __wur;
terminal associated with the master FD is open on in BUF.
Return 0 on success, otherwise an error number. */
extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
- __THROW __nonnull ((2));
+ __THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3));
/* Open a master pseudo terminal and return its file descriptor. */
extern int getpt (void);
@@ -1016,7 +1023,9 @@ extern int ttyslot (void) __THROW;
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
# include <bits/stdlib.h>
#endif
-#ifdef __LDBL_COMPAT
+
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# include <bits/stdlib-ldbl.h>
#endif
lib/libc/glibc/string/bits/endian.h
@@ -1,5 +1,5 @@
/* Endian macros for string.h functions
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 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
lib/libc/glibc/string/endian.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/aarch64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for AArch64.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -75,6 +75,11 @@ call_weak_fn:
.hidden _init
.type _init, %function
_init:
+#if HAVE_AARCH64_PAC_RET
+ PACIASP
+#else
+ BTI_C
+#endif
stp x29, x30, [sp, -16]!
mov x29, sp
#if PREINIT_FUNCTION_WEAK
@@ -89,5 +94,10 @@ _init:
.hidden _fini
.type _fini, %function
_fini:
+#if HAVE_AARCH64_PAC_RET
+ PACIASP
+#else
+ BTI_C
+#endif
stp x29, x30, [sp, -16]!
mov x29, sp
lib/libc/glibc/sysdeps/aarch64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for AArch64.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -37,10 +37,18 @@
/* crtn.S puts function epilogues in the .init and .fini sections
corresponding to the prologues in crti.S. */
+#include <sysdep.h>
+
.section .init,"ax",%progbits
ldp x29, x30, [sp], 16
+#if HAVE_AARCH64_PAC_RET
+ AUTIASP
+#endif
RET
.section .fini,"ax",%progbits
ldp x29, x30, [sp], 16
+#if HAVE_AARCH64_PAC_RET
+ AUTIASP
+#endif
RET
lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/aarch64/start.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -43,10 +43,9 @@
*/
.text
- .globl _start
- .type _start,#function
-_start:
+ENTRY(_start)
/* Create an initial frame with 0 LR and FP */
+ cfi_undefined (x30)
mov x29, #0
mov x30, #0
@@ -64,26 +63,16 @@ _start:
# ifdef SHARED
adrp x0, :got:main
ldr PTR_REG (0), [x0, #:got_lo12:main]
-
- adrp x3, :got:__libc_csu_init
- ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
-
- adrp x4, :got:__libc_csu_fini
- ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
# else
adrp x0, __wrap_main
add x0, x0, :lo12:__wrap_main
- adrp x3, __libc_csu_init
- add x3, x3, :lo12:__libc_csu_init
- adrp x4, __libc_csu_fini
- add x4, x4, :lo12:__libc_csu_fini
# endif
#else
/* Set up the other arguments in registers */
MOVL (0, main)
- MOVL (3, __libc_csu_init)
- MOVL (4, __libc_csu_fini)
#endif
+ mov x3, #0 /* Used to be init. */
+ mov x4, #0 /* Used to be fini. */
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
stack_end) */
@@ -100,8 +89,10 @@ _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
b main
#endif
+END(_start)
/* Define a symbol for the first piece of initialized data. */
.data
lib/libc/glibc/sysdeps/aarch64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,29 +25,90 @@
# define AARCH64_R(NAME) R_AARCH64_ ## NAME
# define PTR_REG(n) x##n
# define PTR_LOG_SIZE 3
-# define DELOUSE(n)
+# 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 DELOUSE(n) mov w##n, w##n
+# define PTR_ARG(n) mov w##n, w##n
+# define SIZE_ARG(n) mov w##n, w##n
#endif
#define PTR_SIZE (1<<PTR_LOG_SIZE)
+#ifndef __ASSEMBLER__
+/* Strip pointer authentication code from pointer p. */
+static inline void *
+strip_pac (void *p)
+{
+ register void *ra asm ("x30") = (p);
+ asm ("hint 7 // xpaclri" : "+r"(ra));
+ return ra;
+}
+
+/* This is needed when glibc is built with -mbranch-protection=pac-ret
+ with a gcc that is affected by PR target/94891. */
+# if HAVE_AARCH64_PAC_RET
+# undef RETURN_ADDRESS
+# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n))
+# endif
+#endif
+
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+/* Branch Target Identitication support. */
+#if HAVE_AARCH64_BTI
+# define BTI_C hint 34
+# define BTI_J hint 36
+#else
+# define BTI_C nop
+# define BTI_J nop
+#endif
+
+/* Return address signing support (pac-ret). */
+#define PACIASP hint 25
+#define AUTIASP hint 29
+
+/* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */
+#define FEATURE_1_AND 0xc0000000
+#define FEATURE_1_BTI 1
+#define FEATURE_1_PAC 2
+
+/* Add a NT_GNU_PROPERTY_TYPE_0 note. */
+#define GNU_PROPERTY(type, value) \
+ .section .note.gnu.property, "a"; \
+ .p2align 3; \
+ .word 4; \
+ .word 16; \
+ .word 5; \
+ .asciz "GNU"; \
+ .word type; \
+ .word 4; \
+ .word value; \
+ .word 0; \
+ .text
+
+/* Add GNU property note with the supported features to all asm code
+ where sysdep.h is included. */
+#if HAVE_AARCH64_BTI && HAVE_AARCH64_PAC_RET
+GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
+#elif HAVE_AARCH64_BTI
+GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI)
+#endif
+
/* Define an entry point visible from C. */
#define ENTRY(name) \
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
- .align 4; \
+ .p2align 6; \
C_LABEL(name) \
cfi_startproc; \
+ BTI_C; \
CALL_MCOUNT
/* Define an entry point visible from C. */
@@ -57,6 +118,7 @@
.p2align align; \
C_LABEL(name) \
cfi_startproc; \
+ BTI_C; \
CALL_MCOUNT
/* Define an entry point visible from C with a specified alignment and
@@ -68,11 +130,12 @@
.globl C_SYMBOL_NAME(name); \
.type C_SYMBOL_NAME(name),%function; \
.p2align align; \
- .rep padding; \
+ .rep padding - 1; /* -1 for bti c. */ \
nop; \
.endr; \
C_LABEL(name) \
cfi_startproc; \
+ BTI_C; \
CALL_MCOUNT
#undef END
lib/libc/glibc/sysdeps/alpha/nptl/bits/pthreadtypes-arch.h
@@ -1,61 +0,0 @@
-/* Machine-specific pthread type layouts. Alpha version.
- Copyright (C) 2003-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#define __SIZEOF_PTHREAD_ATTR_T 56
-#define __SIZEOF_PTHREAD_MUTEX_T 40
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCK_T 56
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
- int __cur_writer;
- int __shared;
- unsigned long int __pad1;
- unsigned long int __pad2;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned int __flags;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/alpha/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for Alpha.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 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
lib/libc/glibc/sysdeps/alpha/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for Alpha.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 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
lib/libc/glibc/sysdeps/alpha/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Alpha version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/alpha/start.S
@@ -1,5 +1,5 @@
/* Startup code for Alpha/ELF.
- Copyright (C) 1993-2020 Free Software Foundation, Inc.
+ Copyright (C) 1993-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>
@@ -55,9 +55,8 @@ _start:
ldl a1, 16(sp) /* get argc */
lda a2, 24(sp) /* get argv */
- /* Load address of our own entry points to .fini and .init. */
- lda a3, __libc_csu_init
- lda a4, __libc_csu_fini
+ mov $r31, a3 /* Used to be init. */
+ mov $r31, a4 /* Used to be fini. */
/* Store address of the shared library termination function. */
mov v0, a5
lib/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h
@@ -1,71 +0,0 @@
-/* Copyright (C) 2002-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#include <endian.h>
-
-#define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCK_T 32
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Data structure for mutex handling. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
-#else
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
-#endif
- int __cur_writer;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/arm/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/arm/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/arm/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Alpha version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/arm/start.S
@@ -1,5 +1,5 @@
/* Startup code for ARM & ELF
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -94,30 +94,20 @@ _start:
adr a4, .L_GOT
add sl, sl, a4
- ldr ip, .L_GOT+4 /* __libc_csu_fini */
- ldr ip, [sl, ip]
+ mov a4, #0 /* Used to be init. */
+ push { a4 } /* Used to be fini. */
- push { ip } /* Push __libc_csu_fini */
-
- ldr a4, .L_GOT+8 /* __libc_csu_init */
- ldr a4, [sl, a4]
-
- ldr a1, .L_GOT+12 /* main */
+ ldr a1, .L_GOT+4 /* main */
ldr a1, [sl, a1]
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
/* Let the libc call main and exit with its return code. */
bl __libc_start_main(PLT)
#else
- /* Fetch address of __libc_csu_fini */
- ldr ip, =__libc_csu_fini
-
- /* Push __libc_csu_fini */
- push { ip }
- /* Set up the other arguments in registers */
+ mov a4, #0 /* Used to init. */
+ push { a4 } /* Used to fini. */
ldr a1, =main
- ldr a4, =__libc_csu_init
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
/* Let the libc call main and exit with its return code. */
@@ -131,8 +121,6 @@ _start:
.align 2
.L_GOT:
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
- .word __libc_csu_fini(GOT)
- .word __libc_csu_init(GOT)
.word main(GOT)
#endif
lib/libc/glibc/sysdeps/arm/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for ARM.
- Copyright (C) 1997-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 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
lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/generic/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Generic version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/generic/dwarf2.h
@@ -1,6 +1,6 @@
/* Declarations and definitions of codes relating to the DWARF2 symbolic
debugging information format.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com). Derived from the
DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
lib/libc/glibc/sysdeps/generic/libc-lock.h
@@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Stub version.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -125,16 +125,4 @@
/* We need portable names for some of the functions. */
#define __libc_mutex_unlock
-/* Type for key of thread specific data. */
-typedef int __libc_key_t;
-
-/* Create key for thread specific data. */
-#define __libc_key_create(KEY,DEST) ((void) (KEY), (void) (DEST), -1)
-
-/* Set thread-specific data associated with KEY to VAL. */
-#define __libc_setspecific(KEY,VAL) ((void) (KEY), (void) (VAL))
-
-/* Get thread-specific data associated with KEY. */
-#define __libc_getspecific(KEY) ((void) (KEY), (void *) 0)
-
#endif /* libc-lock.h */
lib/libc/glibc/sysdeps/generic/libc-symver.h
@@ -0,0 +1,88 @@
+/* Symbol version management.
+ Copyright (C) 1995-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+/* This file is included from <libc-symbols.h> for !_ISOMAC, and
+ unconditionally from <shlib-compat.h>. */
+
+#ifndef _LIBC_SYMVER_H
+#define _LIBC_SYMVER_H 1
+
+#include <config.h>
+
+/* Use symbol_version_reference to specify the version a symbol
+ reference should link to. Use symbol_version or
+ default_symbol_version for the definition of a versioned symbol.
+ The difference is that the latter is a no-op in non-shared
+ builds.
+
+ _set_symbol_version is similar to symbol_version_reference, except
+ that this macro expects the name and symbol version as a single
+ string or token sequence, with an @ or @@ separator. (A string is
+ used in C mode and a token sequence in assembler mode.)
+ _set_symbol_version only be used for definitions because it may
+ introduce an alias symbol that would not be globally unique for
+ mere references. The _set_symbol_version macro is used to define
+ default_symbol_version and compat_symbol. */
+
+#ifdef __ASSEMBLER__
+# define symbol_version_reference(real, name, version) \
+ .symver real, name##@##version
+#else
+# define symbol_version_reference(real, name, version) \
+ __asm__ (".symver " #real "," #name "@" #version)
+#endif /* !__ASSEMBLER__ */
+
+#if SYMVER_NEEDS_ALIAS
+/* If the assembler cannot support multiple versions for the same
+ symbol, introduce __SInnn_ aliases to which the symbol version is
+ attached. */
+# define __symbol_version_unique_concat(x, y) __SI ## x ## _ ## y
+# define _symbol_version_unique_concat(x, y) \
+ __symbol_version_unique_concat (x, y)
+# define _symbol_version_unique_alias(name) \
+ _symbol_version_unique_concat (name, __COUNTER__)
+# ifdef __ASSEMBLER__
+# define _set_symbol_version_2(real, alias, name_version) \
+ .globl alias ASM_LINE_SEP \
+ .equiv alias, real ASM_LINE_SEP \
+ .symver alias, name_version
+# else
+# define _set_symbol_version_2(real, alias, name_version) \
+ __asm__ (".globl " #alias "\n\t" \
+ ".equiv " #alias ", " #real "\n\t" \
+ ".symver " #alias "," name_version)
+# endif
+# define _set_symbol_version_1(real, alias, name_version) \
+ _set_symbol_version_2 (real, alias, name_version)
+/* REAL must be globally unique, so that the counter also produces
+ globally unique symbols. */
+# define _set_symbol_version(real, name_version) \
+ _set_symbol_version_1 (real, _symbol_version_unique_alias (real), \
+ name_version)
+# else /* !SYMVER_NEEDS_ALIAS */
+# ifdef __ASSEMBLER__
+# define _set_symbol_version(real, name_version) \
+ .symver real, name_version
+# else
+# define _set_symbol_version(real, name_version) \
+ __asm__ (".symver " #real "," name_version)
+# endif
+#endif /* !SYMVER_NEEDS_ALIAS */
+
+
+#endif /* _LIBC_SYMVER_H */
lib/libc/glibc/sysdeps/generic/single-thread.h
@@ -1,5 +1,5 @@
/* Single thread optimization, generic version.
- Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Copyright (C) 2019-2021 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
lib/libc/glibc/sysdeps/generic/struct_stat_time64.h
@@ -0,0 +1,6 @@
+#ifndef _BITS_STRUCT_STAT_TIME64_H
+#define _BITS_STRUCT_STAT_TIME64_H 1
+
+#define __stat64_t64 stat64
+
+#endif
lib/libc/glibc/sysdeps/generic/sysdep.h
@@ -1,5 +1,5 @@
/* Generic asm macros used on many machines.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 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
lib/libc/glibc/sysdeps/generic/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. Generic version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/generic/xstatver.h
@@ -0,0 +1,4 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER 0
+#define _MKNOD_VER 0
lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2021 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
lib/libc/glibc/sysdeps/hppa/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for HPPA
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/hppa/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for HPPA
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/hppa/start.S
@@ -1,5 +1,5 @@
/* ELF startup code for HPPA.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -36,8 +36,6 @@
.import main, code
.import $global$, data
.import __libc_start_main, code
- .import __libc_csu_fini, code
- .import __libc_csu_init, code
/* Have the linker create plabel words so we get PLABEL32
relocs and not 21/14. The use of 21/14 relocs is only
@@ -52,10 +50,6 @@
.word P%main
.Lp__libc_start_main:
.word P%__libc_start_main
-.Lp__libc_csu_fini:
- .word P%__libc_csu_fini
-.Lp__libc_csu_init:
- .word P%__libc_csu_init
.text
.align 4
@@ -77,8 +71,8 @@ _start:
1. r26 - Application main
2. r25 - argc
3. r24 - argv
- 4. r23 - __libc_csu_init
- 5. sp-52 - __libc_csu_fini
+ 4. r23 - init (unused)
+ 5. sp-52 - fini (unused)
6. sp-56 - rtld_fini
7. sp-60 - stackend */
@@ -108,14 +102,6 @@ _start:
addil LT'.Lpmain, %r19
ldw RT'.Lpmain(%r1), %r26
ldw 0(%r26),%r26
- /* void (*init) (void) (4th argument) */
- addil LT'.Lp__libc_csu_init, %r19
- ldw RT'.Lp__libc_csu_init(%r1), %r23
- ldw 0(%r23), %r23
- /* void (*fini) (void) (5th argument) */
- addil LT'.Lp__libc_csu_fini, %r19
- ldw RT'.Lp__libc_csu_fini(%r1), %r22
- ldw 0(%r22), %r22
#else
/* Load $global$ address into %dp */
ldil L%$global$, %dp
@@ -124,13 +110,9 @@ _start:
/* load main (1st argument) */
ldil LR'.Lpmain, %r26
ldw RR'.Lpmain(%r26), %r26
- /* void (*init) (void) (4th argument) */
- ldil LR'.Lp__libc_csu_init, %r23
- ldw RR'.Lp__libc_csu_init(%r23), %r23
- /* void (*fini) (void) (5th argument) */
- ldil LR'.Lp__libc_csu_fini, %r22
- ldw RR'.Lp__libc_csu_fini(%r22), %r22
#endif
+ ldi 0,%r23 /* Used to be init. */
+ ldi 0,%r22 /* Used to be fini. */
/* Store 5th argument */
stw %r22, -52(%sp)
/* void *stack_end (7th argument) */
lib/libc/glibc/sysdeps/hppa/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for HP/PA.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
lib/libc/glibc/sysdeps/htl/bits/pthread.h
@@ -1,5 +1,5 @@
/* Pthread data structures. Generic version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/htl/libc-lockP.h
@@ -1,5 +1,5 @@
/* Private libc-internal interface for mutex locks.
- Copyright (C) 2015-2020 Free Software Foundation, Inc.
+ Copyright (C) 2015-2021 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
@@ -22,9 +22,6 @@
#include <pthread.h>
#include <pthread-functions.h>
-/* Type for key to thread-specific data. */
-typedef pthread_key_t __libc_key_t;
-
/* If we check for a weakly referenced symbol and then perform a
normal jump to it te code generated for some platforms in case of
PIC is unnecessarily slow. What would happen is that the function
@@ -109,16 +106,6 @@ extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
-extern int __pthread_key_create (pthread_key_t *__key,
- void (*__destr_function) (void *));
-
-extern int __pthread_key_delete (pthread_key_t __key);
-
-extern int __pthread_setspecific (pthread_key_t __key,
- const void *__pointer);
-
-extern void *__pthread_getspecific (pthread_key_t __key);
-
extern int __pthread_once (pthread_once_t *__once_control,
void (*__init_routine) (void));
lib/libc/glibc/sysdeps/htl/pthread.h
@@ -1,5 +1,5 @@
/* Posix threads. Hurd version.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
@@ -222,6 +222,32 @@ extern void pthread_exit (void *__status) __attribute__ ((__noreturn__));
the exit status of the thread in *STATUS. */
extern int pthread_join (pthread_t __threadp, void **__status);
+#ifdef __USE_GNU
+/* Check whether thread TH has terminated. If yes return the status of
+ the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
+extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
+
+/* Make calling thread wait for termination of the thread TH, but only
+ until TIMEOUT. The exit status of the thread is stored in
+ *THREAD_RETURN, if THREAD_RETURN is not NULL.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
+ const struct timespec *__abstime);
+
+/* Make calling thread wait for termination of the thread TH, but only
+ until TIMEOUT measured against the clock specified by CLOCKID. The
+ exit status of the thread is stored in *THREAD_RETURN, if
+ THREAD_RETURN is not NULL.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
+ clockid_t __clockid,
+ const struct timespec *__abstime);
+#endif
+
/* Indicate that the storage for THREAD can be reclaimed when it
terminates. */
extern int pthread_detach (pthread_t __threadp);
@@ -273,6 +299,7 @@ extern pthread_t pthread_self (void) __THROW;
#ifdef __USE_XOPEN2K
# define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED
# define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST
+# define PTHREAD_MUTEX_ROBUST_NP __PTHREAD_MUTEX_ROBUST
#endif
#include <bits/types/struct___pthread_mutexattr.h>
@@ -400,6 +427,13 @@ extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex,
__THROWNL __nonnull ((1, 2));
#endif
+#ifdef __USE_GNU
+extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
+ clockid_t __clockid,
+ const struct timespec *__restrict
+ __abstime) __THROWNL __nonnull ((1, 3));
+#endif
+
/* Unlock MUTEX. */
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
@@ -516,6 +550,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 3));
+
+# ifdef __USE_GNU
+/* Wait for condition variable COND to be signaled or broadcast until
+ ABSTIME measured by the specified clock. MUTEX is assumed to be
+ locked before. CLOCK is the clock to use. ABSTIME is an absolute
+ time specification against CLOCK's epoch.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
+ pthread_mutex_t *__restrict __mutex,
+ __clockid_t __clock_id,
+ const struct timespec *__restrict __abstime)
+ __nonnull ((1, 2, 4));
+# endif
/* Spin locks. */
@@ -549,42 +598,6 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
__nonnull ((1));
-# if defined __USE_EXTERN_INLINES && defined _LIBC
-
-# include <bits/spin-lock-inline.h>
-
-__extern_inline int
-pthread_spin_destroy (pthread_spinlock_t *__lock)
-{
- return __pthread_spin_destroy (__lock);
-}
-
-__extern_inline int
-pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
-{
- return __pthread_spin_init (__lock, __pshared);
-}
-
-__extern_inline int
-pthread_spin_lock (pthread_spinlock_t *__lock)
-{
- return __pthread_spin_lock (__lock);
-}
-
-__extern_inline int
-pthread_spin_trylock (pthread_spinlock_t *__lock)
-{
- return __pthread_spin_trylock (__lock);
-}
-
-__extern_inline int
-pthread_spin_unlock (pthread_spinlock_t *__lock)
-{
- return __pthread_spin_unlock (__lock);
-}
-
-# endif /* Use extern inlines. */
-
#endif /* XPG6. */
@@ -658,6 +671,13 @@ extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwl
__THROWNL __nonnull ((1, 2));
# endif
+# ifdef __USE_GNU
+extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
+ clockid_t __clockid,
+ const struct timespec *__restrict
+ __abstime) __THROWNL __nonnull ((1, 3));
+# endif
+
/* Acquire the rwlock *RWLOCK for writing. */
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@@ -674,6 +694,13 @@ extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwl
__THROWNL __nonnull ((1, 2));
# endif
+# ifdef __USE_GNU
+extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
+ clockid_t __clockid,
+ const struct timespec *__restrict
+ __abstime) __THROWNL __nonnull ((1, 3));
+# endif
+
/* Release the lock held by the current thread on *RWLOCK. */
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
__THROWNL __nonnull ((1));
@@ -795,14 +822,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;
/* Set the caller thread's thread specific value of KEY to VALUE. */
extern int pthread_setspecific (pthread_key_t __key, const void *__value)
- __THROW;
+ __THROW __attr_access_none (2);
/* Dynamic package initialization. */
#include <bits/types/struct___pthread_once.h>
-#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT
+#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
/* Call INIT_ROUTINE if this function has never been called with
*ONCE_CONTROL, otherwise do nothing. */
lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. Hurd i386 version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/i386/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/i386/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/i386/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF i386 ABI.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -87,11 +87,9 @@ ENTRY (_start)
call 1f
addl $_GLOBAL_OFFSET_TABLE_, %ebx
- /* Push address of our own entry points to .fini and .init. */
- leal __libc_csu_fini@GOTOFF(%ebx), %eax
- pushl %eax
- leal __libc_csu_init@GOTOFF(%ebx), %eax
- pushl %eax
+ /* This used to be the addresses of .fini and .init. */
+ pushl $0
+ pushl $0
pushl %ecx /* Push second argument: argv. */
pushl %esi /* Push first argument: argc. */
@@ -112,9 +110,9 @@ ENTRY (_start)
But let the libc call main. */
call __libc_start_main@PLT
#else
- /* Push address of our own entry points to .fini and .init. */
- pushl $__libc_csu_fini
- pushl $__libc_csu_init
+ /* This used to be the addresses of .fini and .init. */
+ pushl $0
+ pushl $0
pushl %ecx /* Push second argument: argv. */
pushl %esi /* Push first argument: argc. */
lib/libc/glibc/sysdeps/i386/symbol-hacks.h
@@ -1,5 +1,5 @@
/* Hacks needed for symbol manipulation. i386 version.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/sysdeps/i386/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for i386.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 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
@@ -18,8 +18,6 @@
#include <sysdeps/x86/sysdep.h>
-#include <features.h> /* For __GNUC_PREREQ. */
-
/* It is desirable that the names of PIC thunks match those used by
GCC so that multiple copies are eliminated by the linker. Because
GCC 4.6 and earlier use __i686 in the names, it is necessary to
@@ -97,9 +95,9 @@ GET_PC_THUNK(reg): \
# define SETUP_PIC_REG_STR(reg) \
".ifndef " GET_PC_THUNK_STR (reg) "\n" \
- "section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," \
+ ".section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," \
+ GET_PC_THUNK_STR (reg) ",comdat\n" \
".globl " GET_PC_THUNK_STR (reg) "\n" \
- GET_PC_THUNK_STR (reg) ",comdat\n" \
".hidden " GET_PC_THUNK_STR (reg) "\n" \
".p2align 4\n" \
".type " GET_PC_THUNK_STR (reg) ",@function\n" \
lib/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h
@@ -1,63 +0,0 @@
-/* Copyright (C) 2003-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
-
- 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#define __SIZEOF_PTHREAD_ATTR_T 56
-#define __SIZEOF_PTHREAD_MUTEX_T 40
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCK_T 56
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 32
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-/* Data structure for reader-write lock variable handling. The
- structure of the attribute type is not exposed on purpose. */
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
- int __cur_writer;
- int __shared;
- unsigned long int __pad1;
- unsigned long int __pad2;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned int __flags;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/ia64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for IA64.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/ia64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for ARM.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions. IA-64 version.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/ia64/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. IA-64 version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/ia64/start.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
@@ -82,20 +82,15 @@ _start:
{
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
addl out0 = @ltoff(@fptr(main)), gp
- addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
+ mov out3 = r0 /* Used to be init. */
;;
}
{ .mmi
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
ld8 out0 = [out0] /* pointer to `main' function descriptor */
- addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
+ mov out4 = r0 /* Used to be fini. */
;;
}
- { .mmi
- ld8 out3 = [out3] /* pointer to `init' function descriptor */
- ld8 out4 = [out4] /* pointer to `fini' function descriptor */
- nop 0
- }
.body
{ .mib
st8 [r3] = r10
lib/libc/glibc/sysdeps/ia64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
lib/libc/glibc/sysdeps/init_array/crti.S
@@ -1,27 +0,0 @@
-/* Dummy crti file.
-
- In this configuration, crti.o and crtn.o are both empty because the
- .init_array/.fini_array sections are used exclusively.
-
- Older ports cannot use this because even if the linker used to
- build libc itself has .init_array support, we don't want to produce
- a crt[in].o that presume a linker that new will be used to link
- other things later.
-
- But new configurations without compatibility concerns for
- toolchains without .init_array support can use this to avoid the
- superfluous .init and .fini boilerplate code. */
-
-#ifdef PREINIT_FUNCTION
-
-#if PREINIT_FUNCTION_WEAK
-# error PREINIT_FUNCTION_WEAK is unsupported
-#endif
-
-/* This arranges for PREINIT_FUNCTION to be called upon loading a library that
- contains crti.o. */
-
- .section .init_array,"a",%init_array
- .dc.a PREINIT_FUNCTION
-
-#endif
lib/libc/glibc/sysdeps/init_array/crtn.S
@@ -1,13 +0,0 @@
-/* Dummy crtn file.
-
- In this configuration, crti.o and crtn.o are both empty because the
- .init_array/.fini_array sections are used exclusively.
-
- Older ports cannot use this because even if the linker used to
- build libc itself has .init_array support, we don't want to produce
- a crt[in].o that presume a linker that new will be used to link
- other things later.
-
- But new configurations without compatibility concerns for
- toolchains without .init_array support can use this to avoid the
- superfluous .init and .fini boilerplate code. */
lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for Coldfire.
- Copyright (C) 1998-2020 Free Software Foundation, Inc.
+ Copyright (C) 1998-2021 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
lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for m680x0.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 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
lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
lib/libc/glibc/sysdeps/m68k/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for m68k.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/m68k/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for m68k.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/m68k/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF m68k ABI.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -76,15 +76,14 @@ _start:
pea (%a1) /* Push address of the shared library
termination function. */
+ /* These used to be addresses of the .fini and .init entry points. */
+ clr.l -(%sp)
+ clr.l -(%sp)
+
#ifdef PIC
/* Load PIC register. */
LOAD_GOT (%a5)
- /* Push the address of our own entry points to `.fini' and
- `.init'. */
- move.l __libc_csu_fini@GOT(%a5), -(%sp)
- move.l __libc_csu_init@GOT(%a5), -(%sp)
-
pea (%a0) /* Push second argument: argv. */
move.l %d0, -(%sp) /* Push first argument: argc. */
@@ -94,10 +93,6 @@ _start:
let the libc call main. */
jbsr __libc_start_main@PLTPC
#else
- /* Push the address of our own entry points to `.fini' and
- `.init'. */
- pea __libc_csu_fini
- pea __libc_csu_init
pea (%a0) /* Push second argument: argv. */
move.l %d0, -(%sp) /* Push first argument: argc. */
lib/libc/glibc/sysdeps/m68k/symbol-hacks.h
@@ -1,5 +1,5 @@
/* Hacks needed for symbol manipulation. m68k version.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/sysdeps/m68k/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for m68k.
- Copyright (C) 1998-2020 Free Software Foundation, Inc.
+ Copyright (C) 1998-2021 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
lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h
@@ -1,263 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-#include <bits/types.h>
-
-/* NOTE: The size of this structure (32 ints) is known in
- <hurd/hurd_types.defs>, since it is used in the `io_stat' RPC. MiG
- does not cope at all well with the passed C structure not being of
- the expected size. There are some filler words at the end to allow
- for future expansion. To increase the size of the structure used
- in the RPC and retain binary compatibility, we would need to assign
- a new message number. */
-
-struct stat
- {
- int st_fstype; /* File system type. */
- __fsid_t st_fsid; /* File system ID. */
-#define st_dev st_fsid
-
-#ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File number. */
-#else
- __ino64_t st_ino; /* File number. */
-#endif
- unsigned int st_gen; /* To detect reuse of file numbers. */
- __dev_t st_rdev; /* Device if special file. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Number of links. */
-
- __uid_t st_uid; /* Owner. */
- __gid_t st_gid; /* Owning group. */
-
-#ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size in bytes. */
-#else
- __off64_t st_size; /* Size in bytes. */
-#endif
-
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
-
- __blksize_t st_blksize; /* Optimal size for I/O. */
-
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated.
- Not related to `st_blksize'. */
-#else
- __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
- Not related to `st_blksize'. */
-#endif
-
- __uid_t st_author; /* File author. */
-
- unsigned int st_flags; /* User-defined flags.
- High 16 bits can be set only by root. */
-
-#ifndef __USE_FILE_OFFSET64
-# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11)
-#else
-# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
-#endif
- int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
-#undef _SPARE_SIZE
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- int st_fstype; /* File system type. */
- __fsid_t st_fsid; /* File system ID. */
-# define st_dev st_fsid
-
- __ino64_t st_ino; /* File number. */
- unsigned int st_gen; /* To detect reuse of file numbers. */
- __dev_t st_rdev; /* Device if special file. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Number of links. */
-
- __uid_t st_uid; /* Owner. */
- __gid_t st_gid; /* Owning group. */
-
- __off64_t st_size; /* Size in bytes. */
-
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
-
- __blksize_t st_blksize; /* Optimal size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated.
- Not related to `st_blksize'. */
-
- __uid_t st_author; /* File author. */
-
- unsigned int st_flags; /* User-defined flags.
- High 16 bits can be set only by root. */
-
-#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8)
- int st_spare[_SPARE_SIZE]; /* Room for future expansion. */
-#undef _SPARE_SIZE
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-#define __S_IFIFO 0010000 /* FIFO. */
-
-/* POSIX.1b objects. */
-#define __S_TYPEISMQ(buf) (0)
-#define __S_TYPEISSEM(buf) (0)
-#define __S_TYPEISSHM(buf) (0)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 00400 /* Read by owner. */
-#define __S_IWRITE 00200 /* Write by owner. */
-#define __S_IEXEC 00100 /* Execute by owner. */
-
-
-#ifdef __USE_GNU
-/* If set, there is no benefit in caching the contents of this file. */
-#define S_INOCACHE 000000200000
-
-/* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below)
- control access for unknown users. If S_IUSEUNK is clear, then unknown
- users are treated as "others" for purposes of access control. */
-#define S_IUSEUNK 000000400000
-/* Mask of protection bits for unknown users (no effective IDs at all). */
-#define S_IUNKNOWN 000007000000
-/* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the
- protection bits for unknown users. */
-#define S_IUNKSHIFT 12
-
-/* Read only bits: */
-
-/* There is a passive translator set for this file */
-#define S_IPTRANS 000010000000
-/* There is an active translator running on this file */
-#define S_IATRANS 000020000000
-/* This is the root of a filesystem (or single node translator) */
-#define S_IROOT 000040000000
-/* All the bits relevant to translators */
-#define S_ITRANS 000070000000
-
-/* Definitely no mmaps to this. */
-#define S_IMMAP0 000100000000
-
-/* ALL the unused bits. */
-#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0 \
- |S_IUSEUNK|S_IUNKNOWN|07777))
-#endif
-
-#ifdef __USE_MISC
-/* Default file creation mask (umask). */
-# define CMASK 0022
-
-/* Definitions of flags stored in file flags word. */
-
-/* Super-user and owner changeable flags. */
-# define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */
-# define UF_NODUMP 0x00000001 /* do not dump file */
-# define UF_IMMUTABLE 0x00000002 /* file may not be changed */
-# define UF_APPEND 0x00000004 /* writes to file may only append */
-# define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */
-# define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */
-
-/* Super-user changeable flags. */
-# define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */
-# define SF_ARCHIVED 0x00010000 /* file is archived */
-# define SF_IMMUTABLE 0x00020000 /* file may not be changed */
-# define SF_APPEND 0x00040000 /* writes to file may only append */
-# define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */
-# define SF_SNAPSHOT 0x00200000 /* snapshot inode */
-
-__BEGIN_DECLS
-
-/* Set file flags for FILE to FLAGS. */
-extern int chflags (__const char *__file, unsigned long int __flags) __THROW;
-
-/* Set file flags of the file referred to by FD to FLAGS. */
-extern int fchflags (int __fd, unsigned long int __flags) __THROW;
-
-__END_DECLS
-#endif
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW -1 /* corresponds to the current time */
-# define UTIME_OMIT -2 /* target time is omitted */
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h
@@ -1,72 +0,0 @@
-/* bits/typesizes.h -- underlying types for *_t. Hurd version.
- Copyright (C) 2002-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_TYPES_H
-# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
-#endif
-
-#ifndef _BITS_TYPESIZES_H
-#define _BITS_TYPESIZES_H 1
-
-/* See <bits/types.h> for the meaning of these macros. This file exists so
- that <bits/types.h> need not vary across different GNU platforms. */
-
-#define __DEV_T_TYPE __U32_TYPE
-#define __UID_T_TYPE __U32_TYPE
-#define __GID_T_TYPE __U32_TYPE
-#define __INO_T_TYPE __ULONGWORD_TYPE
-#define __INO64_T_TYPE __UQUAD_TYPE
-#define __MODE_T_TYPE __U32_TYPE
-#define __NLINK_T_TYPE __UWORD_TYPE
-#define __OFF_T_TYPE __SLONGWORD_TYPE
-#define __OFF64_T_TYPE __SQUAD_TYPE
-#define __PID_T_TYPE __S32_TYPE
-#define __RLIM_T_TYPE __ULONGWORD_TYPE
-#define __RLIM64_T_TYPE __UQUAD_TYPE
-#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
-#define __BLKCNT64_T_TYPE __SQUAD_TYPE
-#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
-#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
-#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
-#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
-#define __FSWORD_T_TYPE __SWORD_TYPE
-#define __ID_T_TYPE __U32_TYPE
-#define __CLOCK_T_TYPE __SLONGWORD_TYPE
-#define __TIME_T_TYPE __SLONGWORD_TYPE
-#define __USECONDS_T_TYPE __U32_TYPE
-#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
-#define __DADDR_T_TYPE __S32_TYPE
-#define __KEY_T_TYPE __S32_TYPE
-#define __CLOCKID_T_TYPE __S32_TYPE
-#define __TIMER_T_TYPE __S32_TYPE
-#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
-#define __FSID_T_TYPE __UQUAD_TYPE
-#define __SSIZE_T_TYPE __SWORD_TYPE
-#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
-#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
-#define __CPU_MASK_TYPE __ULONGWORD_TYPE
-
-/* Number of descriptors that can fit in an `fd_set'. */
-#define __FD_SETSIZE 256
-
-/* Tell the libc code that fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and
- fsfilcnt64_t are not the same type for all ABI purposes. */
-# define __STATFS_MATCHES_STATFS64 0
-
-
-#endif /* bits/typesizes.h */
lib/libc/glibc/sysdeps/mach/i386/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -39,16 +39,6 @@
envp = p; \
} while (0)
-#define CALL_WITH_SP(fn, info, sp) \
- do { \
- void **ptr = (void **) sp; \
- *--(__typeof (info) *) ptr = info; \
- ptr[-1] = ptr; \
- --ptr; \
- asm volatile ("movl %0, %%esp; call %1" : : \
- "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); \
- } while (0)
-
#define RETURN_TO(sp, pc, retval) \
asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \
: : "g" (sp), "r" (pc), "a" (retval))
lib/libc/glibc/sysdeps/mach/libc-lock.h
@@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Mach cthreads version.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -24,9 +24,6 @@
#include <tls.h>
#include <lowlevellock.h>
-/* The locking here is very inexpensive, even for inlining. */
-#define _IO_lock_inexpensive 1
-
typedef unsigned int __libc_lock_t;
typedef struct
{
@@ -57,13 +54,13 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
CLASS __libc_lock_t NAME;
/* Define an initialized lock variable NAME with storage class CLASS. */
-#define _LIBC_LOCK_INITIALIZER LLL_INITIALIZER
+#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
#define __libc_lock_define_initialized(CLASS,NAME) \
- CLASS __libc_lock_t NAME = LLL_INITIALIZER;
+ CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER;
/* Initialize the named lock variable, leaving it in a consistent, unlocked
state. */
-#define __libc_lock_init(NAME) (NAME) = LLL_INITIALIZER
+#define __libc_lock_init(NAME) (NAME) = LLL_LOCK_INITIALIZER
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
@@ -74,19 +71,19 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
/* Lock the named lock variable. */
#define __libc_lock_lock(NAME) \
- ({ lll_lock (&(NAME), 0); 0; })
+ ({ lll_lock ((NAME), 0); 0; })
/* Lock the named lock variable. */
-#define __libc_lock_trylock(NAME) lll_trylock (&(NAME))
+#define __libc_lock_trylock(NAME) lll_trylock (NAME)
/* Unlock the named lock variable. */
#define __libc_lock_unlock(NAME) \
- ({ lll_unlock (&(NAME), 0); 0; })
+ ({ lll_unlock ((NAME), 0); 0; })
#define __libc_lock_define_recursive(CLASS,NAME) \
CLASS __libc_lock_recursive_t NAME;
-#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_INITIALIZER, 0, 0 }
+#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_LOCK_INITIALIZER, 0, 0 }
#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
@@ -111,7 +108,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
int __r = 0; \
if (__self == __lock->owner) \
++__lock->cnt; \
- else if ((__r = lll_trylock (&__lock->lock)) == 0) \
+ else if ((__r = lll_trylock (__lock->lock)) == 0) \
__lock->owner = __self, __lock->cnt = 1; \
__r; \
})
@@ -122,7 +119,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
void *__self = __libc_lock_owner_self (); \
if (__self != __lock->owner) \
{ \
- lll_lock (&__lock->lock, 0); \
+ lll_lock (__lock->lock, 0); \
__lock->owner = __self; \
} \
++__lock->cnt; \
@@ -135,7 +132,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
if (--__lock->cnt == 0) \
{ \
__lock->owner = 0; \
- lll_unlock (&__lock->lock, 0); \
+ lll_unlock (__lock->lock, 0); \
} \
})
lib/libc/glibc/sysdeps/mach/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2021 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
@@ -62,14 +62,6 @@
#error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h
#endif
-/* Call the C function FN with no arguments,
- on a stack starting at SP (as returned by *_cthread_init_routine).
- You don't need to deal with FN returning; it shouldn't. */
-#ifndef CALL_WITH_SP
-#define CALL_WITH_SP(fn, sp)
-#error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h
-#endif
-
/* LOSE can be defined as the `halt' instruction or something
similar which will cause the process to die in a characteristic
way suggesting a bug. */
lib/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h
@@ -1,72 +0,0 @@
-/* Copyright (C) 2002-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-# define _BITS_PTHREADTYPES_ARCH_H 1
-
-# include <endian.h>
-
-# define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
-# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
-# define __SIZEOF_PTHREAD_CONDATTR_T 4
-# define __SIZEOF_PTHREAD_RWLOCK_T 32
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
-# if __BYTE_ORDER == __BIG_ENDIAN
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
-# else
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
-# endif
- int __cur_writer;
-};
-
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h. */
lib/libc/glibc/sysdeps/microblaze/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MicroBlaze.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/microblaze/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MicroBlaze.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/microblaze/start.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -63,14 +63,14 @@ _start:
mfs r20,rpc
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
lwi r5,r20,main@GOT
- lwi r8,r20,__libc_csu_init@GOT
- lwi r9,r20,__libc_csu_fini@GOT
+ addk r8,r0,r0 /* Used to be init. */
+ addk r9,r0,r0 /* Used to be fini. */
brid __libc_start_main@PLT
addk r10,r0,r0
#else
addik r5,r0,main
- addik r8,r0,__libc_csu_init
- addik r9,r0,__libc_csu_fini
+ addk r8,r0,r0 /* Used to be init. */
+ addk r9,r0,r0 /* Used to be fini. */
brid __libc_start_main
addk r10,r0,r0
#endif
lib/libc/glibc/sysdeps/microblaze/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/mips/mips32/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (o32).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/mips32/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (o32).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (n32).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (n32).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (n64).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for MIPS (n64).
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. MIPS version.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2021 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
lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions. MIPS version.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/mips/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF Mips ABI.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -96,13 +96,13 @@ ENTRY_POINT:
# if _MIPS_SIM == _ABIO32
PTR_SUBIU $29, 32
# endif
- PTR_LA $7, __libc_csu_init /* init */
- PTR_LA $8, __libc_csu_fini
+ move $7, $0 /* Used to be init. */
# if _MIPS_SIM == _ABIO32
- PTR_S $8, 16($29) /* fini */
+ PTR_S $0, 16($29) /* Used to be fini. */
PTR_S $2, 20($29) /* rtld_fini */
PTR_S $29, 24($29) /* stack_end */
# else
+ move $8, $0 /* Used to be fini. */
move $9, $2 /* rtld_fini */
move $10, $29 /* stack_end */
# endif
@@ -143,19 +143,17 @@ ENTRY_POINT:
/* Lay out last arguments, and call __libc_start_main(). */
# ifdef __PIC__
sw $7, 24($sp) /* stack_end */
- lw $4, %got(__libc_csu_fini)($3)
- lw $7, %got(__libc_csu_init)($3) /* init */
- sw $4, 16($sp) /* fini */
+ move $4, $0 /* Used to be ini. */
+ sw $0, 16($sp) /* Used to be fini. */
lw $4, %got(main)($3) /* main */
lw $3, %call16(__libc_start_main)($3)
sw $2, 20($sp) /* rtld_fini */
move $25, $3
jalr $3
# else
- lw $4, 1f
sw $7, 24($sp) /* stack_end */
- lw $7, 2f /* init */
- sw $4, 16($sp) /* fini */
+ move $7, $0 /* Used to be init. */
+ sw $0, 16($sp) /* Used to be fini. */
lw $4, 3f /* main */
sw $2, 20($sp) /* rtld_fini */
/* Load and call __libc_start_main(). */
@@ -165,8 +163,6 @@ ENTRY_POINT:
hlt: b hlt /* Crash if somehow it does return. */
# ifndef __PIC__
.align 2
-1: .word __libc_csu_fini
-2: .word __libc_csu_init
3: .word main
4: .word __libc_start_main
# endif
lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h
@@ -1,5 +1,5 @@
/* Declaration of common pthread types for all architectures.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/sysdeps/nptl/libc-lock.h
@@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. NPTL version.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -143,39 +143,40 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
__libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
#endif
-/* Note that for I/O cleanup handling we are using the old-style
- cancel handling. It does not have to be integrated with C++ since
- no C++ code is called in the middle. The old-style handling is
- faster and the support is not going away. */
-extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
- void (*routine) (void *), void *arg);
-extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
- int execute);
+/* Put the unwind buffer BUFFER on the per-thread callback stack. The
+ caller must fill BUFFER->__routine and BUFFER->__arg before calling
+ this function. */
+void __libc_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer);
+libc_hidden_proto (__libc_cleanup_push_defer)
+/* Remove BUFFER from the unwind callback stack. The caller must invoke
+ the callback if desired. */
+void __libc_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer);
+libc_hidden_proto (__libc_cleanup_pop_restore)
/* Start critical region with cleanup. */
-#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
- { struct _pthread_cleanup_buffer _buffer; \
- int _avail; \
- if (DOIT) { \
- _avail = PTFAVAIL (_pthread_cleanup_push_defer); \
- if (_avail) { \
- __libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \
- ARG)); \
- } else { \
- _buffer.__routine = (FCT); \
- _buffer.__arg = (ARG); \
- } \
- } else { \
- _avail = 0; \
- }
+#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
+ { bool _cleanup_start_doit; \
+ struct _pthread_cleanup_buffer _buffer; \
+ /* Non-addressable copy of FCT, so that we avoid indirect calls on \
+ the non-unwinding path. */ \
+ void (*_cleanup_routine) (void *) = (FCT); \
+ _buffer.__arg = (ARG); \
+ if (DOIT) \
+ { \
+ _cleanup_start_doit = true; \
+ _buffer.__routine = _cleanup_routine; \
+ __libc_cleanup_push_defer (&_buffer); \
+ } \
+ else \
+ _cleanup_start_doit = false;
/* End critical region with cleanup. */
-#define __libc_cleanup_region_end(DOIT) \
- if (_avail) { \
- __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\
- } else if (DOIT) \
- _buffer.__routine (_buffer.__arg); \
- }
+#define __libc_cleanup_region_end(DOIT) \
+ if (_cleanup_start_doit) \
+ __libc_cleanup_pop_restore (&_buffer); \
+ if (DOIT) \
+ _cleanup_routine (_buffer.__arg); \
+ } /* matches __libc_cleanup_region_start */
/* Hide the definitions which are only supposed to be used inside libc in
lib/libc/glibc/sysdeps/nptl/libc-lockP.h
@@ -1,5 +1,5 @@
/* Private libc-internal interface for mutex locks. NPTL version.
- Copyright (C) 1996-2020 Free Software Foundation, Inc.
+ Copyright (C) 1996-2021 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
@@ -32,26 +32,12 @@
ld.so might be used on old kernels with a different libc.so. */
#include <lowlevellock.h>
#include <tls.h>
-#include <pthread-functions.h>
-
-#if IS_IN (libpthread)
-/* This gets us the declarations of the __pthread_* internal names,
- and hidden_proto for them. */
-# include <nptl/pthreadP.h>
-#endif
/* Mutex type. */
-#if !IS_IN (libc) && !IS_IN (libpthread)
-typedef pthread_mutex_t __libc_lock_t;
-#else
typedef int __libc_lock_t;
-#endif
typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t;
typedef pthread_rwlock_t __libc_rwlock_t;
-/* Type for key to thread-specific data. */
-typedef pthread_key_t __libc_key_t;
-
/* Define a lock variable NAME with storage class CLASS. The lock must be
initialized with __libc_lock_init before it can be used (or define it
with __libc_lock_define_initialized, below). Use `extern' for CLASS to
@@ -103,126 +89,48 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
(FUNC != NULL ? FUNC ARGS : ELSE)
#endif
-/* Call thread functions through the function pointer table. */
-#if defined SHARED && IS_IN (libc)
-# define PTFAVAIL(NAME) __libc_pthread_functions_init
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
- (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)
-# define __libc_ptf_call_always(FUNC, ARGS) \
- PTHFCT_CALL (ptr_##FUNC, ARGS)
-#elif IS_IN (libpthread)
-# define PTFAVAIL(NAME) 1
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
- FUNC ARGS
-# define __libc_ptf_call_always(FUNC, ARGS) \
- FUNC ARGS
-#else
-# define PTFAVAIL(NAME) (NAME != NULL)
-# define __libc_ptf_call(FUNC, ARGS, ELSE) \
- __libc_maybe_call (FUNC, ARGS, ELSE)
-# define __libc_ptf_call_always(FUNC, ARGS) \
- FUNC ARGS
-#endif
-
+/* All previously forwarded functions are now called directly (either
+ via local call in libc, or through a __export), but __libc_ptf_call
+ is still used in generic code shared with Hurd. */
+#define PTFAVAIL(NAME) 1
+#define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS
+#define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS
/* Initialize the named lock variable, leaving it in a consistent, unlocked
state. */
-#if IS_IN (libc) || IS_IN (libpthread)
-# define __libc_lock_init(NAME) \
- ((void) ((NAME) = LLL_LOCK_INITIALIZER))
-#else
-# define __libc_lock_init(NAME) \
- __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0)
-#endif
-#if defined SHARED && IS_IN (libc)
-/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER) is inefficient. */
-# define __libc_rwlock_init(NAME) \
- ((void) __builtin_memset (&(NAME), '\0', sizeof (NAME)))
-#else
-# define __libc_rwlock_init(NAME) \
- __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0)
-#endif
+#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER))
+#define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL)
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
called on a lock variable before the containing storage is reused. */
-#if IS_IN (libc) || IS_IN (libpthread)
-# define __libc_lock_fini(NAME) ((void) 0)
-#else
-# define __libc_lock_fini(NAME) \
- __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0)
-#endif
-#if defined SHARED && IS_IN (libc)
-# define __libc_rwlock_fini(NAME) ((void) 0)
-#else
-# define __libc_rwlock_fini(NAME) \
- __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0)
-#endif
+#define __libc_lock_fini(NAME) ((void) 0)
+#define __libc_rwlock_fini(NAME) ((void) 0)
/* Lock the named lock variable. */
-#if IS_IN (libc) || IS_IN (libpthread)
-# ifndef __libc_lock_lock
-# define __libc_lock_lock(NAME) \
- ({ lll_lock (NAME, LLL_PRIVATE); 0; })
-# endif
-#else
-# undef __libc_lock_lock
-# define __libc_lock_lock(NAME) \
- __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0)
-#endif
-#define __libc_rwlock_rdlock(NAME) \
- __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0)
-#define __libc_rwlock_wrlock(NAME) \
- __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0)
+#define __libc_lock_lock(NAME) ({ lll_lock (NAME, LLL_PRIVATE); 0; })
+#define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME))
+#define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME))
/* Try to lock the named lock variable. */
-#if IS_IN (libc) || IS_IN (libpthread)
-# ifndef __libc_lock_trylock
-# define __libc_lock_trylock(NAME) \
- lll_trylock (NAME)
-# endif
-#else
-# undef __libc_lock_trylock
-# define __libc_lock_trylock(NAME) \
- __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0)
-#endif
-#define __libc_rwlock_tryrdlock(NAME) \
- __libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0)
-#define __libc_rwlock_trywrlock(NAME) \
- __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0)
-
-#define __rtld_lock_trylock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
+#define __libc_lock_trylock(NAME) lll_trylock (NAME)
/* Unlock the named lock variable. */
-#if IS_IN (libc) || IS_IN (libpthread)
-# define __libc_lock_unlock(NAME) \
- lll_unlock (NAME, LLL_PRIVATE)
-#else
-# define __libc_lock_unlock(NAME) \
- __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
-#endif
-#define __libc_rwlock_unlock(NAME) \
- __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0)
-
-#ifdef SHARED
-# define __rtld_lock_default_lock_recursive(lock) \
- ++((pthread_mutex_t *)(lock))->__data.__count;
-
-# define __rtld_lock_default_unlock_recursive(lock) \
- --((pthread_mutex_t *)(lock))->__data.__count;
+#define __libc_lock_unlock(NAME) lll_unlock (NAME, LLL_PRIVATE)
+#define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME))
+#if IS_IN (rtld)
# define __rtld_lock_lock_recursive(NAME) \
- GL(dl_rtld_lock_recursive) (&(NAME).mutex)
+ ___rtld_mutex_lock (&(NAME).mutex)
# define __rtld_lock_unlock_recursive(NAME) \
- GL(dl_rtld_unlock_recursive) (&(NAME).mutex)
-#else
+ ___rtld_mutex_unlock (&(NAME).mutex)
+#else /* Not in the dynamic loader. */
# define __rtld_lock_lock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
+ __pthread_mutex_lock (&(NAME).mutex)
# define __rtld_lock_unlock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
+ __pthread_mutex_unlock (&(NAME).mutex)
#endif
/* Define once control variable. */
@@ -236,74 +144,42 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
#endif
-/* Call handler iff the first call. */
-#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
- do { \
- if (PTFAVAIL (__pthread_once)) \
- __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \
- INIT_FUNCTION)); \
- else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \
- INIT_FUNCTION (); \
- (ONCE_CONTROL) |= 2; \
- } \
- } while (0)
+/* Call handler iff the first call. Use a local call in libc, but the
+ global pthread_once symbol elsewhere. */
+#if IS_IN (libc)
+# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+ __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
+#else
+# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
+ pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
+#endif
/* Get once control variable. */
#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
-/* Note that for I/O cleanup handling we are using the old-style
- cancel handling. It does not have to be integrated with C++ snce
- no C++ code is called in the middle. The old-style handling is
- faster and the support is not going away. */
-extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer,
- void (*routine) (void *), void *arg);
-extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer,
- int execute);
-extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer,
- void (*routine) (void *), void *arg);
-extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer,
- int execute);
-
-/* Sometimes we have to exit the block in the middle. */
-#define __libc_cleanup_end(DOIT) \
- if (_avail) { \
- __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\
- } else if (DOIT) \
- _buffer.__routine (_buffer.__arg)
-
+/* __libc_cleanup_push and __libc_cleanup_pop depend on exception
+ handling and stack unwinding. */
+#ifdef __EXCEPTIONS
/* Normal cleanup handling, based on C cleanup attribute. */
-__extern_inline void
+static __always_inline void
__libc_cleanup_routine (struct __pthread_cleanup_frame *f)
{
if (f->__do_it)
f->__cancel_routine (f->__cancel_arg);
}
-#define __libc_cleanup_push(fct, arg) \
+# define __libc_cleanup_push(fct, arg) \
do { \
struct __pthread_cleanup_frame __clframe \
__attribute__ ((__cleanup__ (__libc_cleanup_routine))) \
= { .__cancel_routine = (fct), .__cancel_arg = (arg), \
.__do_it = 1 };
-#define __libc_cleanup_pop(execute) \
+# define __libc_cleanup_pop(execute) \
__clframe.__do_it = (execute); \
} while (0)
-
-
-/* Create thread-specific key. */
-#define __libc_key_create(KEY, DESTRUCTOR) \
- __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1)
-
-/* Get thread-specific data. */
-#define __libc_getspecific(KEY) \
- __libc_ptf_call (__pthread_getspecific, (KEY), NULL)
-
-/* Set thread-specific data. */
-#define __libc_setspecific(KEY, VALUE) \
- __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0)
-
+#endif /* __EXCEPTIONS */
/* Register handlers to execute before and after `fork'. Note that the
last parameter is NULL. The handlers registered by the libc are
@@ -318,107 +194,56 @@ extern int __register_atfork (void (*__prepare) (void),
extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
const pthread_mutexattr_t *__mutex_attr);
-
+libc_hidden_proto (__pthread_mutex_init)
extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
-
+libc_hidden_proto (__pthread_mutex_destroy)
extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
-
+libc_hidden_proto (__pthread_mutex_lock)
extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
-
-extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr);
+libc_hidden_proto (__pthread_mutex_unlock)
extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
-extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr,
- int __kind);
-
extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
const pthread_rwlockattr_t *__attr);
+libc_hidden_proto (__pthread_rwlock_init)
extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
-
-extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_rdlock)
extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
-
-extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
+libc_hidden_proto (__pthread_rwlock_wrlock)
extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
-
-extern int __pthread_key_create (pthread_key_t *__key,
- void (*__destr_function) (void *));
-
-extern int __pthread_setspecific (pthread_key_t __key,
- const void *__pointer);
-
-extern void *__pthread_getspecific (pthread_key_t __key);
-
+libc_hidden_proto (__pthread_rwlock_unlock)
extern int __pthread_once (pthread_once_t *__once_control,
void (*__init_routine) (void));
+libc_hidden_proto (__pthread_once)
extern int __pthread_atfork (void (*__prepare) (void),
void (*__parent) (void),
void (*__child) (void));
extern int __pthread_setcancelstate (int state, int *oldstate);
-
+libc_hidden_proto (__pthread_setcancelstate)
/* Make the pthread functions weak so that we can elide them from
single-threaded processes. */
#ifndef __NO_WEAK_PTHREAD_ALIASES
# ifdef weak_extern
-weak_extern (__pthread_mutex_init)
-weak_extern (__pthread_mutex_destroy)
-weak_extern (__pthread_mutex_lock)
weak_extern (__pthread_mutex_trylock)
-weak_extern (__pthread_mutex_unlock)
-weak_extern (__pthread_mutexattr_init)
weak_extern (__pthread_mutexattr_destroy)
-weak_extern (__pthread_mutexattr_settype)
-weak_extern (__pthread_rwlock_init)
-weak_extern (__pthread_rwlock_destroy)
-weak_extern (__pthread_rwlock_rdlock)
-weak_extern (__pthread_rwlock_tryrdlock)
-weak_extern (__pthread_rwlock_wrlock)
-weak_extern (__pthread_rwlock_trywrlock)
-weak_extern (__pthread_rwlock_unlock)
-weak_extern (__pthread_key_create)
-weak_extern (__pthread_setspecific)
-weak_extern (__pthread_getspecific)
-weak_extern (__pthread_once)
weak_extern (__pthread_initialize)
weak_extern (__pthread_atfork)
-weak_extern (__pthread_setcancelstate)
-weak_extern (_pthread_cleanup_push_defer)
-weak_extern (_pthread_cleanup_pop_restore)
# else
-# pragma weak __pthread_mutex_init
-# pragma weak __pthread_mutex_destroy
-# pragma weak __pthread_mutex_lock
# pragma weak __pthread_mutex_trylock
-# pragma weak __pthread_mutex_unlock
-# pragma weak __pthread_mutexattr_init
# pragma weak __pthread_mutexattr_destroy
-# pragma weak __pthread_mutexattr_settype
-# pragma weak __pthread_rwlock_destroy
-# pragma weak __pthread_rwlock_rdlock
-# pragma weak __pthread_rwlock_tryrdlock
-# pragma weak __pthread_rwlock_wrlock
-# pragma weak __pthread_rwlock_trywrlock
-# pragma weak __pthread_rwlock_unlock
-# pragma weak __pthread_key_create
-# pragma weak __pthread_setspecific
-# pragma weak __pthread_getspecific
-# pragma weak __pthread_once
# pragma weak __pthread_initialize
# pragma weak __pthread_atfork
-# pragma weak __pthread_setcancelstate
-# pragma weak _pthread_cleanup_push_defer
-# pragma weak _pthread_cleanup_pop_restore
# endif
#endif
lib/libc/glibc/sysdeps/nptl/pthread.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 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
@@ -27,7 +27,11 @@
#include <bits/setjmp.h>
#include <bits/wordsize.h>
#include <bits/types/struct_timespec.h>
-
+#include <bits/types/__sigset_t.h>
+#include <bits/types/struct___jmp_buf_tag.h>
+#ifdef __USE_MISC
+# include <bits/pthread_stack_min-dynamic.h>
+#endif
/* Detach state. */
enum
@@ -219,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return);
the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
+# ifndef __USE_TIME_BITS64
/* Make calling thread wait for termination of the thread TH, but only
until TIMEOUT. The exit status of the thread is stored in
*THREAD_RETURN, if THREAD_RETURN is not NULL.
@@ -238,6 +243,23 @@ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
clockid_t __clockid,
const struct timespec *__abstime);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (pthread_timedjoin_np,
+ (pthread_t __th, void **__thread_return,
+ const struct timespec *__abstime),
+ __pthread_timedjoin_np64);
+
+extern int __REDIRECT (pthread_clockjoin_np,
+ (pthread_t __th, void **__thread_return,
+ clockid_t __clockid,
+ const struct timespec *__abstime),
+ __pthread_clockjoin_np64);
+# else
+# define pthread_timedjoin_np __pthread_timedjoin_np64
+# define pthread_clockjoin_np __pthread_clockjoin_np64
+# endif
+# endif
#endif
/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
@@ -385,6 +407,20 @@ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
extern int pthread_getattr_default_np (pthread_attr_t *__attr)
__THROW __nonnull ((1));
+/* Store *SIGMASK as the signal mask for the new thread in *ATTR. */
+extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr,
+ const __sigset_t *sigmask);
+
+/* Store the signal mask of *ATTR in *SIGMASK. If there is no signal
+ mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on
+ success. */
+extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr,
+ __sigset_t *sigmask);
+
+/* Special return value from pthread_attr_getsigmask_np if the signal
+ mask has not been set. */
+#define PTHREAD_ATTR_NO_SIGMASK_NP (-1)
+
/* Set the default attributes to be used by pthread_create in this
process. */
extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
@@ -438,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW;
#endif
#ifdef __USE_GNU
-/* Yield the processor to another thread or process.
- This function is similar to the POSIX `sched_yield' function but
- might be differently implemented in the case of a m-on-n thread
- implementation. */
extern int pthread_yield (void) __THROW;
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield)
+ __attribute_deprecated_msg__ ("\
+pthread_yield is deprecated, use sched_yield instead");
+# else
+# define pthread_yield sched_yield
+# endif
/* Limit specified thread TH to run only on the processors represented
@@ -496,13 +535,15 @@ extern void pthread_testcancel (void);
/* Cancellation handling with integration into exception handling. */
+struct __cancel_jmp_buf_tag
+{
+ __jmp_buf __cancel_jmp_buf;
+ int __mask_was_saved;
+};
+
typedef struct
{
- struct
- {
- __jmp_buf __cancel_jmp_buf;
- int __mask_was_saved;
- } __cancel_jmp_buf[1];
+ struct __cancel_jmp_buf_tag __cancel_jmp_buf[1];
void *__pad[4];
} __pthread_unwind_buf_t __attribute__ ((__aligned__));
@@ -642,8 +683,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
- __cancel_buf.__cancel_jmp_buf, 0); \
+ int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
+ 0); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
@@ -677,8 +718,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
- __cancel_buf.__cancel_jmp_buf, 0); \
+ int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
+ 0); \
if (__glibc_unlikely (__not_first_call)) \
{ \
__cancel_routine (__cancel_arg); \
@@ -714,9 +755,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
;
#endif
-/* Function used in the macros. */
-struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
+/* Function used in the macros. Calling __sigsetjmp, with its first
+ argument declared as an array, results in a -Wstringop-overflow
+ warning from GCC 11 because struct pthread_unwind_buf is smaller
+ than jmp_buf. The calls from the macros have __SAVEMASK set to 0,
+ so nothing beyond the common prefix is used and this warning is a
+ false positive. Use an alias with its first argument declared to
+ use the type in the macros if possible to avoid this warning. */
+#if __GNUC_PREREQ (11, 0)
+extern int __REDIRECT_NTHNL (__sigsetjmp_cancel,
+ (struct __cancel_jmp_buf_tag __env[1],
+ int __savemask),
+ __sigsetjmp) __attribute_returns_twice__;
+#else
+# define __sigsetjmp_cancel(env, savemask) \
+ __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask))
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1],
+ int __savemask) __THROWNL;
+#endif
/* Mutex handling. */
@@ -740,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
+# ifndef __USE_TIME_BITS64
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
+ (pthread_mutex_t *__restrict __mutex,
+ const struct timespec *__restrict __abstime),
+ __pthread_mutex_timedlock64) __nonnull ((1, 2));
+# else
+# define pthread_mutex_timedlock __pthread_mutex_timedlock64
+# endif
+# endif
#endif
#ifdef __USE_GNU
+# ifndef __USE_TIME_BITS64
extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,
+ (pthread_mutex_t *__restrict __mutex,
+ clockid_t __clockid,
+ const struct timespec *__restrict __abstime),
+ __pthread_mutex_clocklock64) __nonnull ((1, 3));
+# else
+# define pthread_mutex_clocklock __pthread_mutex_clocklock64
+# endif
+# endif
#endif
/* Unlock a mutex. */
@@ -776,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
__THROW __nonnull ((1));
# ifdef __USE_GNU
-extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *),
+ pthread_mutex_consistent) __nonnull ((1))
+ __attribute_deprecated_msg__ ("\
+pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent");
+# else
+# define pthread_mutex_consistent_np pthread_mutex_consistent
+# endif
# endif
#endif
@@ -846,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
int *__robustness)
__THROW __nonnull ((1, 2));
# ifdef __USE_GNU
-extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr,
- int *__robustness)
- __THROW __nonnull ((1, 2));
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
+ (pthread_mutex_t *, int *),
+ pthread_mutexattr_getrobust) __nonnull ((1))
+ __attribute_deprecated_msg__ ("\
+pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
+# else
+# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust
+# endif
# endif
/* Set the robustness flag of the mutex attribute ATTR. */
@@ -856,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
int __robustness)
__THROW __nonnull ((1));
# ifdef __USE_GNU
-extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
- int __robustness)
- __THROW __nonnull ((1));
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
+ (pthread_mutex_t *, int),
+ pthread_mutexattr_setrobust) __nonnull ((1))
+ __attribute_deprecated_msg__ ("\
+pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
+# else
+# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust
+# endif
# endif
#endif
-
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Functions for handling read-write locks. */
@@ -886,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
+# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
+ (pthread_rwlock_t *__restrict __rwlock,
+ const struct timespec *__restrict __abstime),
+ __pthread_rwlock_timedrdlock64)
+ __nonnull ((1, 2));
+# else
+# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64
+# endif
+# endif
# endif
# ifdef __USE_GNU
+# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,
+ (pthread_rwlock_t *__restrict __rwlock,
+ clockid_t __clockid,
+ const struct timespec *__restrict __abstime),
+ __pthread_rwlock_clockrdlock64)
+ __nonnull ((1, 3));
+# else
+# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64
+# endif
+# endif
# endif
/* Acquire write lock for RWLOCK. */
@@ -908,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
+# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 2));
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
+ (pthread_rwlock_t *__restrict __rwlock,
+ const struct timespec *__restrict __abstime),
+ __pthread_rwlock_timedwrlock64)
+ __nonnull ((1, 2));
+# else
+# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64
+# endif
+# endif
# endif
# ifdef __USE_GNU
+# ifndef __USE_TIME_BITS64
extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
clockid_t __clockid,
const struct timespec *__restrict
__abstime) __THROWNL __nonnull ((1, 3));
+
+# else
+# ifdef __REDIRECT_NTHNL
+extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,
+ (pthread_rwlock_t *__restrict __rwlock,
+ clockid_t __clockid,
+ const struct timespec *__restrict __abstime),
+ __pthread_rwlock_clockwrlock64)
+ __nonnull ((1, 3));
+# else
+# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64
+# endif
+# endif
# endif
/* Unlock RWLOCK. */
@@ -994,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
This function is a cancellation point and therefore not marked with
__THROW. */
+# ifndef __USE_TIME_BITS64
extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 3));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (pthread_cond_timedwait,
+ (pthread_cond_t *__restrict __cond,
+ pthread_mutex_t *__restrict __mutex,
+ const struct timespec *__restrict __abstime),
+ __pthread_cond_timedwait64)
+ __nonnull ((1, 2, 3));
+# else
+# define pthread_cond_timedwait __pthread_cond_timedwait64
+# endif
+# endif
# ifdef __USE_GNU
/* Wait for condition variable COND to be signaled or broadcast until
@@ -1007,11 +1167,25 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
This function is a cancellation point and therefore not marked with
__THROW. */
+# ifndef __USE_TIME_BITS64
extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
__clockid_t __clock_id,
const struct timespec *__restrict __abstime)
__nonnull ((1, 2, 4));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (pthread_cond_clockwait,
+ (pthread_cond_t *__restrict __cond,
+ pthread_mutex_t *__restrict __mutex,
+ __clockid_t __clock_id,
+ const struct timespec *__restrict __abstime),
+ __pthread_cond_clockwait64)
+ __nonnull ((1, 2, 4));
+# else
+# define pthread_cond_clockwait __pthread_cond_clockwait64
+# endif
+# endif
# endif
/* Functions for handling condition variable attributes. */
@@ -1132,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW;
/* Store POINTER in the thread-specific data slot identified by KEY. */
extern int pthread_setspecific (pthread_key_t __key,
- const void *__pointer) __THROW ;
+ const void *__pointer)
+ __THROW __attr_access_none (2);
#ifdef __USE_XOPEN2K
lib/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h
@@ -1,81 +0,0 @@
-/* Machine-specific pthread type layouts. PowerPC version.
- Copyright (C) 2003-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 64
-# define __SIZEOF_PTHREAD_MUTEX_T 40
-# define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_RWLOCK_T 56
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-#else
-# define __SIZEOF_PTHREAD_MUTEX_T 24
-# define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_RWLOCK_T 32
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-#endif
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
-#if __WORDSIZE == 64
- int __cur_writer;
- int __shared;
- unsigned char __rwelision;
- unsigned char __pad1[7];
- unsigned long int __pad2;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned int __flags;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 }
-#else
- unsigned char __rwelision;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
- int __cur_writer;
-# define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-#endif
-};
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for PowerPC.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for PowerPC.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S
@@ -1,5 +1,5 @@
/* Startup code for programs linked with GNU libc.
- Copyright (C) 1998-2020 Free Software Foundation, Inc.
+ Copyright (C) 1998-2021 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
@@ -52,8 +52,8 @@
L(start_addresses):
.long _SDA_BASE_
.long main
- .long __libc_csu_init
- .long __libc_csu_fini
+ .long 0 /* Used to be init. */
+ .long 0 /* Used to be fini. */
ASM_SIZE_DIRECTIVE(L(start_addresses))
.section ".text"
lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h
@@ -1,5 +1,5 @@
/* Hacks needed for symbol manipulation. powerpc version.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h
@@ -1,5 +1,5 @@
/* Assembly macros for 32-bit PowerPC.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -92,7 +92,10 @@ GOT_LABEL: ; \
#define DO_CALL(syscall) \
li 0,syscall; \
- sc
+ DO_CALL_SC
+
+#define DO_CALL_SC \
+ sc
#undef JUMPTARGET
#ifdef PIC
@@ -106,14 +109,20 @@ GOT_LABEL: ; \
# define HIDDEN_JUMPTARGET(name) __GI_##name##@local
#endif
+#define TAIL_CALL_SYSCALL_ERROR \
+ b __syscall_error@local
+
#define PSEUDO(name, syscall_name, args) \
.section ".text"; \
ENTRY (name) \
DO_CALL (SYS_ify (syscall_name));
+#define RET_SC \
+ bnslr+;
+
#define PSEUDO_RET \
- bnslr+; \
- b __syscall_error@local
+ RET_SC; \
+ TAIL_CALL_SYSCALL_ERROR
#define ret PSEUDO_RET
#undef PSEUDO_END
@@ -179,8 +188,8 @@ GOT_LABEL: ; \
#else
/* Position-dependent code does not require access to the GOT. */
# define __GLRO(rOUT, rGOT, member, offset) \
- lis rOUT,(member+LOWORD)@ha; \
- lwz rOUT,(member+LOWORD)@l(rOUT)
+ lis rOUT,(member)@ha; \
+ lwz rOUT,(member)@l(rOUT)
#endif /* PIC */
#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for PowerPC64.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for PowerPC64.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions. PowerPC64 version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S
@@ -1,5 +1,5 @@
/* Startup code for programs linked with GNU libc. PowerPC64 version.
- Copyright (C) 1998-2020 Free Software Foundation, Inc.
+ Copyright (C) 1998-2021 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
@@ -53,8 +53,8 @@ L(start_addresses):
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
/* function descriptors so don't need JUMPTARGET */
.quad main
- .quad __libc_csu_init
- .quad __libc_csu_fini
+ .quad 0 /* Used to be init. */
+ .quad 0 /* Used to be fini. */
ASM_SIZE_DIRECTIVE(L(start_addresses))
lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h
@@ -1,5 +1,5 @@
/* Assembly macros for 64-bit PowerPC.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -17,6 +17,7 @@
<https://www.gnu.org/licenses/>. */
#include <sysdeps/powerpc/sysdep.h>
+#include <tls.h>
#ifdef __ASSEMBLER__
@@ -263,10 +264,83 @@ LT_LABELSUFFIX(name,_name_end): ; \
TRACEBACK_MASK(name,mask); \
END_2(name)
-#define DO_CALL(syscall) \
- li 0,syscall; \
+/* We will allocate a new frame to save LR and the non-volatile register used to
+ read the TCB when checking for scv support on syscall code. We actually just
+ need the minimum frame size plus room for 1 reg (8 bytes). But the ABI
+ mandates stack frames should be aligned at 16 Bytes, so we end up allocating
+ a bit more space then what will actually be used. */
+#define SCV_FRAME_SIZE (FRAME_MIN_SIZE+16)
+#define SCV_FRAME_NVOLREG_SAVE FRAME_MIN_SIZE
+
+/* Allocate frame and save register */
+#define NVOLREG_SAVE \
+ stdu r1,-SCV_FRAME_SIZE(r1); \
+ std r31,SCV_FRAME_NVOLREG_SAVE(r1); \
+ cfi_adjust_cfa_offset(SCV_FRAME_SIZE);
+
+/* Restore register and destroy frame */
+#define NVOLREG_RESTORE \
+ ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \
+ addi r1,r1,SCV_FRAME_SIZE; \
+ cfi_adjust_cfa_offset(-SCV_FRAME_SIZE);
+
+/* Check PPC_FEATURE2_SCV bit from hwcap2 in the TCB. If it is not set, scv is
+ not available, then go to JUMPFALSE (label given by the macro's caller). We
+ save the value we read from the TCB in a non-volatile register so we can
+ reuse it later when exiting from the syscall in PSEUDO_RET. Note that for
+ the static case we need an extra check to guarantee the thread pointer has
+ already been initialized, otherwise we may try to access an invalid address
+ if a syscall is called before the TLS has been setup. */
+ .macro CHECK_SCV_SUPPORT REG JUMPFALSE
+
+#ifndef SHARED
+ /* Check if thread pointer has already been setup. */
+ cmpdi r13,0
+ beq \JUMPFALSE
+#endif
+
+ /* Read PPC_FEATURE2_SCV from TCB and store it in REG */
+ ld \REG,TCB_HWCAP(PT_THREAD_POINTER)
+ andis. \REG,\REG,PPC_FEATURE2_SCV>>16
+
+ beq \JUMPFALSE
+ .endm
+
+#if !defined(USE_PPC_SCV) || IS_IN(rtld)
+# define DO_CALL(syscall) \
+ li r0,syscall; \
+ DO_CALL_SC
+#else
+/* Before doing the syscall, check if we can use scv. scv is supported by P9
+ and later with Linux v5.9 and later. If so, use it. Otherwise, fallback to
+ sc. We use a non-volatile register to save hwcap2 from the TCB, so we need
+ to save its content beforehand. */
+# define DO_CALL(syscall) \
+ li r0,syscall; \
+ NVOLREG_SAVE; \
+ CHECK_SCV_SUPPORT r31 0f; \
+ DO_CALL_SCV; \
+ b 1f; \
+0: DO_CALL_SC; \
+1:
+#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
+
+/* DO_CALL_SC and DO_CALL_SCV expect the syscall number to be in r0. */
+#define DO_CALL_SC \
sc
+#define DO_CALL_SCV \
+ mflr r9; \
+ std r9,FRAME_LR_SAVE(r1); \
+ cfi_offset(lr,FRAME_LR_SAVE); \
+ .machine "push"; \
+ .machine "power9"; \
+ scv 0; \
+ .machine "pop"; \
+ ld r9,FRAME_LR_SAVE(r1); \
+ mtlr r9; \
+ cfi_restore(lr);
+
/* ppc64 is always PIC */
#undef JUMPTARGET
#define JUMPTARGET(name) FUNC_LABEL(name)
@@ -278,7 +352,7 @@ LT_LABELSUFFIX(name,_name_end): ; \
#ifdef SHARED
#define TAIL_CALL_SYSCALL_ERROR \
- b JUMPTARGET(__syscall_error)
+ b JUMPTARGET (NOTOC (__syscall_error))
#else
/* Static version might be linked into a large app with a toc exceeding
64k. We can't put a toc adjusting stub on a plain branch, so can't
@@ -304,9 +378,33 @@ LT_LABELSUFFIX(name,_name_end): ; \
.endif
#endif
-#define PSEUDO_RET \
- bnslr+; \
+#if !defined(USE_PPC_SCV) || IS_IN(rtld)
+# define PSEUDO_RET \
+ RET_SC; \
TAIL_CALL_SYSCALL_ERROR
+#else
+/* This should only be called after a DO_CALL. In such cases, r31 contains the
+ value of PPC_FEATURE2_SCV read from hwcap2 by CHECK_SCV_SUPPORT. If it is
+ set, we know we have entered the kernel using scv, so handle the return code
+ accordingly. */
+# define PSEUDO_RET \
+ cmpdi cr5,r31,0; \
+ NVOLREG_RESTORE; \
+ beq cr5,0f; \
+ RET_SCV; \
+ b 1f; \
+0: RET_SC; \
+1: TAIL_CALL_SYSCALL_ERROR
+#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
+
+#define RET_SCV \
+ li r9,-4095; \
+ cmpld r3,r9; \
+ bltlr+; \
+ neg r3,r3;
+
+#define RET_SC \
+ bnslr+;
#define ret PSEUDO_RET
@@ -319,8 +417,15 @@ LT_LABELSUFFIX(name,_name_end): ; \
ENTRY (name); \
DO_CALL (SYS_ify (syscall_name))
-#define PSEUDO_RET_NOERRNO \
+#if !defined(USE_PPC_SCV) || IS_IN(rtld)
+# define PSEUDO_RET_NOERRNO \
+ blr
+#else
+/* This should only be called after a DO_CALL. */
+# define PSEUDO_RET_NOERRNO \
+ NVOLREG_RESTORE; \
blr
+#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
#define ret_NOERRNO PSEUDO_RET_NOERRNO
@@ -333,8 +438,15 @@ LT_LABELSUFFIX(name,_name_end): ; \
ENTRY (name); \
DO_CALL (SYS_ify (syscall_name))
-#define PSEUDO_RET_ERRVAL \
+#if !defined(USE_PPC_SCV) || IS_IN(rtld)
+# define PSEUDO_RET_ERRVAL \
+ blr
+#else
+/* This should only be called after a DO_CALL. */
+# define PSEUDO_RET_ERRVAL \
+ NVOLREG_RESTORE; \
blr
+#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */
#define ret_ERRVAL PSEUDO_RET_ERRVAL
@@ -366,6 +478,12 @@ LT_LABELSUFFIX(name,_name_end): ; \
lwz rOUT,0(rOUT)
#endif
+#ifdef USE_PPC64_NOTOC
+# define NOTOC(l) l@notoc
+#else
+# define NOTOC(l) l
+#endif
+
#else /* !__ASSEMBLER__ */
#if _CALL_ELF != 2
lib/libc/glibc/sysdeps/powerpc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2021 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
lib/libc/glibc/nptl/pthread_atfork.c โ lib/libc/glibc/sysdeps/pthread/pthread_atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h
@@ -1,5 +1,5 @@
/* Machine-specific pthread type layouts. RISC-V version.
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 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
@@ -21,18 +21,22 @@
#include <bits/endian.h>
-#if __riscv_xlen == 64
-# define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
-# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-# define __SIZEOF_PTHREAD_COND_T 48
-# define __SIZEOF_PTHREAD_CONDATTR_T 4
-# define __SIZEOF_PTHREAD_RWLOCK_T 56
-# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
+#define __SIZEOF_PTHREAD_COND_T 48
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
+
+#if __WORDSIZE == 64
+# define __SIZEOF_PTHREAD_ATTR_T 56
+# define __SIZEOF_PTHREAD_MUTEX_T 40
+# define __SIZEOF_PTHREAD_RWLOCK_T 56
+# define __SIZEOF_PTHREAD_BARRIER_T 32
#else
-# error "rv32i-based systems are not supported"
+# define __SIZEOF_PTHREAD_ATTR_T 32
+# define __SIZEOF_PTHREAD_MUTEX_T 32
+# define __SIZEOF_PTHREAD_RWLOCK_T 48
+# define __SIZEOF_PTHREAD_BARRIER_T 20
#endif
#define __LOCK_ALIGNMENT
lib/libc/glibc/sysdeps/riscv/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF RISC-V ABI.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
@@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT)
REG_L a1, 0(sp) /* argc. */
addi a2, sp, SZREG /* argv. */
andi sp, sp, ALMASK /* Align stack. */
- lla a3, __libc_csu_init
- lla a4, __libc_csu_fini
+ li a3, 0 /* Used to be init. */
+ li a4, 0 /* Used to be fini. */
mv a6, sp /* stack_end. */
call __libc_start_main@plt
lib/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h
@@ -1,79 +0,0 @@
-/* Copyright (C) 2003-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 64
-# define __SIZEOF_PTHREAD_ATTR_T 56
-# define __SIZEOF_PTHREAD_MUTEX_T 40
-# define __SIZEOF_PTHREAD_RWLOCK_T 56
-# define __SIZEOF_PTHREAD_BARRIER_T 32
-#else
-# define __SIZEOF_PTHREAD_ATTR_T 36
-# define __SIZEOF_PTHREAD_MUTEX_T 24
-# define __SIZEOF_PTHREAD_RWLOCK_T 32
-# define __SIZEOF_PTHREAD_BARRIER_T 20
-#endif
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 1
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
-#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
-#if __WORDSIZE == 64
- int __cur_writer;
- int __shared;
- unsigned long int __pad1;
- unsigned long int __pad2;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned int __flags;
-# else
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
- int __cur_writer;
-#endif
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/s390/s390-32/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for S/390.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/s390/s390-32/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for S/390.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. S/390 version.
- Copyright (C) 2014-2020 Free Software Foundation, Inc.
+ Copyright (C) 2014-2021 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
lib/libc/glibc/sysdeps/s390/s390-32/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF s390 ABI.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -175,18 +175,16 @@ _start:
*/
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
la %r7,96(%r15)
- l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
- l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
l %r2,.L3-.Llit(%r13) # load pointer to main
l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
#ifdef PIC
l %r12,.L5-.Llit(%r13) # load .got pointer
- la %r6,0(%r13,%r6)
- la %r5,0(%r13,%r5)
la %r12,0(%r13,%r12)
l %r2,0(%r12,%r2)
la %r1,0(%r13,%r1)
#endif
+ lhi %r6, 0 # Used to fini.
+ lhi %r5, 0 # Used to init.
/* ok, now branch to the libc main routine */
basr %r14,%r1
@@ -197,13 +195,9 @@ _start:
cfi_endproc
.Llit:
#ifndef PIC
-.L1: .long __libc_csu_init
-.L2: .long __libc_csu_fini
.L3: .long main
.L4: .long __libc_start_main
#else
-.L1: .long __libc_csu_init-.Llit
-.L2: .long __libc_csu_fini-.Llit
.L3: .long main@GOT
.L4: .long __libc_start_main@plt-.Llit
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h
@@ -1,5 +1,5 @@
/* Hacks needed for symbol manipulation. s390 version.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for s390.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/s390/s390-64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for 64 bit S/390.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/s390/s390-64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for 64 bit S/390.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/s390/s390-64/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the 64 bit S/390 ELF ABI.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -80,8 +80,8 @@ _start:
*/
stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
la %r7,160(%r15)
- larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini
- larl %r5,__libc_csu_init # load pointer to __libc_csu_init
+ lghi %r6,0 # Used to be fini.
+ lghi %r5,0 # Used to be init.
/* Ok, now branch to the libc main routine. */
#ifdef PIC
lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for 64 bit S/390.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h
@@ -1,71 +0,0 @@
-/* Copyright (C) 2002-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _BITS_PTHREADTYPES_ARCH_H
-#define _BITS_PTHREADTYPES_ARCH_H 1
-
-#include <endian.h>
-
-#define __SIZEOF_PTHREAD_ATTR_T 36
-#define __SIZEOF_PTHREAD_MUTEX_T 24
-#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
-#define __SIZEOF_PTHREAD_COND_T 48
-#define __SIZEOF_PTHREAD_CONDATTR_T 4
-#define __SIZEOF_PTHREAD_RWLOCK_T 32
-#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-#define __SIZEOF_PTHREAD_BARRIER_T 20
-#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
-
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1
-#define __PTHREAD_MUTEX_USE_UNION 1
-
-#define __LOCK_ALIGNMENT
-#define __ONCE_ALIGNMENT
-
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
-#if __BYTE_ORDER == __BIG_ENDIAN
- unsigned char __pad1;
- unsigned char __pad2;
- unsigned char __shared;
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
-#else
- /* FLAGS must stay at this position in the structure to maintain
- binary compatibility. */
- unsigned char __flags;
- unsigned char __shared;
- unsigned char __pad1;
- unsigned char __pad2;
-#endif
- unsigned long int __cur_writer;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
-#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/sh/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for SH.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/sh/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for SH.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/sh/start.S
@@ -1,5 +1,5 @@
/* Startup code for SH & ELF.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -70,12 +70,11 @@ _start:
/* Push the last arguments to main() onto the stack */
mov.l r4,@-r15
- mov.l L_fini,r0
- mov.l r0,@-r15
+ mov.l r14,@-r15 /* Used to be fini. */
/* Set up the other arguments for main() that go in registers */
mov.l L_main,r4
- mov.l L_init,r7
+ mov #0,r7 /* Used to be init. */
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
@@ -90,10 +89,6 @@ _start:
.align 2
L_main:
.long main
-L_init:
- .long __libc_csu_init
-L_fini:
- .long __libc_csu_fini
L_libc_start_main:
.long __libc_start_main
L_abort:
lib/libc/glibc/sysdeps/sh/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for SH.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
lib/libc/glibc/sysdeps/sparc/sparc32/start.S
@@ -1,5 +1,5 @@
/* Startup code for elf32-sparc
- Copyright (C) 1997-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -59,22 +59,14 @@ _start:
/* Load the addresses of the user entry points. */
#ifndef PIC
sethi %hi(main), %o0
- sethi %hi(__libc_csu_init), %o3
- sethi %hi(__libc_csu_fini), %o4
or %o0, %lo(main), %o0
- or %o3, %lo(__libc_csu_init), %o3
- or %o4, %lo(__libc_csu_fini), %o4
#else
sethi %gdop_hix22(main), %o0
- sethi %gdop_hix22(__libc_csu_init), %o3
- sethi %gdop_hix22(__libc_csu_fini), %o4
xor %o0, %gdop_lox10(main), %o0
- xor %o3, %gdop_lox10(__libc_csu_init), %o3
- xor %o4, %gdop_lox10(__libc_csu_fini), %o4
ld [%l7 + %o0], %o0, %gdop(main)
- ld [%l7 + %o3], %o3, %gdop(__libc_csu_init)
- ld [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
#endif
+ mov 0, %o3 /* Used to be init. */
+ mov 0, %o4 /* Used to be fini. */
/* When starting a binary via the dynamic linker, %g1 contains the
address of the shared library termination function, which will be
lib/libc/glibc/sysdeps/sparc/sparc64/start.S
@@ -1,5 +1,5 @@
/* Startup code for elf64-sparc
- Copyright (C) 1997-2020 Free Software Foundation, Inc.
+ Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -60,22 +60,14 @@ _start:
/* Load the addresses of the user entry points. */
#ifndef PIC
sethi %hi(main), %o0
- sethi %hi(__libc_csu_init), %o3
- sethi %hi(__libc_csu_fini), %o4
or %o0, %lo(main), %o0
- or %o3, %lo(__libc_csu_init), %o3
- or %o4, %lo(__libc_csu_fini), %o4
#else
sethi %gdop_hix22(main), %o0
- sethi %gdop_hix22(__libc_csu_init), %o3
- sethi %gdop_hix22(__libc_csu_fini), %o4
xor %o0, %gdop_lox10(main), %o0
- xor %o3, %gdop_lox10(__libc_csu_init), %o3
- xor %o4, %gdop_lox10(__libc_csu_fini), %o4
ldx [%l7 + %o0], %o0, %gdop(main)
- ldx [%l7 + %o3], %o3, %gdop(__libc_csu_init)
- ldx [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
#endif
+ mov 0, %o3 /* Used to be init. */
+ mov 0, %o4 /* Used to be fini. */
/* When starting a binary via the dynamic linker, %g1 contains the
address of the shared library termination function, which will be
lib/libc/glibc/sysdeps/sparc/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for sparc.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/sparc/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for sparc.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions. SPARC version.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/sparc/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. SPARC version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/sparc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2021 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
lib/libc/glibc/sysdeps/unix/alpha/sysdep.h
@@ -1,382 +0,0 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Brendan Kehoe (brendan@zen.org).
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/unix/sysdep.h>
-#include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
-
-#ifdef __ASSEMBLER__
-
-#ifdef __linux__
-# include <alpha/regdef.h>
-#else
-# include <regdef.h>
-#endif
-
-#define __LABEL(x) x##:
-
-#define LEAF(name, framesize) \
- .globl name; \
- .align 4; \
- .ent name, 0; \
- __LABEL(name) \
- .frame sp, framesize, ra
-
-#define ENTRY(name) \
- .globl name; \
- .align 4; \
- .ent name, 0; \
- __LABEL(name) \
- .frame sp, 0, ra
-
-/* Mark the end of function SYM. */
-#undef END
-#define END(sym) .end sym
-
-#ifdef PROF
-# define PSEUDO_PROF \
- .set noat; \
- lda AT, _mcount; \
- jsr AT, (AT), _mcount; \
- .set at
-#else
-# define PSEUDO_PROF
-#endif
-
-#ifdef PROF
-# define PSEUDO_PROLOGUE \
- .frame sp, 0, ra; \
- ldgp gp,0(pv); \
- PSEUDO_PROF; \
- .prologue 1
-#elif defined PIC
-# define PSEUDO_PROLOGUE \
- .frame sp, 0, ra; \
- .prologue 0
-#else
-# define PSEUDO_PROLOGUE \
- .frame sp, 0, ra; \
- ldgp gp,0(pv); \
- .prologue 1
-#endif /* PROF */
-
-#ifdef PROF
-# define USEPV_PROF std
-#else
-# define USEPV_PROF no
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_LABEL $syscall_error
-# define SYSCALL_ERROR_HANDLER \
-$syscall_error: \
- stl v0, rtld_errno(gp) !gprel; \
- lda v0, -1; \
- ret
-# define SYSCALL_ERROR_FALLTHRU
-#elif defined(PIC)
-# define SYSCALL_ERROR_LABEL __syscall_error !samegp
-# define SYSCALL_ERROR_HANDLER
-# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
-#else
-# define SYSCALL_ERROR_LABEL $syscall_error
-# define SYSCALL_ERROR_HANDLER \
-$syscall_error: \
- jmp $31, __syscall_error
-# define SYSCALL_ERROR_FALLTHRU
-#endif /* RTLD_PRIVATE_ERRNO */
-
-/* Overridden by specific syscalls. */
-#undef PSEUDO_PREPARE_ARGS
-#define PSEUDO_PREPARE_ARGS /* Nothing. */
-
-#define PSEUDO(name, syscall_name, args) \
- .globl name; \
- .align 4; \
- .ent name,0; \
-__LABEL(name) \
- PSEUDO_PROLOGUE; \
- PSEUDO_PREPARE_ARGS \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys; \
- bne a3, SYSCALL_ERROR_LABEL
-
-#undef PSEUDO_END
-#define PSEUDO_END(sym) \
- SYSCALL_ERROR_HANDLER; \
- END(sym)
-
-#define PSEUDO_NOERRNO(name, syscall_name, args) \
- .globl name; \
- .align 4; \
- .ent name,0; \
-__LABEL(name) \
- PSEUDO_PROLOGUE; \
- PSEUDO_PREPARE_ARGS \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys;
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(sym) END(sym)
-
-#define ret_NOERRNO ret
-
-#define PSEUDO_ERRVAL(name, syscall_name, args) \
- .globl name; \
- .align 4; \
- .ent name,0; \
-__LABEL(name) \
- PSEUDO_PROLOGUE; \
- PSEUDO_PREPARE_ARGS \
- lda v0, SYS_ify(syscall_name); \
- call_pal PAL_callsys;
-
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(sym) END(sym)
-
-#define ret_ERRVAL ret
-
-#define r0 v0
-#define r1 a4
-
-#define MOVE(x,y) mov x,y
-
-#else /* !ASSEMBLER */
-
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#include <errno.h>
-
-/* ??? Linux needs to be able to override INLINE_SYSCALL for one
- particular special case. Make this easy. */
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- INLINE_SYSCALL1(name, nr, args)
-
-#define INLINE_SYSCALL1(name, nr, args...) \
-({ \
- long _sc_ret, _sc_err; \
- inline_syscall##nr(__NR_##name, args); \
- if (__builtin_expect (_sc_err, 0)) \
- { \
- __set_errno (_sc_ret); \
- _sc_ret = -1L; \
- } \
- _sc_ret; \
-})
-
-#define INTERNAL_SYSCALL(name, err_out, nr, args...) \
- INTERNAL_SYSCALL1(name, err_out, nr, args)
-
-#define INTERNAL_SYSCALL1(name, err_out, nr, args...) \
- INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args)
-
-#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \
-({ \
- long _sc_ret, _sc_err; \
- inline_syscall##nr(name, args); \
- err_out = _sc_err; \
- _sc_ret; \
-})
-
-#define INTERNAL_SYSCALL_DECL(err) \
- long int err __attribute__((unused))
-
-/* The normal Alpha calling convention sign-extends 32-bit quantties
- no matter what the "real" sign of the 32-bit type. We want to
- preserve that when filling in values for the kernel. */
-#define syscall_promote(arg) \
- (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg))
-
-/* Make sure and "use" the variable that we're not returning,
- in order to suppress unused variable warnings. */
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void)val, err)
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void)err, val)
-
-#define inline_syscall_clobbers \
- "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
- "$22", "$23", "$24", "$25", "$27", "$28", "memory"
-
-/* It is moderately important optimization-wise to limit the lifetime
- of the hard-register variables as much as possible. Thus we copy
- in/out as close to the asm as possible. */
-
-#define inline_syscall0(name, args...) \
-{ \
- register long _sc_19 __asm__("$19"); \
- register long _sc_0 = name; \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2" \
- : "+v"(_sc_0), "=r"(_sc_19) \
- : : inline_syscall_clobbers, \
- "$16", "$17", "$18", "$20", "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall1(name,arg1) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_19 __asm__("$19"); \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3" \
- : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
- : : inline_syscall_clobbers, \
- "$17", "$18", "$20", "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall2(name,arg1,arg2) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _tmp_17 = syscall_promote (arg2); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_17 __asm__("$17") = _tmp_17; \
- register long _sc_19 __asm__("$19"); \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3 %4" \
- : "+v"(_sc_0), "=r"(_sc_19), \
- "+r"(_sc_16), "+r"(_sc_17) \
- : : inline_syscall_clobbers, \
- "$18", "$20", "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall3(name,arg1,arg2,arg3) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _tmp_17 = syscall_promote (arg2); \
- register long _tmp_18 = syscall_promote (arg3); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_17 __asm__("$17") = _tmp_17; \
- register long _sc_18 __asm__("$18") = _tmp_18; \
- register long _sc_19 __asm__("$19"); \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3 %4 %5" \
- : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
- "+r"(_sc_17), "+r"(_sc_18) \
- : : inline_syscall_clobbers, "$20", "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall4(name,arg1,arg2,arg3,arg4) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _tmp_17 = syscall_promote (arg2); \
- register long _tmp_18 = syscall_promote (arg3); \
- register long _tmp_19 = syscall_promote (arg4); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_17 __asm__("$17") = _tmp_17; \
- register long _sc_18 __asm__("$18") = _tmp_18; \
- register long _sc_19 __asm__("$19") = _tmp_19; \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
- : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
- "+r"(_sc_17), "+r"(_sc_18) \
- : : inline_syscall_clobbers, "$20", "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _tmp_17 = syscall_promote (arg2); \
- register long _tmp_18 = syscall_promote (arg3); \
- register long _tmp_19 = syscall_promote (arg4); \
- register long _tmp_20 = syscall_promote (arg5); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_17 __asm__("$17") = _tmp_17; \
- register long _sc_18 __asm__("$18") = _tmp_18; \
- register long _sc_19 __asm__("$19") = _tmp_19; \
- register long _sc_20 __asm__("$20") = _tmp_20; \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
- : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
- "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
- : : inline_syscall_clobbers, "$21"); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-
-#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
-{ \
- register long _tmp_16 = syscall_promote (arg1); \
- register long _tmp_17 = syscall_promote (arg2); \
- register long _tmp_18 = syscall_promote (arg3); \
- register long _tmp_19 = syscall_promote (arg4); \
- register long _tmp_20 = syscall_promote (arg5); \
- register long _tmp_21 = syscall_promote (arg6); \
- register long _sc_0 = name; \
- register long _sc_16 __asm__("$16") = _tmp_16; \
- register long _sc_17 __asm__("$17") = _tmp_17; \
- register long _sc_18 __asm__("$18") = _tmp_18; \
- register long _sc_19 __asm__("$19") = _tmp_19; \
- register long _sc_20 __asm__("$20") = _tmp_20; \
- register long _sc_21 __asm__("$21") = _tmp_21; \
- __asm__ __volatile__ \
- ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
- : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
- "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
- "+r"(_sc_21) \
- : : inline_syscall_clobbers); \
- _sc_ret = _sc_0, _sc_err = _sc_19; \
-}
-#endif /* ASSEMBLER */
-
-/* Pointer mangling support. Note that tls access is slow enough that
- we don't deoptimize things by placing the pointer check value there. */
-
-#ifdef __ASSEMBLER__
-# if IS_IN (rtld)
-# define PTR_MANGLE(dst, src, tmp) \
- ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
- ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
- xor src, tmp, dst
-# define PTR_MANGLE2(dst, src, tmp) \
- xor src, tmp, dst
-# elif defined SHARED
-# define PTR_MANGLE(dst, src, tmp) \
- ldq tmp, __pointer_chk_guard; \
- xor src, tmp, dst
-# else
-# define PTR_MANGLE(dst, src, tmp) \
- ldq tmp, __pointer_chk_guard_local; \
- xor src, tmp, dst
-# endif
-# define PTR_MANGLE2(dst, src, tmp) \
- xor src, tmp, dst
-# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
-# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
-#else
-# include <stdint.h>
-# if (IS_IN (rtld) \
- || (!defined SHARED && (IS_IN (libc) \
- || IS_IN (libpthread))))
-extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
-# define PTR_MANGLE(var) \
- (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
-# else
-extern uintptr_t __pointer_chk_guard attribute_relro;
-# define PTR_MANGLE(var) \
- (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
-# endif
-# define PTR_DEMANGLE(var) PTR_MANGLE(var)
-#endif /* ASSEMBLER */
lib/libc/glibc/sysdeps/unix/arm/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 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
lib/libc/glibc/sysdeps/unix/i386/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
lib/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h
@@ -1,64 +0,0 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
- can make things confusing if you're debugging---it looks like it's jumping
- backwards into the previous fn. */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
- .align 2; \
- .set nomips16; \
- cfi_startproc; \
- 99:; \
- .set noat; \
- .cpsetup t9, $1, name; \
- cfi_register (gp, $1); \
- .set at; \
- la t9,__syscall_error; \
- .cpreturn; \
- cfi_restore (gp); \
- jr t9; \
- cfi_endproc; \
- ENTRY(name) \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- bne a3, zero, 99b; \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
- .set noreorder; \
- .align 2; \
- .set nomips16; \
- cfi_startproc; \
- 99: j __syscall_error; \
- nop; \
- cfi_endproc; \
- ENTRY(name) \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
-L(syse1):
-#endif
-
-#endif
lib/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h
@@ -1,64 +0,0 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#include <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
- can make things confusing if you're debugging---it looks like it's jumping
- backwards into the previous fn. */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
- .align 2; \
- .set nomips16; \
- cfi_startproc; \
- 99:; \
- .set noat; \
- .cpsetup t9, $1, name; \
- cfi_register (gp, $1); \
- .set at; \
- dla t9,__syscall_error; \
- .cpreturn; \
- cfi_restore (gp); \
- jr t9; \
- cfi_endproc; \
- ENTRY(name) \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- bne a3, zero, 99b; \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
- .set noreorder; \
- .align 2; \
- .set nomips16; \
- cfi_startproc; \
- 99: j __syscall_error; \
- nop; \
- cfi_endproc; \
- ENTRY(name) \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
-L(syse1):
-#endif
-
-#endif
lib/libc/glibc/sysdeps/unix/mips/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/sysdeps/unix/sh/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. AArch64 version.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 2018-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -164,29 +164,10 @@
# define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime"
# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday"
-/* Previously AArch64 used the generic version without the libc_hidden_def
- which lead in a non existent __send symbol in libc.so. */
-# undef HAVE_INTERNAL_SEND_SYMBOL
-
# define SINGLE_THREAD_BY_GLOBAL 1
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
- _sys_result = (unsigned long) -1; \
- } \
- (long) _sys_result; })
-
-# undef INTERNAL_SYSCALL_DECL
-# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
# undef INTERNAL_SYSCALL_RAW
-# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ long _sys_result; \
{ \
LOAD_ARGS_##nr (args) \
@@ -198,19 +179,12 @@
_sys_result; })
# undef INTERNAL_SYSCALL
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
+# define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
# undef INTERNAL_SYSCALL_AARCH64
-# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \
- INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args)
-
-# undef INTERNAL_SYSCALL_ERROR_P
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned long) (val) >= (unsigned long) -4095)
-
-# undef INTERNAL_SYSCALL_ERRNO
-# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+# define INTERNAL_SYSCALL_AARCH64(name, nr, args...) \
+ INTERNAL_SYSCALL_RAW(__ARM_NR_##name, nr, args)
# define LOAD_ARGS_0() \
register long _x0 asm ("x0");
@@ -253,8 +227,11 @@
# define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6)
# undef INTERNAL_SYSCALL_NCS
-# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- INTERNAL_SYSCALL_RAW (number, err, nr, args)
+# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
+ INTERNAL_SYSCALL_RAW (number, nr, args)
+
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -1,160 +0,0 @@
-/* Copyright (C) 1996-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_KERNEL 0
-#define _STAT_VER_GLIBC2 1
-#define _STAT_VER_GLIBC2_1 2
-#define _STAT_VER_KERNEL64 3
-#define _STAT_VER_GLIBC2_3_4 3
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 0
-
-
-/* Nanosecond resolution timestamps are stored in a format equivalent to
- 'struct timespec'. This is the type used whenever possible but the
- Unix namespace rules do not allow the identifier 'timespec' to appear
- in the <sys/stat.h> header. Therefore we have to handle the use of
- this header in strictly standard-compliant sources special.
-
- Use neat tidy anonymous unions and structures when possible. */
-
-#ifdef __USE_XOPEN2K8
-# if __GNUC_PREREQ(3,3)
-# define __ST_TIME(X) \
- __extension__ union { \
- struct timespec st_##X##tim; \
- struct { \
- __time_t st_##X##time; \
- unsigned long st_##X##timensec; \
- }; \
- }
-# else
-# define __ST_TIME(X) struct timespec st_##X##tim
-# define st_atime st_atim.tv_sec
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# endif
-#else
-# define __ST_TIME(X) \
- __time_t st_##X##time; \
- unsigned long st_##X##timensec
-#endif
-
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
-#ifdef __USE_FILE_OFFSET64
- __ino64_t st_ino; /* File serial number. */
-#else
- __ino_t st_ino; /* File serial number. */
- int __pad0; /* 64-bit st_ino. */
-#endif
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_FILE_OFFSET64
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
-#else
- __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
- int __pad1; /* 64-bit st_blocks. */
-#endif
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __nlink_t st_nlink; /* Link count. */
- int __pad2; /* Real padding. */
- __ST_TIME(a); /* Time of last access. */
- __ST_TIME(m); /* Time of last modification. */
- __ST_TIME(c); /* Time of last status change. */
- long __glibc_reserved[3];
- };
-
-#ifdef __USE_LARGEFILE64
-/* Note stat64 is the same shape as stat. */
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __nlink_t st_nlink; /* Link count. */
- int __pad0; /* Real padding. */
- __ST_TIME(a); /* Time of last access. */
- __ST_TIME(m); /* Time of last modification. */
- __ST_TIME(c); /* Time of last status change. */
- long __glibc_reserved[3];
- };
-#endif
-
-#undef __ST_TIME
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -49,6 +49,7 @@
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __S64_TYPE
+#define __SUSECONDS64_T_TYPE __S64_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -72,6 +73,9 @@
/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 0
+/* And for getitimer, setitimer and rusage */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
+
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
@@ -19,14 +19,10 @@
#ifndef _LINUX_ALPHA_SYSDEP_H
#define _LINUX_ALPHA_SYSDEP_H 1
-#ifdef __ASSEMBLER__
-#include <asm/pal.h>
-#include <alpha/regdef.h>
-#endif
-
/* There is some commonality. */
#include <sysdeps/unix/sysv/linux/sysdep.h>
-#include <sysdeps/unix/alpha/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
+#include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
#include <tls.h>
@@ -39,4 +35,325 @@
#define SINGLE_THREAD_BY_GLOBAL 1
-#endif /* _LINUX_ALPHA_SYSDEP_H */
+#ifdef __ASSEMBLER__
+#include <asm/pal.h>
+#include <alpha/regdef.h>
+
+#define __LABEL(x) x##:
+
+#define LEAF(name, framesize) \
+ .globl name; \
+ .align 4; \
+ .ent name, 0; \
+ __LABEL(name) \
+ .frame sp, framesize, ra
+
+#define ENTRY(name) \
+ .globl name; \
+ .align 4; \
+ .ent name, 0; \
+ __LABEL(name) \
+ .frame sp, 0, ra
+
+/* Mark the end of function SYM. */
+#undef END
+#define END(sym) .end sym
+
+#ifdef PROF
+# define PSEUDO_PROF \
+ .set noat; \
+ lda AT, _mcount; \
+ jsr AT, (AT), _mcount; \
+ .set at
+#else
+# define PSEUDO_PROF
+#endif
+
+#ifdef PROF
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ ldgp gp,0(pv); \
+ PSEUDO_PROF; \
+ .prologue 1
+#elif defined PIC
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ .prologue 0
+#else
+# define PSEUDO_PROLOGUE \
+ .frame sp, 0, ra; \
+ ldgp gp,0(pv); \
+ .prologue 1
+#endif /* PROF */
+
+#ifdef PROF
+# define USEPV_PROF std
+#else
+# define USEPV_PROF no
+#endif
+
+#undef SYSCALL_ERROR_LABEL
+#if RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_LABEL $syscall_error
+# define SYSCALL_ERROR_HANDLER \
+$syscall_error: \
+ stl v0, rtld_errno(gp) !gprel; \
+ lda v0, -1; \
+ ret
+# define SYSCALL_ERROR_FALLTHRU
+#elif defined(PIC)
+# define SYSCALL_ERROR_LABEL __syscall_error !samegp
+# define SYSCALL_ERROR_HANDLER
+# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL
+#else
+# define SYSCALL_ERROR_LABEL $syscall_error
+# define SYSCALL_ERROR_HANDLER \
+$syscall_error: \
+ jmp $31, __syscall_error
+# define SYSCALL_ERROR_FALLTHRU
+#endif /* RTLD_PRIVATE_ERRNO */
+
+/* Overridden by specific syscalls. */
+#undef PSEUDO_PREPARE_ARGS
+#define PSEUDO_PREPARE_ARGS /* Nothing. */
+
+#define PSEUDO(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys; \
+ bne a3, SYSCALL_ERROR_LABEL
+
+#undef PSEUDO_END
+#define PSEUDO_END(sym) \
+ SYSCALL_ERROR_HANDLER; \
+ END(sym)
+
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys;
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(sym) END(sym)
+
+#define ret_NOERRNO ret
+
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .globl name; \
+ .align 4; \
+ .ent name,0; \
+__LABEL(name) \
+ PSEUDO_PROLOGUE; \
+ PSEUDO_PREPARE_ARGS \
+ lda v0, SYS_ify(syscall_name); \
+ call_pal PAL_callsys;
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym) END(sym)
+
+#define ret_ERRVAL ret
+
+#define r0 v0
+#define r1 a4
+
+#define MOVE(x,y) mov x,y
+
+#else /* !ASSEMBLER */
+
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ internal_syscall##nr(__NR_##name, args)
+
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+ internal_syscall##nr(name, args)
+
+/* The normal Alpha calling convention sign-extends 32-bit quantties
+ no matter what the "real" sign of the 32-bit type. We want to
+ preserve that when filling in values for the kernel. */
+#define syscall_promote(arg) \
+ (sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg))
+
+#define internal_syscall_clobbers \
+ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \
+ "$22", "$23", "$24", "$25", "$27", "$28", "memory"
+
+/* It is moderately important optimization-wise to limit the lifetime
+ of the hard-register variables as much as possible. Thus we copy
+ in/out as close to the asm as possible. */
+
+#define internal_syscall0(name, args...) \
+({ \
+ register long int _sc_19 __asm__("$19"); \
+ register long int _sc_0 = name; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2" \
+ : "+v"(_sc_0), "=r"(_sc_19) \
+ : : internal_syscall_clobbers, \
+ "$16", "$17", "$18", "$20", "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall1(name,arg1) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3" \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \
+ : : internal_syscall_clobbers, \
+ "$17", "$18", "$20", "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall2(name,arg1,arg2) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _tmp_17 = syscall_promote (arg2); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_17 __asm__("$17") = _tmp_17; \
+ register long int _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4" \
+ : "+v"(_sc_0), "=r"(_sc_19), \
+ "+r"(_sc_16), "+r"(_sc_17) \
+ : : internal_syscall_clobbers, \
+ "$18", "$20", "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall3(name,arg1,arg2,arg3) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _tmp_17 = syscall_promote (arg2); \
+ register long int _tmp_18 = syscall_promote (arg3); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_17 __asm__("$17") = _tmp_17; \
+ register long int _sc_18 __asm__("$18") = _tmp_18; \
+ register long int _sc_19 __asm__("$19"); \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5" \
+ : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : internal_syscall_clobbers, "$20", "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall4(name,arg1,arg2,arg3,arg4) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _tmp_17 = syscall_promote (arg2); \
+ register long int _tmp_18 = syscall_promote (arg3); \
+ register long int _tmp_19 = syscall_promote (arg4); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_17 __asm__("$17") = _tmp_17; \
+ register long int _sc_18 __asm__("$18") = _tmp_18; \
+ register long int _sc_19 __asm__("$19") = _tmp_19; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18) \
+ : : internal_syscall_clobbers, "$20", "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _tmp_17 = syscall_promote (arg2); \
+ register long int _tmp_18 = syscall_promote (arg3); \
+ register long int _tmp_19 = syscall_promote (arg4); \
+ register long int _tmp_20 = syscall_promote (arg5); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_17 __asm__("$17") = _tmp_17; \
+ register long int _sc_18 __asm__("$18") = _tmp_18; \
+ register long int _sc_19 __asm__("$19") = _tmp_19; \
+ register long int _sc_20 __asm__("$20") = _tmp_20; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \
+ : : internal_syscall_clobbers, "$21"); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+
+#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
+({ \
+ register long int _tmp_16 = syscall_promote (arg1); \
+ register long int _tmp_17 = syscall_promote (arg2); \
+ register long int _tmp_18 = syscall_promote (arg3); \
+ register long int _tmp_19 = syscall_promote (arg4); \
+ register long int _tmp_20 = syscall_promote (arg5); \
+ register long int _tmp_21 = syscall_promote (arg6); \
+ register long int _sc_0 = name; \
+ register long int _sc_16 __asm__("$16") = _tmp_16; \
+ register long int _sc_17 __asm__("$17") = _tmp_17; \
+ register long int _sc_18 __asm__("$18") = _tmp_18; \
+ register long int _sc_19 __asm__("$19") = _tmp_19; \
+ register long int _sc_20 __asm__("$20") = _tmp_20; \
+ register long int _sc_21 __asm__("$21") = _tmp_21; \
+ __asm__ __volatile__ \
+ ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \
+ : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \
+ "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \
+ "+r"(_sc_21) \
+ : : internal_syscall_clobbers); \
+ _sc_19 != 0 ? -_sc_0 : _sc_0; \
+})
+#endif /* ASSEMBLER */
+
+/* Pointer mangling support. Note that tls access is slow enough that
+ we don't deoptimize things by placing the pointer check value there. */
+
+#ifdef __ASSEMBLER__
+# if IS_IN (rtld)
+# define PTR_MANGLE(dst, src, tmp) \
+ ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \
+ ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \
+ xor src, tmp, dst
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# elif defined SHARED
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard; \
+ xor src, tmp, dst
+# else
+# define PTR_MANGLE(dst, src, tmp) \
+ ldq tmp, __pointer_chk_guard_local; \
+ xor src, tmp, dst
+# endif
+# define PTR_MANGLE2(dst, src, tmp) \
+ xor src, tmp, dst
+# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp)
+# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp)
+#else
+# include <stdint.h>
+# if (IS_IN (rtld) \
+ || (!defined SHARED && (IS_IN (libc) \
+ || IS_IN (libpthread))))
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+# define PTR_MANGLE(var) \
+ (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard)
+# endif
+# define PTR_DEMANGLE(var) PTR_MANGLE(var)
+#endif /* ASSEMBLER */
+
+#endif /* _LINUX_ALPHA_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
@@ -29,11 +29,6 @@
#include <tls.h>
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -317,21 +312,6 @@ __local_syscall_error: \
#else /* not __ASSEMBLER__ */
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
- _sys_result = (unsigned int) -1; \
- } \
- (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
#if defined(__thumb__)
/* We can not expose the use of r7 to the compiler. GCC (as
of 4.5) uses r7 as the hard frame pointer for Thumb - although
@@ -348,7 +328,7 @@ __local_syscall_error: \
then unwinding will fail higher up the stack. So we move the
syscall out of line and provide its own unwind information. */
# undef INTERNAL_SYSCALL_RAW
-# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ \
register int _a1 asm ("a1"); \
int _nametmp = name; \
@@ -361,7 +341,7 @@ __local_syscall_error: \
_a1; })
#else /* ARM */
# undef INTERNAL_SYSCALL_RAW
-# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
({ \
register int _a1 asm ("r0"), _nr asm ("r7"); \
LOAD_ARGS_##nr (args) \
@@ -374,15 +354,8 @@ __local_syscall_error: \
#endif
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
#define VDSO_NAME "LINUX_2.6"
#define VDSO_HASH 61765110
@@ -434,8 +407,8 @@ __local_syscall_error: \
/* For EABI, non-constant syscalls are actually pretty easy... */
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- INTERNAL_SYSCALL_RAW (number, err, nr, args)
+#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
+ INTERNAL_SYSCALL_RAW (number, nr, args)
#define SINGLE_THREAD_BY_GLOBAL 1
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
@@ -22,119 +22,7 @@
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
- unsigned short int __pad1;
-#ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-#else
- __ino_t __st_ino; /* 32bit file serial number. */
-#endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
-#ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-#else
- __off64_t st_size; /* Size of file, in bytes. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
-#ifndef __USE_FILE_OFFSET64
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-#else
- __ino64_t st_ino; /* File serial number. */
-#endif
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- unsigned int __pad1;
-
- __ino_t __st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __ino64_t st_ino; /* File serial number. */
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
+#include <bits/struct_stat.h>
/* Encoding of the file mode. */
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 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
@@ -25,6 +25,36 @@
struct timex
{
+# ifdef __USE_TIME_BITS64
+ unsigned int modes; /* mode selector */
+ int :32; /* pad */
+ long long offset; /* time offset (usec) */
+ long long freq; /* frequency offset (scaled ppm) */
+ long long maxerror; /* maximum error (usec) */
+ long long esterror; /* estimated error (usec) */
+ int status; /* clock command/status */
+ int :32; /* pad */
+ long long constant; /* pll time constant */
+ long long precision; /* clock precision (usec) (read only) */
+ long long tolerance; /* clock frequency tolerance (ppm) (ro) */
+ struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
+ long long tick; /* (modified) usecs between clock ticks */
+ long long ppsfreq; /* pps frequency (scaled ppm) (ro) */
+ long long jitter; /* pps jitter (us) (ro) */
+ int shift; /* interval duration (s) (shift) (ro) */
+ int :32; /* pad */
+ long long stabil; /* pps stability (scaled ppm) (ro) */
+ long long jitcnt; /* jitter limit exceeded (ro) */
+ long long calcnt; /* calibration intervals (ro) */
+ long long errcnt; /* calibration errors (ro) */
+ long long stbcnt; /* stability limit exceeded (ro) */
+
+ int tai; /* TAI offset (ro) */
+
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32;
+# else
unsigned int modes; /* mode selector */
__syscall_slong_t offset; /* time offset (usec) */
__syscall_slong_t freq; /* frequency offset (scaled ppm) */
@@ -51,6 +81,7 @@ struct timex
int :32; int :32; int :32; int :32;
int :32; int :32; int :32; int :32;
int :32; int :32; int :32;
+# endif
};
/* Mode codes (timex.mode) */
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h
@@ -1,174 +0,0 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
- 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-#include <bits/endian.h>
-#include <bits/wordsize.h>
-
-/* 64-bit libc uses the kernel's 'struct stat', accessed via the
- stat() syscall; 32-bit libc uses the kernel's 'struct stat64'
- and accesses it via the stat64() syscall. All the various
- APIs offered by libc use the kernel shape for their struct stat
- structure; the only difference is that 32-bit programs not
- using __USE_FILE_OFFSET64 only see the low 32 bits of some
- of the fields (specifically st_ino, st_size, and st_blocks). */
-#define _STAT_VER_KERNEL 0
-#define _STAT_VER_LINUX 0
-#define _STAT_VER _STAT_VER_KERNEL
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 0
-
-#if defined __USE_FILE_OFFSET64
-# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
-# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
-# error "ino_t and off_t must both be the same type"
-# endif
-# define __field64(type, type64, name) type name
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-# define __field64(type, type64, name) \
- type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
-#else
-# define __field64(type, type64, name) \
- int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
-#endif
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
- __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- __dev_t __pad1;
- __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- int __pad2;
- __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- int __glibc_reserved[2];
- };
-
-#undef __field64
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- __dev_t __pad1;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- int __pad2;
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- int __glibc_reserved[2];
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -26,31 +26,45 @@
/* See <bits/types.h> for the meaning of these macros. This file exists so
that <bits/types.h> need not vary across different GNU platforms. */
+#if __TIMESIZE == 64 && __WORDSIZE == 32
+/* These are the "new" y2038 types defined for architectures added after
+ the 5.1 kernel. */
+# define __INO_T_TYPE __UQUAD_TYPE
+# define __OFF_T_TYPE __SQUAD_TYPE
+# define __RLIM_T_TYPE __UQUAD_TYPE
+# define __BLKCNT_T_TYPE __SQUAD_TYPE
+# define __FSBLKCNT_T_TYPE __UQUAD_TYPE
+# define __FSFILCNT_T_TYPE __UQUAD_TYPE
+# define __TIME_T_TYPE __SQUAD_TYPE
+# define __SUSECONDS_T_TYPE __SQUAD_TYPE
+#else
+# define __INO_T_TYPE __ULONGWORD_TYPE
+# define __OFF_T_TYPE __SLONGWORD_TYPE
+# define __RLIM_T_TYPE __ULONGWORD_TYPE
+# define __BLKCNT_T_TYPE __SLONGWORD_TYPE
+# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
+# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
+# define __TIME_T_TYPE __SLONGWORD_TYPE
+# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#endif
#define __DEV_T_TYPE __UQUAD_TYPE
#define __UID_T_TYPE __U32_TYPE
#define __GID_T_TYPE __U32_TYPE
-#define __INO_T_TYPE __ULONGWORD_TYPE
#define __INO64_T_TYPE __UQUAD_TYPE
#define __MODE_T_TYPE __U32_TYPE
#define __NLINK_T_TYPE __U32_TYPE
-#define __OFF_T_TYPE __SLONGWORD_TYPE
#define __OFF64_T_TYPE __SQUAD_TYPE
#define __PID_T_TYPE __S32_TYPE
-#define __RLIM_T_TYPE __ULONGWORD_TYPE
#define __RLIM64_T_TYPE __UQUAD_TYPE
-#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
#define __BLKCNT64_T_TYPE __SQUAD_TYPE
-#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
-#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
#define __FSWORD_T_TYPE __SWORD_TYPE
#define __ID_T_TYPE __U32_TYPE
#define __CLOCK_T_TYPE __SLONGWORD_TYPE
-#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
-#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -62,7 +76,7 @@
#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
#define __CPU_MASK_TYPE __ULONGWORD_TYPE
-#ifdef __LP64__
+#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32)
/* Tell the libc code that off_t and off64_t are actually the same type
for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */
@@ -76,11 +90,17 @@
/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 1
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64)
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
+
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
+
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -25,11 +25,3 @@
#ifdef __NR_llseek
# define __NR__llseek __NR_llseek
#endif
-
-#if __WORDSIZE == 64
-/* By defining the older names, glibc will build syscall wrappers for
- both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c
- will suppress generating any separate code for pread64.c. */
-#define __NR_pread __NR_pread64
-#define __NR_pwrite __NR_pwrite64
-#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/generic/xstatver.h
@@ -0,0 +1,10 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_KERNEL 0
+#define _STAT_VER_LINUX 0
+#define _STAT_VER _STAT_VER_KERNEL
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 0
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 2006-2020 Free Software Foundation, Inc.
+ Copyright (C) 2006-2021 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
@@ -18,11 +18,6 @@
<https://www.gnu.org/licenses/>. */
-/* Support for the utimes syscall was added in 3.14. */
-#if __LINUX_KERNEL_VERSION >= 0x030e00
-# define __ASSUME_UTIMES 1
-#endif
-
#include_next <kernel-features.h>
#define __ASSUME_RECV_SYSCALL 1
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h
@@ -1,1174 +0,0 @@
-/* Copyright (C) 2002-2019 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
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _PTHREAD_H
-#define _PTHREAD_H 1
-
-#include <features.h>
-#include <endian.h>
-#include <sched.h>
-#include <time.h>
-
-#include <bits/pthreadtypes.h>
-#include <bits/setjmp.h>
-#include <bits/wordsize.h>
-#include <bits/types/struct_timespec.h>
-
-
-/* Detach state. */
-enum
-{
- PTHREAD_CREATE_JOINABLE,
-#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
- PTHREAD_CREATE_DETACHED
-#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
-};
-
-
-/* Mutex types. */
-enum
-{
- PTHREAD_MUTEX_TIMED_NP,
- PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_ADAPTIVE_NP
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
- ,
- PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
- PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
-#endif
-#ifdef __USE_GNU
- /* For compatibility. */
- , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP
-#endif
-};
-
-
-#ifdef __USE_XOPEN2K
-/* Robust mutex or not flags. */
-enum
-{
- PTHREAD_MUTEX_STALLED,
- PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
- PTHREAD_MUTEX_ROBUST,
- PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
-};
-#endif
-
-
-#if defined __USE_POSIX199506 || defined __USE_UNIX98
-/* Mutex protocols. */
-enum
-{
- PTHREAD_PRIO_NONE,
- PTHREAD_PRIO_INHERIT,
- PTHREAD_PRIO_PROTECT
-};
-#endif
-
-
-#define PTHREAD_MUTEX_INITIALIZER \
- { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } }
-#ifdef __USE_GNU
-# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
-# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \
- { __PTHREAD_SPINS }, { 0, 0 } } }
-#endif
-
-
-/* Read-write lock types. */
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-enum
-{
- PTHREAD_RWLOCK_PREFER_READER_NP,
- PTHREAD_RWLOCK_PREFER_WRITER_NP,
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
- PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
-};
-
-/* Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t
- has the shared field. All 64-bit architectures have the shared field
- in pthread_rwlock_t. */
-#ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED
-# if __WORDSIZE == 64
-# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
-# endif
-#endif
-
-
-/* Read-write lock initializers. */
-# define PTHREAD_RWLOCK_INITIALIZER \
- { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
-# ifdef __USE_GNU
-# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
- { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0, 0, 0 } }
-# endif
-#endif /* Unix98 or XOpen2K */
-
-
-/* Scheduler inheritance. */
-enum
-{
- PTHREAD_INHERIT_SCHED,
-#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
- PTHREAD_EXPLICIT_SCHED
-#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
-};
-
-
-/* Scope handling. */
-enum
-{
- PTHREAD_SCOPE_SYSTEM,
-#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
- PTHREAD_SCOPE_PROCESS
-#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
-};
-
-
-/* Process shared or private flag. */
-enum
-{
- PTHREAD_PROCESS_PRIVATE,
-#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
- PTHREAD_PROCESS_SHARED
-#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
-};
-
-
-/* Conditional variable handling. */
-#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } }
-
-
-/* Cleanup buffers */
-struct _pthread_cleanup_buffer
-{
- void (*__routine) (void *); /* Function to call. */
- void *__arg; /* Its argument. */
- int __canceltype; /* Saved cancellation type. */
- struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */
-};
-
-/* Cancellation */
-enum
-{
- PTHREAD_CANCEL_ENABLE,
-#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
- PTHREAD_CANCEL_DISABLE
-#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
-};
-enum
-{
- PTHREAD_CANCEL_DEFERRED,
-#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
- PTHREAD_CANCEL_ASYNCHRONOUS
-#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
-};
-#define PTHREAD_CANCELED ((void *) -1)
-
-
-/* Single execution handling. */
-#define PTHREAD_ONCE_INIT 0
-
-
-#ifdef __USE_XOPEN2K
-/* Value returned by 'pthread_barrier_wait' for one of the threads after
- the required number of threads have called this function.
- -1 is distinct from 0 and all errno constants */
-# define PTHREAD_BARRIER_SERIAL_THREAD -1
-#endif
-
-
-__BEGIN_DECLS
-
-/* Create a new thread, starting with execution of START-ROUTINE
- getting passed ARG. Creation attributed come from ATTR. The new
- handle is stored in *NEWTHREAD. */
-extern int pthread_create (pthread_t *__restrict __newthread,
- const pthread_attr_t *__restrict __attr,
- void *(*__start_routine) (void *),
- void *__restrict __arg) __THROWNL __nonnull ((1, 3));
-
-/* Terminate calling thread.
-
- The registered cleanup handlers are called via exception handling
- so we cannot mark this function with __THROW.*/
-extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
-
-/* Make calling thread wait for termination of the thread TH. The
- exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN
- is not NULL.
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int pthread_join (pthread_t __th, void **__thread_return);
-
-#ifdef __USE_GNU
-/* Check whether thread TH has terminated. If yes return the status of
- the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
-extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
-
-/* Make calling thread wait for termination of the thread TH, but only
- until TIMEOUT. The exit status of the thread is stored in
- *THREAD_RETURN, if THREAD_RETURN is not NULL.
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
- const struct timespec *__abstime);
-#endif
-
-/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
- The resources of TH will therefore be freed immediately when it
- terminates, instead of waiting for another thread to perform PTHREAD_JOIN
- on it. */
-extern int pthread_detach (pthread_t __th) __THROW;
-
-
-/* Obtain the identifier of the current thread. */
-extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
-
-/* Compare two thread identifiers. */
-extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
- __THROW __attribute__ ((__const__));
-
-
-/* Thread attribute handling. */
-
-/* Initialize thread attribute *ATTR with default attributes
- (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER,
- no user-provided stack). */
-extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
-
-/* Destroy thread attribute *ATTR. */
-extern int pthread_attr_destroy (pthread_attr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Get detach state attribute. */
-extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
- int *__detachstate)
- __THROW __nonnull ((1, 2));
-
-/* Set detach state attribute. */
-extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
- int __detachstate)
- __THROW __nonnull ((1));
-
-
-/* Get the size of the guard area created for stack overflow protection. */
-extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
- size_t *__guardsize)
- __THROW __nonnull ((1, 2));
-
-/* Set the size of the guard area created for stack overflow protection. */
-extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
- size_t __guardsize)
- __THROW __nonnull ((1));
-
-
-/* Return in *PARAM the scheduling parameters of *ATTR. */
-extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
- struct sched_param *__restrict __param)
- __THROW __nonnull ((1, 2));
-
-/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */
-extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
- const struct sched_param *__restrict
- __param) __THROW __nonnull ((1, 2));
-
-/* Return in *POLICY the scheduling policy of *ATTR. */
-extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
- __attr, int *__restrict __policy)
- __THROW __nonnull ((1, 2));
-
-/* Set scheduling policy in *ATTR according to POLICY. */
-extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
- __THROW __nonnull ((1));
-
-/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */
-extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
- __attr, int *__restrict __inherit)
- __THROW __nonnull ((1, 2));
-
-/* Set scheduling inheritance mode in *ATTR according to INHERIT. */
-extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
- int __inherit)
- __THROW __nonnull ((1));
-
-
-/* Return in *SCOPE the scheduling contention scope of *ATTR. */
-extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
- int *__restrict __scope)
- __THROW __nonnull ((1, 2));
-
-/* Set scheduling contention scope in *ATTR according to SCOPE. */
-extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
- __THROW __nonnull ((1));
-
-/* Return the previously set address for the stack. */
-extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
- __attr, void **__restrict __stackaddr)
- __THROW __nonnull ((1, 2)) __attribute_deprecated__;
-
-/* Set the starting address of the stack of the thread to be created.
- Depending on whether the stack grows up or down the value must either
- be higher or lower than all the address in the memory block. The
- minimal size of the block must be PTHREAD_STACK_MIN. */
-extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
- void *__stackaddr)
- __THROW __nonnull ((1)) __attribute_deprecated__;
-
-/* Return the currently used minimal stack size. */
-extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
- __attr, size_t *__restrict __stacksize)
- __THROW __nonnull ((1, 2));
-
-/* Add information about the minimum stack size needed for the thread
- to be started. This size must never be less than PTHREAD_STACK_MIN
- and must also not exceed the system limits. */
-extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
- size_t __stacksize)
- __THROW __nonnull ((1));
-
-#ifdef __USE_XOPEN2K
-/* Return the previously set address for the stack. */
-extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
- void **__restrict __stackaddr,
- size_t *__restrict __stacksize)
- __THROW __nonnull ((1, 2, 3));
-
-/* The following two interfaces are intended to replace the last two. They
- require setting the address as well as the size since only setting the
- address will make the implementation on some architectures impossible. */
-extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
- size_t __stacksize) __THROW __nonnull ((1));
-#endif
-
-#ifdef __USE_GNU
-/* Thread created with attribute ATTR will be limited to run only on
- the processors represented in CPUSET. */
-extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
- size_t __cpusetsize,
- const cpu_set_t *__cpuset)
- __THROW __nonnull ((1, 3));
-
-/* Get bit set in CPUSET representing the processors threads created with
- ATTR can run on. */
-extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
- size_t __cpusetsize,
- cpu_set_t *__cpuset)
- __THROW __nonnull ((1, 3));
-
-/* Get the default attributes used by pthread_create in this process. */
-extern int pthread_getattr_default_np (pthread_attr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Set the default attributes to be used by pthread_create in this
- process. */
-extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Initialize thread attribute *ATTR with attributes corresponding to the
- already running thread TH. It shall be called on uninitialized ATTR
- and destroyed with pthread_attr_destroy when no longer needed. */
-extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
- __THROW __nonnull ((2));
-#endif
-
-
-/* Functions for scheduling control. */
-
-/* Set the scheduling parameters for TARGET_THREAD according to POLICY
- and *PARAM. */
-extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
- const struct sched_param *__param)
- __THROW __nonnull ((3));
-
-/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */
-extern int pthread_getschedparam (pthread_t __target_thread,
- int *__restrict __policy,
- struct sched_param *__restrict __param)
- __THROW __nonnull ((2, 3));
-
-/* Set the scheduling priority for TARGET_THREAD. */
-extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
- __THROW;
-
-
-#ifdef __USE_GNU
-/* Get thread name visible in the kernel and its interfaces. */
-extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
- size_t __buflen)
- __THROW __nonnull ((2));
-
-/* Set thread name visible in the kernel and its interfaces. */
-extern int pthread_setname_np (pthread_t __target_thread, const char *__name)
- __THROW __nonnull ((2));
-#endif
-
-
-#ifdef __USE_UNIX98
-/* Determine level of concurrency. */
-extern int pthread_getconcurrency (void) __THROW;
-
-/* Set new concurrency level to LEVEL. */
-extern int pthread_setconcurrency (int __level) __THROW;
-#endif
-
-#ifdef __USE_GNU
-/* Yield the processor to another thread or process.
- This function is similar to the POSIX `sched_yield' function but
- might be differently implemented in the case of a m-on-n thread
- implementation. */
-extern int pthread_yield (void) __THROW;
-
-
-/* Limit specified thread TH to run only on the processors represented
- in CPUSET. */
-extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
- const cpu_set_t *__cpuset)
- __THROW __nonnull ((3));
-
-/* Get bit set in CPUSET representing the processors TH can run on. */
-extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
- cpu_set_t *__cpuset)
- __THROW __nonnull ((3));
-#endif
-
-
-/* Functions for handling initialization. */
-
-/* Guarantee that the initialization function INIT_ROUTINE will be called
- only once, even if pthread_once is executed several times with the
- same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or
- extern variable initialized to PTHREAD_ONCE_INIT.
-
- The initialization functions might throw exception which is why
- this function is not marked with __THROW. */
-extern int pthread_once (pthread_once_t *__once_control,
- void (*__init_routine) (void)) __nonnull ((1, 2));
-
-
-/* Functions for handling cancellation.
-
- Note that these functions are explicitly not marked to not throw an
- exception in C++ code. If cancellation is implemented by unwinding
- this is necessary to have the compiler generate the unwind information. */
-
-/* Set cancelability state of current thread to STATE, returning old
- state in *OLDSTATE if OLDSTATE is not NULL. */
-extern int pthread_setcancelstate (int __state, int *__oldstate);
-
-/* Set cancellation state of current thread to TYPE, returning the old
- type in *OLDTYPE if OLDTYPE is not NULL. */
-extern int pthread_setcanceltype (int __type, int *__oldtype);
-
-/* Cancel THREAD immediately or at the next possibility. */
-extern int pthread_cancel (pthread_t __th);
-
-/* Test for pending cancellation for the current thread and terminate
- the thread as per pthread_exit(PTHREAD_CANCELED) if it has been
- cancelled. */
-extern void pthread_testcancel (void);
-
-
-/* Cancellation handling with integration into exception handling. */
-
-typedef struct
-{
- struct
- {
- __jmp_buf __cancel_jmp_buf;
- int __mask_was_saved;
- } __cancel_jmp_buf[1];
- void *__pad[4];
-} __pthread_unwind_buf_t __attribute__ ((__aligned__));
-
-/* No special attributes by default. */
-#ifndef __cleanup_fct_attribute
-# define __cleanup_fct_attribute
-#endif
-
-
-/* Structure to hold the cleanup handler information. */
-struct __pthread_cleanup_frame
-{
- void (*__cancel_routine) (void *);
- void *__cancel_arg;
- int __do_it;
- int __cancel_type;
-};
-
-#if defined __GNUC__ && defined __EXCEPTIONS
-# ifdef __cplusplus
-/* Class to handle cancellation handler invocation. */
-class __pthread_cleanup_class
-{
- void (*__cancel_routine) (void *);
- void *__cancel_arg;
- int __do_it;
- int __cancel_type;
-
- public:
- __pthread_cleanup_class (void (*__fct) (void *), void *__arg)
- : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { }
- ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); }
- void __setdoit (int __newval) { __do_it = __newval; }
- void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED,
- &__cancel_type); }
- void __restore () const { pthread_setcanceltype (__cancel_type, 0); }
-};
-
-/* Install a cleanup handler: ROUTINE will be called with arguments ARG
- when the thread is canceled or calls pthread_exit. ROUTINE will also
- be called with arguments ARG when the matching pthread_cleanup_pop
- is executed with non-zero EXECUTE argument.
-
- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
- be used in matching pairs at the same nesting level of braces. */
-# define pthread_cleanup_push(routine, arg) \
- do { \
- __pthread_cleanup_class __clframe (routine, arg)
-
-/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
- If EXECUTE is non-zero, the handler function is called. */
-# define pthread_cleanup_pop(execute) \
- __clframe.__setdoit (execute); \
- } while (0)
-
-# ifdef __USE_GNU
-/* Install a cleanup handler as pthread_cleanup_push does, but also
- saves the current cancellation type and sets it to deferred
- cancellation. */
-# define pthread_cleanup_push_defer_np(routine, arg) \
- do { \
- __pthread_cleanup_class __clframe (routine, arg); \
- __clframe.__defer ()
-
-/* Remove a cleanup handler as pthread_cleanup_pop does, but also
- restores the cancellation type that was in effect when the matching
- pthread_cleanup_push_defer was called. */
-# define pthread_cleanup_pop_restore_np(execute) \
- __clframe.__restore (); \
- __clframe.__setdoit (execute); \
- } while (0)
-# endif
-# else
-/* Function called to call the cleanup handler. As an extern inline
- function the compiler is free to decide inlining the change when
- needed or fall back on the copy which must exist somewhere
- else. */
-__extern_inline void
-__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
-{
- if (__frame->__do_it)
- __frame->__cancel_routine (__frame->__cancel_arg);
-}
-
-/* Install a cleanup handler: ROUTINE will be called with arguments ARG
- when the thread is canceled or calls pthread_exit. ROUTINE will also
- be called with arguments ARG when the matching pthread_cleanup_pop
- is executed with non-zero EXECUTE argument.
-
- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
- be used in matching pairs at the same nesting level of braces. */
-# define pthread_cleanup_push(routine, arg) \
- do { \
- struct __pthread_cleanup_frame __clframe \
- __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
- = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
- .__do_it = 1 };
-
-/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
- If EXECUTE is non-zero, the handler function is called. */
-# define pthread_cleanup_pop(execute) \
- __clframe.__do_it = (execute); \
- } while (0)
-
-# ifdef __USE_GNU
-/* Install a cleanup handler as pthread_cleanup_push does, but also
- saves the current cancellation type and sets it to deferred
- cancellation. */
-# define pthread_cleanup_push_defer_np(routine, arg) \
- do { \
- struct __pthread_cleanup_frame __clframe \
- __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
- = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
- .__do_it = 1 }; \
- (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \
- &__clframe.__cancel_type)
-
-/* Remove a cleanup handler as pthread_cleanup_pop does, but also
- restores the cancellation type that was in effect when the matching
- pthread_cleanup_push_defer was called. */
-# define pthread_cleanup_pop_restore_np(execute) \
- (void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \
- __clframe.__do_it = (execute); \
- } while (0)
-# endif
-# endif
-#else
-/* Install a cleanup handler: ROUTINE will be called with arguments ARG
- when the thread is canceled or calls pthread_exit. ROUTINE will also
- be called with arguments ARG when the matching pthread_cleanup_pop
- is executed with non-zero EXECUTE argument.
-
- pthread_cleanup_push and pthread_cleanup_pop are macros and must always
- be used in matching pairs at the same nesting level of braces. */
-# define pthread_cleanup_push(routine, arg) \
- do { \
- __pthread_unwind_buf_t __cancel_buf; \
- void (*__cancel_routine) (void *) = (routine); \
- void *__cancel_arg = (arg); \
- int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
- __cancel_buf.__cancel_jmp_buf, 0); \
- if (__glibc_unlikely (__not_first_call)) \
- { \
- __cancel_routine (__cancel_arg); \
- __pthread_unwind_next (&__cancel_buf); \
- /* NOTREACHED */ \
- } \
- \
- __pthread_register_cancel (&__cancel_buf); \
- do {
-extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
- __cleanup_fct_attribute;
-
-/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
- If EXECUTE is non-zero, the handler function is called. */
-# define pthread_cleanup_pop(execute) \
- do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
- } while (0); \
- __pthread_unregister_cancel (&__cancel_buf); \
- if (execute) \
- __cancel_routine (__cancel_arg); \
- } while (0)
-extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
- __cleanup_fct_attribute;
-
-# ifdef __USE_GNU
-/* Install a cleanup handler as pthread_cleanup_push does, but also
- saves the current cancellation type and sets it to deferred
- cancellation. */
-# define pthread_cleanup_push_defer_np(routine, arg) \
- do { \
- __pthread_unwind_buf_t __cancel_buf; \
- void (*__cancel_routine) (void *) = (routine); \
- void *__cancel_arg = (arg); \
- int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
- __cancel_buf.__cancel_jmp_buf, 0); \
- if (__glibc_unlikely (__not_first_call)) \
- { \
- __cancel_routine (__cancel_arg); \
- __pthread_unwind_next (&__cancel_buf); \
- /* NOTREACHED */ \
- } \
- \
- __pthread_register_cancel_defer (&__cancel_buf); \
- do {
-extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf)
- __cleanup_fct_attribute;
-
-/* Remove a cleanup handler as pthread_cleanup_pop does, but also
- restores the cancellation type that was in effect when the matching
- pthread_cleanup_push_defer was called. */
-# define pthread_cleanup_pop_restore_np(execute) \
- do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
- } while (0); \
- __pthread_unregister_cancel_restore (&__cancel_buf); \
- if (execute) \
- __cancel_routine (__cancel_arg); \
- } while (0)
-extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf)
- __cleanup_fct_attribute;
-# endif
-
-/* Internal interface to initiate cleanup. */
-extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
- __cleanup_fct_attribute __attribute__ ((__noreturn__))
-# ifndef SHARED
- __attribute__ ((__weak__))
-# endif
- ;
-#endif
-
-/* Function used in the macros. */
-struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
-
-
-/* Mutex handling. */
-
-/* Initialize a mutex. */
-extern int pthread_mutex_init (pthread_mutex_t *__mutex,
- const pthread_mutexattr_t *__mutexattr)
- __THROW __nonnull ((1));
-
-/* Destroy a mutex. */
-extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
-
-/* Try locking a mutex. */
-extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
- __THROWNL __nonnull ((1));
-
-/* Lock a mutex. */
-extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
- __THROWNL __nonnull ((1));
-
-#ifdef __USE_XOPEN2K
-/* Wait until lock becomes available, or specified time passes. */
-extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 2));
-#endif
-
-#ifdef __USE_GNU
-extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
- clockid_t __clockid,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 3));
-#endif
-
-/* Unlock a mutex. */
-extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
- __THROWNL __nonnull ((1));
-
-
-/* Get the priority ceiling of MUTEX. */
-extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
- __restrict __mutex,
- int *__restrict __prioceiling)
- __THROW __nonnull ((1, 2));
-
-/* Set the priority ceiling of MUTEX to PRIOCEILING, return old
- priority ceiling value in *OLD_CEILING. */
-extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
- int __prioceiling,
- int *__restrict __old_ceiling)
- __THROW __nonnull ((1, 3));
-
-
-#ifdef __USE_XOPEN2K8
-/* Declare the state protected by MUTEX as consistent. */
-extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
-# ifdef __USE_GNU
-extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
-# endif
-#endif
-
-
-/* Functions for handling mutex attributes. */
-
-/* Initialize mutex attribute object ATTR with default attributes
- (kind is PTHREAD_MUTEX_TIMED_NP). */
-extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Destroy mutex attribute object ATTR. */
-extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Get the process-shared flag of the mutex attribute ATTR. */
-extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
- __restrict __attr,
- int *__restrict __pshared)
- __THROW __nonnull ((1, 2));
-
-/* Set the process-shared flag of the mutex attribute ATTR. */
-extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
- int __pshared)
- __THROW __nonnull ((1));
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
-/* Return in *KIND the mutex kind attribute in *ATTR. */
-extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
- __attr, int *__restrict __kind)
- __THROW __nonnull ((1, 2));
-
-/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
- PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
- PTHREAD_MUTEX_DEFAULT). */
-extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
- __THROW __nonnull ((1));
-#endif
-
-/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */
-extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
- __restrict __attr,
- int *__restrict __protocol)
- __THROW __nonnull ((1, 2));
-
-/* Set the mutex protocol attribute in *ATTR to PROTOCOL (either
- PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */
-extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
- int __protocol)
- __THROW __nonnull ((1));
-
-/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
-extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
- __restrict __attr,
- int *__restrict __prioceiling)
- __THROW __nonnull ((1, 2));
-
-/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
-extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
- int __prioceiling)
- __THROW __nonnull ((1));
-
-#ifdef __USE_XOPEN2K
-/* Get the robustness flag of the mutex attribute ATTR. */
-extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
- int *__robustness)
- __THROW __nonnull ((1, 2));
-# ifdef __USE_GNU
-extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr,
- int *__robustness)
- __THROW __nonnull ((1, 2));
-# endif
-
-/* Set the robustness flag of the mutex attribute ATTR. */
-extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
- int __robustness)
- __THROW __nonnull ((1));
-# ifdef __USE_GNU
-extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
- int __robustness)
- __THROW __nonnull ((1));
-# endif
-#endif
-
-
-#if defined __USE_UNIX98 || defined __USE_XOPEN2K
-/* Functions for handling read-write locks. */
-
-/* Initialize read-write lock RWLOCK using attributes ATTR, or use
- the default values if later is NULL. */
-extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
- const pthread_rwlockattr_t *__restrict
- __attr) __THROW __nonnull ((1));
-
-/* Destroy read-write lock RWLOCK. */
-extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
-
-/* Acquire read lock for RWLOCK. */
-extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
- __THROWNL __nonnull ((1));
-
-/* Try to acquire read lock for RWLOCK. */
-extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
- __THROWNL __nonnull ((1));
-
-# ifdef __USE_XOPEN2K
-/* Try to acquire read lock for RWLOCK or return after specfied time. */
-extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 2));
-# endif
-
-# ifdef __USE_GNU
-extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
- clockid_t __clockid,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 3));
-# endif
-
-/* Acquire write lock for RWLOCK. */
-extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
- __THROWNL __nonnull ((1));
-
-/* Try to acquire write lock for RWLOCK. */
-extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
- __THROWNL __nonnull ((1));
-
-# ifdef __USE_XOPEN2K
-/* Try to acquire write lock for RWLOCK or return after specfied time. */
-extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 2));
-# endif
-
-# ifdef __USE_GNU
-extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
- clockid_t __clockid,
- const struct timespec *__restrict
- __abstime) __THROWNL __nonnull ((1, 3));
-# endif
-
-/* Unlock RWLOCK. */
-extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
- __THROWNL __nonnull ((1));
-
-
-/* Functions for handling read-write lock attributes. */
-
-/* Initialize attribute object ATTR with default values. */
-extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Destroy attribute object ATTR. */
-extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Return current setting of process-shared attribute of ATTR in PSHARED. */
-extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
- __restrict __attr,
- int *__restrict __pshared)
- __THROW __nonnull ((1, 2));
-
-/* Set process-shared attribute of ATTR to PSHARED. */
-extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
- int __pshared)
- __THROW __nonnull ((1));
-
-/* Return current setting of reader/writer preference. */
-extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
- __restrict __attr,
- int *__restrict __pref)
- __THROW __nonnull ((1, 2));
-
-/* Set reader/write preference. */
-extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
- int __pref) __THROW __nonnull ((1));
-#endif
-
-
-/* Functions for handling conditional variables. */
-
-/* Initialize condition variable COND using attributes ATTR, or use
- the default values if later is NULL. */
-extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
- const pthread_condattr_t *__restrict __cond_attr)
- __THROW __nonnull ((1));
-
-/* Destroy condition variable COND. */
-extern int pthread_cond_destroy (pthread_cond_t *__cond)
- __THROW __nonnull ((1));
-
-/* Wake up one thread waiting for condition variable COND. */
-extern int pthread_cond_signal (pthread_cond_t *__cond)
- __THROWNL __nonnull ((1));
-
-/* Wake up all threads waiting for condition variables COND. */
-extern int pthread_cond_broadcast (pthread_cond_t *__cond)
- __THROWNL __nonnull ((1));
-
-/* Wait for condition variable COND to be signaled or broadcast.
- MUTEX is assumed to be locked before.
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
- pthread_mutex_t *__restrict __mutex)
- __nonnull ((1, 2));
-
-/* Wait for condition variable COND to be signaled or broadcast until
- ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an
- absolute time specification; zero is the beginning of the epoch
- (00:00:00 GMT, January 1, 1970).
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
- pthread_mutex_t *__restrict __mutex,
- const struct timespec *__restrict __abstime)
- __nonnull ((1, 2, 3));
-
-# ifdef __USE_GNU
-/* Wait for condition variable COND to be signaled or broadcast until
- ABSTIME measured by the specified clock. MUTEX is assumed to be
- locked before. CLOCK is the clock to use. ABSTIME is an absolute
- time specification against CLOCK's epoch.
-
- This function is a cancellation point and therefore not marked with
- __THROW. */
-extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
- pthread_mutex_t *__restrict __mutex,
- __clockid_t __clock_id,
- const struct timespec *__restrict __abstime)
- __nonnull ((1, 2, 4));
-# endif
-
-/* Functions for handling condition variable attributes. */
-
-/* Initialize condition variable attribute ATTR. */
-extern int pthread_condattr_init (pthread_condattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Destroy condition variable attribute ATTR. */
-extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Get the process-shared flag of the condition variable attribute ATTR. */
-extern int pthread_condattr_getpshared (const pthread_condattr_t *
- __restrict __attr,
- int *__restrict __pshared)
- __THROW __nonnull ((1, 2));
-
-/* Set the process-shared flag of the condition variable attribute ATTR. */
-extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
- int __pshared) __THROW __nonnull ((1));
-
-#ifdef __USE_XOPEN2K
-/* Get the clock selected for the condition variable attribute ATTR. */
-extern int pthread_condattr_getclock (const pthread_condattr_t *
- __restrict __attr,
- __clockid_t *__restrict __clock_id)
- __THROW __nonnull ((1, 2));
-
-/* Set the clock selected for the condition variable attribute ATTR. */
-extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
- __clockid_t __clock_id)
- __THROW __nonnull ((1));
-#endif
-
-
-#ifdef __USE_XOPEN2K
-/* Functions to handle spinlocks. */
-
-/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can
- be shared between different processes. */
-extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
- __THROW __nonnull ((1));
-
-/* Destroy the spinlock LOCK. */
-extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
-
-/* Wait until spinlock LOCK is retrieved. */
-extern int pthread_spin_lock (pthread_spinlock_t *__lock)
- __THROWNL __nonnull ((1));
-
-/* Try to lock spinlock LOCK. */
-extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
- __THROWNL __nonnull ((1));
-
-/* Release spinlock LOCK. */
-extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
- __THROWNL __nonnull ((1));
-
-
-/* Functions to handle barriers. */
-
-/* Initialize BARRIER with the attributes in ATTR. The barrier is
- opened when COUNT waiters arrived. */
-extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
- const pthread_barrierattr_t *__restrict
- __attr, unsigned int __count)
- __THROW __nonnull ((1));
-
-/* Destroy a previously dynamically initialized barrier BARRIER. */
-extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
- __THROW __nonnull ((1));
-
-/* Wait on barrier BARRIER. */
-extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
- __THROWNL __nonnull ((1));
-
-
-/* Initialize barrier attribute ATTR. */
-extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Destroy previously dynamically initialized barrier attribute ATTR. */
-extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
- __THROW __nonnull ((1));
-
-/* Get the process-shared flag of the barrier attribute ATTR. */
-extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
- __restrict __attr,
- int *__restrict __pshared)
- __THROW __nonnull ((1, 2));
-
-/* Set the process-shared flag of the barrier attribute ATTR. */
-extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
- int __pshared)
- __THROW __nonnull ((1));
-#endif
-
-
-/* Functions for handling thread-specific data. */
-
-/* Create a key value identifying a location in the thread-specific
- data area. Each thread maintains a distinct thread-specific data
- area. DESTR_FUNCTION, if non-NULL, is called with the value
- associated to that key when the key is destroyed.
- DESTR_FUNCTION is not called if the value associated is NULL when
- the key is destroyed. */
-extern int pthread_key_create (pthread_key_t *__key,
- void (*__destr_function) (void *))
- __THROW __nonnull ((1));
-
-/* Destroy KEY. */
-extern int pthread_key_delete (pthread_key_t __key) __THROW;
-
-/* Return current value of the thread-specific data slot identified by KEY. */
-extern void *pthread_getspecific (pthread_key_t __key) __THROW;
-
-/* Store POINTER in the thread-specific data slot identified by KEY. */
-extern int pthread_setspecific (pthread_key_t __key,
- const void *__pointer) __THROW ;
-
-
-#ifdef __USE_XOPEN2K
-/* Get ID of CPU-time clock for thread THREAD_ID. */
-extern int pthread_getcpuclockid (pthread_t __thread_id,
- __clockid_t *__clock_id)
- __THROW __nonnull ((2));
-#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
- FORK. The PARENT handler is called in the parent process just after FORK.
- The CHILD handler is called in the child process. Each of the three
- handlers can be NULL, meaning that no handler needs to be called at that
- point.
- PTHREAD_ATFORK can be called several times, in which case the PREPARE
- handlers are called in LIFO order (last added with PTHREAD_ATFORK,
- first called before FORK), and the PARENT and CHILD handlers are called
- in FIFO (first added, first called). */
-
-extern int pthread_atfork (void (*__prepare) (void),
- void (*__parent) (void),
- void (*__child) (void)) __THROW;
-
-
-#ifdef __USE_EXTERN_INLINES
-/* Optimizations. */
-__extern_inline int
-__NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2))
-{
- return __thread1 == __thread2;
-}
-#endif
-
-__END_DECLS
-
-#endif /* pthread.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for PA-RISC.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.
@@ -28,6 +28,8 @@
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
+#include <tls.h>
+
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
#include <errno.h>
@@ -360,39 +362,9 @@ L(pre_end): ASM_LINE_SEP \
#define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \
"%r20", "%r29", "%r31"
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
-({ \
- long __sys_res = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, )); \
- __sys_res = -1; \
- } \
- __sys_res; \
-})
-
-/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static
- value to use within the context of the syscall
- INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise
- You are allowed to use the syscall result (val) and the DECL error
- variable to determine what went wrong.
- INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number.
- In our case we just flip the sign. */
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((val < 0) && (val > -4095))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
/* Similar to INLINE_SYSCALL but we don't set errno */
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
+#define INTERNAL_SYSCALL(name, nr, args...) \
({ \
long __sys_res; \
{ \
@@ -418,7 +390,7 @@ L(pre_end): ASM_LINE_SEP \
/* The _NCS variant allows non-constant syscall numbers. */
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \
long __sys_res; \
{ \
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. i386 version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. i386 version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -23,8 +23,6 @@
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_GETSOCKOPT_SYSCALL 1
-# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
@@ -41,6 +39,8 @@
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
# undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
#endif
/* i686 only supports ipc syscall before 5.1. */
lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
@@ -48,7 +48,7 @@
to compile glibc. Disable GCC 5 optimization when compiling for
profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
can't be used to put the 6th argument in %ebp for syscall. */
-#if __GNUC_PREREQ (5,0) && !defined PROF && CAN_USE_REGISTER_ASM_EBP
+#if !defined PROF && CAN_USE_REGISTER_ASM_EBP
# define OPTIMIZE_FOR_GCC_5
#endif
@@ -67,6 +67,7 @@
/* We don't want the label for the error handle to be global when we define
it here. */
+#undef SYSCALL_ERROR_LABEL
#define SYSCALL_ERROR_LABEL __syscall_error
#undef PSEUDO
@@ -280,35 +281,6 @@ struct libc_do_syscall_args
};
#endif
-/* Define a macro which expands inline into the wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#if IS_IN (libc)
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )) \
- ? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, )) \
- : (int) resultvar; })
-#else
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
- resultvar = 0xffffffff; \
- } \
- (int) resultvar; })
-#endif
-
-/* Set error number and return -1. Return the internal function,
- __syscall_error, which sets errno from the negative error number
- and returns -1, to avoid PIC. */
-#undef INLINE_SYSCALL_ERROR_RETURN_VALUE
-#define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \
- __syscall_error (-(resultvar))
-
# define VDSO_NAME "LINUX_2.6"
# define VDSO_HASH 61765110
@@ -319,6 +291,11 @@ struct libc_do_syscall_args
# define HAVE_TIME_VSYSCALL "__vdso_time"
# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres"
+# define HAVE_CLONE3_WRAPPER 1
+
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
@@ -327,25 +304,41 @@ struct libc_do_syscall_args
The _NCS variant allows non-constant syscall numbers but it is not
possible to use more than four parameters. */
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args)
-#define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args)
-#define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args)
-#define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args)
-#define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args)
-#define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args)
+#define INTERNAL_SYSCALL_MAIN_0(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args)
+#define INTERNAL_SYSCALL_MAIN_1(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args)
+#define INTERNAL_SYSCALL_MAIN_2(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args)
+#define INTERNAL_SYSCALL_MAIN_3(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args)
+#define INTERNAL_SYSCALL_MAIN_4(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args)
+#define INTERNAL_SYSCALL_MAIN_5(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args)
+
+#define INTERNAL_SYSCALL_MAIN_NCS_0(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 0, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_1(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 1, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_2(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 2, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_3(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 3, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_4(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 4, args)
+#define INTERNAL_SYSCALL_MAIN_NCS_5(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 5, args)
+
/* Each object using 6-argument inline syscalls must include a
definition of __libc_do_syscall. */
#ifdef OPTIMIZE_FOR_GCC_5
-# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \
- INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args)
+# define INTERNAL_SYSCALL_MAIN_6(name, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
+# define INTERNAL_SYSCALL_MAIN_NCS_6(name, args...) \
+ INTERNAL_SYSCALL_MAIN_NCS(name, 6, args)
#else /* GCC 5 */
-# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \
+# define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \
arg4, arg5, arg6) \
struct libc_do_syscall_args _xv = \
{ \
@@ -359,52 +352,67 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
: "memory", "cc")
+# define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3, \
+ arg4, arg5, arg6) \
+ struct libc_do_syscall_args _xv = \
+ { \
+ (int) (arg1), \
+ (int) (arg5), \
+ (int) (arg6) \
+ }; \
+ asm volatile ( \
+ "movl %1, %%eax\n\t" \
+ "call __libc_do_syscall" \
+ : "=a" (resultvar) \
+ : "a" (name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
+ : "memory", "cc")
#endif /* GCC 5 */
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
+
+#define INTERNAL_SYSCALL(name, nr, args...) \
({ \
register unsigned int resultvar; \
- INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \
+ INTERNAL_SYSCALL_MAIN_##nr (name, args); \
(int) resultvar; })
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+ INTERNAL_SYSCALL_MAIN_NCS_##nr (name, args); \
+ (int) resultvar; })
+
#if I386_USE_SYSENTER
# ifdef OPTIMIZE_FOR_GCC_5
# ifdef PIC
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"call *%%gs:%P2" \
: "=a" (resultvar) \
: "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMARGS_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"call *%%gs:%P2" \
: "=a" (resultvar) \
: "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
- ASMARGS_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ ASMARGS_##nr(args) : "memory", "cc")
# else
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"call *_dl_sysinfo" \
: "=a" (resultvar) \
: "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"call *_dl_sysinfo" \
: "=a" (resultvar) \
- : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
# endif
# else /* GCC 5 */
# ifdef PIC
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -414,9 +422,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -424,10 +430,9 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
- ASMFMT_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ ASMFMT_##nr(args) : "memory", "cc")
# else
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -436,38 +441,32 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
"call *_dl_sysinfo\n\t" \
RESTOREARGS_##nr \
: "=a" (resultvar) \
- : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
# endif
# endif /* GCC 5 */
#else
# ifdef OPTIMIZE_FOR_GCC_5
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"int $0x80" \
: "=a" (resultvar) \
: "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
"int $0x80" \
: "=a" (resultvar) \
- : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ : "a" (name) ASMARGS_##nr(args) : "memory", "cc")
# else /* GCC 5 */
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -476,30 +475,17 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register unsigned int resultvar; \
+# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
"int $0x80\n\t" \
RESTOREARGS_##nr \
: "=a" (resultvar) \
- : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
- (int) resultvar; })
+ : "0" (name) ASMFMT_##nr(args) : "memory", "cc")
# endif /* GCC 5 */
#endif
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
#define LOADARGS_0
#ifdef __PIC__
# if I386_USE_SYSENTER && defined PIC
@@ -618,20 +604,6 @@ struct libc_do_syscall_args
# define EXTRAVAR_5
#endif
-/* Consistency check for position-independent code. */
-#if defined __PIC__ && !defined OPTIMIZE_FOR_GCC_5
-# define check_consistency() \
- ({ int __res; \
- __asm__ __volatile__ \
- (LOAD_PIC_REG_STR (cx) ";" \
- "subl %%ebx, %%ecx;" \
- "je 1f;" \
- "ud2;" \
- "1:\n" \
- : "=c" (__res)); \
- __res; })
-#endif
-
#endif /* __ASSEMBLER__ */
@@ -662,4 +634,9 @@ struct libc_do_syscall_args
# endif
#endif
+/* Each shadow stack slot takes 4 bytes. Assuming that each stack
+ frame takes 128 bytes, this is used to compute shadow stack size
+ from stack size. */
+#define STACK_SIZE_TO_SHADOW_STACK_SIZE_SHIFT 5
+
#endif /* linux/i386/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h
@@ -1,149 +0,0 @@
-/* Copyright (C) 1999-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_KERNEL 0
-#define _STAT_VER_LINUX 1
-#define _STAT_VER _STAT_VER_LINUX
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 0
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
- __ino_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __glibc_reserved0;
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
- long int __glibc_reserved[3];
- };
-
-#ifdef __USE_LARGEFILE64
-/* Note stat64 is the same shape as stat. */
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __glibc_reserved0;
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
- long int __glibc_reserved[3];
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits//stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. IA-64 version.
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Copyright (C) 2003-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
Based on code originally written by David Mosberger-Tang
@@ -46,12 +46,6 @@
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
-/* This is to help the old kernel headers where __NR_semtimedop is not
- available. */
-#ifndef __NR_semtimedop
-# define __NR_semtimedop 1247
-#endif
-
#if defined USE_DL_SYSINFO \
&& (IS_IN (libc) \
|| IS_IN (libpthread) || IS_IN (librt))
@@ -95,6 +89,7 @@
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
+#undef SYSCALL_ERROR_LABEL
#define SYSCALL_ERROR_LABEL __syscall_error
#undef PSEUDO
@@ -177,6 +172,9 @@
#else /* not __ASSEMBLER__ */
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
#define BREAK_INSN_1(num) "break " #num ";;\n\t"
#define BREAK_INSN(num) BREAK_INSN_1(num)
@@ -191,13 +189,13 @@
#ifdef IA64_USE_NEW_STUB
-# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+({ \
LOAD_ARGS_##nr (args) \
register long _r8 __asm ("r8"); \
register long _r10 __asm ("r10"); \
register long _r15 __asm ("r15") = name; \
register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\
- long _retval; \
LOAD_REGS_##nr \
/* \
* Don't specify any unwind info here. We mark ar.pfs as \
@@ -209,60 +207,30 @@
ASM_OUTARGS_##nr \
: "0" (_b7), "3" (_r15) ASM_ARGS_##nr \
: "memory", "ar.pfs" ASM_CLOBBERS_##nr); \
- _retval = _r8;
+ _r10 == -1 ? -_r8 : _r8; \
+})
#else /* !IA64_USE_NEW_STUB */
-# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+({ \
LOAD_ARGS_##nr (args) \
register long _r8 asm ("r8"); \
register long _r10 asm ("r10"); \
register long _r15 asm ("r15") = name; \
- long _retval; \
LOAD_REGS_##nr \
__asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \
: "=r" (_r8), "=r" (_r10), "=r" (_r15) \
ASM_OUTARGS_##nr \
: "2" (_r15) ASM_ARGS_##nr \
: "memory" ASM_CLOBBERS_##nr); \
- _retval = _r8;
+ _r10 == -1 ? -_r8 : _r8; \
+})
#endif /* !IA64_USE_NEW_STUB */
-#define DO_INLINE_SYSCALL(name, nr, args...) \
- DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args)
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \
- if (_r10 == -1) \
- { \
- __set_errno (_retval); \
- _retval = -1; \
- } \
- _retval; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- DO_INLINE_SYSCALL_NCS (name, nr, args) \
- err = _r10; \
- _retval; })
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ({ (void) (val); \
- (err == -1); \
- })
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h
@@ -1,5 +1,5 @@
/* Internal declarations for sys/timex.h.
- Copyright (C) 2014-2020 Free Software Foundation, Inc.
+ Copyright (C) 2014-2021 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
@@ -23,7 +23,178 @@
# ifndef _ISOMAC
+extern int __adjtimex (struct timex *__ntx);
libc_hidden_proto (__adjtimex)
+# include <time.h>
+# include <struct___timeval64.h>
+/* Local definition of 64 bit time supporting timex struct */
+# if __TIMESIZE == 64
+# define __timex64 timex
+# define __clock_adjtime64 __clock_adjtime
+# define ___adjtimex64 ___adjtimex
+# define __ntptimeval64 ntptimeval
+# define __ntp_gettime64 __ntp_gettime
+# define __ntp_gettimex64 __ntp_gettimex
+# else
+
+struct __timex64
+{
+ unsigned int modes; /* mode selector */
+ int :32; /* pad */
+ long long int offset; /* time offset (usec) */
+ long long int freq; /* frequency offset (scaled ppm) */
+ long long int maxerror; /* maximum error (usec) */
+ long long int esterror; /* estimated error (usec) */
+ int status; /* clock command/status */
+ int :32; /* pad */
+ long long int constant; /* pll time constant */
+ long long int precision; /* clock precision (usec) (read only) */
+ long long int tolerance; /* clock frequency tolerance (ppm) (ro) */
+ struct __timeval64 time; /* (read only, except for ADJ_SETOFFSET) */
+ long long int tick; /* (modified) usecs between clock ticks */
+ long long int ppsfreq; /* pps frequency (scaled ppm) (ro) */
+ long long int jitter; /* pps jitter (us) (ro) */
+ int shift; /* interval duration (s) (shift) (ro) */
+ int :32; /* pad */
+ long long int stabil; /* pps stability (scaled ppm) (ro) */
+ long long int jitcnt; /* jitter limit exceeded (ro) */
+ long long int calcnt; /* calibration intervals (ro) */
+ long long int errcnt; /* calibration errors (ro) */
+ long long int stbcnt; /* stability limit exceeded (ro) */
+
+ int tai; /* TAI offset (ro) */
+
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+ int :32;
+};
+extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64);
+libc_hidden_proto (__clock_adjtime64);
+extern int ___adjtimex64 (struct __timex64 *tx64);
+libc_hidden_proto (___adjtimex64)
+
+struct __ntptimeval64
+{
+ struct __timeval64 time; /* current time (ro) */
+ long int maxerror; /* maximum error (us) (ro) */
+ long int esterror; /* estimated error (us) (ro) */
+ long int tai; /* TAI offset (ro) */
+
+ long int __glibc_reserved1;
+ long int __glibc_reserved2;
+ long int __glibc_reserved3;
+ long int __glibc_reserved4;
+};
+extern int __ntp_gettime64 (struct __ntptimeval64 *ntv);
+libc_hidden_proto (__ntp_gettime64)
+extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv);
+libc_hidden_proto (__ntp_gettimex64)
+
+# endif
+
+/* Convert a known valid struct timex into a struct __timex64. */
+static inline struct __timex64
+valid_timex_to_timex64 (const struct timex tx)
+{
+ struct __timex64 tx64;
+
+ tx64.modes = tx.modes;
+ tx64.offset = tx.offset;
+ tx64.freq = tx.freq;
+ tx64.maxerror = tx.maxerror;
+ tx64.esterror = tx.esterror;
+ tx64.status = tx.status;
+ tx64.constant = tx.constant;
+ tx64.precision = tx.precision;
+ tx64.tolerance = tx.tolerance;
+ tx64.time = valid_timeval_to_timeval64 (tx.time);
+ tx64.tick = tx.tick;
+ tx64.ppsfreq = tx.ppsfreq;
+ tx64.jitter = tx.jitter;
+ tx64.shift = tx.shift;
+ tx64.stabil = tx.stabil;
+ tx64.jitcnt = tx.jitcnt;
+ tx64.calcnt = tx.calcnt;
+ tx64.errcnt = tx.errcnt;
+ tx64.stbcnt = tx.stbcnt;
+ tx64.tai = tx.tai;
+
+ return tx64;
+}
+
+/* Convert a known valid struct __timex64 into a struct timex. */
+static inline struct timex
+valid_timex64_to_timex (const struct __timex64 tx64)
+{
+ struct timex tx;
+
+ tx.modes = tx64.modes;
+ tx.offset = tx64.offset;
+ tx.freq = tx64.freq;
+ tx.maxerror = tx64.maxerror;
+ tx.esterror = tx64.esterror;
+ tx.status = tx64.status;
+ tx.constant = tx64.constant;
+ tx.precision = tx64.precision;
+ tx.tolerance = tx64.tolerance;
+ tx.time = valid_timeval64_to_timeval (tx64.time);
+ tx.tick = tx64.tick;
+ tx.ppsfreq = tx64.ppsfreq;
+ tx.jitter = tx64.jitter;
+ tx.shift = tx64.shift;
+ tx.stabil = tx64.stabil;
+ tx.jitcnt = tx64.jitcnt;
+ tx.calcnt = tx64.calcnt;
+ tx.errcnt = tx64.errcnt;
+ tx.stbcnt = tx64.stbcnt;
+ tx.tai = tx64.tai;
+
+ return tx;
+}
+
+/* Convert a known valid struct ntptimeval into a struct __ntptimeval64. */
+static inline struct __ntptimeval64
+valid_ntptimeval_to_ntptimeval64 (const struct ntptimeval ntv)
+{
+ struct __ntptimeval64 ntv64;
+
+ ntv64.time = valid_timeval_to_timeval64 (ntv.time);
+ ntv64.maxerror = ntv.maxerror;
+ ntv64.esterror = ntv.esterror;
+ ntv64.tai = ntv.tai;
+ ntv64.__glibc_reserved1 = 0;
+ ntv64.__glibc_reserved2 = 0;
+ ntv64.__glibc_reserved3 = 0;
+ ntv64.__glibc_reserved4 = 0;
+
+ return ntv64;
+}
+
+/* Convert a known valid struct __ntptimeval64 into a struct ntptimeval. */
+static inline struct ntptimeval
+valid_ntptimeval64_to_ntptimeval (const struct __ntptimeval64 ntp64)
+{
+ struct ntptimeval ntp;
+
+ ntp.time = valid_timeval64_to_timeval (ntp64.time);
+ ntp.maxerror = ntp64.maxerror;
+ ntp.esterror = ntp64.esterror;
+ ntp.tai = ntp64.tai;
+ ntp.__glibc_reserved1 = 0;
+ ntp.__glibc_reserved2 = 0;
+ ntp.__glibc_reserved3 = 0;
+ ntp.__glibc_reserved4 = 0;
+
+ return ntp;
+}
# endif /* _ISOMAC */
#endif /* sys/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h
@@ -1,172 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
- unsigned short int __pad1;
-#ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-#else
- __ino_t __st_ino; /* 32bit file serial number. */
-#endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
-#ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-#else
- __off64_t st_size; /* Size of file, in bytes. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
-#ifndef __USE_FILE_OFFSET64
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-#else
- __ino64_t st_ino; /* File serial number. */
-#endif
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- unsigned short int __pad1;
-
- __ino_t __st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __ino64_t st_ino; /* File serial number. */
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 2008-2020 Free Software Foundation, Inc.
+ Copyright (C) 2008-2021 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
@@ -23,8 +23,6 @@
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_GETSOCKOPT_SYSCALL 1
-# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
@@ -43,6 +41,8 @@
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
# undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
#endif
/* No support for PI futexes or robust mutexes before 3.10 for m68k. */
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
December 1995.
@@ -44,6 +44,7 @@
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
+#undef SYSCALL_ERROR_LABEL
#ifdef PIC
#define SYSCALL_ERROR_LABEL .Lsyscall_error
#else
@@ -221,27 +222,12 @@ SYSCALL_ERROR_LABEL: \
#else /* not __ASSEMBLER__ */
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
- _sys_result = (unsigned int) -1; \
- } \
- (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
gave back. */
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ unsigned int _sys_result; \
{ \
/* Load argument values in temporary variables
@@ -257,15 +243,8 @@ SYSCALL_ERROR_LABEL: \
_sys_result = _d0; \
} \
(int) _sys_result; })
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= -4095U)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
@@ -313,6 +292,9 @@ SYSCALL_ERROR_LABEL: \
LOAD_REGS_5
#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0)
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
#endif /* not __ASSEMBLER__ */
/* Pointer mangling is not yet supported for M68K. */
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h
@@ -1,203 +0,0 @@
-/* Copyright (C) 1997-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-#ifndef __USE_FILE_OFFSET64
-struct stat
-{
- __dev_t st_dev; /* Device. */
- __ino_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group. */
- __dev_t st_rdev; /* Device number, if device. */
- unsigned long __pad2;
- __off_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- int __pad3;
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- * equivalent to 'struct timespec'. This is the type used
- * whenever possible but the Unix namespace rules do not allow the
- * identifier 'timespec' to appear in the <sys/stat.h> header.
- * Therefore we have to handle the use of this header in strictly
- * standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- unsigned int __glibc_reserved4;
- unsigned int __glibc_reserved5;
-};
-#else /* __USE_FILE_OFFSET64 */
-/* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64
- * structure. Glibc has no type __dev64_t that's why I had to use standard
- * type for st_dev and st_rdev. Several architectures uses pads after st_dev
- * but this approach covers BIG and LITTLE endian. I think it is better to
- * create one ifdef to separate stats structures. */
-struct stat
-{
- unsigned long long st_dev; /* Device. */
- __ino64_t st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group. */
- unsigned long long st_rdev; /* Device number, if device. */
- unsigned long long __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- int __pad3;
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
- /* Nanosecond resolution timestamps are stored in a format
- * equivalent to 'struct timespec'. This is the type used
- * whenever possible but the Unix namespace rules do not allow the
- * identifier 'timespec' to appear in the <sys/stat.h> header.
- * Therefore we have to handle the use of this header in strictly
- * standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- unsigned int __glibc_reserved4;
- unsigned int __glibc_reserved5;
-};
-#endif /* __USE_FILE_OFFSET64 */
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-{
- unsigned long long st_dev; /* Device. */
- __ino64_t st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group. */
- unsigned long long st_rdev; /* Device number, if device. */
- unsigned long long __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- int __pad3;
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- * equivalent to 'struct timespec'. This is the type used
- * whenever possible but the Unix namespace rules do not allow the
- * identifier 'timespec' to appear in the <sys/stat.h> header.
- * Therefore we have to handle the use of this header in strictly
- * standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- unsigned int __glibc_reserved4;
- unsigned int __glibc_reserved5;
-};
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h. */
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2021 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
@@ -28,8 +28,6 @@
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
-#define __ASSUME_GETSOCKOPT_SYSCALL 1
-#define __ASSUME_SETSOCKOPT_SYSCALL 1
#include_next <kernel-features.h>
lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -26,6 +26,8 @@
/* Defines RTLD_PRIVATE_ERRNO. */
#include <dl-sysdep.h>
+#include <tls.h>
+
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#ifndef __ASSEMBLER__
# include <errno.h>
@@ -60,6 +62,7 @@
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
+# undef SYSCALL_ERROR_LABEL
# ifdef PIC
# define SYSCALL_ERROR_LABEL 0f
# else
@@ -163,42 +166,18 @@ SYSCALL_ERROR_LABEL_DCL: \
#else /* not __ASSEMBLER__ */
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
-({ INTERNAL_SYSCALL_DECL(err); \
- unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \
- if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
- resultvar = (unsigned long) -1; \
- } \
- (long) resultvar; \
-})
-
-# undef INTERNAL_SYSCALL_DECL
-# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
gave back. */
# undef INTERNAL_SYSCALL
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
+# define INTERNAL_SYSCALL(name, nr, args...) \
inline_syscall##nr(SYS_ify(name), args)
# undef INTERNAL_SYSCALL_NCS
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
inline_syscall##nr(name, args)
-# undef INTERNAL_SYSCALL_ERROR_P
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= -4095U)
-
-# undef INTERNAL_SYSCALL_ERRNO
-# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
# define SYSCALL_CLOBBERS_6 "r11", "r4", "memory"
# define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6
# define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5
@@ -209,8 +188,8 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall0(name,dummy) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r12) \
@@ -219,9 +198,10 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall1(name,arg1) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
+ long int __arg1 = (long int) (arg1); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r12) \
@@ -230,10 +210,12 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall2(name,arg1,arg2) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
- register long __r6 __asm__("r6") = (long)(arg2); \
+ long int __arg1 = (long int) (arg1); \
+ long int __arg2 = (long int) (arg2); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
+ register long int __r6 __asm__("r6") = __arg2; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r12) \
@@ -243,11 +225,14 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall3(name,arg1,arg2,arg3) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
- register long __r6 __asm__("r6") = (long)(arg2); \
- register long __r7 __asm__("r7") = (long)(arg3); \
+ long int __arg1 = (long int) (arg1); \
+ long int __arg2 = (long int) (arg2); \
+ long int __arg3 = (long int) (arg3); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
+ register long int __r6 __asm__("r6") = __arg2; \
+ register long int __r7 __asm__("r7") = __arg3; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \
@@ -257,12 +242,16 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall4(name,arg1,arg2,arg3,arg4) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
- register long __r6 __asm__("r6") = (long)(arg2); \
- register long __r7 __asm__("r7") = (long)(arg3); \
- register long __r8 __asm__("r8") = (long)(arg4); \
+ long int __arg1 = (long int) (arg1); \
+ long int __arg2 = (long int) (arg2); \
+ long int __arg3 = (long int) (arg3); \
+ long int __arg4 = (long int) (arg4); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
+ register long int __r6 __asm__("r6") = __arg2; \
+ register long int __r7 __asm__("r7") = __arg3; \
+ register long int __r8 __asm__("r8") = __arg4; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \
@@ -272,13 +261,18 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
- register long __r6 __asm__("r6") = (long)(arg2); \
- register long __r7 __asm__("r7") = (long)(arg3); \
- register long __r8 __asm__("r8") = (long)(arg4); \
- register long __r9 __asm__("r9") = (long)(arg5); \
+ long int __arg1 = (long int) (arg1); \
+ long int __arg2 = (long int) (arg2); \
+ long int __arg3 = (long int) (arg3); \
+ long int __arg4 = (long int) (arg4); \
+ long int __arg5 = (long int) (arg5); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
+ register long int __r6 __asm__("r6") = __arg2; \
+ register long int __r7 __asm__("r7") = __arg3; \
+ register long int __r8 __asm__("r8") = __arg4; \
+ register long int __r9 __asm__("r9") = __arg5; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \
@@ -288,14 +282,20 @@ SYSCALL_ERROR_LABEL_DCL: \
# define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
- register long __ret __asm__("r3"); \
- register long __r12 __asm__("r12") = name; \
- register long __r5 __asm__("r5") = (long)(arg1); \
- register long __r6 __asm__("r6") = (long)(arg2); \
- register long __r7 __asm__("r7") = (long)(arg3); \
- register long __r8 __asm__("r8") = (long)(arg4); \
- register long __r9 __asm__("r9") = (long)(arg5); \
- register long __r10 __asm__("r10") = (long)(arg6); \
+ long int __arg1 = (long int) (arg1); \
+ long int __arg2 = (long int) (arg2); \
+ long int __arg3 = (long int) (arg3); \
+ long int __arg4 = (long int) (arg4); \
+ long int __arg5 = (long int) (arg5); \
+ long int __arg6 = (long int) (arg6); \
+ register long int __ret __asm__("r3"); \
+ register long int __r12 __asm__("r12") = name; \
+ register long int __r5 __asm__("r5") = __arg1; \
+ register long int __r6 __asm__("r6") = __arg2; \
+ register long int __r7 __asm__("r7") = __arg3; \
+ register long int __r8 __asm__("r8") = __arg4; \
+ register long int __r9 __asm__("r9") = __arg5; \
+ register long int __r10 __asm__("r10") = __arg6; \
__asm__ __volatile__( "brki r14,8; nop;" \
: "=r"(__ret) \
: "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \
@@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL: \
# define SINGLE_THREAD_BY_GLOBAL 1
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
#endif /* not __ASSEMBLER__ */
#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -1,263 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-#include <sgidefs.h>
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-
-#if _MIPS_SIM == _ABIO32
-/* Structure describing file characteristics. */
-struct stat
- {
- unsigned long int st_dev;
- long int st_pad1[3];
-#ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-#else
- __ino64_t st_ino; /* File serial number. */
-#endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- unsigned long int st_rdev; /* Device number, if device. */
-#ifndef __USE_FILE_OFFSET64
- long int st_pad2[2];
- __off_t st_size; /* Size of file, in bytes. */
- /* SVR4 added this extra long to allow for expansion of off_t. */
- long int st_pad3;
-#else
- long int st_pad2[3];
- __off64_t st_size; /* Size of file, in bytes. */
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
-#else
- long int st_pad4;
- __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
-#endif
- long int st_pad5[14];
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- unsigned long int st_dev;
- long int st_pad1[3];
- __ino64_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- unsigned long int st_rdev; /* Device number, if device. */
- long int st_pad2[3];
- __off64_t st_size; /* Size of file, in bytes. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- long int st_pad3;
- __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
- long int st_pad4[14];
- };
-#endif
-#else
-struct stat
- {
- __dev_t st_dev;
- int st_pad1[3]; /* Reserved for st_dev expansion */
-#ifndef __USE_FILE_OFFSET64
- __ino_t st_ino;
-#else
- __ino64_t st_ino;
-#endif
- __mode_t st_mode;
- __nlink_t st_nlink;
- __uid_t st_uid;
- __gid_t st_gid;
- __dev_t st_rdev;
-#if !defined __USE_FILE_OFFSET64
- unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */
- __off_t st_size;
- int st_pad3;
-#else
- unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
- __off64_t st_size;
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- __blksize_t st_blksize;
- unsigned int st_pad4;
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks;
-#else
- __blkcnt64_t st_blocks;
-#endif
- int st_pad5[14];
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev;
- unsigned int st_pad1[3]; /* Reserved for st_dev expansion */
- __ino64_t st_ino;
- __mode_t st_mode;
- __nlink_t st_nlink;
- __uid_t st_uid;
- __gid_t st_gid;
- __dev_t st_rdev;
- unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */
- __off64_t st_size;
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __blksize_t st_blksize;
- unsigned int st_pad3;
- __blkcnt64_t st_blocks;
- int st_pad4[14];
-};
-#endif
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 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
@@ -25,11 +25,6 @@
#include <tls.h>
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -42,32 +37,14 @@
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
#ifdef __PIC__
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 99b
#endif
#else /* ! __ASSEMBLER__ */
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL (_sc_err); \
- long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \
- result_var = -1L; \
- } \
- result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
/* Note that the original Linux syscall restart convention required the
instruction immediately preceding SYSCALL to initialize $v0 with the
@@ -103,11 +80,11 @@
union __mips_syscall_return
{
- long long val;
+ long long int val;
struct
{
- long v0;
- long v1;
+ long int v0;
+ long int v1;
}
reg;
};
@@ -121,14 +98,13 @@ union __mips_syscall_return
# include <mips16-syscall.h>
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args)
+# define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args)
-# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
({ \
union __mips_syscall_return _sc_ret; \
_sc_ret.val = __mips16_syscall##nr (args, number); \
- err = _sc_ret.reg.v1; \
_sc_ret.reg.v0; \
})
@@ -138,12 +114,12 @@ union __mips_syscall_return
number, err, args)
#else /* !__mips16 */
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
+# define INTERNAL_SYSCALL(name, nr, args...) \
internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
"IK" (SYS_ify (name)), \
SYS_ify (name), err, args)
-# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
"r" (__s0), \
number, err, args)
@@ -152,13 +128,13 @@ union __mips_syscall_return
#define internal_syscall0(v0_init, input, number, err, dummy...) \
({ \
- long _sys_result; \
+ long int _sys_result; \
\
{ \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
+ register long int __s0 asm ("$16") __attribute__ ((unused)) \
= (number); \
- register long __v0 asm ("$2"); \
- register long __a3 asm ("$7"); \
+ register long int __v0 asm ("$2"); \
+ register long int __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
v0_init \
@@ -167,22 +143,22 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
#define internal_syscall1(v0_init, input, number, err, arg1) \
({ \
- long _sys_result; \
+ long int _sys_result; \
\
{ \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
+ long int _arg1 = (long int) (arg1); \
+ register long int __s0 asm ("$16") __attribute__ ((unused)) \
= (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a3 asm ("$7"); \
+ register long int __v0 asm ("$2"); \
+ register long int __a0 asm ("$4") = _arg1; \
+ register long int __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
v0_init \
@@ -191,23 +167,24 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
({ \
- long _sys_result; \
+ long int _sys_result; \
\
{ \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ register long int __s0 asm ("$16") __attribute__ ((unused)) \
= (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a3 asm ("$7"); \
+ register long int __v0 asm ("$2"); \
+ register long int __a0 asm ("$4") = _arg1; \
+ register long int __a1 asm ("$5") = _arg2; \
+ register long int __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
v0_init \
@@ -216,8 +193,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -225,16 +201,19 @@ union __mips_syscall_return
#define internal_syscall3(v0_init, input, number, err, \
arg1, arg2, arg3) \
({ \
- long _sys_result; \
+ long int _sys_result; \
\
{ \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ register long int __s0 asm ("$16") __attribute__ ((unused)) \
= (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7"); \
+ register long int __v0 asm ("$2"); \
+ register long int __a0 asm ("$4") = _arg1; \
+ register long int __a1 asm ("$5") = _arg2; \
+ register long int __a2 asm ("$6") = _arg3; \
+ register long int __a3 asm ("$7"); \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
v0_init \
@@ -243,8 +222,7 @@ union __mips_syscall_return
: "=r" (__v0), "=r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -252,16 +230,20 @@ union __mips_syscall_return
#define internal_syscall4(v0_init, input, number, err, \
arg1, arg2, arg3, arg4) \
({ \
- long _sys_result; \
+ long int _sys_result; \
\
{ \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ register long int __s0 asm ("$16") __attribute__ ((unused)) \
= (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7") = (long) (arg4); \
+ register long int __v0 asm ("$2"); \
+ register long int __a0 asm ("$4") = _arg1; \
+ register long int __a1 asm ("$5") = _arg2; \
+ register long int __a2 asm ("$6") = _arg3; \
+ register long int __a3 asm ("$7") = _arg4; \
__asm__ volatile ( \
".set\tnoreorder\n\t" \
v0_init \
@@ -270,8 +252,7 @@ union __mips_syscall_return
: "=r" (__v0), "+r" (__a3) \
: input, "r" (__a0), "r" (__a1), "r" (__a2) \
: __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
+ _sys_result = __a3 != 0 ? -__v0 : __v0; \
} \
_sys_result; \
})
@@ -285,65 +266,65 @@ union __mips_syscall_return
compiler specifics required for the stack arguments to be pushed,
which would be the case if these syscalls were inlined. */
-long long __nomips16 __mips_syscall5 (long arg1, long arg2, long arg3,
- long arg4, long arg5,
- long number);
+long long int __nomips16 __mips_syscall5 (long int arg1, long int arg2,
+ long int arg3, long int arg4,
+ long int arg5,
+ long int number);
libc_hidden_proto (__mips_syscall5, nomips16)
#define internal_syscall5(v0_init, input, number, err, \
arg1, arg2, arg3, arg4, arg5) \
({ \
union __mips_syscall_return _sc_ret; \
- _sc_ret.val = __mips_syscall5 ((long) (arg1), \
- (long) (arg2), \
- (long) (arg3), \
- (long) (arg4), \
- (long) (arg5), \
- (long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.val = __mips_syscall5 ((long int) (arg1), \
+ (long int) (arg2), \
+ (long int) (arg3), \
+ (long int) (arg4), \
+ (long int) (arg5), \
+ (long int) (number)); \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
-long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3,
- long arg4, long arg5, long arg6,
- long number);
+long long int __nomips16 __mips_syscall6 (long int arg1, long int arg2,
+ long int arg3, long int arg4,
+ long int arg5, long int arg6,
+ long int number);
libc_hidden_proto (__mips_syscall6, nomips16)
#define internal_syscall6(v0_init, input, number, err, \
arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
union __mips_syscall_return _sc_ret; \
- _sc_ret.val = __mips_syscall6 ((long) (arg1), \
- (long) (arg2), \
- (long) (arg3), \
- (long) (arg4), \
- (long) (arg5), \
- (long) (arg6), \
- (long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.val = __mips_syscall6 ((long int) (arg1), \
+ (long int) (arg2), \
+ (long int) (arg3), \
+ (long int) (arg4), \
+ (long int) (arg5), \
+ (long int) (arg6), \
+ (long int) (number)); \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
-long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3,
- long arg4, long arg5, long arg6,
- long arg7,
- long number);
+long long int __nomips16 __mips_syscall7 (long int arg1, long int arg2,
+ long int arg3, long int arg4,
+ long int arg5, long int arg6,
+ long int arg7,
+ long int number);
libc_hidden_proto (__mips_syscall7, nomips16)
#define internal_syscall7(v0_init, input, number, err, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
({ \
union __mips_syscall_return _sc_ret; \
- _sc_ret.val = __mips_syscall7 ((long) (arg1), \
- (long) (arg2), \
- (long) (arg3), \
- (long) (arg4), \
- (long) (arg5), \
- (long) (arg6), \
- (long) (arg7), \
- (long) (number)); \
- err = _sc_ret.reg.v1; \
- _sc_ret.reg.v0; \
+ _sc_ret.val = __mips_syscall7 ((long int) (arg1), \
+ (long int) (arg2), \
+ (long int) (arg3), \
+ (long int) (arg4), \
+ (long int) (arg5), \
+ (long int) (arg6), \
+ (long int) (arg7), \
+ (long int) (number)); \
+ _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
})
#if __mips_isa_rev >= 6
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
@@ -1,311 +0,0 @@
-/* Copyright (C) 2000-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality. */
-#include <sysdeps/unix/sysv/linux/mips/sysdep.h>
-#include <sysdeps/unix/sysv/linux/sysdep.h>
-#include <sysdeps/unix/mips/mips64/n32/sysdep.h>
-
-#include <tls.h>
-
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
- table when we define it here. */
-# define SYSCALL_ERROR_LABEL 99b
-
-#else /* ! __ASSEMBLER__ */
-
-/* Convert X to a long long, without losing any bits if it is one
- already or warning if it is a 32-bit pointer. */
-#define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X))
-
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL (_sc_err); \
- long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \
- result_var = -1L; \
- } \
- result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
-
-/* Note that the original Linux syscall restart convention required the
- instruction immediately preceding SYSCALL to initialize $v0 with the
- syscall number. Then if a restart triggered, $v0 would have been
- clobbered by the syscall interrupted, and needed to be reinititalized.
- The kernel would decrement the PC by 4 before switching back to the
- user mode so that $v0 had been reloaded before SYSCALL was executed
- again. This implied the place $v0 was loaded from must have been
- preserved across a syscall, e.g. an immediate, static register, stack
- slot, etc.
-
- The convention was relaxed in Linux with a change applied to the kernel
- GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
- first appeared in the 2.6.36 release. Since then the kernel has had
- code that reloads $v0 upon syscall restart and resumes right at the
- SYSCALL instruction, so no special arrangement is needed anymore.
-
- For backwards compatibility with existing kernel binaries we support
- the old convention by choosing the instruction preceding SYSCALL
- carefully. This also means we have to force a 32-bit encoding of the
- microMIPS MOVE instruction if one is used. */
-
-#ifdef __mips_micromips
-# define MOVE32 "move32"
-#else
-# define MOVE32 "move"
-#endif
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
- "IK" (SYS_ify (name)), \
- 0, err, args)
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
- "r" (__s0), \
- number, err, args)
-
-#define internal_syscall0(v0_init, input, number, err, dummy...) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall1(v0_init, input, number, err, arg1) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a1 asm ("$5") = ARGIFY (arg2); \
- register long long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall3(v0_init, input, number, err, \
- arg1, arg2, arg3) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a1 asm ("$5") = ARGIFY (arg2); \
- register long long __a2 asm ("$6") = ARGIFY (arg3); \
- register long long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall4(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a1 asm ("$5") = ARGIFY (arg2); \
- register long long __a2 asm ("$6") = ARGIFY (arg3); \
- register long long __a3 asm ("$7") = ARGIFY (arg4); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall5(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4, arg5) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a1 asm ("$5") = ARGIFY (arg2); \
- register long long __a2 asm ("$6") = ARGIFY (arg3); \
- register long long __a3 asm ("$7") = ARGIFY (arg4); \
- register long long __a4 asm ("$8") = ARGIFY (arg5); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall6(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4, arg5, arg6) \
-({ \
- long _sys_result; \
- \
- { \
- register long long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long long __v0 asm ("$2"); \
- register long long __a0 asm ("$4") = ARGIFY (arg1); \
- register long long __a1 asm ("$5") = ARGIFY (arg2); \
- register long long __a2 asm ("$6") = ARGIFY (arg3); \
- register long long __a3 asm ("$7") = ARGIFY (arg4); \
- register long long __a4 asm ("$8") = ARGIFY (arg5); \
- register long long __a5 asm ("$9") = ARGIFY (arg6); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
- "r" (__a5) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#if __mips_isa_rev >= 6
-# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"
-#else
-# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "hi", "lo", "memory"
-#endif
-
-#endif /* __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for MIPS. */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
-#endif /* linux/mips/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
@@ -1,307 +0,0 @@
-/* Copyright (C) 2000-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality. */
-#include <sysdeps/unix/sysv/linux/mips/sysdep.h>
-#include <sysdeps/unix/sysv/linux/sysdep.h>
-#include <sysdeps/unix/mips/mips64/n64/sysdep.h>
-
-#include <tls.h>
-
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
- table when we define it here. */
-# define SYSCALL_ERROR_LABEL 99b
-
-#else /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL (_sc_err); \
- long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \
- result_var = -1L; \
- } \
- result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val)
-
-/* Note that the original Linux syscall restart convention required the
- instruction immediately preceding SYSCALL to initialize $v0 with the
- syscall number. Then if a restart triggered, $v0 would have been
- clobbered by the syscall interrupted, and needed to be reinititalized.
- The kernel would decrement the PC by 4 before switching back to the
- user mode so that $v0 had been reloaded before SYSCALL was executed
- again. This implied the place $v0 was loaded from must have been
- preserved across a syscall, e.g. an immediate, static register, stack
- slot, etc.
-
- The convention was relaxed in Linux with a change applied to the kernel
- GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
- first appeared in the 2.6.36 release. Since then the kernel has had
- code that reloads $v0 upon syscall restart and resumes right at the
- SYSCALL instruction, so no special arrangement is needed anymore.
-
- For backwards compatibility with existing kernel binaries we support
- the old convention by choosing the instruction preceding SYSCALL
- carefully. This also means we have to force a 32-bit encoding of the
- microMIPS MOVE instruction if one is used. */
-
-#ifdef __mips_micromips
-# define MOVE32 "move32"
-#else
-# define MOVE32 "move"
-#endif
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
- "IK" (SYS_ify (name)), \
- 0, err, args)
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
- "r" (__s0), \
- number, err, args)
-
-#define internal_syscall0(v0_init, input, number, err, dummy...) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall1(v0_init, input, number, err, arg1) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall3(v0_init, input, number, err, \
- arg1, arg2, arg3) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall4(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7") = (long) (arg4); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall5(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4, arg5) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7") = (long) (arg4); \
- register long __a4 asm ("$8") = (long) (arg5); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall6(v0_init, input, number, err, \
- arg1, arg2, arg3, arg4, arg5, arg6) \
-({ \
- long _sys_result; \
- \
- { \
- register long __s0 asm ("$16") __attribute__ ((unused)) \
- = (number); \
- register long __v0 asm ("$2"); \
- register long __a0 asm ("$4") = (long) (arg1); \
- register long __a1 asm ("$5") = (long) (arg2); \
- register long __a2 asm ("$6") = (long) (arg3); \
- register long __a3 asm ("$7") = (long) (arg4); \
- register long __a4 asm ("$8") = (long) (arg5); \
- register long __a5 asm ("$9") = (long) (arg6); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- v0_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
- "r" (__a5) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#if __mips_isa_rev >= 6
-# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"
-#else
-# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "hi", "lo", "memory"
-#endif
-
-#endif /* __ASSEMBLER__ */
-
-/* Pointer mangling is not yet supported for MIPS. */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
-
-#endif /* linux/mips/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h
@@ -1,275 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-#include <bits/wordsize.h>
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#if __WORDSIZE == 32
-# define _STAT_VER _STAT_VER_LINUX
-#else
-# define _STAT_VER _STAT_VER_KERNEL
-#endif
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-
-#if __WORDSIZE == 32
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
-# ifndef __USE_FILE_OFFSET64
- unsigned short int __pad1;
- __ino_t st_ino; /* File serial number. */
-# else
- __ino64_t st_ino; /* File serial number. */
-# endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
-# ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-# else
- __off64_t st_size; /* Size of file, in bytes. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-# ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-# else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# endif
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- };
-
-
-# ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- };
-# endif /* __USE_LARGEFILE64 */
-
-#else /* __WORDSIZE == 32 */
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
-# ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-# else
- __ino64_t st_ino; /* File serial number. */
-# endif
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __pad2;
- __dev_t st_rdev; /* Device number, if device. */
-# ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-# else
- __off64_t st_size; /* Size of file, in bytes. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-# ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-# else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# endif
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- unsigned long int __glibc_reserved6;
- };
-
-# ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __pad2;
- __dev_t st_rdev; /* Device number, if device. */
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- unsigned long int __glibc_reserved6;
- };
-# endif /* __USE_LARGEFILE64 */
-#endif
-
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -1,214 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _LINUX_POWERPC_SYSDEP_H
-#define _LINUX_POWERPC_SYSDEP_H 1
-
-#include <sysdeps/unix/sysv/linux/powerpc/sysdep.h>
-#include <sysdeps/unix/sysv/linux/sysdep.h>
-#include <sysdeps/unix/powerpc/sysdep.h>
-#include <tls.h>
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
-#ifndef __ASSEMBLER__
-
-# include <errno.h>
-
-/* Define a macro which expands inline into the wrapper code for a VDSO
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno.
- On powerpc a system call basically clobbers the same registers like a
- function call, with the exception of LR (which is needed for the
- "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
- an error return status). */
-# define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \
- ({ \
- register void *r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- register long int r9 __asm__ ("r9"); \
- register long int r10 __asm__ ("r10"); \
- register long int r11 __asm__ ("r11"); \
- register long int r12 __asm__ ("r12"); \
- register type rval __asm__ ("r3"); \
- LOADARGS_##nr (funcptr, args); \
- __asm__ __volatile__ \
- ("mtctr %0\n\t" \
- "bctrl\n\t" \
- "mfcr %0" \
- : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \
- "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \
- : : "cr0", "ctr", "lr", "memory"); \
- err = (long int) r0; \
- __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \
- rval; \
- })
-
-#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
- INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args)
-
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- sc_ret; \
- })
-
-/* Define a macro which expands inline into the wrapper code for a system
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno.
- On powerpc a system call basically clobbers the same registers like a
- function call, with the exception of LR (which is needed for the
- "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
- an error return status). */
-
-# undef INTERNAL_SYSCALL_DECL
-# define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused))
-
-# undef INTERNAL_SYSCALL
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register long int r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- register long int r9 __asm__ ("r9"); \
- register long int r10 __asm__ ("r10"); \
- register long int r11 __asm__ ("r11"); \
- register long int r12 __asm__ ("r12"); \
- LOADARGS_##nr(name, args); \
- __asm__ __volatile__ \
- ("sc \n\t" \
- "mfcr %0" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \
- "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \
- : ASM_INPUT_##nr \
- : "cr0", "ctr", "memory"); \
- err = r0; \
- (int) r3; \
- })
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-
-# undef INTERNAL_SYSCALL_ERROR_P
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
-
-# undef INTERNAL_SYSCALL_ERRNO
-# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
-
-# define LOADARGS_0(name, dummy) \
- r0 = name
-# define LOADARGS_1(name, __arg1) \
- long int arg1 = (long int) (__arg1); \
- LOADARGS_0(name, 0); \
- extern void __illegally_sized_syscall_arg1 (void); \
- if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
- __illegally_sized_syscall_arg1 (); \
- r3 = arg1
-# define LOADARGS_2(name, __arg1, __arg2) \
- long int arg2 = (long int) (__arg2); \
- LOADARGS_1(name, __arg1); \
- extern void __illegally_sized_syscall_arg2 (void); \
- if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \
- __illegally_sized_syscall_arg2 (); \
- r4 = arg2
-# define LOADARGS_3(name, __arg1, __arg2, __arg3) \
- long int arg3 = (long int) (__arg3); \
- LOADARGS_2(name, __arg1, __arg2); \
- extern void __illegally_sized_syscall_arg3 (void); \
- if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \
- __illegally_sized_syscall_arg3 (); \
- r5 = arg3
-# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \
- long int arg4 = (long int) (__arg4); \
- LOADARGS_3(name, __arg1, __arg2, __arg3); \
- extern void __illegally_sized_syscall_arg4 (void); \
- if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \
- __illegally_sized_syscall_arg4 (); \
- r6 = arg4
-# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
- long int arg5 = (long int) (__arg5); \
- LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \
- extern void __illegally_sized_syscall_arg5 (void); \
- if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \
- __illegally_sized_syscall_arg5 (); \
- r7 = arg5
-# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
- long int arg6 = (long int) (__arg6); \
- LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
- extern void __illegally_sized_syscall_arg6 (void); \
- if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \
- __illegally_sized_syscall_arg6 (); \
- r8 = arg6
-
-# define ASM_INPUT_0 "0" (r0)
-# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
-# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
-# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
-# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6)
-# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
-# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
-
-#endif /* __ASSEMBLER__ */
-
-
-/* Pointer mangling support. */
-#if IS_IN (rtld)
-/* We cannot use the thread descriptor because in ld.so we use setjmp
- earlier than the descriptor is initialized. */
-#else
-# ifdef __ASSEMBLER__
-# define PTR_MANGLE(reg, tmpreg) \
- lwz tmpreg,POINTER_GUARD(r2); \
- xor reg,tmpreg,reg
-# define PTR_MANGLE2(reg, tmpreg) \
- xor reg,tmpreg,reg
-# define PTR_MANGLE3(destreg, reg, tmpreg) \
- lwz tmpreg,POINTER_GUARD(r2); \
- xor destreg,tmpreg,reg
-# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
-# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
-# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
-# else
-# define PTR_MANGLE(var) \
- (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
-# define PTR_DEMANGLE(var) PTR_MANGLE (var)
-# endif
-#endif
-
-#endif /* linux/powerpc/powerpc32/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 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
@@ -17,202 +17,10 @@
/* Alan Modra <amodra@bigpond.net.au> rewrote the INLINE_SYSCALL macro */
-#ifndef _LINUX_POWERPC_SYSDEP_H
-#define _LINUX_POWERPC_SYSDEP_H 1
+#ifndef _LINUX_POWERPC64_SYSDEP_H
+#define _LINUX_POWERPC64_SYSDEP_H 1
#include <sysdeps/unix/sysv/linux/powerpc/sysdep.h>
-#include <sysdeps/unix/sysv/linux/sysdep.h>
-#include <sysdeps/unix/powerpc/sysdep.h>
-#include <tls.h>
-
-/* Define __set_errno() for INLINE_SYSCALL macro below. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
-#ifdef __ASSEMBLER__
-
-/* This seems to always be the case on PPC. */
-# define ALIGNARG(log2) log2
-# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
-
-#endif /* __ASSEMBLER__ */
-
-/* Define a macro which expands inline into the wrapper code for a system
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno. This returns just what the kernel
- gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
- the negation of the return value in the kernel gets reverted. */
-
-#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \
- ({ \
- register void *r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- register type rval __asm__ ("r3"); \
- LOADARGS_##nr (funcptr, args); \
- __asm__ __volatile__ \
- ("mtctr %0\n\t" \
- "bctrl\n\t" \
- "mfcr %0\n\t" \
- "0:" \
- : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \
- "+r" (r7), "+r" (r8) \
- : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \
- err = (long int) r0; \
- __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \
- rval; \
- })
-
-#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
- INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args)
-
-/* This version is for kernels that implement system calls that
- behave like function calls as far as register saving. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- sc_ret; \
- })
-
-/* Define a macro which expands inline into the wrapper code for a system
- call. This use is for internal calls that do not need to handle errors
- normally. It will never touch errno. This returns just what the kernel
- gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
- the negation of the return value in the kernel gets reverted. */
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- register long int r0 __asm__ ("r0"); \
- register long int r3 __asm__ ("r3"); \
- register long int r4 __asm__ ("r4"); \
- register long int r5 __asm__ ("r5"); \
- register long int r6 __asm__ ("r6"); \
- register long int r7 __asm__ ("r7"); \
- register long int r8 __asm__ ("r8"); \
- LOADARGS_##nr (name, ##args); \
- __asm__ __volatile__ \
- ("sc\n\t" \
- "mfcr %0\n\t" \
- "0:" \
- : "=&r" (r0), \
- "=&r" (r3), "=&r" (r4), "=&r" (r5), \
- "=&r" (r6), "=&r" (r7), "=&r" (r8) \
- : ASM_INPUT_##nr \
- : "r9", "r10", "r11", "r12", \
- "cr0", "ctr", "memory"); \
- err = r0; \
- r3; \
- })
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
-
-#define LOADARGS_0(name, dummy) \
- r0 = name
-#define LOADARGS_1(name, __arg1) \
- long int arg1 = (long int) (__arg1); \
- LOADARGS_0(name, 0); \
- extern void __illegally_sized_syscall_arg1 (void); \
- if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 8) \
- __illegally_sized_syscall_arg1 (); \
- r3 = arg1
-#define LOADARGS_2(name, __arg1, __arg2) \
- long int arg2 = (long int) (__arg2); \
- LOADARGS_1(name, __arg1); \
- extern void __illegally_sized_syscall_arg2 (void); \
- if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 8) \
- __illegally_sized_syscall_arg2 (); \
- r4 = arg2
-#define LOADARGS_3(name, __arg1, __arg2, __arg3) \
- long int arg3 = (long int) (__arg3); \
- LOADARGS_2(name, __arg1, __arg2); \
- extern void __illegally_sized_syscall_arg3 (void); \
- if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \
- __illegally_sized_syscall_arg3 (); \
- r5 = arg3
-#define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \
- long int arg4 = (long int) (__arg4); \
- LOADARGS_3(name, __arg1, __arg2, __arg3); \
- extern void __illegally_sized_syscall_arg4 (void); \
- if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 8) \
- __illegally_sized_syscall_arg4 (); \
- r6 = arg4
-#define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \
- long int arg5 = (long int) (__arg5); \
- LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \
- extern void __illegally_sized_syscall_arg5 (void); \
- if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 8) \
- __illegally_sized_syscall_arg5 (); \
- r7 = arg5
-#define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \
- long int arg6 = (long int) (__arg6); \
- LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \
- extern void __illegally_sized_syscall_arg6 (void); \
- if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 8) \
- __illegally_sized_syscall_arg6 (); \
- r8 = arg6
-
-#define ASM_INPUT_0 "0" (r0)
-#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3)
-#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4)
-#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5)
-#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6)
-#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
-#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
-
-
-/* Pointer mangling support. */
-#if IS_IN (rtld)
-/* We cannot use the thread descriptor because in ld.so we use setjmp
- earlier than the descriptor is initialized. */
-#else
-# ifdef __ASSEMBLER__
-# define PTR_MANGLE(reg, tmpreg) \
- ld tmpreg,POINTER_GUARD(r13); \
- xor reg,tmpreg,reg
-# define PTR_MANGLE2(reg, tmpreg) \
- xor reg,tmpreg,reg
-# define PTR_MANGLE3(destreg, reg, tmpreg) \
- ld tmpreg,POINTER_GUARD(r13); \
- xor destreg,tmpreg,reg
-# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
-# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
-# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
-# else
-# define PTR_MANGLE(var) \
- (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
-# define PTR_DEMANGLE(var) PTR_MANGLE (var)
-# endif
-#endif
/* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used
even by largefile64 code. */
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. PowerPC version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -28,8 +28,6 @@
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
-#define __ASSUME_GETSOCKOPT_SYSCALL 1
-#define __ASSUME_SETSOCKOPT_SYSCALL 1
/* Define this if your 32-bit syscall API requires 64-bit register
pairs to start with an even-number register. */
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/xstatver.h
@@ -0,0 +1,17 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#if __WORDSIZE == 32
+# define _STAT_VER _STAT_VER_LINUX
+#else
+# define _STAT_VER _STAT_VER_KERNEL
+#endif
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. RISC-V version.
- Copyright (C) 2018-2020 Free Software Foundation, Inc.
+ Copyright (C) 2018-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -22,6 +22,32 @@
#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
#include <tls.h>
+#undef SYS_ify
+#define SYS_ify(syscall_name) __NR_##syscall_name
+
+#if __WORDSIZE == 32
+
+/* Workarounds for generic code needing to handle 64-bit time_t. */
+
+/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */
+#define __NR_clock_getres __NR_clock_getres_time64
+/* Fix sysdeps/nptl/lowlevellock-futex.h. */
+#define __NR_futex __NR_futex_time64
+/* Fix sysdeps/unix/sysv/linux/pause.c. */
+#define __NR_ppoll __NR_ppoll_time64
+/* Fix sysdeps/unix/sysv/linux/select.c. */
+#define __NR_pselect6 __NR_pselect6_time64
+/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */
+#define __NR_recvmmsg __NR_recvmmsg_time64
+/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */
+#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64
+/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */
+#define __NR_semtimedop __NR_semtimedop_time64
+/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */
+#define __NR_utimensat __NR_utimensat_time64
+
+#endif /* __WORDSIZE == 32 */
+
#ifdef __ASSEMBLER__
# include <sys/asm.h>
@@ -107,56 +133,38 @@
# undef ret_ERRVAL
# define ret_ERRVAL ret
-#endif /* __ASSEMBLER__ */
+#else /* !__ASSEMBLER__ */
-/* In order to get __set_errno() definition in INLINE_SYSCALL. */
-#ifndef __ASSEMBLER__
-# include <errno.h>
-#endif
+# if __WORDSIZE == 64
+# define VDSO_NAME "LINUX_4.15"
+# define VDSO_HASH 182943605
-#include <sysdeps/unix/sysdep.h>
-
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
-#ifndef __ASSEMBLER__
+/* List of system calls which are supported as vsyscalls only
+ for RV64. */
+# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
+# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
+# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
+# else
+# define VDSO_NAME "LINUX_5.4"
+# define VDSO_HASH 61765876
-# define VDSO_NAME "LINUX_4.15"
-# define VDSO_HASH 182943605
+/* RV32 does not support the gettime VDSO syscalls. */
+# endif
-/* List of system calls which are supported as vsyscalls. */
-# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
-# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime"
-# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
+/* List of system calls which are supported as vsyscalls (for RV32 and
+ RV64). */
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL (err); \
- long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \
- __sys_result = (unsigned long) -1; \
- } \
- __sys_result; })
-
-# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned long int) (val) > -4096UL)
-
-# define INTERNAL_SYSCALL_ERRNO(val, err) (-val)
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
-# define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (SYS_ify (name), err, args)
+# define INTERNAL_SYSCALL(name, nr, args...) \
+ internal_syscall##nr (SYS_ify (name), args)
-# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (number, err, args)
+# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
+ internal_syscall##nr (number, args)
-# define internal_syscall0(number, err, dummy...) \
+# define internal_syscall0(number, dummy...) \
({ \
long int _sys_result; \
\
@@ -173,13 +181,14 @@
_sys_result; \
})
-# define internal_syscall1(number, err, arg0) \
+# define internal_syscall1(number, arg0) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
+ register long int __a0 asm ("a0") = _arg0; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -190,14 +199,16 @@
_sys_result; \
})
-# define internal_syscall2(number, err, arg0, arg1) \
+# define internal_syscall2(number, arg0, arg1) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -208,15 +219,18 @@
_sys_result; \
})
-# define internal_syscall3(number, err, arg0, arg1, arg2) \
+# define internal_syscall3(number, arg0, arg1, arg2) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
- register long int __a2 asm ("a2") = (long int) (arg2); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
+ register long int __a2 asm ("a2") = _arg2; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -227,16 +241,20 @@
_sys_result; \
})
-# define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \
+# define internal_syscall4(number, arg0, arg1, arg2, arg3) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
- register long int __a2 asm ("a2") = (long int) (arg2); \
- register long int __a3 asm ("a3") = (long int) (arg3); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
+ register long int __a2 asm ("a2") = _arg2; \
+ register long int __a3 asm ("a3") = _arg3; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -247,17 +265,22 @@
_sys_result; \
})
-# define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \
+# define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
- register long int __a2 asm ("a2") = (long int) (arg2); \
- register long int __a3 asm ("a3") = (long int) (arg3); \
- register long int __a4 asm ("a4") = (long int) (arg4); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
+ register long int __a2 asm ("a2") = _arg2; \
+ register long int __a3 asm ("a3") = _arg3; \
+ register long int __a4 asm ("a4") = _arg4; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -268,18 +291,24 @@
_sys_result; \
})
-# define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \
+# define internal_syscall6(number, arg0, arg1, arg2, arg3, arg4, arg5) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ long int _arg5 = (long int) (arg5); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
- register long int __a2 asm ("a2") = (long int) (arg2); \
- register long int __a3 asm ("a3") = (long int) (arg3); \
- register long int __a4 asm ("a4") = (long int) (arg4); \
- register long int __a5 asm ("a5") = (long int) (arg5); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
+ register long int __a2 asm ("a2") = _arg2; \
+ register long int __a3 asm ("a3") = _arg3; \
+ register long int __a4 asm ("a4") = _arg4; \
+ register long int __a5 asm ("a5") = _arg5; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
@@ -291,19 +320,26 @@
_sys_result; \
})
-# define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
+# define internal_syscall7(number, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
long int _sys_result; \
+ long int _arg0 = (long int) (arg0); \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ long int _arg5 = (long int) (arg5); \
+ long int _arg6 = (long int) (arg6); \
\
{ \
register long int __a7 asm ("a7") = number; \
- register long int __a0 asm ("a0") = (long int) (arg0); \
- register long int __a1 asm ("a1") = (long int) (arg1); \
- register long int __a2 asm ("a2") = (long int) (arg2); \
- register long int __a3 asm ("a3") = (long int) (arg3); \
- register long int __a4 asm ("a4") = (long int) (arg4); \
- register long int __a5 asm ("a5") = (long int) (arg5); \
- register long int __a6 asm ("a6") = (long int) (arg6); \
+ register long int __a0 asm ("a0") = _arg0; \
+ register long int __a1 asm ("a1") = _arg1; \
+ register long int __a2 asm ("a2") = _arg2; \
+ register long int __a3 asm ("a3") = _arg3; \
+ register long int __a4 asm ("a4") = _arg4; \
+ register long int __a5 asm ("a5") = _arg5; \
+ register long int __a6 asm ("a6") = _arg6; \
__asm__ volatile ( \
"scall\n\t" \
: "+r" (__a0) \
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h
@@ -1,265 +0,0 @@
-/* Copyright (C) 2000-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 64
-/* Versions of the `struct stat' data structure. */
-# define _STAT_VER_KERNEL 0
-# define _STAT_VER_LINUX 1
-# define _STAT_VER _STAT_VER_LINUX
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 0
-#else
-/* Versions of the `struct stat' data structure. */
-# define _STAT_VER_LINUX_OLD 1
-# define _STAT_VER_KERNEL 1
-# define _STAT_VER_SVR4 2
-# define _STAT_VER_LINUX 3
-# define _STAT_VER _STAT_VER_LINUX
-
-/* Versions of the `xmknod' interface. */
-# define _MKNOD_VER_LINUX 1
-# define _MKNOD_VER_SVR4 2
-# define _MKNOD_VER _MKNOD_VER_LINUX
-#endif
-
-#if __WORDSIZE == 64
-struct stat
- {
- __dev_t st_dev; /* Device. */
- __ino_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __glibc_reserved0;
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
- long int __glibc_reserved[3];
- };
-#else
-struct stat
- {
- __dev_t st_dev; /* Device. */
- unsigned int __pad1;
-# ifndef __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-# else
- __ino_t __st_ino; /* 32bit file serial number. */
-# endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned int __pad2;
-# ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-# else
- __off64_t st_size; /* Size of file, in bytes. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-# ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-# else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# endif
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
-# ifndef __USE_FILE_OFFSET64
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-# else
- __ino64_t st_ino; /* File serial number. */
-# endif
- };
-#endif
-
-#ifdef __USE_LARGEFILE64
-# if __WORDSIZE == 64
-/* Note stat64 is the same shape as stat. */
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- __ino64_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- int __glibc_reserved0;
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
- long int __glibc_reserved[3];
- };
-# else
-struct stat64
- {
- __dev_t st_dev; /* Device. */
- unsigned int __pad1;
-
- __ino_t __st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- __ino64_t st_ino; /* File serial number. */
- };
-# endif
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Linux/s390 version.
- Copyright (C) 2003-2020 Free Software Foundation, Inc.
+ Copyright (C) 2003-2021 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
@@ -50,6 +50,7 @@
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -81,10 +82,16 @@
/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 1
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
/* Number of descriptors that can fit in an `fd_set'. */
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -26,11 +26,6 @@
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
#include <tls.h>
-/* Define __set_errno() for INLINE_SYSCALL macro below. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -38,9 +33,6 @@
/* in newer 2.1 kernels __NR_syscall is missing so we define it here */
#define __NR_syscall 0
-#undef SYS_ify
-#define SYS_ify(syscall_name) __NR_##syscall_name
-
#ifdef __ASSEMBLER__
/* Linux uses a negative return value to indicate syscall errors, unlike
@@ -88,7 +80,9 @@
#define PSEUDO_END_ERRVAL(name) \
END (name)
+#undef SYSCALL_ERROR_LABEL
#ifndef PIC
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
@@ -97,6 +91,7 @@
2: .long syscall_error
#else
# if RTLD_PRIVATE_ERRNO
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
@@ -112,6 +107,7 @@
# else
# define SYSCALL_ERROR_ERRNO errno
# endif
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: lcr %r0,%r2; \
@@ -124,6 +120,7 @@
br %r14; \
2: .long _GLOBAL_OFFSET_TABLE_-1b
# else
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: basr %r1,0; \
@@ -178,99 +175,12 @@
#define ret_ERRVAL \
br 14
-#endif /* __ASSEMBLER__ */
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
- _ret = 0xffffffff; \
- } \
- (int) _ret; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_DIRECT
-#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register int _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc %b1\n\t" \
- : "=d" (_ret) \
- : "i" (__NR_##name) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL_SVC0
-#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \
- register int _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc 0\n\t" \
- : "=d" (_ret) \
- : "d" (_nr) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register unsigned long _nr __asm__("1") = (unsigned long)(no); \
- register int _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc 0\n\t" \
- : "=d" (_ret) \
- : "d" (_nr) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- (((__NR_##name) < 256) \
- ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
- : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+#else
-#define DECLARGS_0()
-#define DECLARGS_1(arg1) \
- register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1);
-#define DECLARGS_2(arg1, arg2) \
- DECLARGS_1(arg1) \
- register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2);
-#define DECLARGS_3(arg1, arg2, arg3) \
- DECLARGS_2(arg1, arg2) \
- register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3);
-#define DECLARGS_4(arg1, arg2, arg3, arg4) \
- DECLARGS_3(arg1, arg2, arg3) \
- register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4);
-#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
- DECLARGS_4(arg1, arg2, arg3, arg4) \
- register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5);
-#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
- DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
- register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6);
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
-#define ASMFMT_0
-#define ASMFMT_1 , "0" (gpr2)
-#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
-#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
-#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
-#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
-#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+#endif /* __ASSEMBLER__ */
/* Pointer mangling support. */
#if IS_IN (rtld)
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for 64 bit S/390.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library.
@@ -27,11 +27,6 @@
#include <dl-sysdep.h> /* For RTLD_PRIVATE_ERRNO. */
#include <tls.h>
-/* Define __set_errno() for INLINE_SYSCALL macro below. */
-#ifndef __ASSEMBLER__
-#include <errno.h>
-#endif
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -39,17 +34,6 @@
/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */
#define __NR_syscall 0
-/*
- * Newer kernel versions redefined __NR_pread and __NR_pwrite to
- * __NR_pread64 and __NR_pwrite64.
- */
-#ifndef __NR_pread
-# define __NR_pread __NR_pread64
-#endif
-#ifndef __NR_pwrite
-# define __NR_pwrite __NR_pwrite64
-#endif
-
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
@@ -102,11 +86,14 @@
SYSCALL_ERROR_HANDLER; \
END (name)
+#undef SYSCALL_ERROR_LABEL
#ifndef PIC
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL syscall_error
# define SYSCALL_ERROR_HANDLER
#else
# if RTLD_PRIVATE_ERRNO
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: larl %r1,rtld_errno; \
@@ -120,6 +107,7 @@
# else
# define SYSCALL_ERROR_ERRNO errno
# endif
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: lcr %r0,%r2; \
@@ -132,6 +120,7 @@
lghi %r2,-1; \
br %r14
# else
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# define SYSCALL_ERROR_HANDLER \
0: larl %r1,_GLOBAL_OFFSET_TABLE_; \
@@ -184,101 +173,12 @@
#define ret_ERRVAL \
br 14
-#endif /* __ASSEMBLER__ */
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- long _ret = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
- _ret = -1; \
- } \
- _ret; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_DIRECT
-#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register long _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc %b1\n\t" \
- : "=d" (_ret) \
- : "i" (__NR_##name) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL_SVC0
-#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \
- register long _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc 0\n\t" \
- : "=d" (_ret) \
- : "d" (_nr) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \
- ({ \
- DECLARGS_##nr(args) \
- register unsigned long _nr __asm__("1") = (unsigned long)(no); \
- register long _ret __asm__("2"); \
- __asm__ __volatile__ ( \
- "svc 0\n\t" \
- : "=d" (_ret) \
- : "d" (_nr) ASMFMT_##nr \
- : "memory" ); \
- _ret; })
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- (((__NR_##name) < 256) \
- ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \
- : INTERNAL_SYSCALL_SVC0(name, err,nr, args))
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned long) (val) >= -4095UL)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
-#define DECLARGS_0()
-#define DECLARGS_1(arg1) \
- register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1);
-#define DECLARGS_2(arg1, arg2) \
- DECLARGS_1(arg1) \
- register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2);
-#define DECLARGS_3(arg1, arg2, arg3) \
- DECLARGS_2(arg1, arg2) \
- register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3);
-#define DECLARGS_4(arg1, arg2, arg3, arg4) \
- DECLARGS_3(arg1, arg2, arg3) \
- register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4);
-#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
- DECLARGS_4(arg1, arg2, arg3, arg4) \
- register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5);
-#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
- DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
- register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6);
+#else
-#define ASMFMT_0
-#define ASMFMT_1 , "0" (gpr2)
-#define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
-#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
-#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
-#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
-#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
-#define SINGLE_THREAD_BY_GLOBAL 1
+#endif /* __ASSEMBLER__ */
/* Pointer mangling support. */
#if IS_IN (rtld)
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. S/390 version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -23,8 +23,6 @@
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_GETSOCKOPT_SYSCALL 1
-# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
@@ -43,6 +41,8 @@
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
# undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
#endif
/* s390 only supports ipc syscall before 5.1. */
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/xstatver.h
@@ -0,0 +1,19 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define _STAT_VER_KERNEL 0
+# define _STAT_VER_LINUX 1
+# define _MKNOD_VER_LINUX 0
+#else
+# define _STAT_VER_LINUX_OLD 1
+# define _STAT_VER_KERNEL 1
+# define _STAT_VER_SVR4 2
+# define _STAT_VER_LINUX 3
+# define _MKNOD_VER_LINUX 1
+# define _MKNOD_VER_SVR4 2
+#endif
+#define _STAT_VER _STAT_VER_LINUX
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. SH version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -33,8 +33,6 @@
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
-#define __ASSUME_GETSOCKOPT_SYSCALL 1
-#define __ASSUME_SETSOCKOPT_SYSCALL 1
#include_next <kernel-features.h>
lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -287,19 +287,8 @@
register long int r1 asm ("%r1") = (long int) (_arg6); \
register long int r2 asm ("%r2") = (long int) (_arg7)
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
- resultvar = 0xffffffff; \
- } \
- (int) resultvar; })
-
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
+#define INTERNAL_SYSCALL(name, nr, args...) \
({ \
unsigned long int resultvar; \
register long int r3 asm ("%r3") = SYS_ify (name); \
@@ -313,7 +302,7 @@
(int) resultvar; })
/* The _NCS variant allows non-constant syscall numbers. */
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
({ \
unsigned long int resultvar; \
register long int r3 asm ("%r3") = (name); \
@@ -326,16 +315,6 @@
\
(int) resultvar; })
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
#endif /* __ASSEMBLER__ */
/* Pointer mangling support. */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -1,173 +0,0 @@
-/* Copyright (C) 1992-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#define _STAT_VER_LINUX_OLD 1
-#define _STAT_VER_KERNEL 1
-#define _STAT_VER_SVR4 2
-#define _STAT_VER_LINUX 3
-#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
-
-/* Versions of the `xmknod' interface. */
-#define _MKNOD_VER_LINUX 1
-#define _MKNOD_VER_SVR4 2
-#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
-#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
- unsigned short int __pad1;
- __ino_t st_ino; /* File serial number. */
-#else
- __ino64_t st_ino; /* File serial number. */
-#endif
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
-#ifndef __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-#else
- __off64_t st_size; /* Size of file, in bytes. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
-#ifndef __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-#endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
- {
- __dev_t st_dev; /* Device. */
-# if __WORDSIZE == 64
- unsigned short int __pad1;
-# endif
- __ino64_t st_ino; /* File serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
- __dev_t st_rdev; /* Device number, if device. */
- unsigned short int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-# else
- __time_t st_atime; /* Time of last access. */
- unsigned long int st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- unsigned long int st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- unsigned long int st_ctimensec; /* Nsecs of last status change. */
-# endif
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 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
@@ -50,6 +50,7 @@
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __S32_TYPE
+#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -75,10 +76,16 @@
/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 1
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
/* Number of descriptors that can fit in an `fd_set'. */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
@@ -110,9 +110,8 @@ ENTRY(name); \
#define __SYSCALL_STRING \
"ta 0x10;" \
"bcc 1f;" \
- " mov 0, %%g1;" \
+ " nop;" \
"sub %%g0, %%o0, %%o0;" \
- "mov 1, %%g1;" \
"1:"
#define __SYSCALL_CLOBBERS \
@@ -122,6 +121,9 @@ ENTRY(name); \
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
"cc", "memory"
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
#endif /* __ASSEMBLER__ */
/* Pointer mangling support. */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -109,9 +109,8 @@ ENTRY(name); \
#define __SYSCALL_STRING \
"ta 0x6d;" \
"bcc,pt %%xcc, 1f;" \
- " mov 0, %%g1;" \
+ " nop;" \
"sub %%g0, %%o0, %%o0;" \
- "mov 1, %%g1;" \
"1:"
#define __SYSCALL_CLOBBERS \
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. SPARC version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -38,10 +38,11 @@
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
# undef __ASSUME_SENDTO_SYSCALL
+# undef __ASSUME_GETSOCKOPT_SYSCALL
+# undef __ASSUME_SETSOCKOPT_SYSCALL
#else
# define __ASSUME_SOCKET_SYSCALL 1
# define __ASSUME_SOCKETPAIR_SYSCALL 1
-# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -49,7 +50,6 @@
#if __LINUX_KERNEL_VERSION >= 0x040400
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_SETSOCKOPT_SYSCALL 1
#endif
#ifdef __arch64__
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
@@ -34,13 +34,6 @@
#else /* __ASSEMBLER__ */
-#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
- ({ \
- long _ret = funcptr (args); \
- err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \
- _ret; \
- })
-
# define VDSO_NAME "LINUX_2.6"
# define VDSO_HASH 61765110
@@ -52,121 +45,119 @@
# endif
# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
-({ INTERNAL_SYSCALL_DECL(err); \
- unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\
- if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \
- resultvar = (unsigned long) -1; \
- } \
- (long) resultvar; \
-})
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) \
- register long err __asm__("g1");
-
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args)
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- inline_syscall##nr(__SYSCALL_STRING, err, name, args)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((void) (val), __builtin_expect((err) != 0, 0))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+ internal_syscall##nr(__SYSCALL_STRING, name, args)
-#define inline_syscall0(string,err,name,dummy...) \
+#define internal_syscall0(string,name,dummy...) \
({ \
+ register long int __g1 __asm__ ("g1") = (name); \
register long __o0 __asm__ ("o0"); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err) : \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall1(string,err,name,arg1) \
+#define internal_syscall1(string,name,arg1) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0) : \
+ long int _arg1 = (long int) (arg1); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall2(string,err,name,arg1,arg2) \
+#define internal_syscall2(string,name,arg1,arg2) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0), "r" (__o1) : \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0), "r" (__o1) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall3(string,err,name,arg1,arg2,arg3) \
+#define internal_syscall3(string,name,arg1,arg2,arg3) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0), "r" (__o1), \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ register long int __o2 __asm__ ("o2") = _arg3; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0), "r" (__o1), \
"r" (__o2) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall4(string,err,name,arg1,arg2,arg3,arg4) \
+#define internal_syscall4(string,name,arg1,arg2,arg3,arg4) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- register long __o3 __asm__ ("o3") = (long)(arg4); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0), "r" (__o1), \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ register long int __o2 __asm__ ("o2") = _arg3; \
+ register long int __o3 __asm__ ("o3") = _arg4; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0), "r" (__o1), \
"r" (__o2), "r" (__o3) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \
+#define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- register long __o3 __asm__ ("o3") = (long)(arg4); \
- register long __o4 __asm__ ("o4") = (long)(arg5); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0), "r" (__o1), \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ long int _arg5 = (long int) (arg5); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ register long int __o2 __asm__ ("o2") = _arg3; \
+ register long int __o3 __asm__ ("o3") = _arg4; \
+ register long int __o4 __asm__ ("o4") = _arg5; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0), "r" (__o1), \
"r" (__o2), "r" (__o3), "r" (__o4) : \
__SYSCALL_CLOBBERS); \
__o0; \
})
-#define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6) \
+#define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- register long __o3 __asm__ ("o3") = (long)(arg4); \
- register long __o4 __asm__ ("o4") = (long)(arg5); \
- register long __o5 __asm__ ("o5") = (long)(arg6); \
- err = name; \
- __asm __volatile (string : "=r" (err), "=r" (__o0) : \
- "0" (err), "1" (__o0), "r" (__o1), \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ long int _arg5 = (long int) (arg5); \
+ long int _arg6 = (long int) (arg6); \
+ register long int __g1 __asm__("g1") = (name); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ register long int __o2 __asm__ ("o2") = _arg3; \
+ register long int __o3 __asm__ ("o3") = _arg4; \
+ register long int __o4 __asm__ ("o4") = _arg5; \
+ register long int __o5 __asm__ ("o5") = _arg6; \
+ __asm __volatile (string : "=r" (__o0) : \
+ "r" (__g1), "0" (__o0), "r" (__o1), \
"r" (__o2), "r" (__o3), "r" (__o4), \
"r" (__o5) : \
__SYSCALL_CLOBBERS); \
@@ -175,20 +166,25 @@
#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \
({ \
- register long __o0 __asm__ ("o0") = (long)(arg1); \
- register long __o1 __asm__ ("o1") = (long)(arg2); \
- register long __o2 __asm__ ("o2") = (long)(arg3); \
- register long __o3 __asm__ ("o3") = (long)(arg4); \
- register long __o4 __asm__ ("o4") = (long)(arg5); \
- register long __g1 __asm__ ("g1") = __NR_clone; \
+ long int _arg1 = (long int) (arg1); \
+ long int _arg2 = (long int) (arg2); \
+ long int _arg3 = (long int) (arg3); \
+ long int _arg4 = (long int) (arg4); \
+ long int _arg5 = (long int) (arg5); \
+ register long int __o0 __asm__ ("o0") = _arg1; \
+ register long int __o1 __asm__ ("o1") = _arg2; \
+ register long int __o2 __asm__ ("o2") = _arg3; \
+ register long int __o3 __asm__ ("o3") = _arg4; \
+ register long int __o4 __asm__ ("o4") = _arg5; \
+ register long int __g1 __asm__ ("g1") = __NR_clone; \
__asm __volatile (__SYSCALL_STRING : \
- "=r" (__g1), "=r" (__o0), "=r" (__o1) : \
- "0" (__g1), "1" (__o0), "2" (__o1), \
+ "=r" (__o0), "=r" (__o1) : \
+ "r" (__g1), "0" (__o0), "1" (__o1), \
"r" (__o2), "r" (__o3), "r" (__o4) : \
__SYSCALL_CLOBBERS); \
- if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \
+ if (__glibc_unlikely ((unsigned long int) (__o0) > -4096UL)) \
{ \
- __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \
+ __set_errno (-__o0); \
__o0 = -1L; \
} \
else \
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2021 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
@@ -54,17 +54,34 @@ struct ntptimeval
__BEGIN_DECLS
-extern int __adjtimex (struct timex *__ntx) __THROW;
+#ifndef __USE_TIME_BITS64
extern int adjtimex (struct timex *__ntx) __THROW;
+extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
-#ifdef __REDIRECT_NTH
+# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
- ntp_gettimex);
+ ntp_gettimex);
+# else
+# define ntp_gettime ntp_gettimex
+# endif
+extern int ntp_adjtime (struct timex *__tntx) __THROW;
#else
-extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
-# define ntp_gettime ntp_gettimex
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),
+ ___adjtimex64);
+extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
+ __ntp_gettime64);
+extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),
+ __ntp_gettimex64);
+extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),
+ ___adjtimex64);
+# else
+# define adjtimex ___adjtimex64
+# define ntp_adjtime ___adjtimex64
+# define ntp_gettime __ntp_gettime64
+# define ntp_gettimex __ntp_gettimex64
+# endif
#endif
-extern int ntp_adjtime (struct timex *__tntx) __THROW;
__END_DECLS
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h
@@ -1,210 +0,0 @@
-/* Copyright (C) 1999-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#if !defined _SYS_STAT_H && !defined _FCNTL_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H 1
-
-/* Versions of the `struct stat' data structure. */
-#ifndef __x86_64__
-# define _STAT_VER_LINUX_OLD 1
-# define _STAT_VER_KERNEL 1
-# define _STAT_VER_SVR4 2
-# define _STAT_VER_LINUX 3
-
-/* i386 versions of the `xmknod' interface. */
-# define _MKNOD_VER_LINUX 1
-# define _MKNOD_VER_SVR4 2
-# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
-#else
-# define _STAT_VER_KERNEL 0
-# define _STAT_VER_LINUX 1
-
-/* x86-64 versions of the `xmknod' interface. */
-# define _MKNOD_VER_LINUX 0
-#endif
-
-#define _STAT_VER _STAT_VER_LINUX
-
-struct stat
- {
- __dev_t st_dev; /* Device. */
-#ifndef __x86_64__
- unsigned short int __pad1;
-#endif
-#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
- __ino_t st_ino; /* File serial number. */
-#else
- __ino_t __st_ino; /* 32bit file serial number. */
-#endif
-#ifndef __x86_64__
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
-#else
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
-#endif
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
-#ifdef __x86_64__
- int __pad0;
-#endif
- __dev_t st_rdev; /* Device number, if device. */
-#ifndef __x86_64__
- unsigned short int __pad2;
-#endif
-#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
- __off_t st_size; /* Size of file, in bytes. */
-#else
- __off64_t st_size; /* Size of file, in bytes. */
-#endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
-#if defined __x86_64__ || !defined __USE_FILE_OFFSET64
- __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
-#else
- __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# define st_atime st_atim.tv_sec /* Backward compatibility. */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
- __time_t st_atime; /* Time of last access. */
- __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
-#endif
-#ifdef __x86_64__
- __syscall_slong_t __glibc_reserved[3];
-#else
-# ifndef __USE_FILE_OFFSET64
- unsigned long int __glibc_reserved4;
- unsigned long int __glibc_reserved5;
-# else
- __ino64_t st_ino; /* File serial number. */
-# endif
-#endif
- };
-
-#ifdef __USE_LARGEFILE64
-/* Note stat64 has the same shape as stat for x86-64. */
-struct stat64
- {
- __dev_t st_dev; /* Device. */
-# ifdef __x86_64__
- __ino64_t st_ino; /* File serial number. */
- __nlink_t st_nlink; /* Link count. */
- __mode_t st_mode; /* File mode. */
-# else
- unsigned int __pad1;
- __ino_t __st_ino; /* 32bit file serial number. */
- __mode_t st_mode; /* File mode. */
- __nlink_t st_nlink; /* Link count. */
-# endif
- __uid_t st_uid; /* User ID of the file's owner. */
- __gid_t st_gid; /* Group ID of the file's group.*/
-# ifdef __x86_64__
- int __pad0;
- __dev_t st_rdev; /* Device number, if device. */
- __off_t st_size; /* Size of file, in bytes. */
-# else
- __dev_t st_rdev; /* Device number, if device. */
- unsigned int __pad2;
- __off64_t st_size; /* Size of file, in bytes. */
-# endif
- __blksize_t st_blksize; /* Optimal block size for I/O. */
- __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
-# ifdef __USE_XOPEN2K8
- /* Nanosecond resolution timestamps are stored in a format
- equivalent to 'struct timespec'. This is the type used
- whenever possible but the Unix namespace rules do not allow the
- identifier 'timespec' to appear in the <sys/stat.h> header.
- Therefore we have to handle the use of this header in strictly
- standard-compliant sources special. */
- struct timespec st_atim; /* Time of last access. */
- struct timespec st_mtim; /* Time of last modification. */
- struct timespec st_ctim; /* Time of last status change. */
-# else
- __time_t st_atime; /* Time of last access. */
- __syscall_ulong_t st_atimensec; /* Nscecs of last access. */
- __time_t st_mtime; /* Time of last modification. */
- __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */
- __time_t st_ctime; /* Time of last status change. */
- __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */
-# endif
-# ifdef __x86_64__
- __syscall_slong_t __glibc_reserved[3];
-# else
- __ino64_t st_ino; /* File serial number. */
-# endif
- };
-#endif
-
-/* Tell code we have these members. */
-#define _STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported. */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode. */
-
-#define __S_IFMT 0170000 /* These bits determine file type. */
-
-/* File types. */
-#define __S_IFDIR 0040000 /* Directory. */
-#define __S_IFCHR 0020000 /* Character device. */
-#define __S_IFBLK 0060000 /* Block device. */
-#define __S_IFREG 0100000 /* Regular file. */
-#define __S_IFIFO 0010000 /* FIFO. */
-#define __S_IFLNK 0120000 /* Symbolic link. */
-#define __S_IFSOCK 0140000 /* Socket. */
-
-/* POSIX.1b objects. Note that these macros always evaluate to zero. But
- they do it by enforcing the correct use of the macros. */
-#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits. */
-
-#define __S_ISUID 04000 /* Set user ID on execution. */
-#define __S_ISGID 02000 /* Set group ID on execution. */
-#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
-#define __S_IREAD 0400 /* Read by owner. */
-#define __S_IWRITE 0200 /* Write by owner. */
-#define __S_IEXEC 0100 /* Execute by owner. */
-
-#ifdef __USE_ATFILE
-# define UTIME_NOW ((1l << 30) - 1l)
-# define UTIME_OMIT ((1l << 30) - 2l)
-#endif
-
-#endif /* bits/stat.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
@@ -64,6 +64,7 @@
#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE
+#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
@@ -87,10 +88,15 @@
/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
# define __STATFS_MATCHES_STATFS64 1
+
+/* And for getitimer, setitimer and rusage */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
+
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
/* Number of descriptors that can fit in an `fd_set'. */
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/xstatver.h
@@ -0,0 +1,16 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#ifndef __x86_64__
+# define _STAT_VER_LINUX_OLD 1
+# define _STAT_VER_KERNEL 1
+# define _STAT_VER_SVR4 2
+# define _STAT_VER_LINUX 3
+# define _MKNOD_VER_LINUX 1
+# define _MKNOD_VER_SVR4 2
+#else
+# define _STAT_VER_KERNEL 0
+# define _STAT_VER_LINUX 1
+# define _MKNOD_VER_LINUX 0
+#endif
+#define _STAT_VER _STAT_VER_LINUX
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2021 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
@@ -26,4 +26,39 @@
#undef LO_HI_LONG
#define LO_HI_LONG(val) (val)
+#ifdef __ASSEMBLER__
+/* Zero-extend 32-bit unsigned long int arguments to 64 bits. */
+# undef ZERO_EXTEND_1
+# define ZERO_EXTEND_1 movl %edi, %edi;
+# undef ZERO_EXTEND_2
+# define ZERO_EXTEND_2 movl %esi, %esi;
+# undef ZERO_EXTEND_3
+# define ZERO_EXTEND_3 movl %edx, %edx;
+# if SYSCALL_ULONG_ARG_1 == 4 || SYSCALL_ULONG_ARG_2 == 4
+# undef DOARGS_4
+# define DOARGS_4 movl %ecx, %r10d;
+# else
+# undef ZERO_EXTEND_4
+# define ZERO_EXTEND_4 movl %r10d, %r10d;
+# endif
+# undef ZERO_EXTEND_5
+# define ZERO_EXTEND_5 movl %r8d, %r8d;
+# undef ZERO_EXTEND_6
+# define ZERO_EXTEND_6 movl %r9d, %r9d;
+#else /* !__ASSEMBLER__ */
+# undef ARGIFY
+/* Enforce zero-extension for pointers and array system call arguments.
+ For integer types, extend to int64_t (the full register) using a
+ regular cast, resulting in zero or sign extension based on the
+ signedness of the original type. */
+# define ARGIFY(X) \
+ ({ \
+ _Pragma ("GCC diagnostic push"); \
+ _Pragma ("GCC diagnostic ignored \"-Wpointer-to-int-cast\""); \
+ (__builtin_classify_type (X) == 5 \
+ ? (uintptr_t) (X) : (int64_t) (X)); \
+ _Pragma ("GCC diagnostic pop"); \
+ })
+#endif /* __ASSEMBLER__ */
+
#endif /* linux/x86_64/x32/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number. x86-64 version.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2021 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
@@ -33,13 +33,6 @@
#undef SYS_ify
#define SYS_ify(syscall_name) __NR_##syscall_name
-/* This is to help the old kernel headers where __NR_semtimedop is not
- available. */
-#ifndef __NR_semtimedop
-# define __NR_semtimedop 220
-#endif
-
-
#ifdef __ASSEMBLER__
/* Linux uses a negative return value to indicate syscall errors,
@@ -55,19 +48,40 @@
/* We don't want the label for the error handle to be global when we define
it here. */
+# undef SYSCALL_ERROR_LABEL
# ifdef PIC
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL 0f
# else
+# undef SYSCALL_ERROR_LABEL
# define SYSCALL_ERROR_LABEL syscall_error
# endif
+/* PSEUDO and T_PSEUDO macros have 2 extra arguments for unsigned long
+ int arguments. */
+# define PSEUDOS_HAVE_ULONG_INDICES 1
+
+# ifndef SYSCALL_ULONG_ARG_1
+# define SYSCALL_ULONG_ARG_1 0
+# define SYSCALL_ULONG_ARG_2 0
+# endif
+
# undef PSEUDO
-# define PSEUDO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- DO_CALL (syscall_name, args); \
- cmpq $-4095, %rax; \
+# if SYSCALL_ULONG_ARG_1
+# define PSEUDO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2); \
+ cmpq $-4095, %rax; \
+ jae SYSCALL_ERROR_LABEL
+# else
+# define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, 0, 0); \
+ cmpq $-4095, %rax; \
jae SYSCALL_ERROR_LABEL
+# endif
# undef PSEUDO_END
# define PSEUDO_END(name) \
@@ -75,10 +89,17 @@
END (name)
# undef PSEUDO_NOERRNO
-# define PSEUDO_NOERRNO(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- DO_CALL (syscall_name, args)
+# if SYSCALL_ULONG_ARG_1
+# define PSEUDO_NOERRNO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2)
+# else
+# define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, 0, 0)
+# endif
# undef PSEUDO_END_NOERRNO
# define PSEUDO_END_NOERRNO(name) \
@@ -87,11 +108,19 @@
# define ret_NOERRNO ret
# undef PSEUDO_ERRVAL
-# define PSEUDO_ERRVAL(name, syscall_name, args) \
- .text; \
- ENTRY (name) \
- DO_CALL (syscall_name, args); \
+# if SYSCALL_ULONG_ARG_1
+# define PSEUDO_ERRVAL(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2); \
+ negq %rax
+# else
+# define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args, 0, 0); \
negq %rax
+# endif
# undef PSEUDO_END_ERRVAL
# define PSEUDO_END_ERRVAL(name) \
@@ -163,8 +192,10 @@
Syscalls of more than 6 arguments are not supported. */
# undef DO_CALL
-# define DO_CALL(syscall_name, args) \
+# define DO_CALL(syscall_name, args, ulong_arg_1, ulong_arg_2) \
DOARGS_##args \
+ ZERO_EXTEND_##ulong_arg_1 \
+ ZERO_EXTEND_##ulong_arg_2 \
movl $SYS_ify (syscall_name), %eax; \
syscall;
@@ -176,57 +207,39 @@
# define DOARGS_5 DOARGS_4
# define DOARGS_6 DOARGS_5
+# define ZERO_EXTEND_0 /* nothing */
+# define ZERO_EXTEND_1 /* nothing */
+# define ZERO_EXTEND_2 /* nothing */
+# define ZERO_EXTEND_3 /* nothing */
+# define ZERO_EXTEND_4 /* nothing */
+# define ZERO_EXTEND_5 /* nothing */
+# define ZERO_EXTEND_6 /* nothing */
+
#else /* !__ASSEMBLER__ */
-/* Define a macro which expands inline into the wrapper code for a system
- call. */
-# undef INLINE_SYSCALL
-# define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
- resultvar = (unsigned long int) -1; \
- } \
- (long int) resultvar; })
-
-/* Define a macro with explicit types for arguments, which expands inline
- into the wrapper code for a system call. It should be used when size
- of any argument > size of long int. */
-# undef INLINE_SYSCALL_TYPES
-# define INLINE_SYSCALL_TYPES(name, nr, args...) \
- ({ \
- unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
- { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
- resultvar = (unsigned long int) -1; \
- } \
- (long int) resultvar; })
-
-# undef INTERNAL_SYSCALL_DECL
-# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
/* Registers clobbered by syscall. */
# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"
-/* Create a variable 'name' based on type 'X' to avoid explicit types.
- This is mainly used set use 64-bits arguments in x32. */
-#define TYPEFY(X, name) __typeof__ ((X) - (X)) name
-/* Explicit cast the argument to avoid integer from pointer warning on
- x32. */
-#define ARGIFY(X) ((__typeof__ ((X) - (X))) (X))
+/* NB: This also works when X is an array. For an array X, type of
+ (X) - (X) is ptrdiff_t, which is signed, since size of ptrdiff_t
+ == size of pointer, cast is a NOP. */
+#define TYPEFY1(X) __typeof__ ((X) - (X))
+/* Explicit cast the argument. */
+#define ARGIFY(X) ((TYPEFY1 (X)) (X))
+/* Create a variable 'name' based on type of variable 'X' to avoid
+ explicit types. */
+#define TYPEFY(X, name) __typeof__ (ARGIFY (X)) name
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (SYS_ify (name), err, args)
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ internal_syscall##nr (SYS_ify (name), args)
#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (number, err, args)
+#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
+ internal_syscall##nr (number, args)
#undef internal_syscall0
-#define internal_syscall0(number, err, dummy...) \
+#define internal_syscall0(number, dummy...) \
({ \
unsigned long int resultvar; \
asm volatile ( \
@@ -238,7 +251,7 @@
})
#undef internal_syscall1
-#define internal_syscall1(number, err, arg1) \
+#define internal_syscall1(number, arg1) \
({ \
unsigned long int resultvar; \
TYPEFY (arg1, __arg1) = ARGIFY (arg1); \
@@ -252,7 +265,7 @@
})
#undef internal_syscall2
-#define internal_syscall2(number, err, arg1, arg2) \
+#define internal_syscall2(number, arg1, arg2) \
({ \
unsigned long int resultvar; \
TYPEFY (arg2, __arg2) = ARGIFY (arg2); \
@@ -268,7 +281,7 @@
})
#undef internal_syscall3
-#define internal_syscall3(number, err, arg1, arg2, arg3) \
+#define internal_syscall3(number, arg1, arg2, arg3) \
({ \
unsigned long int resultvar; \
TYPEFY (arg3, __arg3) = ARGIFY (arg3); \
@@ -286,7 +299,7 @@
})
#undef internal_syscall4
-#define internal_syscall4(number, err, arg1, arg2, arg3, arg4) \
+#define internal_syscall4(number, arg1, arg2, arg3, arg4) \
({ \
unsigned long int resultvar; \
TYPEFY (arg4, __arg4) = ARGIFY (arg4); \
@@ -306,7 +319,7 @@
})
#undef internal_syscall5
-#define internal_syscall5(number, err, arg1, arg2, arg3, arg4, arg5) \
+#define internal_syscall5(number, arg1, arg2, arg3, arg4, arg5) \
({ \
unsigned long int resultvar; \
TYPEFY (arg5, __arg5) = ARGIFY (arg5); \
@@ -329,7 +342,7 @@
})
#undef internal_syscall6
-#define internal_syscall6(number, err, arg1, arg2, arg3, arg4, arg5, arg6) \
+#define internal_syscall6(number, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \
unsigned long int resultvar; \
TYPEFY (arg6, __arg6) = ARGIFY (arg6); \
@@ -353,12 +366,6 @@
(long int) resultvar; \
})
-# undef INTERNAL_SYSCALL_ERROR_P
-# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned long int) (long int) (val) >= -4095L)
-
-# undef INTERNAL_SYSCALL_ERRNO
-# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
# define VDSO_NAME "LINUX_2.6"
# define VDSO_HASH 61765110
@@ -370,6 +377,8 @@
# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"
# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres"
+# define HAVE_CLONE3_WRAPPER 1
+
# define SINGLE_THREAD_BY_GLOBAL 1
#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Linux version.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2021 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
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h
@@ -1,6 +1,6 @@
/* Set flags signalling availability of kernel features based on given
kernel version number.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 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
@@ -49,10 +49,6 @@
SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */
#define __ASSUME_PSELECT 1
-/* The *at syscalls were introduced just after 2.6.16-rc1. On PPC
- they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */
-#define __ASSUME_ATFCTS 1
-
/* Support for inter-process robust mutexes was added in 2.6.17 (but
some architectures lack futex_atomic_cmpxchg_inatomic in some
configurations). */
@@ -81,6 +77,8 @@
#define __ASSUME_ACCEPT4_SYSCALL 1
#define __ASSUME_RECVMMSG_SYSCALL 1
#define __ASSUME_SENDMMSG_SYSCALL 1
+#define __ASSUME_GETSOCKOPT_SYSCALL 1
+#define __ASSUME_SETSOCKOPT_SYSCALL 1
/* Support for SysV IPC through wired syscalls. All supported architectures
either support ipc syscall and/or all the ipc correspondent syscalls. */
@@ -214,4 +212,12 @@
# define __ASSUME_WAITID_PID0_P_PGID
#endif
+/* The faccessat2 system call was introduced across all architectures
+ in Linux 5.8. */
+#if __LINUX_KERNEL_VERSION >= 0x050800
+# define __ASSUME_FACCESSAT2 1
+#else
+# define __ASSUME_FACCESSAT2 0
+#endif
+
#endif /* kernel-features.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h
@@ -1,5 +1,5 @@
/* Single thread optimization, Linux version.
- Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ Copyright (C) 2019-2021 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
@@ -27,36 +27,18 @@
The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread
check to use global variables instead of the pthread_t field. */
-#ifdef SINGLE_THREAD_BY_GLOBAL
-# if IS_IN (libc)
+#ifndef __ASSEMBLER__
extern int __libc_multiple_threads;
-# define SINGLE_THREAD_P \
- __glibc_likely (__libc_multiple_threads == 0)
-# elif IS_IN (libpthread)
-extern int __pthread_multiple_threads;
-# define SINGLE_THREAD_P \
- __glibc_likely (__pthread_multiple_threads == 0)
-# elif IS_IN (librt)
-# define SINGLE_THREAD_P \
- __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
- header.multiple_threads) == 0)
-# else
-/* For rtld, et cetera. */
-# define SINGLE_THREAD_P (1)
-# endif
-#else /* SINGLE_THREAD_BY_GLOBAL */
-# if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt)
-# define SINGLE_THREAD_P \
- __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
- header.multiple_threads) == 0)
-# else
-/* For rtld, et cetera. */
-# define SINGLE_THREAD_P (1)
-# endif
-#endif /* SINGLE_THREAD_BY_GLOBAL */
-
-#define RTLD_SINGLE_THREAD_P \
- __glibc_likely (THREAD_GETMEM (THREAD_SELF, \
- header.multiple_threads) == 0)
+libc_hidden_proto (__libc_multiple_threads)
+#endif
+
+#if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld)
+# define SINGLE_THREAD_P \
+ (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0)
+#else
+# define SINGLE_THREAD_P (__libc_multiple_threads == 0)
+#endif
+
+#define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P
#endif /* _SINGLE_THREAD_H */
lib/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h โ lib/libc/glibc/sysdeps/unix/sysv/linux/struct_stat_time64.h
@@ -1,5 +1,5 @@
-/* System-specific settings for dynamic linker code. Hurd version.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Struct stat with 64-bit time support.
+ Copyright (C) 2020-2021 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
@@ -16,16 +16,19 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* The private errno doesn't make sense on the Hurd. errno is always the
- thread-local slot shared with libc, and it matters to share the cell
- with libc because after startup we use libc functions that set errno
- (open, mmap, etc). */
+#ifndef _BITS_STRUCT_STAT_TIME64_H
+#define _BITS_STRUCT_STAT_TIME64_H 1
-#define RTLD_PRIVATE_ERRNO 0
+#if __TIMESIZE == 64
+# define __stat64_t64 stat64
+#else
+# include <struct___timespec64.h>
-#ifdef SHARED
-/* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching
- libc initializer for using cthreads might write into it. */
-# define DL_ARGV_NOT_RELRO 1
-# define LIBC_STACK_END_NOT_RELRO 1
-#endif
+struct __stat64_t64
+ {
+# define __struct_timespec struct __timespec64
+# include <bits/struct_stat_time64_helper.h>
+ };
+#endif /* __TIMESIZE == 64 */
+
+#endif /* _BITS_STRUCT_STAT_TIME64_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2015-2021 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
@@ -15,8 +15,40 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#ifndef _SYSDEP_LINUX_H
+#define _SYSDEP_LINUX_H
+
#include <bits/wordsize.h>
#include <kernel-features.h>
+#include <endian.h>
+#include <errno.h>
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val) \
+ ((unsigned long int) (val) > -4096UL)
+
+#ifndef SYSCALL_ERROR_LABEL
+# define SYSCALL_ERROR_LABEL(sc_err) \
+ ({ \
+ __set_errno (sc_err); \
+ -1L; \
+ })
+#endif
+
+/* Define a macro which expands into the inline wrapper code for a system
+ call. It sets the errno and returns -1 on a failure, or the syscall
+ return value otherwise. */
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ long int sc_ret = INTERNAL_SYSCALL (name, nr, args); \
+ __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \
+ ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret)) \
+ : sc_ret; \
+ })
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val) (-(val))
/* Set error number and return -1. A target may choose to return the
internal function, __syscall_error, which sets errno and returns -1.
@@ -63,6 +95,8 @@
(long) (val), \
(long) (((uint64_t) (val)) >> 32)
-/* Exports the __send symbol on send.c linux implementation (some ABI have
- it missing due the usage of a old generic version without it). */
-#define HAVE_INTERNAL_SEND_SYMBOL 1
+/* Export the ___brk_addr symbol on brk.c implementation (some ABIs export
+ it due and old crtstuff.c code). */
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 0
+
+#endif /* _SYSDEP_LINUX_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+ functions. */
+#define _STAT_VER_LINUX_OLD 1
+#define _STAT_VER_KERNEL 1
+#define _STAT_VER_SVR4 2
+#define _STAT_VER_LINUX 3
+#define _STAT_VER _STAT_VER_LINUX
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+ functions. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX
lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
lib/libc/glibc/sysdeps/unix/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2021 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
@@ -28,24 +28,24 @@
#define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b)
-#define __INTERNAL_SYSCALL0(name, err) \
- INTERNAL_SYSCALL (name, err, 0)
-#define __INTERNAL_SYSCALL1(name, err, a1) \
- INTERNAL_SYSCALL (name, err, 1, a1)
-#define __INTERNAL_SYSCALL2(name, err, a1, a2) \
- INTERNAL_SYSCALL (name, err, 2, a1, a2)
-#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \
- INTERNAL_SYSCALL (name, err, 3, a1, a2, a3)
-#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \
- INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4)
-#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \
- INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5)
-#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \
- INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6)
-#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \
- INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7)
-
-#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o
+#define __INTERNAL_SYSCALL0(name) \
+ INTERNAL_SYSCALL (name, 0)
+#define __INTERNAL_SYSCALL1(name, a1) \
+ INTERNAL_SYSCALL (name, 1, a1)
+#define __INTERNAL_SYSCALL2(name, a1, a2) \
+ INTERNAL_SYSCALL (name, 2, a1, a2)
+#define __INTERNAL_SYSCALL3(name, a1, a2, a3) \
+ INTERNAL_SYSCALL (name, 3, a1, a2, a3)
+#define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \
+ INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4)
+#define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \
+ INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5)
+#define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \
+ INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6)
+#define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \
+ INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7)
+
+#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n
#define __INTERNAL_SYSCALL_NARGS(...) \
__INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,)
#define __INTERNAL_SYSCALL_DISP(b,...) \
@@ -88,10 +88,17 @@
#define INLINE_SYSCALL_CALL(...) \
__INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__)
+#if IS_IN (rtld)
+/* All cancellation points are compiled out in the dynamic loader. */
+# define NO_SYSCALL_CANCEL_CHECKING 1
+#else
+# define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P
+#endif
+
#define SYSCALL_CANCEL(...) \
({ \
long int sc_ret; \
- if (SINGLE_THREAD_P) \
+ if (NO_SYSCALL_CANCEL_CHECKING) \
sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \
else \
{ \
@@ -107,7 +114,7 @@
#define INTERNAL_SYSCALL_CANCEL(...) \
({ \
long int sc_ret; \
- if (SINGLE_THREAD_P) \
+ if (NO_SYSCALL_CANCEL_CHECKING) \
sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \
else \
{ \
lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h
@@ -1,5 +1,5 @@
/* Hacks needed for divdi3 symbol manipulation.
- Copyright (C) 2004-2020 Free Software Foundation, Inc.
+ Copyright (C) 2004-2021 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
lib/libc/glibc/sysdeps/x86/bits/select.h
@@ -1,63 +0,0 @@
-/* Copyright (C) 1997-2020 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
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _SYS_SELECT_H
-# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
-#endif
-
-#include <bits/wordsize.h>
-
-
-#if defined __GNUC__ && __GNUC__ >= 2
-
-# if __WORDSIZE == 64
-# define __FD_ZERO_STOS "stosq"
-# else
-# define __FD_ZERO_STOS "stosl"
-# endif
-
-# define __FD_ZERO(fdsp) \
- do { \
- int __d0, __d1; \
- __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS \
- : "=c" (__d0), "=D" (__d1) \
- : "a" (0), "0" (sizeof (fd_set) \
- / sizeof (__fd_mask)), \
- "1" (&__FDS_BITS (fdsp)[0]) \
- : "memory"); \
- } while (0)
-
-#else /* ! GNU CC */
-
-/* We don't use `memset' because this would require a prototype and
- the array isn't too big. */
-# define __FD_ZERO(set) \
- do { \
- unsigned int __i; \
- fd_set *__arr = (set); \
- for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
- __FDS_BITS (__arr)[__i] = 0; \
- } while (0)
-
-#endif /* GNU CC */
-
-#define __FD_SET(d, set) \
- ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d)))
-#define __FD_CLR(d, set) \
- ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d)))
-#define __FD_ISSET(d, set) \
- ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0)
lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2021 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
lib/libc/glibc/sysdeps/x86/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for x86.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 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
@@ -57,6 +57,11 @@ enum cf_protection_level
#define STATE_SAVE_MASK \
((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
+/* Constants for bits in __x86_string_control: */
+
+/* Avoid short distance REP MOVSB. */
+#define X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB (1 << 0)
+
#ifdef __ASSEMBLER__
/* Syntactic details of assembler. */
lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for x32.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/x86_64/crti.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86-64.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/x86_64/crtn.S
@@ -1,5 +1,5 @@
/* Special .init and .fini section support for x86-64.
- Copyright (C) 2012-2020 Free Software Foundation, Inc.
+ Copyright (C) 2012-2021 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
lib/libc/glibc/sysdeps/x86_64/start.S
@@ -1,5 +1,5 @@
/* Startup code compliant to the ELF x86-64 ABI.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
@@ -96,17 +96,13 @@ ENTRY (_start)
which grow downwards). */
pushq %rsp
-#ifdef PIC
- /* Pass address of our own entry points to .fini and .init. */
- mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP
- mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP
+ /* These used to be the addresses of .fini and .init. */
+ xorl %r8d, %r8d
+ xorl %ecx, %ecx
+#ifdef PIC
mov main@GOTPCREL(%rip), %RDI_LP
#else
- /* Pass address of our own entry points to .fini and .init. */
- mov $__libc_csu_fini, %R8_LP
- mov $__libc_csu_init, %RCX_LP
-
mov $main, %RDI_LP
#endif
lib/libc/glibc/sysdeps/x86_64/sysdep.h
@@ -1,5 +1,5 @@
/* Assembler macros for x86-64.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 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
@@ -95,6 +95,28 @@ lose: \
#define R14_LP r14
#define R15_LP r15
+/* Zero upper vector registers and return with xtest. NB: Use VZEROALL
+ to avoid RTM abort triggered by VZEROUPPER inside transactionally. */
+#define ZERO_UPPER_VEC_REGISTERS_RETURN_XTEST \
+ xtest; \
+ jz 1f; \
+ vzeroall; \
+ ret; \
+1: \
+ vzeroupper; \
+ ret
+
+/* Zero upper vector registers and return. */
+#ifndef ZERO_UPPER_VEC_REGISTERS_RETURN
+# define ZERO_UPPER_VEC_REGISTERS_RETURN \
+ VZEROUPPER; \
+ ret
+#endif
+
+#ifndef VZEROUPPER_RETURN
+# define VZEROUPPER_RETURN VZEROUPPER; ret
+#endif
+
#else /* __ASSEMBLER__ */
/* Long and pointer size in bytes. */
lib/libc/glibc/time/bits/types/struct_timespec.h
@@ -4,15 +4,20 @@
#include <bits/types.h>
#include <bits/endian.h>
+#include <bits/types/time_t.h>
/* POSIX.1b structure for a time value. This is like a `struct timeval' but
has nanoseconds instead of microseconds. */
struct timespec
{
+#ifdef __USE_TIME_BITS64
+ __time64_t tv_sec; /* Seconds. */
+#else
__time_t tv_sec; /* Seconds. */
+#endif
#if __WORDSIZE == 64 \
|| (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
- || __TIMESIZE == 32
+ || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64)
__syscall_slong_t tv_nsec; /* Nanoseconds. */
#else
# if __BYTE_ORDER == __BIG_ENDIAN
lib/libc/glibc/time/bits/types/struct_timeval.h
@@ -7,7 +7,12 @@
microsecond but also has a range of years. */
struct timeval
{
+#ifdef __USE_TIME_BITS64
+ __time64_t tv_sec; /* Seconds. */
+ __suseconds64_t tv_usec; /* Microseconds. */
+#else
__time_t tv_sec; /* Seconds. */
__suseconds_t tv_usec; /* Microseconds. */
+#endif
};
#endif
lib/libc/glibc/time/bits/types/time_t.h
@@ -4,6 +4,10 @@
#include <bits/types.h>
/* Returned by `time'. */
+#ifdef __USE_TIME_BITS64
+typedef __time64_t time_t;
+#else
typedef __time_t time_t;
+#endif
#endif
src/glibc.zig
@@ -282,46 +282,13 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c",
lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c",
lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknodat.c",
- lib_libc_glibc ++ "nptl" ++ path.sep_str ++ "pthread_atfork.c",
+ lib_libc_glibc ++ "sysdeps" ++ path.sep_str ++ "pthread" ++ path.sep_str ++
+ "pthread_atfork.c",
lib_libc_glibc ++ "debug" ++ path.sep_str ++ "stack_chk_fail_local.c",
+ lib_libc_glibc ++ "csu" ++ path.sep_str ++ "errno.c",
};
- var c_source_files: [deps.len + 1]Compilation.CSourceFile = undefined;
-
- c_source_files[0] = blk: {
- var args = std.ArrayList([]const u8).init(arena);
- try args.appendSlice(&[_][]const u8{
- "-std=gnu11",
- "-fgnu89-inline",
- "-fmerge-all-constants",
- "-fno-stack-protector",
- "-fmath-errno",
- "-fno-stack-protector",
- "-I",
- try lib_path(comp, arena, lib_libc_glibc ++ "csu"),
- });
- try add_include_dirs(comp, arena, &args);
- try args.appendSlice(&[_][]const u8{
- "-DSTACK_PROTECTOR_LEVEL=0",
- "-fPIC",
- "-fno-stack-protector",
- "-ftls-model=initial-exec",
- "-D_LIBC_REENTRANT",
- "-include",
- try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"),
- "-DMODULE_NAME=libc",
- "-Wno-nonportable-include-path",
- "-include",
- try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"),
- "-DPIC",
- "-DLIBC_NONSHARED=1",
- "-DTOP_NAMESPACE=glibc",
- });
- break :blk .{
- .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "elf-init.c"),
- .extra_flags = args.items,
- };
- };
+ var c_source_files: [deps.len]Compilation.CSourceFile = undefined;
for (deps) |dep, i| {
var args = std.ArrayList([]const u8).init(arena);
@@ -347,7 +314,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
"-DLIBC_NONSHARED=1",
"-DTOP_NAMESPACE=glibc",
});
- c_source_files[i + 1] = .{
+ c_source_files[i] = .{
.src_path = try lib_path(comp, arena, dep),
.extra_flags = args.items,
};
test/standalone.zig
@@ -84,5 +84,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void {
cases.add("tools/gen_stubs.zig");
cases.add("tools/update_clang_options.zig");
cases.add("tools/update_cpu_features.zig");
+ cases.add("tools/update_glibc.zig");
cases.add("tools/update_spirv_features.zig");
}
tools/update_glibc.zig
@@ -0,0 +1,71 @@
+//! This script updates the .c, .h, .s, and .S files that make up the start
+//! files such as crt1.o. Not to be confused with
+//! https://github.com/ziglang/glibc-abi-tool/ which updates the `abilists`
+//! file.
+//!
+//! Example usage:
+//! `zig run ../tools/update_glibc.zig -- ~/Downloads/glibc ..`
+
+const std = @import("std");
+const mem = std.mem;
+const log = std.log;
+const fs = std.fs;
+
+const exempt_files = [_][]const u8{
+ "abilists",
+ "include/libc-modules.h",
+ "include/config.h",
+ // These are easier to maintain like this, without updating to the abi-note.c
+ // that glibc did upstream.
+ "csu/abi-tag.h",
+ "csu/abi-note.S",
+};
+
+pub fn main() !void {
+ var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
+ defer arena_instance.deinit();
+ const arena = arena_instance.allocator();
+
+ const args = try std.process.argsAlloc(arena);
+ const glibc_src_path = args[1];
+ const zig_src_path = args[2];
+
+ const dest_dir_path = try std.fmt.allocPrint(arena, "{s}/lib/libc/glibc", .{zig_src_path});
+
+ var dest_dir = fs.cwd().openDir(dest_dir_path, .{ .iterate = true }) catch |err| {
+ fatal("unable to open destination directory '{s}': {s}", .{
+ dest_dir_path, @errorName(err),
+ });
+ };
+ defer dest_dir.close();
+
+ var glibc_src_dir = try fs.cwd().openDir(glibc_src_path, .{});
+ defer glibc_src_dir.close();
+
+ var walker = try dest_dir.walk(arena);
+ defer walker.deinit();
+
+ walk: while (try walker.next()) |entry| {
+ if (entry.kind != .File) continue;
+ if (mem.startsWith(u8, entry.basename, ".")) continue;
+ for (exempt_files) |p| {
+ if (mem.eql(u8, entry.path, p)) continue :walk;
+ }
+
+ glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| {
+ log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {s}", .{
+ glibc_src_path, entry.path,
+ dest_dir_path, entry.path,
+ @errorName(err),
+ });
+ if (err == error.FileNotFound) {
+ try dest_dir.deleteFile(entry.path);
+ }
+ };
+ }
+}
+
+fn fatal(comptime format: []const u8, args: anytype) noreturn {
+ log.err(format, args);
+ std.process.exit(1);
+}