update glibc start files to 2.34

This commit introduces tools/update_glibc.zig to update the start files
for next time.

Some notable changes in recent glibc:

 * abi-note.S has been changed to abi-note.c but we resist the change to
   keep it easier to compile the start files.
 * elf-init.c has been deleted upstream. Further testing should be done
   to verify that binaries against glibc omitting elf-init.c still run
   properly on oldel glibc linux systems.

Closes #4926
This commit is contained in:
Andrew Kelley 2021-12-15 00:22:38 -07:00
parent 1edf8efa42
commit 19ca2415f2
292 changed files with 3979 additions and 8539 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'. */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */

45
lib/libc/glibc/include/errno.h vendored Normal file
View File

@ -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 */

View File

@ -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))

View File

@ -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}. */

View File

@ -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. */
@ -365,11 +374,11 @@ for linking")
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)
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)
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_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_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>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
libc_hidden_proto (__chk_fail)
rtld_hidden_proto (__chk_fail)
#endif
/* 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

View File

@ -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,

View File

@ -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

View File

@ -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

347
lib/libc/glibc/io/fcntl.h vendored Normal file
View File

@ -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 */

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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,6 +209,20 @@ 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 __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)
@ -220,10 +234,26 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
# 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,6 +265,16 @@ extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
# else
# 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_time64) __nonnull ((2, 3));
# else
# define fstatat __fstatat64_time64
# endif
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
@ -244,11 +284,25 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
# 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,6 +313,16 @@ 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 __USE_TIME_BITS64
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
struct stat *__restrict __buf), __lstat64_time64)
__nonnull ((1, 2));
# else
# define lstat __lstat64_time64
# endif
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
@ -268,10 +332,18 @@ extern int __REDIRECT_NTH (lstat,
# 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));
extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]),
__futimens64);
# else
# define __fxstat __fxstat64
# define __xstat __xstat64
# define __lxstat __lxstat64
# define futimens __futimens64
# 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

View File

@ -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.

View File

@ -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

View File

@ -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)
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4)
# if __cplusplus >= 201103L
# define __THROW noexcept (true)
# else
# define __THROW throw ()
# define __THROWNL throw ()
# define __NTH(fct) __LEAF_ATTR fct throw ()
# define __NTHNL(fct) fct 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
/* 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__ || __GNUC__ < 2
#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)
#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
/* 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 defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
#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
# 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 */

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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

55
lib/libc/glibc/stdlib/errno.h vendored Normal file
View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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).

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -0,0 +1,6 @@
#ifndef _BITS_STRUCT_STAT_TIME64_H
#define _BITS_STRUCT_STAT_TIME64_H 1
#define __stat64_t64 stat64
#endif

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,4 @@
/* Versions of the 'struct stat' data structure used in compatibility xstat
functions. */
#define _STAT_VER 0
#define _MKNOD_VER 0

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) */

View File

@ -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.

View File

@ -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

View File

@ -1,5 +1,5 @@
/* Common threading primitives definitions for both POSIX and C11.
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
@ -20,5 +20,18 @@
#define _THREAD_SHARED_TYPES_H 1
#include <bits/pthreadtypes-arch.h>
#include <bits/types/struct___pthread_once.h>
typedef int __tss_t;
typedef int __thrd_t;
typedef union
{
struct __pthread_once __data;
int __align __ONCE_ALIGNMENT;
char __size[__SIZEOF_PTHREAD_ONCE_T];
} __once_flag;
#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
#endif /* _THREAD_SHARED_TYPES_H */

View File

@ -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));

Some files were not shown because too many files have changed in this diff Show More