diff --git a/lib/libc/glibc/abilists b/lib/libc/glibc/abilists index dbcb66c995..205d3c15fb 100644 Binary files a/lib/libc/glibc/abilists and b/lib/libc/glibc/abilists differ diff --git a/lib/libc/glibc/bits/byteswap.h b/lib/libc/glibc/bits/byteswap.h index ccf613a9f6..6438a8b389 100644 --- a/lib/libc/glibc/bits/byteswap.h +++ b/lib/libc/glibc/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros and inline functions to swap the order of bytes in integer values. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/floatn-common.h b/lib/libc/glibc/bits/floatn-common.h index 6aa5ba12e4..b43c9532d8 100644 --- a/lib/libc/glibc/bits/floatn-common.h +++ b/lib/libc/glibc/bits/floatn-common.h @@ -1,6 +1,6 @@ /* Macros to control TS 18661-3 glibc features where the same definitions are appropriate for all platforms. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/libc-header-start.h b/lib/libc/glibc/bits/libc-header-start.h index b872a417be..47f39105a2 100644 --- a/lib/libc/glibc/bits/libc-header-start.h +++ b/lib/libc/glibc/bits/libc-header-start.h @@ -1,5 +1,5 @@ /* Handle feature test macros at the start of a header. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,8 +44,26 @@ /* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__ macro. Most but not all symbols enabled by that macro in TS - 18661-1 are enabled unconditionally in C2X; the symbols in Annex F - still require that macro in C2X. */ + 18661-1 are enabled unconditionally in C2X. In C2X, the symbols in + Annex F still require a new feature test macro + __STDC_WANT_IEC_60559_EXT__ instead (C2X does not define + __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS + 18661-1 are not included in C2X (and thus should depend on + __STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are + enabled). + + __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS + 18661-1 not included in C2X. + + __GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS + 18661-1 that are also included in C2X (with no feature test macro + required in C2X). + + __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1 + that are included in C2X but conditional on + __STDC_WANT_IEC_60559_EXT__. (There are currently no features + conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS + 18661-1.) */ #undef __GLIBC_USE_IEC_60559_BFP_EXT #if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__ # define __GLIBC_USE_IEC_60559_BFP_EXT 1 @@ -58,6 +76,12 @@ #else # define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0 #endif +#undef __GLIBC_USE_IEC_60559_EXT +#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__ +# define __GLIBC_USE_IEC_60559_EXT 1 +#else +# define __GLIBC_USE_IEC_60559_EXT 0 +#endif /* ISO/IEC TS 18661-4:2015 defines the __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction diff --git a/lib/libc/glibc/bits/long-double.h b/lib/libc/glibc/bits/long-double.h index 6e16447e65..fdb574d937 100644 --- a/lib/libc/glibc/bits/long-double.h +++ b/lib/libc/glibc/bits/long-double.h @@ -1,5 +1,5 @@ /* Properties of long double type. - Copyright (C) 2016-2020 Free Software Foundation, Inc. + Copyright (C) 2016-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,4 +37,17 @@ #ifndef __NO_LONG_DOUBLE_MATH # define __NO_LONG_DOUBLE_MATH 1 #endif -#define __LONG_DOUBLE_USES_FLOAT128 0 + +/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the + choice of the underlying ABI of long double. It will always assume + a constant value for each translation unit. + + If the value is non-zero, any API which is parameterized by the long + double type (i.e the scanf/printf family of functions or the explicitly + parameterized math.h functions) will be redirected to a compatible + implementation using _Float128 ABI via symbols suffixed with ieee128. + + The mechanism this macro uses to acquire may be a function + of architecture, or target specific options used to invoke the + compiler. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 diff --git a/lib/libc/glibc/bits/select.h b/lib/libc/glibc/bits/select.h index 14ea12f437..8204bbd4c4 100644 --- a/lib/libc/glibc/bits/select.h +++ b/lib/libc/glibc/bits/select.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/signum-generic.h b/lib/libc/glibc/bits/signum-generic.h index 504e5fb8c8..4e481c148a 100644 --- a/lib/libc/glibc/bits/signum-generic.h +++ b/lib/libc/glibc/bits/signum-generic.h @@ -1,5 +1,5 @@ /* Signal number constants. Generic template. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,31 +57,9 @@ #define SIGQUIT 3 /* Quit. */ #define SIGTRAP 5 /* Trace/breakpoint trap. */ #define SIGKILL 9 /* Killed. */ -#define SIGBUS 10 /* Bus error. */ -#define SIGSYS 12 /* Bad system call. */ #define SIGPIPE 13 /* Broken pipe. */ #define SIGALRM 14 /* Alarm clock. */ -/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ -#define SIGURG 16 /* Urgent data is available at a socket. */ -#define SIGSTOP 17 /* Stop, unblockable. */ -#define SIGTSTP 18 /* Keyboard stop. */ -#define SIGCONT 19 /* Continue. */ -#define SIGCHLD 20 /* Child terminated or stopped. */ -#define SIGTTIN 21 /* Background read from control terminal. */ -#define SIGTTOU 22 /* Background write to control terminal. */ -#define SIGPOLL 23 /* Pollable event occurred (System V). */ -#define SIGXCPU 24 /* CPU time limit exceeded. */ -#define SIGXFSZ 25 /* File size limit exceeded. */ -#define SIGVTALRM 26 /* Virtual timer expired. */ -#define SIGPROF 27 /* Profiling timer expired. */ -#define SIGUSR1 30 /* User-defined signal 1. */ -#define SIGUSR2 31 /* User-defined signal 2. */ - -/* Nonstandard signals found in all modern POSIX systems - (including both BSD and Linux). */ -#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ - /* Archaic names for compatibility. */ #define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ #define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */ @@ -93,8 +71,9 @@ but some real-time signals may be used internally by glibc. Do not use these constants in application code; use SIGRTMIN and SIGRTMAX (defined in signal.h) instead. */ -#define __SIGRTMIN 32 -#define __SIGRTMAX __SIGRTMIN + +/* Include system specific bits. */ +#include /* Biggest signal number + 1 (including real-time signals). */ #define _NSIG (__SIGRTMAX + 1) diff --git a/lib/libc/glibc/bits/stat.h b/lib/libc/glibc/bits/stat.h index d6497c9aa7..3b04d9677f 100644 --- a/lib/libc/glibc/bits/stat.h +++ b/lib/libc/glibc/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/stdint-intn.h b/lib/libc/glibc/bits/stdint-intn.h index 9e7bbc97ba..8a1cf5db9d 100644 --- a/lib/libc/glibc/bits/stdint-intn.h +++ b/lib/libc/glibc/bits/stdint-intn.h @@ -1,5 +1,5 @@ /* Define intN_t types. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/stdlib-bsearch.h b/lib/libc/glibc/bits/stdlib-bsearch.h index 2f248a6937..4132dc6af0 100644 --- a/lib/libc/glibc/bits/stdlib-bsearch.h +++ b/lib/libc/glibc/bits/stdlib-bsearch.h @@ -1,5 +1,5 @@ /* Perform binary search - inline version. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/time64.h b/lib/libc/glibc/bits/time64.h index 42f21fc86e..af3e731684 100644 --- a/lib/libc/glibc/bits/time64.h +++ b/lib/libc/glibc/bits/time64.h @@ -1,5 +1,5 @@ /* bits/time64.h -- underlying types for __time64_t. Generic version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/timesize.h b/lib/libc/glibc/bits/timesize.h index 71bf755069..11a9c9a499 100644 --- a/lib/libc/glibc/bits/timesize.h +++ b/lib/libc/glibc/bits/timesize.h @@ -1,5 +1,5 @@ /* Bit size of the time_t type at glibc build time, general case. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/types/struct_sched_param.h b/lib/libc/glibc/bits/types/struct_sched_param.h index db228a8d0a..78f3d0b556 100644 --- a/lib/libc/glibc/bits/types/struct_sched_param.h +++ b/lib/libc/glibc/bits/types/struct_sched_param.h @@ -1,5 +1,5 @@ /* Sched parameter structure. Generic version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/typesizes.h b/lib/libc/glibc/bits/typesizes.h index 014c9aab21..63564b2fa1 100644 --- a/lib/libc/glibc/bits/typesizes.h +++ b/lib/libc/glibc/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Generic version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,7 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -75,10 +76,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ diff --git a/lib/libc/glibc/bits/uintn-identity.h b/lib/libc/glibc/bits/uintn-identity.h index f2fc48b63d..6eb4964a1d 100644 --- a/lib/libc/glibc/bits/uintn-identity.h +++ b/lib/libc/glibc/bits/uintn-identity.h @@ -1,5 +1,5 @@ /* Inline functions to return unsigned integer values unchanged. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/bits/waitflags.h b/lib/libc/glibc/bits/waitflags.h index a2f9646b22..03d4db2de3 100644 --- a/lib/libc/glibc/bits/waitflags.h +++ b/lib/libc/glibc/bits/waitflags.h @@ -1,5 +1,5 @@ /* Definitions of flag bits for `waitpid' et al. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,3 +24,11 @@ /* Bits in the third argument to `waitpid'. */ #define WNOHANG 1 /* Don't block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */ + +/* Bits in the fourth argument to `waitid'. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# define WSTOPPED WUNTRACED /* Report stopped child. */ +# define WCONTINUED 4 /* Report continued child. */ +# define WNOWAIT 8 /* Don't reap, just poll status. */ +# define WEXITED 16 /* Report dead child. */ +#endif diff --git a/lib/libc/glibc/bits/waitstatus.h b/lib/libc/glibc/bits/waitstatus.h index 66d88a0be6..baaf96ac04 100644 --- a/lib/libc/glibc/bits/waitstatus.h +++ b/lib/libc/glibc/bits/waitstatus.h @@ -1,5 +1,5 @@ /* Definitions of status bits for `wait' et al. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/csu/elf-init.c b/lib/libc/glibc/csu/elf-init.c deleted file mode 100644 index b713c8b0fb..0000000000 --- a/lib/libc/glibc/csu/elf-init.c +++ /dev/null @@ -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 - . */ - -#include - - -/* 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 -} diff --git a/lib/libc/glibc/csu/errno.c b/lib/libc/glibc/csu/errno.c new file mode 100644 index 0000000000..946673585b --- /dev/null +++ b/lib/libc/glibc/csu/errno.c @@ -0,0 +1,35 @@ +/* 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 + 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 + . */ + +#include +#include +#include +#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 diff --git a/lib/libc/glibc/debug/stack_chk_fail_local.c b/lib/libc/glibc/debug/stack_chk_fail_local.c index 5d6dc84e6b..c9251c2411 100644 --- a/lib/libc/glibc/debug/stack_chk_fail_local.c +++ b/lib/libc/glibc/debug/stack_chk_fail_local.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/elf/elf.h b/lib/libc/glibc/elf/elf.h index 2549a177d6..4738dfa28f 100644 --- a/lib/libc/glibc/elf/elf.h +++ b/lib/libc/glibc/elf/elf.h @@ -1,5 +1,5 @@ /* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,10 +19,6 @@ #ifndef _ELF_H #define _ELF_H 1 -#include - -__BEGIN_DECLS - /* Standard ELF types. */ #include @@ -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 */ diff --git a/lib/libc/glibc/include/bits/cpu-set.h b/lib/libc/glibc/include/bits/cpu-set.h index 388f03cfbd..05aa0a8cf9 100644 --- a/lib/libc/glibc/include/bits/cpu-set.h +++ b/lib/libc/glibc/include/bits/cpu-set.h @@ -1 +1,9 @@ +#ifndef _BITS_CPU_SET_H #include + +#ifndef _ISOMAC +int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp); +libc_hidden_proto (__sched_cpucount) +#endif + +#endif /* _BITS_CPU_SET_H */ diff --git a/lib/libc/glibc/include/errno.h b/lib/libc/glibc/include/errno.h new file mode 100644 index 0000000000..c361a785c2 --- /dev/null +++ b/lib/libc/glibc/include/errno.h @@ -0,0 +1,45 @@ +#ifndef _ERRNO_H +#include +#if !defined _ISOMAC && !defined __ASSEMBLER__ + +# if IS_IN (rtld) +# include +# 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 */ diff --git a/lib/libc/glibc/include/features.h b/lib/libc/glibc/include/features.h deleted file mode 100644 index b6ff1e9b7b..0000000000 --- a/lib/libc/glibc/include/features.h +++ /dev/null @@ -1,492 +0,0 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _FEATURES_H -#define _FEATURES_H 1 - -/* These are defined by the user (or the compiler) - to specify the desired environment: - - __STRICT_ANSI__ ISO Standard C. - _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. - _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. - _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. - __STDC_WANT_LIB_EXT2__ - Extensions to ISO C99 from TR 27431-2:2010. - __STDC_WANT_IEC_60559_BFP_EXT__ - Extensions to ISO C11 from TS 18661-1:2014. - __STDC_WANT_IEC_60559_FUNCS_EXT__ - Extensions to ISO C11 from TS 18661-4:2015. - __STDC_WANT_IEC_60559_TYPES_EXT__ - Extensions to ISO C11 from TS 18661-3:2015. - - _POSIX_SOURCE IEEE Std 1003.1. - _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; - if >=199309L, add IEEE Std 1003.1b-1993; - if >=199506L, add IEEE Std 1003.1c-1995; - if >=200112L, all of IEEE 1003.1-2004 - if >=200809L, all of IEEE 1003.1-2008 - _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if - Single Unix conformance is wanted, to 600 for the - sixth revision, to 700 for the seventh revision. - _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. - _LARGEFILE_SOURCE Some more functions for correct standard I/O. - _LARGEFILE64_SOURCE Additional functionality from LFS for large files. - _FILE_OFFSET_BITS=N Select default filesystem interface. - _ATFILE_SOURCE Additional *at interfaces. - _GNU_SOURCE All of the above, plus GNU extensions. - _DEFAULT_SOURCE The default set of features (taking precedence over - __STRICT_ANSI__). - - _FORTIFY_SOURCE Add security hardening to many library functions. - Set to 1 or 2; 2 performs stricter checks than 1. - - _REENTRANT, _THREAD_SAFE - Obsolete; equivalent to _POSIX_C_SOURCE=199506L. - - The `-ansi' switch to the GNU C compiler, and standards conformance - options such as `-std=c99', define __STRICT_ANSI__. If none of - these are defined, or if _DEFAULT_SOURCE is defined, the default is - to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to - 200809L, as well as enabling miscellaneous functions from BSD and - SVID. If more than one of these are defined, they accumulate. For - example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together - give you ISO C, 1003.1, and 1003.2, but nothing else. - - These are defined by this file and are used by the - header files to decide what to declare or define: - - __GLIBC_USE (F) Define things from feature set F. This is defined - to 1 or 0; the subsequent macros are either defined - or undefined, and those tests should be moved to - __GLIBC_USE. - __USE_ISOC11 Define ISO C11 things. - __USE_ISOC99 Define ISO C99 things. - __USE_ISOC95 Define ISO C90 AMD1 (C95) things. - __USE_ISOCXX11 Define ISO C++11 things. - __USE_POSIX Define IEEE Std 1003.1 things. - __USE_POSIX2 Define IEEE Std 1003.2 things. - __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. - __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. - __USE_XOPEN Define XPG things. - __USE_XOPEN_EXTENDED Define X/Open Unix things. - __USE_UNIX98 Define Single Unix V2 things. - __USE_XOPEN2K Define XPG6 things. - __USE_XOPEN2KXSI Define XPG6 XSI things. - __USE_XOPEN2K8 Define XPG7 things. - __USE_XOPEN2K8XSI Define XPG7 XSI things. - __USE_LARGEFILE Define correct standard I/O things. - __USE_LARGEFILE64 Define LFS things with separate names. - __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_GNU Define GNU extensions. - __USE_FORTIFY_LEVEL Additional security measures used, according to level. - - The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are - defined by this file unconditionally. `__GNU_LIBRARY__' is provided - only for compatibility. All new code should use the other symbols - to test for features. - - All macros listed above as possibly being defined by this file are - explicitly undefined if they are not explicitly defined. - Feature-test macros that are not defined by the user or compiler - but are implied by the other feature-test macros defined (or by the - lack of any definitions) are defined by the file. - - ISO C feature test macros depend on the definition of the macro - when an affected header is included, not when the first system - header is included, and so they are handled in - , which does not have a multiple include - guard. Feature test macros that can be handled from the first - system header included are handled here. */ - - -/* Undefine everything, so we get a clean slate. */ -#undef __USE_ISOC11 -#undef __USE_ISOC99 -#undef __USE_ISOC95 -#undef __USE_ISOCXX11 -#undef __USE_POSIX -#undef __USE_POSIX2 -#undef __USE_POSIX199309 -#undef __USE_POSIX199506 -#undef __USE_XOPEN -#undef __USE_XOPEN_EXTENDED -#undef __USE_UNIX98 -#undef __USE_XOPEN2K -#undef __USE_XOPEN2KXSI -#undef __USE_XOPEN2K8 -#undef __USE_XOPEN2K8XSI -#undef __USE_LARGEFILE -#undef __USE_LARGEFILE64 -#undef __USE_FILE_OFFSET64 -#undef __USE_MISC -#undef __USE_ATFILE -#undef __USE_GNU -#undef __USE_FORTIFY_LEVEL -#undef __KERNEL_STRICT_NAMES -#undef __GLIBC_USE_ISOC2X -#undef __GLIBC_USE_DEPRECATED_GETS -#undef __GLIBC_USE_DEPRECATED_SCANF - -/* Suppress kernel-name space pollution unless user expressedly asks - for it. */ -#ifndef _LOOSE_KERNEL_NAMES -# define __KERNEL_STRICT_NAMES -#endif - -/* Convenience macro to test the version of gcc. - Use like this: - #if __GNUC_PREREQ (2,8) - ... code requiring gcc 2.8 or later ... - #endif - Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was - added in 2.0. */ -#if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) -#else -# define __GNUC_PREREQ(maj, min) 0 -#endif - -/* Similarly for clang. Features added to GCC after version 4.2 may - or may not also be available in clang, and clang's definitions of - __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such - features can be queried via __has_extension/__has_feature. */ -#if defined __clang_major__ && defined __clang_minor__ -# define __glibc_clang_prereq(maj, min) \ - ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) -#else -# define __glibc_clang_prereq(maj, min) 0 -#endif - -/* Whether to use feature set F. */ -#define __GLIBC_USE(F) __GLIBC_USE_ ## F - -/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for - _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not - issue a warning; the expectation is that the source is being - transitioned to use the new macro. */ -#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \ - && !defined _DEFAULT_SOURCE -# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" -# undef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE 1 -#endif - -/* If _GNU_SOURCE was defined by the user, turn on all the other features. */ -#ifdef _GNU_SOURCE -# undef _ISOC95_SOURCE -# define _ISOC95_SOURCE 1 -# undef _ISOC99_SOURCE -# define _ISOC99_SOURCE 1 -# undef _ISOC11_SOURCE -# define _ISOC11_SOURCE 1 -# undef _ISOC2X_SOURCE -# define _ISOC2X_SOURCE 1 -# undef _POSIX_SOURCE -# define _POSIX_SOURCE 1 -# undef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 200809L -# undef _XOPEN_SOURCE -# define _XOPEN_SOURCE 700 -# undef _XOPEN_SOURCE_EXTENDED -# define _XOPEN_SOURCE_EXTENDED 1 -# undef _LARGEFILE64_SOURCE -# define _LARGEFILE64_SOURCE 1 -# undef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE 1 -# undef _ATFILE_SOURCE -# define _ATFILE_SOURCE 1 -#endif - -/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, - define _DEFAULT_SOURCE. */ -#if (defined _DEFAULT_SOURCE \ - || (!defined __STRICT_ANSI__ \ - && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \ - && !defined _ISOC2X_SOURCE \ - && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ - && !defined _XOPEN_SOURCE)) -# undef _DEFAULT_SOURCE -# define _DEFAULT_SOURCE 1 -#endif - -/* This is to enable the ISO C2X extension. */ -#if (defined _ISOC2X_SOURCE \ - || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)) -# define __GLIBC_USE_ISOC2X 1 -#else -# define __GLIBC_USE_ISOC2X 0 -#endif - -/* This is to enable the ISO C11 extension. */ -#if (defined _ISOC11_SOURCE || defined _ISOC2X_SOURCE \ - || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) -# define __USE_ISOC11 1 -#endif - -/* This is to enable the ISO C99 extension. */ -#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ - || defined _ISOC2X_SOURCE \ - || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) -# define __USE_ISOC99 1 -#endif - -/* This is to enable the ISO C90 Amendment 1:1995 extension. */ -#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ - || defined _ISOC2X_SOURCE \ - || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) -# define __USE_ISOC95 1 -#endif - -#ifdef __cplusplus -/* This is to enable compatibility for ISO C++17. */ -# if __cplusplus >= 201703L -# define __USE_ISOC11 1 -# endif -/* This is to enable compatibility for ISO C++11. - Check the temporary macro for now, too. */ -# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ -# define __USE_ISOCXX11 1 -# define __USE_ISOC99 1 -# endif -#endif - -/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE - is defined, use POSIX.1-2008 (or another version depending on - _XOPEN_SOURCE). */ -#ifdef _DEFAULT_SOURCE -# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE -# define __USE_POSIX_IMPLICITLY 1 -# endif -# undef _POSIX_SOURCE -# define _POSIX_SOURCE 1 -# undef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 200809L -#endif - -#if ((!defined __STRICT_ANSI__ \ - || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \ - && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) -# define _POSIX_SOURCE 1 -# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 -# define _POSIX_C_SOURCE 2 -# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600 -# define _POSIX_C_SOURCE 199506L -# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700 -# define _POSIX_C_SOURCE 200112L -# else -# define _POSIX_C_SOURCE 200809L -# endif -# define __USE_POSIX_IMPLICITLY 1 -#endif - -/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be - defined in all multithreaded code. GNU libc has not required this - for many years. We now treat them as compatibility synonyms for - _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with - comprehensive support for multithreaded code. Using them never - lowers the selected level of POSIX conformance, only raises it. */ -#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \ - && (defined _REENTRANT || defined _THREAD_SAFE)) -# define _POSIX_SOURCE 1 -# undef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 199506L -#endif - -#if (defined _POSIX_SOURCE \ - || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \ - || defined _XOPEN_SOURCE) -# define __USE_POSIX 1 -#endif - -#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE -# define __USE_POSIX2 1 -#endif - -#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L -# define __USE_POSIX199309 1 -#endif - -#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L -# define __USE_POSIX199506 1 -#endif - -#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L -# define __USE_XOPEN2K 1 -# undef __USE_ISOC95 -# define __USE_ISOC95 1 -# undef __USE_ISOC99 -# define __USE_ISOC99 1 -#endif - -#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L -# define __USE_XOPEN2K8 1 -# undef _ATFILE_SOURCE -# define _ATFILE_SOURCE 1 -#endif - -#ifdef _XOPEN_SOURCE -# define __USE_XOPEN 1 -# if (_XOPEN_SOURCE - 0) >= 500 -# define __USE_XOPEN_EXTENDED 1 -# define __USE_UNIX98 1 -# undef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# if (_XOPEN_SOURCE - 0) >= 600 -# if (_XOPEN_SOURCE - 0) >= 700 -# define __USE_XOPEN2K8 1 -# define __USE_XOPEN2K8XSI 1 -# endif -# define __USE_XOPEN2K 1 -# define __USE_XOPEN2KXSI 1 -# undef __USE_ISOC95 -# define __USE_ISOC95 1 -# undef __USE_ISOC99 -# define __USE_ISOC99 1 -# endif -# else -# ifdef _XOPEN_SOURCE_EXTENDED -# define __USE_XOPEN_EXTENDED 1 -# endif -# endif -#endif - -#ifdef _LARGEFILE_SOURCE -# define __USE_LARGEFILE 1 -#endif - -#ifdef _LARGEFILE64_SOURCE -# define __USE_LARGEFILE64 1 -#endif - -#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 -# define __USE_FILE_OFFSET64 1 -#endif - -#if defined _DEFAULT_SOURCE -# define __USE_MISC 1 -#endif - -#ifdef _ATFILE_SOURCE -# define __USE_ATFILE 1 -#endif - -#ifdef _GNU_SOURCE -# define __USE_GNU 1 -#endif - -#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 -# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 -# 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 > 1 -# define __USE_FORTIFY_LEVEL 2 -# else -# define __USE_FORTIFY_LEVEL 1 -# endif -#endif -#ifndef __USE_FORTIFY_LEVEL -# define __USE_FORTIFY_LEVEL 0 -#endif - -/* The function 'gets' existed in C89, but is impossible to use - safely. It has been removed from ISO C11 and ISO C++14. Note: for - compatibility with various implementations of , this test - must consider only the value of __cplusplus when compiling C++. */ -#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11 -# define __GLIBC_USE_DEPRECATED_GETS 0 -#else -# define __GLIBC_USE_DEPRECATED_GETS 1 -#endif - -/* GNU formerly extended the scanf functions with modified format - specifiers %as, %aS, and %a[...] that allocate a buffer for the - input using malloc. This extension conflicts with ISO C99, which - defines %a as a standalone format specifier that reads a floating- - point number; moreover, POSIX.1-2008 provides the same feature - using the modifier letter 'm' instead (%ms, %mS, %m[...]). - - We now follow C99 unless GNU extensions are active and the compiler - is specifically in C89 or C++98 mode (strict or not). For - instance, with GCC, -std=gnu11 will have C99-compliant scanf with - or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the - old extension. */ -#if (defined __USE_GNU \ - && (defined __cplusplus \ - ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \ - : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L))) -# define __GLIBC_USE_DEPRECATED_SCANF 1 -#else -# define __GLIBC_USE_DEPRECATED_SCANF 0 -#endif - -/* Get definitions of __STDC_* predefined macros, if the compiler has - not preincluded this header automatically. */ -#include - -/* This macro indicates that the installed library is the GNU C Library. - For historic reasons the value now is 6 and this will stay from now - on. The use of this variable is deprecated. Use __GLIBC__ and - __GLIBC_MINOR__ now (see below) when you want to test for a specific - GNU C library version and use the values in to get - the sonames of the shared libraries. */ -#undef __GNU_LIBRARY__ -#define __GNU_LIBRARY__ 6 - -/* 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_PREREQ(maj, min) \ - ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) - -/* This is here only because every header file already includes this one. */ -#ifndef __ASSEMBLER__ -# ifndef _SYS_CDEFS_H -# include -# endif - -/* If we don't have __REDIRECT, prototypes will be missing if - __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ -# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT -# define __USE_LARGEFILE 1 -# define __USE_LARGEFILE64 1 -# endif - -#endif /* !ASSEMBLER */ - -/* Decide whether we can define 'extern inline' functions in headers. */ -#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ - && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ - && defined __extern_inline -# define __USE_EXTERN_INLINES 1 -#endif - - -/* This is here only because every header file already includes this one. - Get the definitions of all the appropriate `__stub_FUNCTION' symbols. - contains `#define __stub_FUNCTION' when FUNCTION is a stub - that will always return failure (and set errno to ENOSYS). */ -#include - - -#endif /* features.h */ diff --git a/lib/libc/glibc/include/libc-modules.h b/lib/libc/glibc/include/libc-modules.h index bac5bc33a1..6e5413b344 100644 --- a/lib/libc/glibc/include/libc-modules.h +++ b/lib/libc/glibc/include/libc-modules.h @@ -19,26 +19,25 @@ #define MODULE_LIBS_BEGIN 17 #define MODULE_rtld 18 #define MODULE_libc 19 -#define MODULE_libnss_nis 20 -#define MODULE_libBrokenLocale 21 -#define MODULE_libpthread 22 -#define MODULE_libthread_db 23 -#define MODULE_libnss_nisplus 24 -#define MODULE_libcrypt 25 -#define MODULE_libdl 26 -#define MODULE_libgcc_s 27 -#define MODULE_libnss_test1 28 -#define MODULE_libnsl 29 -#define MODULE_libutil 30 -#define MODULE_libnss_ldap 31 -#define MODULE_libnss_test2 32 -#define MODULE_libnss_dns 33 -#define MODULE_libnss_compat 34 -#define MODULE_libmvec 35 -#define MODULE_libresolv 36 -#define MODULE_libnss_db 37 -#define MODULE_libm 38 -#define MODULE_libnss_files 39 -#define MODULE_librt 40 -#define MODULE_libnss_hesiod 41 -#define MODULE_libanl 42 +#define MODULE_libBrokenLocale 20 +#define MODULE_libpthread 21 +#define MODULE_libthread_db 22 +#define MODULE_libcrypt 23 +#define MODULE_libdl 24 +#define MODULE_libgcc_s 25 +#define MODULE_libnss_test1 26 +#define MODULE_libnsl 27 +#define MODULE_libc_malloc_debug 28 +#define MODULE_libutil 29 +#define MODULE_libnss_ldap 30 +#define MODULE_libnss_test2 31 +#define MODULE_libnss_dns 32 +#define MODULE_libnss_compat 33 +#define MODULE_libmvec 34 +#define MODULE_libresolv 35 +#define MODULE_libnss_db 36 +#define MODULE_libm 37 +#define MODULE_libnss_files 38 +#define MODULE_librt 39 +#define MODULE_libnss_hesiod 40 +#define MODULE_libanl 41 diff --git a/lib/libc/glibc/include/libc-pointer-arith.h b/lib/libc/glibc/include/libc-pointer-arith.h index b4d716c727..04ba537617 100644 --- a/lib/libc/glibc/include/libc-pointer-arith.h +++ b/lib/libc/glibc/include/libc-pointer-arith.h @@ -1,5 +1,5 @@ /* Helper macros for pointer arithmetic. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,6 +37,9 @@ /* Cast an integer or a pointer VAL to integer with proper type. */ # define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val)) +/* Cast an integer VAL to void * pointer. */ +# define cast_to_pointer(val) ((void *) (uintptr_t) (val)) + /* Align a value by rounding down to closest size. e.g. Using size of 4096, we get this behavior: {4095, 4096, 4097} = {0, 4096, 4096}. */ diff --git a/lib/libc/glibc/include/libc-symbols.h b/lib/libc/glibc/include/libc-symbols.h index 685e20fdc0..d41ecf4384 100644 --- a/lib/libc/glibc/include/libc-symbols.h +++ b/lib/libc/glibc/include/libc-symbols.h @@ -1,6 +1,6 @@ /* Support macros for making weak and strong aliases for symbols, and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -84,6 +84,9 @@ #include +/* Obtain the definition of symbol_version_reference. */ +#include + /* When PIC is defined and SHARED isn't defined, we are building PIE by default. */ #if defined PIC && !defined SHARED @@ -307,7 +310,7 @@ for linking") /* Resource freeing functions from libc.so go in this section. */ #define __libc_freeres_fn_section \ - __attribute__ ((section ("__libc_freeres_fn"))) + __attribute__ ((__used__, section ("__libc_freeres_fn"))) /* Resource freeing functions for libc.so. */ #define libc_freeres_fn(name) \ @@ -349,6 +352,12 @@ for linking") */ +#ifdef HAVE_GNU_RETAIN +# define attribute_used_retain __attribute__ ((__used__, __retain__)) +#else +# define attribute_used_retain __attribute__ ((__used__)) +#endif + /* Symbol set support macros. */ /* Make SYMBOL, which is in the text segment, an element of SET. */ @@ -364,12 +373,12 @@ for linking") /* When building a shared library, make the set section writable, because it will need to be relocated at run time anyway. */ # define _elf_set_element(set, symbol) \ - static const void *__elf_set_##set##_element_##symbol##__ \ - __attribute__ ((used, section (#set))) = &(symbol) + static const void *__elf_set_##set##_element_##symbol##__ \ + attribute_used_retain __attribute__ ((section (#set))) = &(symbol) #else # define _elf_set_element(set, symbol) \ - static const void *const __elf_set_##set##_element_##symbol##__ \ - __attribute__ ((used, section (#set))) = &(symbol) + static const void *const __elf_set_##set##_element_##symbol##__ \ + attribute_used_retain __attribute__ ((section (#set))) = &(symbol) #endif /* Define SET as a symbol set. This may be required (it is in a.out) to @@ -396,32 +405,27 @@ for linking") past the last element in SET. */ #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set) -/* Use symbol_version_reference to specify the version a symbol - reference should link to. Use symbol_version or - default_symbol_version for the definition of a versioned symbol. - The difference is that the latter is a no-op in non-shared - builds. */ -#ifdef __ASSEMBLER__ -# define symbol_version_reference(real, name, version) \ - .symver real, name##@##version -#else /* !__ASSEMBLER__ */ -# define symbol_version_reference(real, name, version) \ - __asm__ (".symver " #real "," #name "@" #version) -#endif - #ifdef SHARED # define symbol_version(real, name, version) \ symbol_version_reference(real, name, version) # define default_symbol_version(real, name, version) \ _default_symbol_version(real, name, version) +/* See . */ # ifdef __ASSEMBLER__ # define _default_symbol_version(real, name, version) \ - .symver real, name##@##@##version + _set_symbol_version (real, name@@version) # else # define _default_symbol_version(real, name, version) \ - __asm__ (".symver " #real "," #name "@@" #version) + _set_symbol_version (real, #name "@@" #version) # endif -#else + +/* Evalutes to a string literal for VERSION in LIB. */ +# define symbol_version_string(lib, version) \ + _symbol_version_stringify_1 (VERSION_##lib##_##version) +# define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg) +# define _symbol_version_stringify_2(arg) #arg + +#else /* !SHARED */ # define symbol_version(real, name, version) # define default_symbol_version(real, name, version) \ strong_alias(real, name) @@ -618,12 +622,7 @@ for linking") # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define libc_hidden_def(name) hidden_def (name) # define libc_hidden_weak(name) hidden_weak (name) -# ifdef LINK_OBSOLETE_RPC - /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */ -# define libc_hidden_nolink_sunrpc(name, version) hidden_def (name) -# else -# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) -# endif +# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version) # define libc_hidden_ver(local, name) hidden_ver (local, name) # define libc_hidden_data_def(name) hidden_data_def (name) # define libc_hidden_tls_def(name) hidden_tls_def (name) @@ -641,7 +640,7 @@ for linking") # define libc_hidden_data_ver(local, name) #endif -#if IS_IN (rtld) && !defined NO_RTLD_HIDDEN +#if IS_IN (rtld) # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define rtld_hidden_def(name) hidden_def (name) @@ -730,6 +729,29 @@ for linking") # define libresolv_hidden_data_ver(local, name) #endif +#if IS_IN (libpthread) +# define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libpthread_hidden_tls_proto(name, attrs...) \ + hidden_tls_proto (name, ##attrs) +# define libpthread_hidden_def(name) hidden_def (name) +# define libpthread_hidden_weak(name) hidden_weak (name) +# define libpthread_hidden_ver(local, name) hidden_ver (local, name) +# define libpthread_hidden_data_def(name) hidden_data_def (name) +# define libpthread_hidden_tls_def(name) hidden_tls_def (name) +# define libpthread_hidden_data_weak(name) hidden_data_weak (name) +# define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name) +#else +# define libpthread_hidden_proto(name, attrs...) +# define libpthread_hidden_tls_proto(name, attrs...) +# define libpthread_hidden_def(name) +# define libpthread_hidden_weak(name) +# define libpthread_hidden_ver(local, name) +# define libpthread_hidden_data_def(name) +# define libpthread_hidden_tls_def(name) +# define libpthread_hidden_data_weak(name) +# define libpthread_hidden_data_ver(local, name) +#endif + #if IS_IN (librt) # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define librt_hidden_tls_proto(name, attrs...) \ @@ -776,40 +798,11 @@ for linking") # define libdl_hidden_data_ver(local, name) #endif -#if IS_IN (libnss_files) -# define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) -# define libnss_files_hidden_tls_proto(name, attrs...) \ - hidden_tls_proto (name, ##attrs) -# define libnss_files_hidden_def(name) hidden_def (name) -# define libnss_files_hidden_weak(name) hidden_weak (name) -# define libnss_files_hidden_ver(local, name) hidden_ver (local, name) -# define libnss_files_hidden_data_def(name) hidden_data_def (name) -# define libnss_files_hidden_tls_def(name) hidden_tls_def (name) -# define libnss_files_hidden_data_weak(name) hidden_data_weak (name) -# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name) -#else -# define libnss_files_hidden_proto(name, attrs...) -# define libnss_files_hidden_tls_proto(name, attrs...) -# define libnss_files_hidden_def(name) -# define libnss_files_hidden_weak(name) -# define libnss_files_hidden_ver(local, name) -# define libnss_files_hidden_data_def(name) -# define libnss_files_hidden_tls_def(name) -# define libnss_files_hidden_data_weak(name) -# define libnss_files_hidden_data_ver(local, name) -#endif - #if IS_IN (libnsl) # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libnsl_hidden_tls_proto(name, attrs...) \ hidden_tls_proto (name, ##attrs) -# ifdef LINK_OBSOLETE_NSL - /* libnsl_hidden_nolink should only get used in libnsl code. */ -# define libnsl_hidden_nolink_def(name, version) libnsl_hidden_def (name) -# else -# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version) -# endif -# define libnsl_hidden_def(name) hidden_def (name) +# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version) # define libnsl_hidden_weak(name) hidden_weak (name) # define libnsl_hidden_ver(local, name) hidden_ver (local, name) # define libnsl_hidden_data_def(name) hidden_data_def (name) @@ -819,7 +812,6 @@ for linking") #else # define libnsl_hidden_proto(name, attrs...) # define libnsl_hidden_tls_proto(name, attrs...) -# define libnsl_hidden_def(name) # define libnsl_hidden_weak(name) # define libnsl_hidden_ver(local, name) # define libnsl_hidden_data_def(name) @@ -828,33 +820,12 @@ for linking") # define libnsl_hidden_data_ver(local, name) #endif -#if IS_IN (libnss_nisplus) -# define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) -# define libnss_nisplus_hidden_tls_proto(name, attrs...) \ - hidden_tls_proto (name, ##attrs) -# define libnss_nisplus_hidden_def(name) hidden_def (name) -# define libnss_nisplus_hidden_weak(name) hidden_weak (name) -# define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name) -# define libnss_nisplus_hidden_data_def(name) hidden_data_def (name) -# define libnss_nisplus_hidden_tls_def(name) hidden_tls_def (name) -# define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name) -# define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name) -#else -# define libnss_nisplus_hidden_proto(name, attrs...) -# define libnss_nisplus_hidden_tls_proto(name, attrs...) -# define libnss_nisplus_hidden_def(name) -# define libnss_nisplus_hidden_weak(name) -# define libnss_nisplus_hidden_ver(local, name) -# define libnss_nisplus_hidden_data_def(name) -# define libnss_nisplus_hidden_tls_def(name) -# define libnss_nisplus_hidden_data_weak(name) -# define libnss_nisplus_hidden_data_ver(local, name) -#endif - #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs) #define libc_hidden_builtin_def(name) libc_hidden_def (name) #define libc_hidden_builtin_weak(name) libc_hidden_weak (name) #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name) + +#define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs) #ifdef __ASSEMBLER__ # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name) #endif @@ -882,6 +853,14 @@ for linking") # define libutil_hidden_data_ver(local, name) #endif +#if IS_IN (libanl) +# define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) +# define libanl_hidden_def(name) hidden_def (name) +#else +# define libanl_hidden_proto(name, attrs...) +# define libanl_hidden_def(name) +#endif + /* Get some dirty hacks. */ #include diff --git a/lib/libc/glibc/include/pthread.h b/lib/libc/glibc/include/pthread.h index 858c869a16..819bf3f235 100644 --- a/lib/libc/glibc/include/pthread.h +++ b/lib/libc/glibc/include/pthread.h @@ -8,9 +8,20 @@ extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier, const pthread_barrierattr_t *__restrict __attr, unsigned int __count) __THROW __nonnull ((1)); +#if PTHREAD_IN_LIBC +libc_hidden_proto (__pthread_barrier_init) +#endif extern int __pthread_barrier_wait (pthread_barrier_t *__barrier) __THROWNL __nonnull ((1)); +#if PTHREAD_IN_LIBC +libc_hidden_proto (__pthread_barrier_wait) +#endif /* This function is called to initialize the pthread library. */ extern void __pthread_initialize (void) __attribute__ ((weak)); + +extern int __pthread_kill (pthread_t threadid, int signo); + +extern pthread_t __pthread_self (void); + #endif diff --git a/lib/libc/glibc/include/signal.h b/lib/libc/glibc/include/signal.h index 293258ad65..2a278697c1 100644 --- a/lib/libc/glibc/include/signal.h +++ b/lib/libc/glibc/include/signal.h @@ -2,6 +2,8 @@ # include # ifndef _ISOMAC +# include + 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 +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 diff --git a/lib/libc/glibc/include/stap-probe.h b/lib/libc/glibc/include/stap-probe.h index 3c24ac640e..9e13a4decc 100644 --- a/lib/libc/glibc/include/stap-probe.h +++ b/lib/libc/glibc/include/stap-probe.h @@ -1,5 +1,5 @@ /* Macros for defining Systemtap 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 diff --git a/lib/libc/glibc/include/stdc-predef.h b/lib/libc/glibc/include/stdc-predef.h deleted file mode 100644 index eaf0a6aea8..0000000000 --- a/lib/libc/glibc/include/stdc-predef.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _STDC_PREDEF_H -#define _STDC_PREDEF_H 1 - -/* This header is separate from features.h so that the compiler can - include it implicitly at the start of every compilation. It must - not itself include or any other header that includes - because the implicit include comes before any feature - test macros that may be defined in a source file before it first - explicitly includes a system header. GCC knows the name of this - header in order to preinclude it. */ - -/* glibc's intent is to support the IEC 559 math functionality, real - and complex. If the GCC (4.9 and later) predefined macros - specifying compiler intent are available, use them to determine - whether the overall intent is to support these features; otherwise, - presume an older compiler has intent to support these features and - define these macros by default. */ - -#ifdef __GCC_IEC_559 -# if __GCC_IEC_559 > 0 -# define __STDC_IEC_559__ 1 -# endif -#else -# define __STDC_IEC_559__ 1 -#endif - -#ifdef __GCC_IEC_559_COMPLEX -# if __GCC_IEC_559_COMPLEX > 0 -# define __STDC_IEC_559_COMPLEX__ 1 -# endif -#else -# define __STDC_IEC_559_COMPLEX__ 1 -#endif - -/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is - synchronized with ISO/IEC 10646:2017, fifth edition, plus - the following additions from Amendment 1 to the fifth edition: - - 56 emoji characters - - 285 hentaigana - - 3 additional Zanabazar Square characters */ -#define __STDC_ISO_10646__ 201706L - -#endif diff --git a/lib/libc/glibc/include/stdlib.h b/lib/libc/glibc/include/stdlib.h index 1fab78aa16..1c6f70b082 100644 --- a/lib/libc/glibc/include/stdlib.h +++ b/lib/libc/glibc/include/stdlib.h @@ -3,12 +3,23 @@ #ifndef _ISOMAC # include #endif + +/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */ +#include +#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 /* Now define the internal interfaces. */ #if !defined _ISOMAC # include +# include + 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 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 diff --git a/lib/libc/glibc/include/struct___timespec64.h b/lib/libc/glibc/include/struct___timespec64.h new file mode 100644 index 0000000000..9abb25c8f7 --- /dev/null +++ b/lib/libc/glibc/include/struct___timespec64.h @@ -0,0 +1,27 @@ +#ifndef _STRUCT_TIMESPEC64_H +#define _STRUCT_TIMESPEC64_H + +#if __TIMESIZE == 64 +# define __timespec64 timespec +#else +#include +/* 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 */ diff --git a/lib/libc/glibc/include/struct___timeval64.h b/lib/libc/glibc/include/struct___timeval64.h new file mode 100644 index 0000000000..05cf2f26fc --- /dev/null +++ b/lib/libc/glibc/include/struct___timeval64.h @@ -0,0 +1,17 @@ +#ifndef _STRUCT_TIMEVAL64_H +#define _STRUCT_TIMEVAL64_H + +#if __TIMESIZE == 64 +# define __timeval64 timeval +#else +/* The glibc Y2038-proof struct __timeval64 structure for a time value. + This structure is NOT supposed to be passed to the Linux kernel. + Instead, it shall be converted to struct __timespec64 and time shall + be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */ +struct __timeval64 +{ + __time64_t tv_sec; /* Seconds */ + __suseconds64_t tv_usec; /* Microseconds */ +}; +#endif +#endif /* _STRUCT_TIMEVAL64_H */ diff --git a/lib/libc/glibc/include/sys/cdefs.h b/lib/libc/glibc/include/sys/cdefs.h index 524fe57a25..6a76160ed4 100644 --- a/lib/libc/glibc/include/sys/cdefs.h +++ b/lib/libc/glibc/include/sys/cdefs.h @@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__)); libc_hidden_proto (__chk_fail) rtld_hidden_proto (__chk_fail) -#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 diff --git a/lib/libc/glibc/include/sys/select.h b/lib/libc/glibc/include/sys/select.h index 07bb49b994..a8961afbed 100644 --- a/lib/libc/glibc/include/sys/select.h +++ b/lib/libc/glibc/include/sys/select.h @@ -3,6 +3,35 @@ #ifndef _ISOMAC /* Now define the internal interfaces. */ +# if __TIMESIZE == 64 +# define __pselect64 __pselect +# define __select64 __select +#else +# include +# include + +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, diff --git a/lib/libc/glibc/include/sys/stat.h b/lib/libc/glibc/include/sys/stat.h index b82d452780..13e777b3c7 100644 --- a/lib/libc/glibc/include/sys/stat.h +++ b/lib/libc/glibc/include/sys/stat.h @@ -2,63 +2,97 @@ #include #ifndef _ISOMAC +# include +# include +# include +# include + +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 diff --git a/lib/libc/glibc/io/bits/statx.h b/lib/libc/glibc/io/bits/statx.h index e63e6988c2..ed2ac92d80 100644 --- a/lib/libc/glibc/io/bits/statx.h +++ b/lib/libc/glibc/io/bits/statx.h @@ -1,5 +1,5 @@ /* statx-related definitions and declarations. Generic version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/io/fcntl.h b/lib/libc/glibc/io/fcntl.h new file mode 100644 index 0000000000..8917a73b42 --- /dev/null +++ b/lib/libc/glibc/io/fcntl.h @@ -0,0 +1,347 @@ +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * POSIX Standard: 6.5 File Control Operations + */ + +#ifndef _FCNTL_H +#define _FCNTL_H 1 + +#include + +/* This must be early so can define types winningly. */ +__BEGIN_DECLS + +/* Get __mode_t, __dev_t and __off_t .*/ +#include + +/* Get the definitions of O_*, F_*, FD_*: all the + numbers and flag bits for `open', `fcntl', et al. */ +#include + +/* 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 . + 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 should also be available. */ +#ifdef __USE_XOPEN2K8 +# include +#endif +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +# include + +# 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 . 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. 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 ; 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 +#endif + +__END_DECLS + +#endif /* fcntl.h */ diff --git a/lib/libc/glibc/io/fstat.c b/lib/libc/glibc/io/fstat.c deleted file mode 100644 index 6ce077dc4a..0000000000 --- a/lib/libc/glibc/io/fstat.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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); -} - -weak_hidden_alias (__fstat, fstat) diff --git a/lib/libc/glibc/io/fstat64.c b/lib/libc/glibc/io/fstat64.c deleted file mode 100644 index c4dd3acd60..0000000000 --- a/lib/libc/glibc/io/fstat64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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) -{ - return __fxstat64 (_STAT_VER, fd, buf); -} diff --git a/lib/libc/glibc/io/fstatat.c b/lib/libc/glibc/io/fstatat.c deleted file mode 100644 index edc773487a..0000000000 --- a/lib/libc/glibc/io/fstatat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2005-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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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) -{ - return __fxstatat (_STAT_VER, fd, file, buf, flag); -} diff --git a/lib/libc/glibc/io/fstatat64.c b/lib/libc/glibc/io/fstatat64.c deleted file mode 100644 index b57133bd90..0000000000 --- a/lib/libc/glibc/io/fstatat64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 2005-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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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) -{ - return __fxstatat64 (_STAT_VER, fd, file, buf, flag); -} diff --git a/lib/libc/glibc/io/lstat.c b/lib/libc/glibc/io/lstat.c deleted file mode 100644 index 7134741106..0000000000 --- a/lib/libc/glibc/io/lstat.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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); -} - -weak_hidden_alias (__lstat, lstat) diff --git a/lib/libc/glibc/io/lstat64.c b/lib/libc/glibc/io/lstat64.c deleted file mode 100644 index a890da71a8..0000000000 --- a/lib/libc/glibc/io/lstat64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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) -{ - return __lxstat64 (_STAT_VER, file, buf); -} diff --git a/lib/libc/glibc/io/mknod.c b/lib/libc/glibc/io/mknod.c index ac96829230..bf45055fdd 100644 --- a/lib/libc/glibc/io/mknod.c +++ b/lib/libc/glibc/io/mknod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -6,23 +6,6 @@ License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -32,24 +15,13 @@ License along with the GNU C Library; if not, see . */ - -#include #include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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 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) diff --git a/lib/libc/glibc/io/mknodat.c b/lib/libc/glibc/io/mknodat.c deleted file mode 100644 index 65c9f1aa9c..0000000000 --- a/lib/libc/glibc/io/mknodat.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 1995-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 - . */ - - -#include -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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. */ - -int -attribute_hidden -mknodat (int fd, const char *path, mode_t mode, dev_t dev) -{ - return __xmknodat (_MKNOD_VER, fd, path, mode, &dev); -} diff --git a/lib/libc/glibc/io/stat.c b/lib/libc/glibc/io/stat.c deleted file mode 100644 index 8c3cd877c8..0000000000 --- a/lib/libc/glibc/io/stat.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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); -} - -weak_hidden_alias (__stat, stat) diff --git a/lib/libc/glibc/io/stat64.c b/lib/libc/glibc/io/stat64.c deleted file mode 100644 index 8b6b662f3a..0000000000 --- a/lib/libc/glibc/io/stat64.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - 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 - . */ - -#include - -/* This definition is only used if inlining fails for this function; see - the last page of . 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) -{ - return __xstat64 (_STAT_VER, file, buf); -} diff --git a/lib/libc/glibc/io/sys/stat.h b/lib/libc/glibc/io/sys/stat.h index ce014d03a5..f7874ec5ba 100644 --- a/lib/libc/glibc/io/sys/stat.h +++ b/lib/libc/glibc/io/sys/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -209,21 +209,51 @@ extern int stat (const char *__restrict __file, that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (stat, (const char *__restrict __file, + struct stat *__restrict __buf), + __stat64_time64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), + __fstat64_time64) + __nonnull ((2)); +# else +# define stat __stat64_time64 +# define fstat __fstat64_time64 +# endif +# else +# ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), stat64) __nonnull ((1, 2)); extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) __nonnull ((2)); -# else -# define stat stat64 -# define fstat fstat64 +# else +# define stat stat64 +# define fstat fstat64 +# endif # endif #endif #ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (stat64, (const char *__restrict __file, + struct stat64 *__restrict __buf), + __stat64_time64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf), + __fstat64_time64) + __nonnull ((2)); +# else +# define stat64 __stat64_time64 +# define fstat64 __fstat64_time +# endif +# endif #endif #ifdef __USE_ATFILE @@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, + struct stat *__restrict __buf, + int __flag), + __fstatat64_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, int __flag), fstatat64) __nonnull ((2, 3)); -# else -# define fstatat fstatat64 +# else +# define fstatat fstatat64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatat64, (int __fd, + const char *__restrict __file, + struct stat64 *__restrict __buf, + int __flag), + __fstatat64_time64) + __nonnull ((2, 3)); +# else +# define fstatat64 __fstatat64_time64 +# endif +# endif # endif #endif @@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file, extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (lstat, + (const char *__restrict __file, + struct stat *__restrict __buf), __lstat64_time64) + __nonnull ((1, 2)); +# else +# define lstat __lstat64_time64 +# endif +# else +# ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, struct stat *__restrict __buf), lstat64) __nonnull ((1, 2)); -# else -# define lstat lstat64 +# else +# define lstat lstat64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); +# else +extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file, + struct stat64 *__restrict __buf), + __lstat64_time64) + __nonnull ((1, 2)); +# endif # endif #endif @@ -355,182 +427,44 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) #endif #ifdef __USE_ATFILE +# ifndef __USE_TIME_BITS64 /* Set file access and modification times relative to directory file descriptor. */ extern int utimensat (int __fd, const char *__path, const struct timespec __times[2], int __flags) __THROW __nonnull ((2)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path, + const struct timespec __times[2], + int flags), + __utimensat64) __nonnull ((2)); +# else +# define utimensat __utimensat64 +# endif +# endif #endif #ifdef __USE_XOPEN2K8 +# ifndef __USE_TIME_BITS64 /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; -#endif - -/* To allow the `struct stat' structure and the file type `mode_t' - bits to vary without changing shared library major version number, - the `stat' family of functions and `mknod' are in fact inline - wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod', - which all take a leading version-number argument designating the - data structure and bits used. defines _STAT_VER with - the version number corresponding to `struct stat' as defined in - that file; and _MKNOD_VER with the version number corresponding to - the S_IF* macros defined therein. It is arranged that when not - inlined these function are always statically linked; that way a - dynamically-linked executable always encodes the version number - corresponding to the data structures it uses, so the `x' functions - in the shared library can adapt without needing to recompile all - callers. */ - -#ifndef _STAT_VER -# define _STAT_VER 0 -#endif -#ifndef _MKNOD_VER -# define _MKNOD_VER 0 -#endif - -/* Wrappers for stat and mknod system calls. */ -#ifndef __USE_FILE_OFFSET64 -extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat (int __ver, const char *__filename, - struct stat *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat (int __ver, int __fildes, const char *__filename, - struct stat *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#else -# ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes, - struct stat *__stat_buf), __fxstat64) - __nonnull ((3)); -extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __xstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename, - struct stat *__stat_buf), __lxstat64) - __nonnull ((2, 3)); -extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes, - const char *__filename, - struct stat *__stat_buf, int __flag), - __fxstatat64) __nonnull ((3, 4)); # else -# define __fxstat __fxstat64 -# define __xstat __xstat64 -# define __lxstat __lxstat64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]), + __futimens64); +# else +# define futimens __futimens64 +# endif # endif #endif -#ifdef __USE_LARGEFILE64 -extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf) - __THROW __nonnull ((3)); -extern int __xstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __lxstat64 (int __ver, const char *__filename, - struct stat64 *__stat_buf) __THROW __nonnull ((2, 3)); -extern int __fxstatat64 (int __ver, int __fildes, const char *__filename, - struct stat64 *__stat_buf, int __flag) - __THROW __nonnull ((3, 4)); -#endif -extern int __xmknod (int __ver, const char *__path, __mode_t __mode, - __dev_t *__dev) __THROW __nonnull ((2, 4)); - -extern int __xmknodat (int __ver, int __fd, const char *__path, - __mode_t __mode, __dev_t *__dev) - __THROW __nonnull ((3, 5)); - #ifdef __USE_GNU # include #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 diff --git a/lib/libc/glibc/locale/bits/types/__locale_t.h b/lib/libc/glibc/locale/bits/types/__locale_t.h index 53e9a9c41d..b0742bfb28 100644 --- a/lib/libc/glibc/locale/bits/types/__locale_t.h +++ b/lib/libc/glibc/locale/bits/types/__locale_t.h @@ -1,5 +1,5 @@ /* Definition of struct __locale_struct and __locale_t. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. diff --git a/lib/libc/glibc/locale/bits/types/locale_t.h b/lib/libc/glibc/locale/bits/types/locale_t.h index 6156631d75..f46e9b0ef5 100644 --- a/lib/libc/glibc/locale/bits/types/locale_t.h +++ b/lib/libc/glibc/locale/bits/types/locale_t.h @@ -1,5 +1,5 @@ /* Definition of locale_t. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/misc/sys/cdefs.h b/lib/libc/glibc/misc/sys/cdefs.h index ff7144f3f3..e490fc1aeb 100644 --- a/lib/libc/glibc/misc/sys/cdefs.h +++ b/lib/libc/glibc/misc/sys/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not - anymore supported. */ + supported anymore. */ #if defined __GNUC__ && !defined __STDC__ # error "You need a ISO C conforming compiler to use the glibc headers" #endif @@ -34,7 +34,29 @@ #undef __P #undef __PMT -#ifdef __GNUC__ +/* Compilers that lack __has_attribute may object to + #if defined __has_attribute && __has_attribute (...) + even though they do not need to evaluate the right-hand side of the &&. + Similarly for __has_builtin, etc. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define __glibc_has_attribute(attr) __has_attribute (attr) +#else +# define __glibc_has_attribute(attr) 0 +#endif +#ifdef __has_builtin +# define __glibc_has_builtin(name) __has_builtin (name) +#else +# define __glibc_has_builtin(name) 0 +#endif +#ifdef __has_extension +# define __glibc_has_extension(ext) __has_extension (ext) +#else +# define __glibc_has_extension(ext) 0 +#endif + +#if defined __GNUC__ || defined __clang__ /* All functions, except those with callbacks or those that synchronize memory, are leaf functions. */ @@ -47,21 +69,26 @@ # endif /* GCC can always grok prototypes. For C++ programs we add throw() - to help it optimize the function calls. But this works only with - gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions + to help it optimize the function calls. But this only works with + gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions as non-throwing using a function attribute since programs can use the -fexceptions options for C code as well. */ -# if !defined __cplusplus && __GNUC_PREREQ (3, 3) +# if !defined __cplusplus \ + && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) # define __THROW __attribute__ ((__nothrow__ __LEAF)) # define __THROWNL __attribute__ ((__nothrow__)) # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct # else -# if defined __cplusplus && __GNUC_PREREQ (2,8) -# define __THROW throw () -# define __THROWNL throw () -# define __NTH(fct) __LEAF_ATTR fct throw () -# define __NTHNL(fct) fct throw () +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) +# if __cplusplus >= 201103L +# define __THROW noexcept (true) +# else +# define __THROW throw () +# endif +# define __THROWNL __THROW +# define __NTH(fct) __LEAF_ATTR fct __THROW +# define __NTHNL(fct) fct __THROW # else # define __THROW # define __THROWNL @@ -70,7 +97,7 @@ # endif # endif -#else /* Not GCC. */ +#else /* Not GCC or clang. */ # if (defined __cplusplus \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) @@ -83,16 +110,7 @@ # define __THROWNL # define __NTH(fct) fct -#endif /* GCC. */ - -/* Compilers that are not clang may object to - #if defined __clang__ && __has_extension(...) - even though they do not need to evaluate the right-hand side of the &&. */ -#if defined __clang__ && defined __has_extension -# define __glibc_clang_has_extension(ext) __has_extension (ext) -#else -# define __glibc_clang_has_extension(ext) 0 -#endif +#endif /* GCC || clang. */ /* These two macros are not used in glibc anymore. They are kept here only because some other projects expect the macros to be defined. */ @@ -123,14 +141,20 @@ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) #define __bos0(ptr) __builtin_object_size (ptr, 0) +/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ +#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0) +# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) +# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) +#else +# define __glibc_objsize0(__o) __bos0 (__o) +# define __glibc_objsize(__o) __bos (__o) +#endif + #if __GNUC_PREREQ (4,3) -# define __warndecl(name, msg) \ - extern void name (void) __attribute__((__warning__ (msg))) # define __warnattr(msg) __attribute__((__warning__ (msg))) # define __errordecl(name, msg) \ extern void name (void) __attribute__((__error__ (msg))) #else -# define __warndecl(name, msg) extern void name (void) # define __warnattr(msg) # define __errordecl(name, msg) extern void name (void) #endif @@ -139,11 +163,11 @@ Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affect sizeof()) should test #if __glibc_c99_flexarr_available. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc # define __flexarr [] # define __glibc_c99_flexarr_available 1 -#elif __GNUC_PREREQ (2,97) -/* GCC 2.97 supports C99 flexible array members as an extension, +#elif __GNUC_PREREQ (2,97) || defined __clang__ +/* GCC 2.97 and clang support C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 @@ -169,7 +193,7 @@ Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ -#if defined __GNUC__ && __GNUC__ >= 2 +#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4) # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) # ifdef __cplusplus @@ -194,17 +218,17 @@ */ #endif -/* GCC has various useful declarations that can be made with the - `__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !defined __GNUC__ || __GNUC__ < 2 +/* GCC and clang have various useful declarations that can be made with + the '__attribute__' syntax. All of the ways we use this do fine if + they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__) # define __attribute__(xyz) /* Ignore */ #endif /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) +#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) # define __attribute_malloc__ __attribute__ ((__malloc__)) #else # define __attribute_malloc__ /* Ignore */ @@ -222,23 +246,29 @@ /* At some point during the gcc 2.96 development the `pure' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) +#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) # define __attribute_pure__ __attribute__ ((__pure__)) #else # define __attribute_pure__ /* Ignore */ #endif /* This declaration tells the compiler that the value is constant. */ -#if __GNUC_PREREQ (2,5) +#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) # define __attribute_const__ __attribute__ ((__const__)) #else # define __attribute_const__ /* Ignore */ #endif +#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) +# define __attribute_maybe_unused__ __attribute__ ((__unused__)) +#else +# define __attribute_maybe_unused__ /* Ignore */ +#endif + /* At some point during the gcc 3.1 development the `used' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (3,1) +#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) # define __attribute_used__ __attribute__ ((__used__)) # define __attribute_noinline__ __attribute__ ((__noinline__)) #else @@ -247,7 +277,7 @@ #endif /* Since version 3.2, gcc allows marking deprecated functions. */ -#if __GNUC_PREREQ (3,2) +#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) # define __attribute_deprecated__ __attribute__ ((__deprecated__)) #else # define __attribute_deprecated__ /* Ignore */ @@ -257,7 +287,7 @@ when a deprecated function is used. clang claims to be gcc 4.2, but may also support this feature. */ #if __GNUC_PREREQ (4,5) \ - || __glibc_clang_has_extension (__attribute_deprecated_with_message__) + || __glibc_has_extension (__attribute_deprecated_with_message__) # define __attribute_deprecated_msg__(msg) \ __attribute__ ((__deprecated__ (msg))) #else @@ -270,7 +300,7 @@ If several `format_arg' attributes are given for the same function, in gcc-3.0 and older, all but the last one are ignored. In newer gccs, all designated arguments are considered. */ -#if __GNUC_PREREQ (2,8) +#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) #else # define __attribute_format_arg__(x) /* Ignore */ @@ -280,27 +310,42 @@ attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,97) +#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) # define __attribute_format_strfmon__(a,b) \ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif -/* The nonull function attribute allows to mark pointer parameters which +/* The nonnull function attribute marks pointer parameters that must not be NULL. */ -#if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -#else -# define __nonnull(params) +#ifndef __nonnull +# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) +# define __nonnull(params) __attribute__ ((__nonnull__ params)) +# else +# define __nonnull(params) +# endif +#elif !defined __GLIBC__ +# undef __nonnull +# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) +#endif + +/* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +#ifndef __returns_nonnull +# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) +# define __returns_nonnull __attribute__ ((__returns_nonnull__)) +# else +# define __returns_nonnull +# endif #endif /* If fortification mode, we warn about unused results of certain function calls which can lead to problems. */ -#if __GNUC_PREREQ (3,4) +#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) # define __attribute_warn_unused_result__ \ __attribute__ ((__warn_unused_result__)) -# if __USE_FORTIFY_LEVEL > 0 +# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 # define __wur __attribute_warn_unused_result__ # endif #else @@ -311,7 +356,7 @@ #endif /* Forces a function to be always inlined. */ -#if __GNUC_PREREQ (3,2) +#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) /* The Linux kernel defines __always_inline in stddef.h (283d7573), and it conflicts with this definition. Therefore undefine it first to allow either header to be included first. */ @@ -324,7 +369,7 @@ /* Associate error messages with the source location of the call site rather than with the source location inside the function. */ -#if __GNUC_PREREQ (4,3) +#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) # define __attribute_artificial__ __attribute__ ((__artificial__)) #else # define __attribute_artificial__ /* Ignore */ @@ -367,12 +412,14 @@ run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ -#if !__GNUC_PREREQ (2,8) +#if !(__GNUC_PREREQ (2,8) || defined __clang__) # define __extension__ /* Ignore */ #endif -/* __restrict is known in EGCS 1.2 and above. */ -#if !__GNUC_PREREQ (2,92) +/* __restrict is known in EGCS 1.2 and above, and in clang. + It works also in C++ mode (outside of arrays), but only when spelled + as '__restrict', not 'restrict'. */ +#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) # if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L # define __restrict restrict # else @@ -382,8 +429,9 @@ /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is array_name[restrict] - GCC 3.1 supports this. */ -#if __GNUC_PREREQ (3,1) && !defined __GNUG__ + GCC 3.1 and clang support this. + This syntax is not usable in C++ mode. */ +#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus # define __restrict_arr __restrict #else # ifdef __GNUC__ @@ -398,7 +446,7 @@ # endif #endif -#if __GNUC__ >= 3 +#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) # define __glibc_likely(cond) __builtin_expect ((cond), 1) #else @@ -406,15 +454,10 @@ # define __glibc_likely(cond) (cond) #endif -#ifdef __has_attribute -# define __glibc_has_attribute(attr) __has_attribute (attr) -#else -# define __glibc_has_attribute(attr) 0 -#endif - #if (!defined _Noreturn \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && !__GNUC_PREREQ (4,7)) + && !(__GNUC_PREREQ (4,7) \ + || (3 < __clang_major__ + (5 <= __clang_minor__)))) # if __GNUC_PREREQ (2,8) # define _Noreturn __attribute__ ((__noreturn__)) # else @@ -443,16 +486,51 @@ #if (!defined _Static_assert && !defined __cplusplus \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) + && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ + || defined __STRICT_ANSI__)) # define _Static_assert(expr, diagnostic) \ extern int (*__Static_assert_function (void)) \ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif -#include -#include +/* The #ifndef lets Gnulib avoid including these on non-glibc + platforms, where the includes typically do not exist. */ +#ifdef __GLIBC__ +# include +# include +#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, [, ]) */ +# 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 */ diff --git a/lib/libc/glibc/misc/sys/select.h b/lib/libc/glibc/misc/sys/select.h index 29d011c2d5..e9c0e8fc20 100644 --- a/lib/libc/glibc/misc/sys/select.h +++ b/lib/libc/glibc/misc/sys/select.h @@ -1,5 +1,5 @@ /* `fd_set' type and related macros, and `select'/`pselect' declarations. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -98,10 +98,23 @@ __BEGIN_DECLS This function is a cancellation point and therefore not marked with __THROW. */ +#ifndef __USE_TIME_BITS64 extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); +#else +# ifdef __REDIRECT +extern int __REDIRECT (select, + (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout), + __select64); +# else +# define select __select64 +# endif +#endif #ifdef __USE_XOPEN2K /* Same as above only that the TIMEOUT value is given with higher @@ -110,11 +123,25 @@ extern int select (int __nfds, fd_set *__restrict __readfds, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, const struct timespec *__restrict __timeout, const __sigset_t *__restrict __sigmask); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pselect, + (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask), + __pselect64); +# else +# define pselect __pselect64 +# endif +# endif #endif diff --git a/lib/libc/glibc/posix/bits/cpu-set.h b/lib/libc/glibc/posix/bits/cpu-set.h index 427a59975f..9a7e55920c 100644 --- a/lib/libc/glibc/posix/bits/cpu-set.h +++ b/lib/libc/glibc/posix/bits/cpu-set.h @@ -1,6 +1,6 @@ /* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/posix/bits/types.h b/lib/libc/glibc/posix/bits/types.h index adba926b45..2dc63de5c2 100644 --- a/lib/libc/glibc/posix/bits/types.h +++ b/lib/libc/glibc/posix/bits/types.h @@ -1,5 +1,5 @@ /* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -160,6 +160,7 @@ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t; __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ diff --git a/lib/libc/glibc/posix/sys/types.h b/lib/libc/glibc/posix/sys/types.h index c9241e40b4..477a45f4af 100644 --- a/lib/libc/glibc/posix/sys/types.h +++ b/lib/libc/glibc/posix/sys/types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/signal/signal.h b/lib/libc/glibc/signal/signal.h index 40825e95ec..5fd93382fc 100644 --- a/lib/libc/glibc/signal/signal.h +++ b/lib/libc/glibc/signal/signal.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,7 +27,7 @@ __BEGIN_DECLS #include -#include +#include #include @@ -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 ). */ -extern const char *const _sys_siglist[_NSIG]; -extern const char *const sys_siglist[_NSIG]; - - /* Get machine-dependent `struct sigcontext' and signal subcodes. */ # include @@ -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 +# include # include /* 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 diff --git a/lib/libc/glibc/stdlib/alloca.h b/lib/libc/glibc/stdlib/alloca.h index bd44688720..cd2a9e0dc1 100644 --- a/lib/libc/glibc/stdlib/alloca.h +++ b/lib/libc/glibc/stdlib/alloca.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ __BEGIN_DECLS -/* Remove any previous definitions. */ +/* Remove any previous definition. */ #undef alloca /* Allocate a block that will be freed when the calling function exits. */ diff --git a/lib/libc/glibc/stdlib/at_quick_exit.c b/lib/libc/glibc/stdlib/at_quick_exit.c index 5176f5e5fd..e768099df5 100644 --- a/lib/libc/glibc/stdlib/at_quick_exit.c +++ b/lib/libc/glibc/stdlib/at_quick_exit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/stdlib/atexit.c b/lib/libc/glibc/stdlib/atexit.c index 181101de38..6a9666d103 100644 --- a/lib/libc/glibc/stdlib/atexit.c +++ b/lib/libc/glibc/stdlib/atexit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/stdlib/bits/stdlib-float.h b/lib/libc/glibc/stdlib/bits/stdlib-float.h index 4a414ae66c..3373c5bebc 100644 --- a/lib/libc/glibc/stdlib/bits/stdlib-float.h +++ b/lib/libc/glibc/stdlib/bits/stdlib-float.h @@ -1,5 +1,5 @@ /* Floating-point inline functions for stdlib.h. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/stdlib/errno.h b/lib/libc/glibc/stdlib/errno.h new file mode 100644 index 0000000000..336a37e455 --- /dev/null +++ b/lib/libc/glibc/stdlib/errno.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.5 Errors + */ + +#ifndef _ERRNO_H +#define _ERRNO_H 1 + +#include + +/* The system-specific definitions of the E* constants, as macros. */ +#include + +/* 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 + +# endif /* __USE_GNU */ + +__END_DECLS + +#endif /* !__ASSEMBLER__ */ +#endif /* errno.h */ diff --git a/lib/libc/glibc/stdlib/exit.h b/lib/libc/glibc/stdlib/exit.h index 6010828148..0e5fef1b20 100644 --- a/lib/libc/glibc/stdlib/exit.h +++ b/lib/libc/glibc/stdlib/exit.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/stdlib/stdlib.h b/lib/libc/glibc/stdlib/stdlib.h index e3470631e1..0481c12355 100644 --- a/lib/libc/glibc/stdlib/stdlib.h +++ b/lib/libc/glibc/stdlib/stdlib.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -397,7 +397,7 @@ extern long int a64l (const char *__s) `initstate' and `setstate' functions are those from BSD Unices. The `rand' and `srand' functions are required by the ANSI standard. We provide both interfaces to the same random number generator. */ -/* Return a random long integer between 0 and RAND_MAX inclusive. */ +/* Return a random long integer between 0 and 2^31-1 inclusive. */ extern long int random (void) __THROW; /* Seed the random number generator with the given number. */ @@ -550,6 +550,9 @@ extern void *calloc (size_t __nmemb, size_t __size) extern void *realloc (void *__ptr, size_t __size) __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); +/* Free a block allocated by `malloc', `realloc' or `calloc'. */ +extern void free (void *__ptr) __THROW; + #ifdef __USE_MISC /* Re-allocate the previously allocated block in PTR, making the new block large enough for NMEMB elements of SIZE bytes each. */ @@ -558,11 +561,13 @@ extern void *realloc (void *__ptr, size_t __size) between objects pointed by the old and new pointers. */ extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) __THROW __attribute_warn_unused_result__ - __attribute_alloc_size__ ((2, 3)); -#endif + __attribute_alloc_size__ ((2, 3)) + __attr_dealloc_free; -/* Free a block allocated by `malloc', `realloc' or `calloc'. */ -extern void free (void *__ptr) __THROW; +/* Add reallocarray as its own deallocator. */ +extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) + __THROW __attr_dealloc (reallocarray, 1); +#endif #ifdef __USE_MISC # include @@ -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 #endif -#ifdef __LDBL_COMPAT + +#include +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # include #endif diff --git a/lib/libc/glibc/string/bits/endian.h b/lib/libc/glibc/string/bits/endian.h index 1892b999d1..6372c6f52b 100644 --- a/lib/libc/glibc/string/bits/endian.h +++ b/lib/libc/glibc/string/bits/endian.h @@ -1,5 +1,5 @@ /* Endian macros for string.h functions - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/string/endian.h b/lib/libc/glibc/string/endian.h index 0256ee4446..b8c5f7f33b 100644 --- a/lib/libc/glibc/string/endian.h +++ b/lib/libc/glibc/string/endian.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/aarch64/crti.S b/lib/libc/glibc/sysdeps/aarch64/crti.S index 1728eac37a..d5dd25b084 100644 --- a/lib/libc/glibc/sysdeps/aarch64/crti.S +++ b/lib/libc/glibc/sysdeps/aarch64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for AArch64. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -75,6 +75,11 @@ call_weak_fn: .hidden _init .type _init, %function _init: +#if HAVE_AARCH64_PAC_RET + PACIASP +#else + BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -89,5 +94,10 @@ _init: .hidden _fini .type _fini, %function _fini: +#if HAVE_AARCH64_PAC_RET + PACIASP +#else + BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp diff --git a/lib/libc/glibc/sysdeps/aarch64/crtn.S b/lib/libc/glibc/sysdeps/aarch64/crtn.S index c3e97cc449..325d04cffa 100644 --- a/lib/libc/glibc/sysdeps/aarch64/crtn.S +++ b/lib/libc/glibc/sysdeps/aarch64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for AArch64. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -37,10 +37,18 @@ /* crtn.S puts function epilogues in the .init and .fini sections corresponding to the prologues in crti.S. */ +#include + .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 diff --git a/lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h b/lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h index a4403d5f0d..8a9acd433b 100644 --- a/lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/aarch64/dl-sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h index b0816653d6..a0a3077b2d 100644 --- a/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/aarch64/start.S b/lib/libc/glibc/sysdeps/aarch64/start.S index d96cf57e2d..417da8802b 100644 --- a/lib/libc/glibc/sysdeps/aarch64/start.S +++ b/lib/libc/glibc/sysdeps/aarch64/start.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -43,10 +43,9 @@ */ .text - .globl _start - .type _start,#function -_start: +ENTRY(_start) /* Create an initial frame with 0 LR and FP */ + cfi_undefined (x30) mov x29, #0 mov x30, #0 @@ -64,26 +63,16 @@ _start: # ifdef SHARED adrp x0, :got:main ldr PTR_REG (0), [x0, #:got_lo12:main] - - adrp x3, :got:__libc_csu_init - ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init] - - adrp x4, :got:__libc_csu_fini - ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini] # else adrp x0, __wrap_main add x0, x0, :lo12:__wrap_main - adrp x3, __libc_csu_init - add x3, x3, :lo12:__libc_csu_init - adrp x4, __libc_csu_fini - add x4, x4, :lo12:__libc_csu_fini # endif #else /* Set up the other arguments in registers */ MOVL (0, main) - MOVL (3, __libc_csu_init) - MOVL (4, __libc_csu_fini) #endif + mov x3, #0 /* Used to be init. */ + mov x4, #0 /* Used to be fini. */ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ @@ -100,8 +89,10 @@ _start: because crt1.o and rcrt1.o share code and the later must avoid the use of GOT relocations before __libc_start_main is called. */ __wrap_main: + BTI_C b main #endif +END(_start) /* Define a symbol for the first piece of initialized data. */ .data diff --git a/lib/libc/glibc/sysdeps/aarch64/sysdep.h b/lib/libc/glibc/sysdeps/aarch64/sysdep.h index 604c489170..b936e29cbd 100644 --- a/lib/libc/glibc/sysdeps/aarch64/sysdep.h +++ b/lib/libc/glibc/sysdeps/aarch64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -25,29 +25,90 @@ # define AARCH64_R(NAME) R_AARCH64_ ## NAME # define PTR_REG(n) x##n # define PTR_LOG_SIZE 3 -# define DELOUSE(n) +# define PTR_ARG(n) +# define SIZE_ARG(n) #else # define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME # define PTR_REG(n) w##n # define PTR_LOG_SIZE 2 -# define DELOUSE(n) mov w##n, w##n +# define PTR_ARG(n) mov w##n, w##n +# define SIZE_ARG(n) mov w##n, w##n #endif #define PTR_SIZE (1<. */ - -#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 */ diff --git a/lib/libc/glibc/sysdeps/alpha/start.S b/lib/libc/glibc/sysdeps/alpha/start.S index a59898c4c0..65dcd4d392 100644 --- a/lib/libc/glibc/sysdeps/alpha/start.S +++ b/lib/libc/glibc/sysdeps/alpha/start.S @@ -1,5 +1,5 @@ /* Startup code for Alpha/ELF. - Copyright (C) 1993-2020 Free Software Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson @@ -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 diff --git a/lib/libc/glibc/sysdeps/arc/sysdep.h b/lib/libc/glibc/sysdeps/arc/sysdep.h new file mode 100644 index 0000000000..fc774abbdf --- /dev/null +++ b/lib/libc/glibc/sysdeps/arc/sysdep.h @@ -0,0 +1,53 @@ +/* Assembler macros for ARC. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. + ; is not newline but comment, # is also for comment. */ +# define ASM_SIZE_DIRECTIVE(name) .size name,.-name + +# define ENTRY(name) \ + .align 4 ASM_LINE_SEP \ + .globl C_SYMBOL_NAME(name) ASM_LINE_SEP \ + .type C_SYMBOL_NAME(name),%function ASM_LINE_SEP \ + C_LABEL(name) ASM_LINE_SEP \ + cfi_startproc ASM_LINE_SEP \ + CALL_MCOUNT + +# undef END +# define END(name) \ + cfi_endproc ASM_LINE_SEP \ + ASM_SIZE_DIRECTIVE(name) + +# ifdef SHARED +# define PLTJMP(_x) _x##@plt +# else +# define PLTJMP(_x) _x +# endif + +# define L(label) .L##label + +# define CALL_MCOUNT /* Do nothing for now. */ + +# define STR(reg, rbase, off) st reg, [rbase, off * 4] +# define LDR(reg, rbase, off) ld reg, [rbase, off * 4] + +#endif /* __ASSEMBLER__ */ diff --git a/lib/libc/glibc/sysdeps/arm/crti.S b/lib/libc/glibc/sysdeps/arm/crti.S index 8169783267..c06e310626 100644 --- a/lib/libc/glibc/sysdeps/arm/crti.S +++ b/lib/libc/glibc/sysdeps/arm/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for ARM. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/arm/crtn.S b/lib/libc/glibc/sysdeps/arm/crtn.S index d60f9f05de..f159ab9139 100644 --- a/lib/libc/glibc/sysdeps/arm/crtn.S +++ b/lib/libc/glibc/sysdeps/arm/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for ARM. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/arm/dl-sysdep.h b/lib/libc/glibc/sysdeps/arm/dl-sysdep.h index 6acfd62f01..076d8228f9 100644 --- a/lib/libc/glibc/sysdeps/arm/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/arm/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. Alpha version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index 332b288067..0000000000 --- a/lib/libc/glibc/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -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 - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#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 */ diff --git a/lib/libc/glibc/sysdeps/arm/start.S b/lib/libc/glibc/sysdeps/arm/start.S index 2ff56179d2..9b56bc0cca 100644 --- a/lib/libc/glibc/sysdeps/arm/start.S +++ b/lib/libc/glibc/sysdeps/arm/start.S @@ -1,5 +1,5 @@ /* Startup code for ARM & ELF - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -94,30 +94,20 @@ _start: adr a4, .L_GOT add sl, sl, a4 - ldr ip, .L_GOT+4 /* __libc_csu_fini */ - ldr ip, [sl, ip] + mov a4, #0 /* Used to be init. */ + push { a4 } /* Used to be fini. */ - push { ip } /* Push __libc_csu_fini */ - - ldr a4, .L_GOT+8 /* __libc_csu_init */ - ldr a4, [sl, a4] - - ldr a1, .L_GOT+12 /* main */ + ldr a1, .L_GOT+4 /* main */ ldr a1, [sl, a1] /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ /* Let the libc call main and exit with its return code. */ bl __libc_start_main(PLT) #else - /* Fetch address of __libc_csu_fini */ - ldr ip, =__libc_csu_fini - /* Push __libc_csu_fini */ - push { ip } - - /* Set up the other arguments in registers */ + mov a4, #0 /* Used to init. */ + push { a4 } /* Used to fini. */ ldr a1, =main - ldr a4, =__libc_csu_init /* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */ /* Let the libc call main and exit with its return code. */ @@ -131,8 +121,6 @@ _start: .align 2 .L_GOT: .word _GLOBAL_OFFSET_TABLE_ - .L_GOT - .word __libc_csu_fini(GOT) - .word __libc_csu_init(GOT) .word main(GOT) #endif diff --git a/lib/libc/glibc/sysdeps/arm/sysdep.h b/lib/libc/glibc/sysdeps/arm/sysdep.h index 5fff50dbfa..cceb4a92af 100644 --- a/lib/libc/glibc/sysdeps/arm/sysdep.h +++ b/lib/libc/glibc/sysdeps/arm/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for ARM. - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/csky/sysdep.h b/lib/libc/glibc/sysdeps/csky/sysdep.h new file mode 100644 index 0000000000..fbd09aa088 --- /dev/null +++ b/lib/libc/glibc/sysdeps/csky/sysdep.h @@ -0,0 +1,84 @@ +/* Assembler macros for C-SKY. + 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 + 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 + . */ + +#include +#include + +#ifdef __ASSEMBLER__ + +# define ASM_SIZE_DIRECTIVE(name) .size name,.-name + +/* Define an entry point visible from C. */ +# define ENTRY(name) \ + .globl name; \ + .type name,@function; \ + .align 4; \ + name##:; \ + cfi_startproc; \ + CALL_MCOUNT + +# undef END +# define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(name) + +/* If compiled for profiling, call `mcount' at the start of each function. */ +# ifdef PROF +# ifdef __PIC__ +# define CALL_MCOUNT \ + subi sp, 4; \ + stw lr, (sp, 0); \ + grs t0, .Lgetpc; \ +.Lgetpc: \ + lrw gb, .Lgetpc@GOTPC; \ + addu gb, t0; \ + lrw t1, _mcount@PLT; \ + ldr.w t0, (gb, t1 << 0); \ + jmp t0; +# else +# define CALL_MCOUNT \ + subi sp, 4; \ + stw lr, (sp, 0); \ + jbsr _mcount; +# endif +# else +# define CALL_MCOUNT /* Do nothing. */ +# endif + +# if defined (__CK860__) +/* Instruction fetch will be faster when the label is 16 bytes aligned. + Filling with nop instruction to avoid extra jump. */ +# define LABLE_ALIGN \ + .balignw 16, 0x6c03 + +# define PRE_BNEZAD(R) + +# define BNEZAD(R, L) \ + bnezad R, L +# else +# define LABLE_ALIGN \ + .balignw 8, 0x6c03 + +# define PRE_BNEZAD(R) \ + subi R, 1 + +# define BNEZAD(R, L) \ + bnez R, L +# endif + +#endif diff --git a/lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h b/lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h index 27fc351f4f..aeda016775 100644 --- a/lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h +++ b/lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/generic/dl-sysdep.h b/lib/libc/glibc/sysdeps/generic/dl-sysdep.h index d9e998dfc0..80e12b52ab 100644 --- a/lib/libc/glibc/sysdeps/generic/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/generic/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. Generic version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/generic/dwarf2.h b/lib/libc/glibc/sysdeps/generic/dwarf2.h index 4c7de0d873..0d08da02b7 100644 --- a/lib/libc/glibc/sysdeps/generic/dwarf2.h +++ b/lib/libc/glibc/sysdeps/generic/dwarf2.h @@ -1,6 +1,6 @@ /* Declarations and definitions of codes relating to the DWARF2 symbolic debugging information format. - Copyright (C) 1992-2020 Free Software Foundation, Inc. + Copyright (C) 1992-2021 Free Software Foundation, Inc. Contributed by Gary Funck (gary@intrepid.com). Derived from the DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com). diff --git a/lib/libc/glibc/sysdeps/generic/entry.h b/lib/libc/glibc/sysdeps/generic/entry.h new file mode 100644 index 0000000000..16d3e3045e --- /dev/null +++ b/lib/libc/glibc/sysdeps/generic/entry.h @@ -0,0 +1,5 @@ +#ifndef __ASSEMBLY__ +extern void _start (void) attribute_hidden; +#endif + +#define ENTRY_POINT _start diff --git a/lib/libc/glibc/sysdeps/generic/libc-lock.h b/lib/libc/glibc/sysdeps/generic/libc-lock.h index 7f184f942d..c538e858ea 100644 --- a/lib/libc/glibc/sysdeps/generic/libc-lock.h +++ b/lib/libc/glibc/sysdeps/generic/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Stub version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -125,16 +125,4 @@ /* We need portable names for some of the functions. */ #define __libc_mutex_unlock -/* Type for key of thread specific data. */ -typedef int __libc_key_t; - -/* Create key for thread specific data. */ -#define __libc_key_create(KEY,DEST) ((void) (KEY), (void) (DEST), -1) - -/* Set thread-specific data associated with KEY to VAL. */ -#define __libc_setspecific(KEY,VAL) ((void) (KEY), (void) (VAL)) - -/* Get thread-specific data associated with KEY. */ -#define __libc_getspecific(KEY) ((void) (KEY), (void *) 0) - #endif /* libc-lock.h */ diff --git a/lib/libc/glibc/sysdeps/generic/libc-symver.h b/lib/libc/glibc/sysdeps/generic/libc-symver.h new file mode 100644 index 0000000000..69d147e2a8 --- /dev/null +++ b/lib/libc/glibc/sysdeps/generic/libc-symver.h @@ -0,0 +1,88 @@ +/* Symbol version management. + Copyright (C) 1995-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This file is included from for !_ISOMAC, and + unconditionally from . */ + +#ifndef _LIBC_SYMVER_H +#define _LIBC_SYMVER_H 1 + +#include + +/* 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 */ diff --git a/lib/libc/glibc/sysdeps/generic/single-thread.h b/lib/libc/glibc/sysdeps/generic/single-thread.h index 41673c0e06..3f1c598d22 100644 --- a/lib/libc/glibc/sysdeps/generic/single-thread.h +++ b/lib/libc/glibc/sysdeps/generic/single-thread.h @@ -1,5 +1,5 @@ /* Single thread optimization, generic version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/generic/struct_stat_time64.h b/lib/libc/glibc/sysdeps/generic/struct_stat_time64.h new file mode 100644 index 0000000000..303718d1bf --- /dev/null +++ b/lib/libc/glibc/sysdeps/generic/struct_stat_time64.h @@ -0,0 +1,6 @@ +#ifndef _BITS_STRUCT_STAT_TIME64_H +#define _BITS_STRUCT_STAT_TIME64_H 1 + +#define __stat64_t64 stat64 + +#endif diff --git a/lib/libc/glibc/sysdeps/generic/sysdep.h b/lib/libc/glibc/sysdeps/generic/sysdep.h index 2788092112..39cac91b94 100644 --- a/lib/libc/glibc/sysdeps/generic/sysdep.h +++ b/lib/libc/glibc/sysdeps/generic/sysdep.h @@ -1,5 +1,5 @@ /* Generic asm macros used on many machines. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/generic/tls.h b/lib/libc/glibc/sysdeps/generic/tls.h index 646427ff74..e86d70e6ce 100644 --- a/lib/libc/glibc/sysdeps/generic/tls.h +++ b/lib/libc/glibc/sysdeps/generic/tls.h @@ -1,5 +1,5 @@ /* Definition for thread-local data handling. Generic version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/generic/xstatver.h b/lib/libc/glibc/sysdeps/generic/xstatver.h new file mode 100644 index 0000000000..281013b2f1 --- /dev/null +++ b/lib/libc/glibc/sysdeps/generic/xstatver.h @@ -0,0 +1,4 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER 0 +#define _MKNOD_VER 0 diff --git a/lib/libc/glibc/sysdeps/hppa/crti.S b/lib/libc/glibc/sysdeps/hppa/crti.S index b3b0c38e52..3864d47d51 100644 --- a/lib/libc/glibc/sysdeps/hppa/crti.S +++ b/lib/libc/glibc/sysdeps/hppa/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for HPPA - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/hppa/crtn.S b/lib/libc/glibc/sysdeps/hppa/crtn.S index e2c0cba7e2..42ca2d1f32 100644 --- a/lib/libc/glibc/sysdeps/hppa/crtn.S +++ b/lib/libc/glibc/sysdeps/hppa/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for HPPA - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/hppa/entry.h b/lib/libc/glibc/sysdeps/hppa/entry.h new file mode 100644 index 0000000000..5ea5b47448 --- /dev/null +++ b/lib/libc/glibc/sysdeps/hppa/entry.h @@ -0,0 +1,13 @@ +#ifndef __ASSEMBLY__ +extern void _start (void); +#endif + +/* Lives in libgcc.so and canonicalizes function pointers for comparison. */ +extern unsigned int __canonicalize_funcptr_for_compare (unsigned int fptr); + +/* The function's entry point is stored in the first word of the + function descriptor (plabel) of _start(). */ +#define ENTRY_POINT __canonicalize_funcptr_for_compare((unsigned int)_start) + +/* We have to provide a special declaration. */ +#define ENTRY_POINT_DECL(class) class void _start (void); diff --git a/lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h index 20151dc763..bbd6176007 100644 --- a/lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/hppa/nptl/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/hppa/start.S b/lib/libc/glibc/sysdeps/hppa/start.S index c725f002dc..4a1877f8e8 100644 --- a/lib/libc/glibc/sysdeps/hppa/start.S +++ b/lib/libc/glibc/sysdeps/hppa/start.S @@ -1,5 +1,5 @@ /* ELF startup code for HPPA. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -36,8 +36,6 @@ .import main, code .import $global$, data .import __libc_start_main, code - .import __libc_csu_fini, code - .import __libc_csu_init, code /* Have the linker create plabel words so we get PLABEL32 relocs and not 21/14. The use of 21/14 relocs is only @@ -52,10 +50,6 @@ .word P%main .Lp__libc_start_main: .word P%__libc_start_main -.Lp__libc_csu_fini: - .word P%__libc_csu_fini -.Lp__libc_csu_init: - .word P%__libc_csu_init .text .align 4 @@ -77,8 +71,8 @@ _start: 1. r26 - Application main 2. r25 - argc 3. r24 - argv - 4. r23 - __libc_csu_init - 5. sp-52 - __libc_csu_fini + 4. r23 - init (unused) + 5. sp-52 - fini (unused) 6. sp-56 - rtld_fini 7. sp-60 - stackend */ @@ -108,14 +102,6 @@ _start: addil LT'.Lpmain, %r19 ldw RT'.Lpmain(%r1), %r26 ldw 0(%r26),%r26 - /* void (*init) (void) (4th argument) */ - addil LT'.Lp__libc_csu_init, %r19 - ldw RT'.Lp__libc_csu_init(%r1), %r23 - ldw 0(%r23), %r23 - /* void (*fini) (void) (5th argument) */ - addil LT'.Lp__libc_csu_fini, %r19 - ldw RT'.Lp__libc_csu_fini(%r1), %r22 - ldw 0(%r22), %r22 #else /* Load $global$ address into %dp */ ldil L%$global$, %dp @@ -124,13 +110,9 @@ _start: /* load main (1st argument) */ ldil LR'.Lpmain, %r26 ldw RR'.Lpmain(%r26), %r26 - /* void (*init) (void) (4th argument) */ - ldil LR'.Lp__libc_csu_init, %r23 - ldw RR'.Lp__libc_csu_init(%r23), %r23 - /* void (*fini) (void) (5th argument) */ - ldil LR'.Lp__libc_csu_fini, %r22 - ldw RR'.Lp__libc_csu_fini(%r22), %r22 #endif + ldi 0,%r23 /* Used to be init. */ + ldi 0,%r22 /* Used to be fini. */ /* Store 5th argument */ stw %r22, -52(%sp) /* void *stack_end (7th argument) */ diff --git a/lib/libc/glibc/sysdeps/hppa/sysdep.h b/lib/libc/glibc/sysdeps/hppa/sysdep.h index 72e72bbc06..e3d3cf40ce 100644 --- a/lib/libc/glibc/sysdeps/hppa/sysdep.h +++ b/lib/libc/glibc/sysdeps/hppa/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for HP/PA. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1999. diff --git a/lib/libc/glibc/sysdeps/htl/bits/pthread.h b/lib/libc/glibc/sysdeps/htl/bits/pthread.h index bedb815108..63dce24889 100644 --- a/lib/libc/glibc/sysdeps/htl/bits/pthread.h +++ b/lib/libc/glibc/sysdeps/htl/bits/pthread.h @@ -1,5 +1,5 @@ /* Pthread data structures. Generic version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h b/lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h index c280f2e182..9088377d22 100644 --- a/lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h +++ b/lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h @@ -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 +#include + +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 */ diff --git a/lib/libc/glibc/sysdeps/htl/libc-lockP.h b/lib/libc/glibc/sysdeps/htl/libc-lockP.h index 4ba3930a13..eb09171c85 100644 --- a/lib/libc/glibc/sysdeps/htl/libc-lockP.h +++ b/lib/libc/glibc/sysdeps/htl/libc-lockP.h @@ -1,5 +1,5 @@ /* Private libc-internal interface for mutex locks. - Copyright (C) 2015-2020 Free Software Foundation, Inc. + Copyright (C) 2015-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,9 +22,6 @@ #include #include -/* 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)); diff --git a/lib/libc/glibc/sysdeps/htl/pthread.h b/lib/libc/glibc/sysdeps/htl/pthread.h index 3216860493..6bcf97d692 100644 --- a/lib/libc/glibc/sysdeps/htl/pthread.h +++ b/lib/libc/glibc/sysdeps/htl/pthread.h @@ -1,5 +1,5 @@ /* Posix threads. Hurd version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -222,6 +222,32 @@ extern void pthread_exit (void *__status) __attribute__ ((__noreturn__)); the exit status of the thread in *STATUS. */ extern int pthread_join (pthread_t __threadp, void **__status); +#ifdef __USE_GNU +/* Check whether thread TH has terminated. If yes return the status of + the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ +extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; + +/* Make calling thread wait for termination of the thread TH, but only + until TIMEOUT. The exit status of the thread is stored in + *THREAD_RETURN, if THREAD_RETURN is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, + const struct timespec *__abstime); + +/* Make calling thread wait for termination of the thread TH, but only + until TIMEOUT measured against the clock specified by CLOCKID. The + exit status of the thread is stored in *THREAD_RETURN, if + THREAD_RETURN is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, + clockid_t __clockid, + const struct timespec *__abstime); +#endif + /* Indicate that the storage for THREAD can be reclaimed when it terminates. */ extern int pthread_detach (pthread_t __threadp); @@ -273,6 +299,7 @@ extern pthread_t pthread_self (void) __THROW; #ifdef __USE_XOPEN2K # define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED # define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST +# define PTHREAD_MUTEX_ROBUST_NP __PTHREAD_MUTEX_ROBUST #endif #include @@ -400,6 +427,13 @@ extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex, __THROWNL __nonnull ((1, 2)); #endif +#ifdef __USE_GNU +extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); +#endif + /* Unlock MUTEX. */ extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROWNL __nonnull ((1)); @@ -516,6 +550,21 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __const struct timespec *__restrict __abstime) __nonnull ((1, 2, 3)); + +# ifdef __USE_GNU +/* Wait for condition variable COND to be signaled or broadcast until + ABSTIME measured by the specified clock. MUTEX is assumed to be + locked before. CLOCK is the clock to use. ABSTIME is an absolute + time specification against CLOCK's epoch. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, + const struct timespec *__restrict __abstime) + __nonnull ((1, 2, 4)); +# endif /* Spin locks. */ @@ -549,42 +598,6 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __nonnull ((1)); -# if defined __USE_EXTERN_INLINES && defined _LIBC - -# include - -__extern_inline int -pthread_spin_destroy (pthread_spinlock_t *__lock) -{ - return __pthread_spin_destroy (__lock); -} - -__extern_inline int -pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) -{ - return __pthread_spin_init (__lock, __pshared); -} - -__extern_inline int -pthread_spin_lock (pthread_spinlock_t *__lock) -{ - return __pthread_spin_lock (__lock); -} - -__extern_inline int -pthread_spin_trylock (pthread_spinlock_t *__lock) -{ - return __pthread_spin_trylock (__lock); -} - -__extern_inline int -pthread_spin_unlock (pthread_spinlock_t *__lock) -{ - return __pthread_spin_unlock (__lock); -} - -# endif /* Use extern inlines. */ - #endif /* XPG6. */ @@ -658,6 +671,13 @@ extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwl __THROWNL __nonnull ((1, 2)); # endif +# ifdef __USE_GNU +extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); +# endif + /* Acquire the rwlock *RWLOCK for writing. */ extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); @@ -674,6 +694,13 @@ extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwl __THROWNL __nonnull ((1, 2)); # endif +# ifdef __USE_GNU +extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); +# endif + /* Release the lock held by the current thread on *RWLOCK. */ extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROWNL __nonnull ((1)); @@ -795,14 +822,14 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW; /* Set the caller thread's thread specific value of KEY to VALUE. */ extern int pthread_setspecific (pthread_key_t __key, const void *__value) - __THROW; + __THROW __attr_access_none (2); /* Dynamic package initialization. */ #include -#define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT +#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT } /* Call INIT_ROUTINE if this function has never been called with *ONCE_CONTROL, otherwise do nothing. */ diff --git a/lib/libc/glibc/sysdeps/i386/crti.S b/lib/libc/glibc/sysdeps/i386/crti.S index f86ff63967..fd60a117e1 100644 --- a/lib/libc/glibc/sysdeps/i386/crti.S +++ b/lib/libc/glibc/sysdeps/i386/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/i386/crtn.S b/lib/libc/glibc/sysdeps/i386/crtn.S index 727390605a..97138b51d2 100644 --- a/lib/libc/glibc/sysdeps/i386/crtn.S +++ b/lib/libc/glibc/sysdeps/i386/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h index 17568fb536..e27c364b6d 100644 --- a/lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. Hurd i386 version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/i386/start.S b/lib/libc/glibc/sysdeps/i386/start.S index c57b25f055..5296b27e65 100644 --- a/lib/libc/glibc/sysdeps/i386/start.S +++ b/lib/libc/glibc/sysdeps/i386/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF i386 ABI. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -87,11 +87,9 @@ ENTRY (_start) call 1f addl $_GLOBAL_OFFSET_TABLE_, %ebx - /* Push address of our own entry points to .fini and .init. */ - leal __libc_csu_fini@GOTOFF(%ebx), %eax - pushl %eax - leal __libc_csu_init@GOTOFF(%ebx), %eax - pushl %eax + /* This used to be the addresses of .fini and .init. */ + pushl $0 + pushl $0 pushl %ecx /* Push second argument: argv. */ pushl %esi /* Push first argument: argc. */ @@ -112,9 +110,9 @@ ENTRY (_start) But let the libc call main. */ call __libc_start_main@PLT #else - /* Push address of our own entry points to .fini and .init. */ - pushl $__libc_csu_fini - pushl $__libc_csu_init + /* This used to be the addresses of .fini and .init. */ + pushl $0 + pushl $0 pushl %ecx /* Push second argument: argv. */ pushl %esi /* Push first argument: argc. */ diff --git a/lib/libc/glibc/sysdeps/i386/symbol-hacks.h b/lib/libc/glibc/sysdeps/i386/symbol-hacks.h index 679002ba35..5665553260 100644 --- a/lib/libc/glibc/sysdeps/i386/symbol-hacks.h +++ b/lib/libc/glibc/sysdeps/i386/symbol-hacks.h @@ -1,5 +1,5 @@ /* Hacks needed for symbol manipulation. i386 version. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/i386/sysdep.h b/lib/libc/glibc/sysdeps/i386/sysdep.h index b338b0dc36..3599d1a653 100644 --- a/lib/libc/glibc/sysdeps/i386/sysdep.h +++ b/lib/libc/glibc/sysdeps/i386/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for i386. - Copyright (C) 1991-2020 Free Software Foundation, Inc. + Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,8 +18,6 @@ #include -#include /* For __GNUC_PREREQ. */ - /* It is desirable that the names of PIC thunks match those used by GCC so that multiple copies are eliminated by the linker. Because GCC 4.6 and earlier use __i686 in the names, it is necessary to @@ -97,9 +95,9 @@ GET_PC_THUNK(reg): \ # define SETUP_PIC_REG_STR(reg) \ ".ifndef " GET_PC_THUNK_STR (reg) "\n" \ - "section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," \ + ".section .text." GET_PC_THUNK_STR (reg) ",\"axG\",@progbits," \ + GET_PC_THUNK_STR (reg) ",comdat\n" \ ".globl " GET_PC_THUNK_STR (reg) "\n" \ - GET_PC_THUNK_STR (reg) ",comdat\n" \ ".hidden " GET_PC_THUNK_STR (reg) "\n" \ ".p2align 4\n" \ ".type " GET_PC_THUNK_STR (reg) ",@function\n" \ diff --git a/lib/libc/glibc/sysdeps/ia64/crti.S b/lib/libc/glibc/sysdeps/ia64/crti.S index 167e6533b6..e26e2523da 100644 --- a/lib/libc/glibc/sysdeps/ia64/crti.S +++ b/lib/libc/glibc/sysdeps/ia64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for IA64. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/ia64/crtn.S b/lib/libc/glibc/sysdeps/ia64/crtn.S index c99cf283a6..e2c44844b9 100644 --- a/lib/libc/glibc/sysdeps/ia64/crtn.S +++ b/lib/libc/glibc/sysdeps/ia64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for ARM. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h b/lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h index 6280720537..45e1226bfb 100644 --- a/lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h +++ b/lib/libc/glibc/sysdeps/ia64/dl-dtprocnum.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. IA-64 version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/ia64/dl-sysdep.h b/lib/libc/glibc/sysdeps/ia64/dl-sysdep.h index 7ad1076ddc..bd29ee0d14 100644 --- a/lib/libc/glibc/sysdeps/ia64/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/ia64/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. IA-64 version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/ia64/entry.h b/lib/libc/glibc/sysdeps/ia64/entry.h new file mode 100644 index 0000000000..e11b49fc53 --- /dev/null +++ b/lib/libc/glibc/sysdeps/ia64/entry.h @@ -0,0 +1,13 @@ +#include +#include + +#ifndef __ASSEMBLY__ +extern void _start (void); +#endif + +/* The function's entry point is stored in the first word of the + function descriptor (plabel) of _start(). */ +#define ENTRY_POINT ELF_PTR_TO_FDESC (_start)->ip + +/* We have to provide a special declaration. */ +#define ENTRY_POINT_DECL(class) class void _start (void); diff --git a/lib/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index 6f932bb9a9..0000000000 --- a/lib/libc/glibc/sysdeps/ia64/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 2003-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#define __SIZEOF_PTHREAD_ATTR_T 56 -#define __SIZEOF_PTHREAD_MUTEX_T 40 -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCK_T 56 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIER_T 32 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 0 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0 -#define __PTHREAD_MUTEX_USE_UNION 0 - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -/* Data structure for reader-write lock variable handling. The - structure of the attribute type is not exposed on purpose. */ -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -}; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -#endif /* bits/pthreadtypes.h */ diff --git a/lib/libc/glibc/sysdeps/ia64/start.S b/lib/libc/glibc/sysdeps/ia64/start.S index 18c8962b6e..b28f8cb429 100644 --- a/lib/libc/glibc/sysdeps/ia64/start.S +++ b/lib/libc/glibc/sysdeps/ia64/start.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jes Sorensen, , April 1999. @@ -82,20 +82,15 @@ _start: { addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp addl out0 = @ltoff(@fptr(main)), gp - addl out3 = @ltoff(@fptr(__libc_csu_init)), gp + mov out3 = r0 /* Used to be init. */ ;; } { .mmi ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */ ld8 out0 = [out0] /* pointer to `main' function descriptor */ - addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp + mov out4 = r0 /* Used to be fini. */ ;; } - { .mmi - ld8 out3 = [out3] /* pointer to `init' function descriptor */ - ld8 out4 = [out4] /* pointer to `fini' function descriptor */ - nop 0 - } .body { .mib st8 [r3] = r10 diff --git a/lib/libc/glibc/sysdeps/ia64/sysdep.h b/lib/libc/glibc/sysdeps/ia64/sysdep.h index 1627807de8..0ce3a862c3 100644 --- a/lib/libc/glibc/sysdeps/ia64/sysdep.h +++ b/lib/libc/glibc/sysdeps/ia64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger-Tang diff --git a/lib/libc/glibc/sysdeps/init_array/crti.S b/lib/libc/glibc/sysdeps/init_array/crti.S deleted file mode 100644 index 145c918f93..0000000000 --- a/lib/libc/glibc/sysdeps/init_array/crti.S +++ /dev/null @@ -1,27 +0,0 @@ -/* Dummy crti file. - - In this configuration, crti.o and crtn.o are both empty because the - .init_array/.fini_array sections are used exclusively. - - Older ports cannot use this because even if the linker used to - build libc itself has .init_array support, we don't want to produce - a crt[in].o that presume a linker that new will be used to link - other things later. - - But new configurations without compatibility concerns for - toolchains without .init_array support can use this to avoid the - superfluous .init and .fini boilerplate code. */ - -#ifdef PREINIT_FUNCTION - -#if PREINIT_FUNCTION_WEAK -# error PREINIT_FUNCTION_WEAK is unsupported -#endif - -/* This arranges for PREINIT_FUNCTION to be called upon loading a library that - contains crti.o. */ - - .section .init_array,"a",%init_array - .dc.a PREINIT_FUNCTION - -#endif diff --git a/lib/libc/glibc/sysdeps/init_array/crtn.S b/lib/libc/glibc/sysdeps/init_array/crtn.S deleted file mode 100644 index 6f70e77160..0000000000 --- a/lib/libc/glibc/sysdeps/init_array/crtn.S +++ /dev/null @@ -1,13 +0,0 @@ -/* Dummy crtn file. - - In this configuration, crti.o and crtn.o are both empty because the - .init_array/.fini_array sections are used exclusively. - - Older ports cannot use this because even if the linker used to - build libc itself has .init_array support, we don't want to produce - a crt[in].o that presume a linker that new will be used to link - other things later. - - But new configurations without compatibility concerns for - toolchains without .init_array support can use this to avoid the - superfluous .init and .fini boilerplate code. */ diff --git a/lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h b/lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h index 04bbcbc71e..3a4d8f9d50 100644 --- a/lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h +++ b/lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for Coldfire. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/m68k/crti.S b/lib/libc/glibc/sysdeps/m68k/crti.S index 54391c4c7c..45b1f276ef 100644 --- a/lib/libc/glibc/sysdeps/m68k/crti.S +++ b/lib/libc/glibc/sysdeps/m68k/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for m68k. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/m68k/crtn.S b/lib/libc/glibc/sysdeps/m68k/crtn.S index 6721d54cae..bc4a4a58e6 100644 --- a/lib/libc/glibc/sysdeps/m68k/crtn.S +++ b/lib/libc/glibc/sysdeps/m68k/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for m68k. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h b/lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h index 0e2e6d0f77..3583820a11 100644 --- a/lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h +++ b/lib/libc/glibc/sysdeps/m68k/m680x0/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for m680x0. - Copyright (C) 2010-2020 Free Software Foundation, Inc. + Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h index b45265a47e..c566403fbc 100644 --- a/lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2020 Free Software Foundation, Inc. +/* Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Maxim Kuvyrkov , 2010. diff --git a/lib/libc/glibc/sysdeps/m68k/start.S b/lib/libc/glibc/sysdeps/m68k/start.S index f69a6502e6..98da4db9f3 100644 --- a/lib/libc/glibc/sysdeps/m68k/start.S +++ b/lib/libc/glibc/sysdeps/m68k/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF m68k ABI. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -76,15 +76,14 @@ _start: pea (%a1) /* Push address of the shared library termination function. */ + /* These used to be addresses of the .fini and .init entry points. */ + clr.l -(%sp) + clr.l -(%sp) + #ifdef PIC /* Load PIC register. */ LOAD_GOT (%a5) - /* Push the address of our own entry points to `.fini' and - `.init'. */ - move.l __libc_csu_fini@GOT(%a5), -(%sp) - move.l __libc_csu_init@GOT(%a5), -(%sp) - pea (%a0) /* Push second argument: argv. */ move.l %d0, -(%sp) /* Push first argument: argc. */ @@ -94,10 +93,6 @@ _start: let the libc call main. */ jbsr __libc_start_main@PLTPC #else - /* Push the address of our own entry points to `.fini' and - `.init'. */ - pea __libc_csu_fini - pea __libc_csu_init pea (%a0) /* Push second argument: argv. */ move.l %d0, -(%sp) /* Push first argument: argc. */ diff --git a/lib/libc/glibc/sysdeps/m68k/symbol-hacks.h b/lib/libc/glibc/sysdeps/m68k/symbol-hacks.h index f561ae560c..8f1635faab 100644 --- a/lib/libc/glibc/sysdeps/m68k/symbol-hacks.h +++ b/lib/libc/glibc/sysdeps/m68k/symbol-hacks.h @@ -1,5 +1,5 @@ /* Hacks needed for symbol manipulation. m68k version. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/m68k/sysdep.h b/lib/libc/glibc/sysdeps/m68k/sysdep.h index 9a1c4b7fcf..8f474a911f 100644 --- a/lib/libc/glibc/sysdeps/m68k/sysdep.h +++ b/lib/libc/glibc/sysdeps/m68k/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for m68k. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h b/lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h deleted file mode 100644 index bcb8fb747f..0000000000 --- a/lib/libc/glibc/sysdeps/mach/hurd/bits/stat.h +++ /dev/null @@ -1,263 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -#include - -/* NOTE: The size of this structure (32 ints) is known in - , since it is used in the `io_stat' RPC. MiG - does not cope at all well with the passed C structure not being of - the expected size. There are some filler words at the end to allow - for future expansion. To increase the size of the structure used - in the RPC and retain binary compatibility, we would need to assign - a new message number. */ - -struct stat - { - int st_fstype; /* File system type. */ - __fsid_t st_fsid; /* File system ID. */ -#define st_dev st_fsid - -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File number. */ -#else - __ino64_t st_ino; /* File number. */ -#endif - unsigned int st_gen; /* To detect reuse of file numbers. */ - __dev_t st_rdev; /* Device if special file. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Number of links. */ - - __uid_t st_uid; /* Owner. */ - __gid_t st_gid; /* Owning group. */ - -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size in bytes. */ -#else - __off64_t st_size; /* Size in bytes. */ -#endif - -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - - __blksize_t st_blksize; /* Optimal size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. - Not related to `st_blksize'. */ -#else - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. - Not related to `st_blksize'. */ -#endif - - __uid_t st_author; /* File author. */ - - unsigned int st_flags; /* User-defined flags. - High 16 bits can be set only by root. */ - -#ifndef __USE_FILE_OFFSET64 -# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 12 : 11) -#else -# define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) -#endif - int st_spare[_SPARE_SIZE]; /* Room for future expansion. */ -#undef _SPARE_SIZE - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - int st_fstype; /* File system type. */ - __fsid_t st_fsid; /* File system ID. */ -# define st_dev st_fsid - - __ino64_t st_ino; /* File number. */ - unsigned int st_gen; /* To detect reuse of file numbers. */ - __dev_t st_rdev; /* Device if special file. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Number of links. */ - - __uid_t st_uid; /* Owner. */ - __gid_t st_gid; /* Owning group. */ - - __off64_t st_size; /* Size in bytes. */ - -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - - __blksize_t st_blksize; /* Optimal size for I/O. */ - - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. - Not related to `st_blksize'. */ - - __uid_t st_author; /* File author. */ - - unsigned int st_flags; /* User-defined flags. - High 16 bits can be set only by root. */ - -#define _SPARE_SIZE ((sizeof (__fsid_t) == sizeof (int)) ? 9 : 8) - int st_spare[_SPARE_SIZE]; /* Room for future expansion. */ -#undef _SPARE_SIZE - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ -#define __S_IFIFO 0010000 /* FIFO. */ - -/* POSIX.1b objects. */ -#define __S_TYPEISMQ(buf) (0) -#define __S_TYPEISSEM(buf) (0) -#define __S_TYPEISSHM(buf) (0) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 00400 /* Read by owner. */ -#define __S_IWRITE 00200 /* Write by owner. */ -#define __S_IEXEC 00100 /* Execute by owner. */ - - -#ifdef __USE_GNU -/* If set, there is no benefit in caching the contents of this file. */ -#define S_INOCACHE 000000200000 - -/* If the S_IUSEUNK bit is set, then the S_IUNKNOWN bits (see below) - control access for unknown users. If S_IUSEUNK is clear, then unknown - users are treated as "others" for purposes of access control. */ -#define S_IUSEUNK 000000400000 -/* Mask of protection bits for unknown users (no effective IDs at all). */ -#define S_IUNKNOWN 000007000000 -/* Shift S_IREAD, S_IWRITE, S_IEXEC left this many bits to produce the - protection bits for unknown users. */ -#define S_IUNKSHIFT 12 - -/* Read only bits: */ - -/* There is a passive translator set for this file */ -#define S_IPTRANS 000010000000 -/* There is an active translator running on this file */ -#define S_IATRANS 000020000000 -/* This is the root of a filesystem (or single node translator) */ -#define S_IROOT 000040000000 -/* All the bits relevant to translators */ -#define S_ITRANS 000070000000 - -/* Definitely no mmaps to this. */ -#define S_IMMAP0 000100000000 - -/* ALL the unused bits. */ -#define S_ISPARE (~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0 \ - |S_IUSEUNK|S_IUNKNOWN|07777)) -#endif - -#ifdef __USE_MISC -/* Default file creation mask (umask). */ -# define CMASK 0022 - -/* Definitions of flags stored in file flags word. */ - -/* Super-user and owner changeable flags. */ -# define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ -# define UF_NODUMP 0x00000001 /* do not dump file */ -# define UF_IMMUTABLE 0x00000002 /* file may not be changed */ -# define UF_APPEND 0x00000004 /* writes to file may only append */ -# define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ -# define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ - -/* Super-user changeable flags. */ -# define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ -# define SF_ARCHIVED 0x00010000 /* file is archived */ -# define SF_IMMUTABLE 0x00020000 /* file may not be changed */ -# define SF_APPEND 0x00040000 /* writes to file may only append */ -# define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */ -# define SF_SNAPSHOT 0x00200000 /* snapshot inode */ - -__BEGIN_DECLS - -/* Set file flags for FILE to FLAGS. */ -extern int chflags (__const char *__file, unsigned long int __flags) __THROW; - -/* Set file flags of the file referred to by FD to FLAGS. */ -extern int fchflags (int __fd, unsigned long int __flags) __THROW; - -__END_DECLS -#endif - -#ifdef __USE_ATFILE -# define UTIME_NOW -1 /* corresponds to the current time */ -# define UTIME_OMIT -2 /* target time is omitted */ -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h b/lib/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h deleted file mode 100644 index b429379d7d..0000000000 --- a/lib/libc/glibc/sysdeps/mach/hurd/bits/typesizes.h +++ /dev/null @@ -1,72 +0,0 @@ -/* bits/typesizes.h -- underlying types for *_t. Hurd version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_TYPES_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_TYPESIZES_H -#define _BITS_TYPESIZES_H 1 - -/* See for the meaning of these macros. This file exists so - that need not vary across different GNU platforms. */ - -#define __DEV_T_TYPE __U32_TYPE -#define __UID_T_TYPE __U32_TYPE -#define __GID_T_TYPE __U32_TYPE -#define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE -#define __MODE_T_TYPE __U32_TYPE -#define __NLINK_T_TYPE __UWORD_TYPE -#define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE -#define __PID_T_TYPE __S32_TYPE -#define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE -#define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE -#define __FSWORD_T_TYPE __SWORD_TYPE -#define __ID_T_TYPE __U32_TYPE -#define __CLOCK_T_TYPE __SLONGWORD_TYPE -#define __TIME_T_TYPE __SLONGWORD_TYPE -#define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE -#define __KEY_T_TYPE __S32_TYPE -#define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE __S32_TYPE -#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE -#define __FSID_T_TYPE __UQUAD_TYPE -#define __SSIZE_T_TYPE __SWORD_TYPE -#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE -#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE -#define __CPU_MASK_TYPE __ULONGWORD_TYPE - -/* Number of descriptors that can fit in an `fd_set'. */ -#define __FD_SETSIZE 256 - -/* Tell the libc code that fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and - fsfilcnt64_t are not the same type for all ABI purposes. */ -# define __STATFS_MATCHES_STATFS64 0 - - -#endif /* bits/typesizes.h */ diff --git a/lib/libc/glibc/sysdeps/mach/i386/sysdep.h b/lib/libc/glibc/sysdeps/mach/i386/sysdep.h index e849f120f9..5523a8b5f2 100644 --- a/lib/libc/glibc/sysdeps/mach/i386/sysdep.h +++ b/lib/libc/glibc/sysdeps/mach/i386/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -39,16 +39,6 @@ envp = p; \ } while (0) -#define CALL_WITH_SP(fn, info, sp) \ - do { \ - void **ptr = (void **) sp; \ - *--(__typeof (info) *) ptr = info; \ - ptr[-1] = ptr; \ - --ptr; \ - asm volatile ("movl %0, %%esp; call %1" : : \ - "g" (ptr), "m" (*(long int *) (fn)) : "%esp"); \ - } while (0) - #define RETURN_TO(sp, pc, retval) \ asm volatile ("movl %0, %%esp; jmp %*%1 # %2" \ : : "g" (sp), "r" (pc), "a" (retval)) diff --git a/lib/libc/glibc/sysdeps/mach/libc-lock.h b/lib/libc/glibc/sysdeps/mach/libc-lock.h index e04dcc445d..220fcee921 100644 --- a/lib/libc/glibc/sysdeps/mach/libc-lock.h +++ b/lib/libc/glibc/sysdeps/mach/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. Mach cthreads version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,9 +24,6 @@ #include #include -/* The locking here is very inexpensive, even for inlining. */ -#define _IO_lock_inexpensive 1 - typedef unsigned int __libc_lock_t; typedef struct { @@ -57,13 +54,13 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; CLASS __libc_lock_t NAME; /* Define an initialized lock variable NAME with storage class CLASS. */ -#define _LIBC_LOCK_INITIALIZER LLL_INITIALIZER +#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER #define __libc_lock_define_initialized(CLASS,NAME) \ - CLASS __libc_lock_t NAME = LLL_INITIALIZER; + CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER; /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ -#define __libc_lock_init(NAME) (NAME) = LLL_INITIALIZER +#define __libc_lock_init(NAME) (NAME) = LLL_LOCK_INITIALIZER /* Finalize the named lock variable, which must be locked. It cannot be used again until __libc_lock_init is called again on it. This must be @@ -74,19 +71,19 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; /* Lock the named lock variable. */ #define __libc_lock_lock(NAME) \ - ({ lll_lock (&(NAME), 0); 0; }) + ({ lll_lock ((NAME), 0); 0; }) /* Lock the named lock variable. */ -#define __libc_lock_trylock(NAME) lll_trylock (&(NAME)) +#define __libc_lock_trylock(NAME) lll_trylock (NAME) /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) \ - ({ lll_unlock (&(NAME), 0); 0; }) + ({ lll_unlock ((NAME), 0); 0; }) #define __libc_lock_define_recursive(CLASS,NAME) \ CLASS __libc_lock_recursive_t NAME; -#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_INITIALIZER, 0, 0 } +#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_LOCK_INITIALIZER, 0, 0 } #define __libc_lock_define_initialized_recursive(CLASS,NAME) \ CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER; @@ -111,7 +108,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; int __r = 0; \ if (__self == __lock->owner) \ ++__lock->cnt; \ - else if ((__r = lll_trylock (&__lock->lock)) == 0) \ + else if ((__r = lll_trylock (__lock->lock)) == 0) \ __lock->owner = __self, __lock->cnt = 1; \ __r; \ }) @@ -122,7 +119,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; void *__self = __libc_lock_owner_self (); \ if (__self != __lock->owner) \ { \ - lll_lock (&__lock->lock, 0); \ + lll_lock (__lock->lock, 0); \ __lock->owner = __self; \ } \ ++__lock->cnt; \ @@ -135,7 +132,7 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; if (--__lock->cnt == 0) \ { \ __lock->owner = 0; \ - lll_unlock (&__lock->lock, 0); \ + lll_unlock (__lock->lock, 0); \ } \ }) diff --git a/lib/libc/glibc/sysdeps/mach/sysdep.h b/lib/libc/glibc/sysdeps/mach/sysdep.h index ba65015253..ae306b3cad 100644 --- a/lib/libc/glibc/sysdeps/mach/sysdep.h +++ b/lib/libc/glibc/sysdeps/mach/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2020 Free Software Foundation, Inc. +/* Copyright (C) 1994-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,14 +62,6 @@ #error SNARF_ARGS not defined by sysdeps/mach/MACHINE/sysdep.h #endif -/* Call the C function FN with no arguments, - on a stack starting at SP (as returned by *_cthread_init_routine). - You don't need to deal with FN returning; it shouldn't. */ -#ifndef CALL_WITH_SP -#define CALL_WITH_SP(fn, sp) -#error CALL_WITH_SP not defined by sysdeps/mach/MACHINE/sysdep.h -#endif - /* LOSE can be defined as the `halt' instruction or something similar which will cause the process to die in a characteristic way suggesting a bug. */ diff --git a/lib/libc/glibc/sysdeps/microblaze/crti.S b/lib/libc/glibc/sysdeps/microblaze/crti.S index 1b44887639..3eb70cf9f1 100644 --- a/lib/libc/glibc/sysdeps/microblaze/crti.S +++ b/lib/libc/glibc/sysdeps/microblaze/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MicroBlaze. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/microblaze/crtn.S b/lib/libc/glibc/sysdeps/microblaze/crtn.S index 1e00328f92..c82fbd947c 100644 --- a/lib/libc/glibc/sysdeps/microblaze/crtn.S +++ b/lib/libc/glibc/sysdeps/microblaze/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MicroBlaze. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index 838e71f4e1..0000000000 --- a/lib/libc/glibc/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2002-2019 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -# define _BITS_PTHREADTYPES_ARCH_H 1 - -# include - -# define __SIZEOF_PTHREAD_ATTR_T 36 -# define __SIZEOF_PTHREAD_MUTEX_T 24 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -# define __SIZEOF_PTHREAD_COND_T 48 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 32 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 0 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 -#define __PTHREAD_MUTEX_USE_UNION 1 - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -# if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; -# else - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -# endif - int __cur_writer; -}; - -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -#endif /* bits/pthreadtypes.h. */ diff --git a/lib/libc/glibc/sysdeps/microblaze/start.S b/lib/libc/glibc/sysdeps/microblaze/start.S index 55d15d6308..6589bd4dc7 100644 --- a/lib/libc/glibc/sysdeps/microblaze/start.S +++ b/lib/libc/glibc/sysdeps/microblaze/start.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -63,14 +63,14 @@ _start: mfs r20,rpc addik r20,r20,_GLOBAL_OFFSET_TABLE_+8 lwi r5,r20,main@GOT - lwi r8,r20,__libc_csu_init@GOT - lwi r9,r20,__libc_csu_fini@GOT + addk r8,r0,r0 /* Used to be init. */ + addk r9,r0,r0 /* Used to be fini. */ brid __libc_start_main@PLT addk r10,r0,r0 #else addik r5,r0,main - addik r8,r0,__libc_csu_init - addik r9,r0,__libc_csu_fini + addk r8,r0,r0 /* Used to be init. */ + addk r9,r0,r0 /* Used to be fini. */ brid __libc_start_main addk r10,r0,r0 #endif diff --git a/lib/libc/glibc/sysdeps/microblaze/sysdep.h b/lib/libc/glibc/sysdeps/microblaze/sysdep.h index f597a8135b..a219258926 100644 --- a/lib/libc/glibc/sysdeps/microblaze/sysdep.h +++ b/lib/libc/glibc/sysdeps/microblaze/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h b/lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h index acef635092..323c577f52 100644 --- a/lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h +++ b/lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. MIPS version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips32/crti.S b/lib/libc/glibc/sysdeps/mips/mips32/crti.S index 417b07a896..056c4f75c2 100644 --- a/lib/libc/glibc/sysdeps/mips/mips32/crti.S +++ b/lib/libc/glibc/sysdeps/mips/mips32/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (o32). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips32/crtn.S b/lib/libc/glibc/sysdeps/mips/mips32/crtn.S index 78ab58a68a..f677e1cc25 100644 --- a/lib/libc/glibc/sysdeps/mips/mips32/crtn.S +++ b/lib/libc/glibc/sysdeps/mips/mips32/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (o32). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S b/lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S index 22dad81963..8dc866b20e 100644 --- a/lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S +++ b/lib/libc/glibc/sysdeps/mips/mips64/n32/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (n32). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S b/lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S index 1ba6b73c09..820111c4cb 100644 --- a/lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S +++ b/lib/libc/glibc/sysdeps/mips/mips64/n32/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (n32). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S b/lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S index 85edb784b4..52666963d5 100644 --- a/lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S +++ b/lib/libc/glibc/sysdeps/mips/mips64/n64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (n64). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S b/lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S index c337602c69..875c8e06c5 100644 --- a/lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S +++ b/lib/libc/glibc/sysdeps/mips/mips64/n64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for MIPS (n64). - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h index ce50110dd2..fbe0a46e3b 100644 --- a/lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/mips/nptl/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. MIPS version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/mips/start.S b/lib/libc/glibc/sysdeps/mips/start.S index fabc8080df..4ec42a2a7f 100644 --- a/lib/libc/glibc/sysdeps/mips/start.S +++ b/lib/libc/glibc/sysdeps/mips/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF Mips ABI. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -96,13 +96,13 @@ ENTRY_POINT: # if _MIPS_SIM == _ABIO32 PTR_SUBIU $29, 32 # endif - PTR_LA $7, __libc_csu_init /* init */ - PTR_LA $8, __libc_csu_fini + move $7, $0 /* Used to be init. */ # if _MIPS_SIM == _ABIO32 - PTR_S $8, 16($29) /* fini */ + PTR_S $0, 16($29) /* Used to be fini. */ PTR_S $2, 20($29) /* rtld_fini */ PTR_S $29, 24($29) /* stack_end */ # else + move $8, $0 /* Used to be fini. */ move $9, $2 /* rtld_fini */ move $10, $29 /* stack_end */ # endif @@ -143,19 +143,17 @@ ENTRY_POINT: /* Lay out last arguments, and call __libc_start_main(). */ # ifdef __PIC__ sw $7, 24($sp) /* stack_end */ - lw $4, %got(__libc_csu_fini)($3) - lw $7, %got(__libc_csu_init)($3) /* init */ - sw $4, 16($sp) /* fini */ + move $4, $0 /* Used to be ini. */ + sw $0, 16($sp) /* Used to be fini. */ lw $4, %got(main)($3) /* main */ lw $3, %call16(__libc_start_main)($3) sw $2, 20($sp) /* rtld_fini */ move $25, $3 jalr $3 # else - lw $4, 1f sw $7, 24($sp) /* stack_end */ - lw $7, 2f /* init */ - sw $4, 16($sp) /* fini */ + move $7, $0 /* Used to be init. */ + sw $0, 16($sp) /* Used to be fini. */ lw $4, 3f /* main */ sw $2, 20($sp) /* rtld_fini */ /* Load and call __libc_start_main(). */ @@ -165,8 +163,6 @@ ENTRY_POINT: hlt: b hlt /* Crash if somehow it does return. */ # ifndef __PIC__ .align 2 -1: .word __libc_csu_fini -2: .word __libc_csu_init 3: .word main 4: .word __libc_start_main # endif diff --git a/lib/libc/glibc/sysdeps/nios2/sysdep.h b/lib/libc/glibc/sysdeps/nios2/sysdep.h new file mode 100644 index 0000000000..83b79f8a32 --- /dev/null +++ b/lib/libc/glibc/sysdeps/nios2/sysdep.h @@ -0,0 +1,65 @@ +/* Assembler macros for Nios II. + 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 + 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 + . */ + +#include + +#ifdef __ASSEMBLER__ + +/* Syntactic details of assembler. */ + +#define ASM_SIZE_DIRECTIVE(name) .size name,.-name + +#define ENTRY(name) \ + .globl C_SYMBOL_NAME(name); \ + .type C_SYMBOL_NAME(name),%function; \ + C_LABEL(name) \ + cfi_startproc; \ + CALL_MCOUNT; + +#undef END +#define END(name) \ + cfi_endproc; \ + ASM_SIZE_DIRECTIVE(name) + +#ifdef PROF + +# ifdef __PIC__ +# define CALL_MCOUNT \ + mov r8, ra; \ + nextpc r2; \ +1: \ + movhi r3, %hiadj(_gp_got - 1b); \ + addi r3, r3, %lo(_gp_got - 1b); \ + add r2, r2, r3; \ + ldw r2, %call(_mcount)(r2); \ + callr r2; \ + mov ra, r8; \ + ret; +# else +# define CALL_MCOUNT \ + mov r8, ra; \ + call _mount; \ + mov ra, r8; \ + ret; +# endif + +#else +# define CALL_MCOUNT /* Do nothing. */ +#endif + +#endif /* __ASSEMBLER__ */ diff --git a/lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h b/lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h index ac65027463..4d4a255368 100644 --- a/lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h +++ b/lib/libc/glibc/sysdeps/nptl/bits/pthreadtypes.h @@ -1,5 +1,5 @@ /* Declaration of common pthread types for all architectures. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/nptl/bits/thread-shared-types.h b/lib/libc/glibc/sysdeps/nptl/bits/thread-shared-types.h index fd08b6916a..44bf1e358d 100644 --- a/lib/libc/glibc/sysdeps/nptl/bits/thread-shared-types.h +++ b/lib/libc/glibc/sysdeps/nptl/bits/thread-shared-types.h @@ -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 @@ -116,4 +116,14 @@ struct __pthread_cond_s unsigned int __g_signals[2]; }; +typedef unsigned int __tss_t; +typedef unsigned long int __thrd_t; + +typedef struct +{ + int __data __ONCE_ALIGNMENT; +} __once_flag; + +#define __ONCE_FLAG_INIT { 0 } + #endif /* _THREAD_SHARED_TYPES_H */ diff --git a/lib/libc/glibc/sysdeps/nptl/libc-lock.h b/lib/libc/glibc/sysdeps/nptl/libc-lock.h index bfeee32eaf..e8a5e68a12 100644 --- a/lib/libc/glibc/sysdeps/nptl/libc-lock.h +++ b/lib/libc/glibc/sysdeps/nptl/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. NPTL version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -143,39 +143,40 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) #endif -/* Note that for I/O cleanup handling we are using the old-style - cancel handling. It does not have to be integrated with C++ since - no C++ code is called in the middle. The old-style handling is - faster and the support is not going away. */ -extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); -extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, - int execute); +/* Put the unwind buffer BUFFER on the per-thread callback stack. The + caller must fill BUFFER->__routine and BUFFER->__arg before calling + this function. */ +void __libc_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer); +libc_hidden_proto (__libc_cleanup_push_defer) +/* Remove BUFFER from the unwind callback stack. The caller must invoke + the callback if desired. */ +void __libc_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer); +libc_hidden_proto (__libc_cleanup_pop_restore) /* Start critical region with cleanup. */ -#define __libc_cleanup_region_start(DOIT, FCT, ARG) \ - { struct _pthread_cleanup_buffer _buffer; \ - int _avail; \ - if (DOIT) { \ - _avail = PTFAVAIL (_pthread_cleanup_push_defer); \ - if (_avail) { \ - __libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT, \ - ARG)); \ - } else { \ - _buffer.__routine = (FCT); \ - _buffer.__arg = (ARG); \ - } \ - } else { \ - _avail = 0; \ - } +#define __libc_cleanup_region_start(DOIT, FCT, ARG) \ + { bool _cleanup_start_doit; \ + struct _pthread_cleanup_buffer _buffer; \ + /* Non-addressable copy of FCT, so that we avoid indirect calls on \ + the non-unwinding path. */ \ + void (*_cleanup_routine) (void *) = (FCT); \ + _buffer.__arg = (ARG); \ + if (DOIT) \ + { \ + _cleanup_start_doit = true; \ + _buffer.__routine = _cleanup_routine; \ + __libc_cleanup_push_defer (&_buffer); \ + } \ + else \ + _cleanup_start_doit = false; /* End critical region with cleanup. */ -#define __libc_cleanup_region_end(DOIT) \ - if (_avail) { \ - __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ - } else if (DOIT) \ - _buffer.__routine (_buffer.__arg); \ - } +#define __libc_cleanup_region_end(DOIT) \ + if (_cleanup_start_doit) \ + __libc_cleanup_pop_restore (&_buffer); \ + if (DOIT) \ + _cleanup_routine (_buffer.__arg); \ + } /* matches __libc_cleanup_region_start */ /* Hide the definitions which are only supposed to be used inside libc in diff --git a/lib/libc/glibc/sysdeps/nptl/libc-lockP.h b/lib/libc/glibc/sysdeps/nptl/libc-lockP.h index 86d903dddc..b66c938e44 100644 --- a/lib/libc/glibc/sysdeps/nptl/libc-lockP.h +++ b/lib/libc/glibc/sysdeps/nptl/libc-lockP.h @@ -1,5 +1,5 @@ /* Private libc-internal interface for mutex locks. NPTL version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,26 +32,12 @@ ld.so might be used on old kernels with a different libc.so. */ #include #include -#include - -#if IS_IN (libpthread) -/* This gets us the declarations of the __pthread_* internal names, - and hidden_proto for them. */ -# include -#endif /* Mutex type. */ -#if !IS_IN (libc) && !IS_IN (libpthread) -typedef pthread_mutex_t __libc_lock_t; -#else typedef int __libc_lock_t; -#endif typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t; typedef pthread_rwlock_t __libc_rwlock_t; -/* Type for key to thread-specific data. */ -typedef pthread_key_t __libc_key_t; - /* Define a lock variable NAME with storage class CLASS. The lock must be initialized with __libc_lock_init before it can be used (or define it with __libc_lock_define_initialized, below). Use `extern' for CLASS to @@ -103,126 +89,48 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); (FUNC != NULL ? FUNC ARGS : ELSE) #endif -/* Call thread functions through the function pointer table. */ -#if defined SHARED && IS_IN (libc) -# define PTFAVAIL(NAME) __libc_pthread_functions_init -# define __libc_ptf_call(FUNC, ARGS, ELSE) \ - (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE) -# define __libc_ptf_call_always(FUNC, ARGS) \ - PTHFCT_CALL (ptr_##FUNC, ARGS) -#elif IS_IN (libpthread) -# define PTFAVAIL(NAME) 1 -# define __libc_ptf_call(FUNC, ARGS, ELSE) \ - FUNC ARGS -# define __libc_ptf_call_always(FUNC, ARGS) \ - FUNC ARGS -#else -# define PTFAVAIL(NAME) (NAME != NULL) -# define __libc_ptf_call(FUNC, ARGS, ELSE) \ - __libc_maybe_call (FUNC, ARGS, ELSE) -# define __libc_ptf_call_always(FUNC, ARGS) \ - FUNC ARGS -#endif - +/* All previously forwarded functions are now called directly (either + via local call in libc, or through a __export), but __libc_ptf_call + is still used in generic code shared with Hurd. */ +#define PTFAVAIL(NAME) 1 +#define __libc_ptf_call(FUNC, ARGS, ELSE) FUNC ARGS +#define __libc_ptf_call_always(FUNC, ARGS) FUNC ARGS /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ -#if IS_IN (libc) || IS_IN (libpthread) -# define __libc_lock_init(NAME) \ - ((void) ((NAME) = LLL_LOCK_INITIALIZER)) -#else -# define __libc_lock_init(NAME) \ - __libc_maybe_call (__pthread_mutex_init, (&(NAME), NULL), 0) -#endif -#if defined SHARED && IS_IN (libc) -/* ((NAME) = (__libc_rwlock_t) PTHREAD_RWLOCK_INITIALIZER) is inefficient. */ -# define __libc_rwlock_init(NAME) \ - ((void) __builtin_memset (&(NAME), '\0', sizeof (NAME))) -#else -# define __libc_rwlock_init(NAME) \ - __libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0) -#endif +#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER)) +#define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL) /* Finalize the named lock variable, which must be locked. It cannot be used again until __libc_lock_init is called again on it. This must be called on a lock variable before the containing storage is reused. */ -#if IS_IN (libc) || IS_IN (libpthread) -# define __libc_lock_fini(NAME) ((void) 0) -#else -# define __libc_lock_fini(NAME) \ - __libc_maybe_call (__pthread_mutex_destroy, (&(NAME)), 0) -#endif -#if defined SHARED && IS_IN (libc) -# define __libc_rwlock_fini(NAME) ((void) 0) -#else -# define __libc_rwlock_fini(NAME) \ - __libc_maybe_call (__pthread_rwlock_destroy, (&(NAME)), 0) -#endif +#define __libc_lock_fini(NAME) ((void) 0) +#define __libc_rwlock_fini(NAME) ((void) 0) /* Lock the named lock variable. */ -#if IS_IN (libc) || IS_IN (libpthread) -# ifndef __libc_lock_lock -# define __libc_lock_lock(NAME) \ - ({ lll_lock (NAME, LLL_PRIVATE); 0; }) -# endif -#else -# undef __libc_lock_lock -# define __libc_lock_lock(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME)), 0) -#endif -#define __libc_rwlock_rdlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_rdlock, (&(NAME)), 0) -#define __libc_rwlock_wrlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_wrlock, (&(NAME)), 0) +#define __libc_lock_lock(NAME) ({ lll_lock (NAME, LLL_PRIVATE); 0; }) +#define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME)) +#define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME)) /* Try to lock the named lock variable. */ -#if IS_IN (libc) || IS_IN (libpthread) -# ifndef __libc_lock_trylock -# define __libc_lock_trylock(NAME) \ - lll_trylock (NAME) -# endif -#else -# undef __libc_lock_trylock -# define __libc_lock_trylock(NAME) \ - __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) -#endif -#define __libc_rwlock_tryrdlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_tryrdlock, (&(NAME)), 0) -#define __libc_rwlock_trywrlock(NAME) \ - __libc_maybe_call (__pthread_rwlock_trywrlock, (&(NAME)), 0) - -#define __rtld_lock_trylock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0) +#define __libc_lock_trylock(NAME) lll_trylock (NAME) /* Unlock the named lock variable. */ -#if IS_IN (libc) || IS_IN (libpthread) -# define __libc_lock_unlock(NAME) \ - lll_unlock (NAME, LLL_PRIVATE) -#else -# define __libc_lock_unlock(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0) -#endif -#define __libc_rwlock_unlock(NAME) \ - __libc_ptf_call (__pthread_rwlock_unlock, (&(NAME)), 0) - -#ifdef SHARED -# define __rtld_lock_default_lock_recursive(lock) \ - ++((pthread_mutex_t *)(lock))->__data.__count; - -# define __rtld_lock_default_unlock_recursive(lock) \ - --((pthread_mutex_t *)(lock))->__data.__count; +#define __libc_lock_unlock(NAME) lll_unlock (NAME, LLL_PRIVATE) +#define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME)) +#if IS_IN (rtld) # define __rtld_lock_lock_recursive(NAME) \ - GL(dl_rtld_lock_recursive) (&(NAME).mutex) + ___rtld_mutex_lock (&(NAME).mutex) # define __rtld_lock_unlock_recursive(NAME) \ - GL(dl_rtld_unlock_recursive) (&(NAME).mutex) -#else + ___rtld_mutex_unlock (&(NAME).mutex) +#else /* Not in the dynamic loader. */ # define __rtld_lock_lock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0) + __pthread_mutex_lock (&(NAME).mutex) # define __rtld_lock_unlock_recursive(NAME) \ - __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0) + __pthread_mutex_unlock (&(NAME).mutex) #endif /* Define once control variable. */ @@ -236,74 +144,42 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT #endif -/* Call handler iff the first call. */ -#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ - do { \ - if (PTFAVAIL (__pthread_once)) \ - __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ - INIT_FUNCTION)); \ - else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ - INIT_FUNCTION (); \ - (ONCE_CONTROL) |= 2; \ - } \ - } while (0) +/* Call handler iff the first call. Use a local call in libc, but the + global pthread_once symbol elsewhere. */ +#if IS_IN (libc) +# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) +#else +# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) +#endif /* Get once control variable. */ #define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT) -/* Note that for I/O cleanup handling we are using the old-style - cancel handling. It does not have to be integrated with C++ snce - no C++ code is called in the middle. The old-style handling is - faster and the support is not going away. */ -extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); -extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, - int execute); -extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg); -extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, - int execute); - -/* Sometimes we have to exit the block in the middle. */ -#define __libc_cleanup_end(DOIT) \ - if (_avail) { \ - __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\ - } else if (DOIT) \ - _buffer.__routine (_buffer.__arg) - +/* __libc_cleanup_push and __libc_cleanup_pop depend on exception + handling and stack unwinding. */ +#ifdef __EXCEPTIONS /* Normal cleanup handling, based on C cleanup attribute. */ -__extern_inline void +static __always_inline void __libc_cleanup_routine (struct __pthread_cleanup_frame *f) { if (f->__do_it) f->__cancel_routine (f->__cancel_arg); } -#define __libc_cleanup_push(fct, arg) \ +# define __libc_cleanup_push(fct, arg) \ do { \ struct __pthread_cleanup_frame __clframe \ __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \ = { .__cancel_routine = (fct), .__cancel_arg = (arg), \ .__do_it = 1 }; -#define __libc_cleanup_pop(execute) \ +# define __libc_cleanup_pop(execute) \ __clframe.__do_it = (execute); \ } while (0) - - -/* Create thread-specific key. */ -#define __libc_key_create(KEY, DESTRUCTOR) \ - __libc_ptf_call (__pthread_key_create, (KEY, DESTRUCTOR), 1) - -/* Get thread-specific data. */ -#define __libc_getspecific(KEY) \ - __libc_ptf_call (__pthread_getspecific, (KEY), NULL) - -/* Set thread-specific data. */ -#define __libc_setspecific(KEY, VALUE) \ - __libc_ptf_call (__pthread_setspecific, (KEY, VALUE), 0) - +#endif /* __EXCEPTIONS */ /* Register handlers to execute before and after `fork'. Note that the last parameter is NULL. The handlers registered by the libc are @@ -318,107 +194,56 @@ extern int __register_atfork (void (*__prepare) (void), extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__mutex_attr); - +libc_hidden_proto (__pthread_mutex_init) extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); - +libc_hidden_proto (__pthread_mutex_destroy) extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); - +libc_hidden_proto (__pthread_mutex_lock) extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); - -extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr); +libc_hidden_proto (__pthread_mutex_unlock) extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); -extern int __pthread_mutexattr_settype (pthread_mutexattr_t *__attr, - int __kind); - extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock, const pthread_rwlockattr_t *__attr); +libc_hidden_proto (__pthread_rwlock_init) extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); +libc_hidden_proto (__pthread_rwlock_rdlock) extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); +libc_hidden_proto (__pthread_rwlock_wrlock) extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); - -extern int __pthread_key_create (pthread_key_t *__key, - void (*__destr_function) (void *)); - -extern int __pthread_setspecific (pthread_key_t __key, - const void *__pointer); - -extern void *__pthread_getspecific (pthread_key_t __key); - +libc_hidden_proto (__pthread_rwlock_unlock) extern int __pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)); +libc_hidden_proto (__pthread_once) extern int __pthread_atfork (void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)); extern int __pthread_setcancelstate (int state, int *oldstate); - +libc_hidden_proto (__pthread_setcancelstate) /* Make the pthread functions weak so that we can elide them from single-threaded processes. */ #ifndef __NO_WEAK_PTHREAD_ALIASES # ifdef weak_extern -weak_extern (__pthread_mutex_init) -weak_extern (__pthread_mutex_destroy) -weak_extern (__pthread_mutex_lock) weak_extern (__pthread_mutex_trylock) -weak_extern (__pthread_mutex_unlock) -weak_extern (__pthread_mutexattr_init) weak_extern (__pthread_mutexattr_destroy) -weak_extern (__pthread_mutexattr_settype) -weak_extern (__pthread_rwlock_init) -weak_extern (__pthread_rwlock_destroy) -weak_extern (__pthread_rwlock_rdlock) -weak_extern (__pthread_rwlock_tryrdlock) -weak_extern (__pthread_rwlock_wrlock) -weak_extern (__pthread_rwlock_trywrlock) -weak_extern (__pthread_rwlock_unlock) -weak_extern (__pthread_key_create) -weak_extern (__pthread_setspecific) -weak_extern (__pthread_getspecific) -weak_extern (__pthread_once) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) -weak_extern (__pthread_setcancelstate) -weak_extern (_pthread_cleanup_push_defer) -weak_extern (_pthread_cleanup_pop_restore) # else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock # pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock -# pragma weak __pthread_mutexattr_init # pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_mutexattr_settype -# pragma weak __pthread_rwlock_destroy -# pragma weak __pthread_rwlock_rdlock -# pragma weak __pthread_rwlock_tryrdlock -# pragma weak __pthread_rwlock_wrlock -# pragma weak __pthread_rwlock_trywrlock -# pragma weak __pthread_rwlock_unlock -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific -# pragma weak __pthread_once # pragma weak __pthread_initialize # pragma weak __pthread_atfork -# pragma weak __pthread_setcancelstate -# pragma weak _pthread_cleanup_push_defer -# pragma weak _pthread_cleanup_pop_restore # endif #endif diff --git a/lib/libc/glibc/sysdeps/nptl/pthread.h b/lib/libc/glibc/sysdeps/nptl/pthread.h index 44dd707896..f1b7f2bdc6 100644 --- a/lib/libc/glibc/sysdeps/nptl/pthread.h +++ b/lib/libc/glibc/sysdeps/nptl/pthread.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,7 +27,11 @@ #include #include #include - +#include +#include +#ifdef __USE_MISC +# include +#endif /* Detach state. */ enum @@ -219,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; +# ifndef __USE_TIME_BITS64 /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. @@ -238,6 +243,23 @@ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, clockid_t __clockid, const struct timespec *__abstime); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_timedjoin_np, + (pthread_t __th, void **__thread_return, + const struct timespec *__abstime), + __pthread_timedjoin_np64); + +extern int __REDIRECT (pthread_clockjoin_np, + (pthread_t __th, void **__thread_return, + clockid_t __clockid, + const struct timespec *__abstime), + __pthread_clockjoin_np64); +# else +# define pthread_timedjoin_np __pthread_timedjoin_np64 +# define pthread_clockjoin_np __pthread_clockjoin_np64 +# endif +# endif #endif /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. @@ -385,6 +407,20 @@ extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, extern int pthread_getattr_default_np (pthread_attr_t *__attr) __THROW __nonnull ((1)); +/* Store *SIGMASK as the signal mask for the new thread in *ATTR. */ +extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr, + const __sigset_t *sigmask); + +/* Store the signal mask of *ATTR in *SIGMASK. If there is no signal + mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on + success. */ +extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr, + __sigset_t *sigmask); + +/* Special return value from pthread_attr_getsigmask_np if the signal + mask has not been set. */ +#define PTHREAD_ATTR_NO_SIGMASK_NP (-1) + /* Set the default attributes to be used by pthread_create in this process. */ extern int pthread_setattr_default_np (const pthread_attr_t *__attr) @@ -438,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW; #endif #ifdef __USE_GNU -/* Yield the processor to another thread or process. - This function is similar to the POSIX `sched_yield' function but - might be differently implemented in the case of a m-on-n thread - implementation. */ extern int pthread_yield (void) __THROW; +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) + __attribute_deprecated_msg__ ("\ +pthread_yield is deprecated, use sched_yield instead"); +# else +# define pthread_yield sched_yield +# endif /* Limit specified thread TH to run only on the processors represented @@ -496,13 +535,15 @@ extern void pthread_testcancel (void); /* Cancellation handling with integration into exception handling. */ +struct __cancel_jmp_buf_tag +{ + __jmp_buf __cancel_jmp_buf; + int __mask_was_saved; +}; + typedef struct { - struct - { - __jmp_buf __cancel_jmp_buf; - int __mask_was_saved; - } __cancel_jmp_buf[1]; + struct __cancel_jmp_buf_tag __cancel_jmp_buf[1]; void *__pad[4]; } __pthread_unwind_buf_t __attribute__ ((__aligned__)); @@ -642,8 +683,8 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ @@ -677,8 +718,8 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) __pthread_unwind_buf_t __cancel_buf; \ void (*__cancel_routine) (void *) = (routine); \ void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ if (__glibc_unlikely (__not_first_call)) \ { \ __cancel_routine (__cancel_arg); \ @@ -714,9 +755,24 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) ; #endif -/* Function used in the macros. */ -struct __jmp_buf_tag; -extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; +/* Function used in the macros. Calling __sigsetjmp, with its first + argument declared as an array, results in a -Wstringop-overflow + warning from GCC 11 because struct pthread_unwind_buf is smaller + than jmp_buf. The calls from the macros have __SAVEMASK set to 0, + so nothing beyond the common prefix is used and this warning is a + false positive. Use an alias with its first argument declared to + use the type in the macros if possible to avoid this warning. */ +#if __GNUC_PREREQ (11, 0) +extern int __REDIRECT_NTHNL (__sigsetjmp_cancel, + (struct __cancel_jmp_buf_tag __env[1], + int __savemask), + __sigsetjmp) __attribute_returns_twice__; +#else +# define __sigsetjmp_cancel(env, savemask) \ + __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask)) +extern int __sigsetjmp (struct __jmp_buf_tag __env[1], + int __savemask) __THROWNL; +#endif /* Mutex handling. */ @@ -740,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ +# ifndef __USE_TIME_BITS64 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, + (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_mutex_timedlock64) __nonnull ((1, 2)); +# else +# define pthread_mutex_timedlock __pthread_mutex_timedlock64 +# endif +# endif #endif #ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock, + (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_mutex_clocklock64) __nonnull ((1, 3)); +# else +# define pthread_mutex_clocklock __pthread_mutex_clocklock64 +# endif +# endif #endif /* Unlock a mutex. */ @@ -776,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # ifdef __USE_GNU -extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) - __THROW __nonnull ((1)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *), + pthread_mutex_consistent) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent"); +# else +# define pthread_mutex_consistent_np pthread_mutex_consistent +# endif # endif #endif @@ -846,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # ifdef __USE_GNU -extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, - int *__robustness) - __THROW __nonnull ((1, 2)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np, + (pthread_mutex_t *, int *), + pthread_mutexattr_getrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust"); +# else +# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust +# endif # endif /* Set the robustness flag of the mutex attribute ATTR. */ @@ -856,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # ifdef __USE_GNU -extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, - int __robustness) - __THROW __nonnull ((1)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np, + (pthread_mutex_t *, int), + pthread_mutexattr_setrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust"); +# else +# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust +# endif # endif #endif - #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ @@ -886,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specfied time. */ +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedrdlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64 +# endif +# endif # endif # ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockrdlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64 +# endif +# endif # endif /* Acquire write lock for RWLOCK. */ @@ -908,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specfied time. */ +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedwrlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64 +# endif +# endif # endif # ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); + +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockwrlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64 +# endif +# endif # endif /* Unlock RWLOCK. */ @@ -994,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 3)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_timedwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_cond_timedwait64) + __nonnull ((1, 2, 3)); +# else +# define pthread_cond_timedwait __pthread_cond_timedwait64 +# endif +# endif # ifdef __USE_GNU /* Wait for condition variable COND to be signaled or broadcast until @@ -1007,11 +1167,25 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __clockid_t __clock_id, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 4)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_clockwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, + const struct timespec *__restrict __abstime), + __pthread_cond_clockwait64) + __nonnull ((1, 2, 4)); +# else +# define pthread_cond_clockwait __pthread_cond_clockwait64 +# endif +# endif # endif /* Functions for handling condition variable attributes. */ @@ -1132,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW; /* Store POINTER in the thread-specific data slot identified by KEY. */ extern int pthread_setspecific (pthread_key_t __key, - const void *__pointer) __THROW ; + const void *__pointer) + __THROW __attr_access_none (2); #ifdef __USE_XOPEN2K diff --git a/lib/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index e91c8cda8e..0000000000 --- a/lib/libc/glibc/sysdeps/powerpc/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Machine-specific pthread type layouts. PowerPC version. - Copyright (C) 2003-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#if __WORDSIZE == 64 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -#else -# define __SIZEOF_PTHREAD_MUTEX_T 24 -# define __SIZEOF_PTHREAD_ATTR_T 36 -# define __SIZEOF_PTHREAD_RWLOCK_T 32 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -#endif -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 1 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) -#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#if __WORDSIZE == 64 - int __cur_writer; - int __shared; - unsigned char __rwelision; - unsigned char __pad1[7]; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 } -#else - unsigned char __rwelision; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - int __cur_writer; -# define __PTHREAD_RWLOCK_ELISION_EXTRA 0 -#endif -}; - -#endif /* bits/pthreadtypes.h */ diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S b/lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S index 4d1082035e..4a5f53a995 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc32/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for PowerPC. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S b/lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S index 630a3b9e35..fdf6a43275 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc32/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for PowerPC. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S b/lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S index b7b9a133a2..39ce1a18ff 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc32/start.S @@ -1,5 +1,5 @@ /* Startup code for programs linked with GNU libc. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -52,8 +52,8 @@ L(start_addresses): .long _SDA_BASE_ .long main - .long __libc_csu_init - .long __libc_csu_fini + .long 0 /* Used to be init. */ + .long 0 /* Used to be fini. */ ASM_SIZE_DIRECTIVE(L(start_addresses)) .section ".text" diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h b/lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h index 3b03e12629..d4474e15d0 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h @@ -1,5 +1,5 @@ /* Hacks needed for symbol manipulation. powerpc version. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h b/lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h index 2ba009e919..4fef254988 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h @@ -1,5 +1,5 @@ /* Assembly macros for 32-bit PowerPC. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -92,7 +92,10 @@ GOT_LABEL: ; \ #define DO_CALL(syscall) \ li 0,syscall; \ - sc + DO_CALL_SC + +#define DO_CALL_SC \ + sc #undef JUMPTARGET #ifdef PIC @@ -106,14 +109,20 @@ GOT_LABEL: ; \ # define HIDDEN_JUMPTARGET(name) __GI_##name##@local #endif +#define TAIL_CALL_SYSCALL_ERROR \ + b __syscall_error@local + #define PSEUDO(name, syscall_name, args) \ .section ".text"; \ ENTRY (name) \ DO_CALL (SYS_ify (syscall_name)); +#define RET_SC \ + bnslr+; + #define PSEUDO_RET \ - bnslr+; \ - b __syscall_error@local + RET_SC; \ + TAIL_CALL_SYSCALL_ERROR #define ret PSEUDO_RET #undef PSEUDO_END @@ -179,8 +188,8 @@ GOT_LABEL: ; \ #else /* Position-dependent code does not require access to the GOT. */ # define __GLRO(rOUT, rGOT, member, offset) \ - lis rOUT,(member+LOWORD)@ha; \ - lwz rOUT,(member+LOWORD)@l(rOUT) + lis rOUT,(member)@ha; \ + lwz rOUT,(member)@l(rOUT) #endif /* PIC */ #endif /* __ASSEMBLER__ */ diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S b/lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S index 9d334e2817..1b0d866c98 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for PowerPC64. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S b/lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S index 677beecdaf..1a36eb8ad0 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for PowerPC64. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h b/lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h index 289bcc7aa9..820681c801 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. PowerPC64 version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/entry.h b/lib/libc/glibc/sysdeps/powerpc/powerpc64/entry.h new file mode 100644 index 0000000000..99c81cb982 --- /dev/null +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/entry.h @@ -0,0 +1,37 @@ +/* Finding the entry point and start of text. PowerPC64 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 + 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 + . */ + + +#ifndef __ASSEMBLY__ +extern void _start (void); +#endif + +#define ENTRY_POINT _start + +#if _CALL_ELF != 2 +/* We have to provide a special declaration. */ +#define ENTRY_POINT_DECL(class) class void _start (void); + +/* Use the address of ._start as the lowest address for which we need + to keep profiling records. We can't copy the ia64 scheme as our + entry poiny address is really the address of the function + descriptor, not the actual function entry. */ +#define TEXT_START \ + ({ extern unsigned long int _start_as_data[] asm ("_start"); \ + _start_as_data[0]; }) +#endif diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S b/lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S index 94bf771e83..71c0c67926 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/start.S @@ -1,5 +1,5 @@ /* Startup code for programs linked with GNU libc. PowerPC64 version. - Copyright (C) 1998-2020 Free Software Foundation, Inc. + Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -53,8 +53,8 @@ L(start_addresses): .quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/ /* function descriptors so don't need JUMPTARGET */ .quad main - .quad __libc_csu_init - .quad __libc_csu_fini + .quad 0 /* Used to be init. */ + .quad 0 /* Used to be fini. */ ASM_SIZE_DIRECTIVE(L(start_addresses)) diff --git a/lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h b/lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h index d6616ac905..589f7c8d18 100644 --- a/lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h +++ b/lib/libc/glibc/sysdeps/powerpc/powerpc64/sysdep.h @@ -1,5 +1,5 @@ /* Assembly macros for 64-bit PowerPC. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,6 +17,7 @@ . */ #include +#include #ifdef __ASSEMBLER__ @@ -263,10 +264,83 @@ LT_LABELSUFFIX(name,_name_end): ; \ TRACEBACK_MASK(name,mask); \ END_2(name) -#define DO_CALL(syscall) \ - li 0,syscall; \ +/* We will allocate a new frame to save LR and the non-volatile register used to + read the TCB when checking for scv support on syscall code. We actually just + need the minimum frame size plus room for 1 reg (8 bytes). But the ABI + mandates stack frames should be aligned at 16 Bytes, so we end up allocating + a bit more space then what will actually be used. */ +#define SCV_FRAME_SIZE (FRAME_MIN_SIZE+16) +#define SCV_FRAME_NVOLREG_SAVE FRAME_MIN_SIZE + +/* Allocate frame and save register */ +#define NVOLREG_SAVE \ + stdu r1,-SCV_FRAME_SIZE(r1); \ + std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ + cfi_adjust_cfa_offset(SCV_FRAME_SIZE); + +/* Restore register and destroy frame */ +#define NVOLREG_RESTORE \ + ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ + addi r1,r1,SCV_FRAME_SIZE; \ + cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); + +/* Check PPC_FEATURE2_SCV bit from hwcap2 in the TCB. If it is not set, scv is + not available, then go to JUMPFALSE (label given by the macro's caller). We + save the value we read from the TCB in a non-volatile register so we can + reuse it later when exiting from the syscall in PSEUDO_RET. Note that for + the static case we need an extra check to guarantee the thread pointer has + already been initialized, otherwise we may try to access an invalid address + if a syscall is called before the TLS has been setup. */ + .macro CHECK_SCV_SUPPORT REG JUMPFALSE + +#ifndef SHARED + /* Check if thread pointer has already been setup. */ + cmpdi r13,0 + beq \JUMPFALSE +#endif + + /* Read PPC_FEATURE2_SCV from TCB and store it in REG */ + ld \REG,TCB_HWCAP(PT_THREAD_POINTER) + andis. \REG,\REG,PPC_FEATURE2_SCV>>16 + + beq \JUMPFALSE + .endm + +#if !defined(USE_PPC_SCV) || IS_IN(rtld) +# define DO_CALL(syscall) \ + li r0,syscall; \ + DO_CALL_SC +#else +/* Before doing the syscall, check if we can use scv. scv is supported by P9 + and later with Linux v5.9 and later. If so, use it. Otherwise, fallback to + sc. We use a non-volatile register to save hwcap2 from the TCB, so we need + to save its content beforehand. */ +# define DO_CALL(syscall) \ + li r0,syscall; \ + NVOLREG_SAVE; \ + CHECK_SCV_SUPPORT r31 0f; \ + DO_CALL_SCV; \ + b 1f; \ +0: DO_CALL_SC; \ +1: +#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ + +/* DO_CALL_SC and DO_CALL_SCV expect the syscall number to be in r0. */ +#define DO_CALL_SC \ sc +#define DO_CALL_SCV \ + mflr r9; \ + std r9,FRAME_LR_SAVE(r1); \ + cfi_offset(lr,FRAME_LR_SAVE); \ + .machine "push"; \ + .machine "power9"; \ + scv 0; \ + .machine "pop"; \ + ld r9,FRAME_LR_SAVE(r1); \ + mtlr r9; \ + cfi_restore(lr); + /* ppc64 is always PIC */ #undef JUMPTARGET #define JUMPTARGET(name) FUNC_LABEL(name) @@ -278,7 +352,7 @@ LT_LABELSUFFIX(name,_name_end): ; \ #ifdef SHARED #define TAIL_CALL_SYSCALL_ERROR \ - b JUMPTARGET(__syscall_error) + b JUMPTARGET (NOTOC (__syscall_error)) #else /* Static version might be linked into a large app with a toc exceeding 64k. We can't put a toc adjusting stub on a plain branch, so can't @@ -304,9 +378,33 @@ LT_LABELSUFFIX(name,_name_end): ; \ .endif #endif -#define PSEUDO_RET \ - bnslr+; \ +#if !defined(USE_PPC_SCV) || IS_IN(rtld) +# define PSEUDO_RET \ + RET_SC; \ TAIL_CALL_SYSCALL_ERROR +#else +/* This should only be called after a DO_CALL. In such cases, r31 contains the + value of PPC_FEATURE2_SCV read from hwcap2 by CHECK_SCV_SUPPORT. If it is + set, we know we have entered the kernel using scv, so handle the return code + accordingly. */ +# define PSEUDO_RET \ + cmpdi cr5,r31,0; \ + NVOLREG_RESTORE; \ + beq cr5,0f; \ + RET_SCV; \ + b 1f; \ +0: RET_SC; \ +1: TAIL_CALL_SYSCALL_ERROR +#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ + +#define RET_SCV \ + li r9,-4095; \ + cmpld r3,r9; \ + bltlr+; \ + neg r3,r3; + +#define RET_SC \ + bnslr+; #define ret PSEUDO_RET @@ -319,8 +417,15 @@ LT_LABELSUFFIX(name,_name_end): ; \ ENTRY (name); \ DO_CALL (SYS_ify (syscall_name)) -#define PSEUDO_RET_NOERRNO \ +#if !defined(USE_PPC_SCV) || IS_IN(rtld) +# define PSEUDO_RET_NOERRNO \ blr +#else +/* This should only be called after a DO_CALL. */ +# define PSEUDO_RET_NOERRNO \ + NVOLREG_RESTORE; \ + blr +#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ #define ret_NOERRNO PSEUDO_RET_NOERRNO @@ -333,8 +438,15 @@ LT_LABELSUFFIX(name,_name_end): ; \ ENTRY (name); \ DO_CALL (SYS_ify (syscall_name)) -#define PSEUDO_RET_ERRVAL \ +#if !defined(USE_PPC_SCV) || IS_IN(rtld) +# define PSEUDO_RET_ERRVAL \ blr +#else +/* This should only be called after a DO_CALL. */ +# define PSEUDO_RET_ERRVAL \ + NVOLREG_RESTORE; \ + blr +#endif /* !defined(USE_PPC_SCV) || IS_IN(rtld) */ #define ret_ERRVAL PSEUDO_RET_ERRVAL @@ -366,6 +478,12 @@ LT_LABELSUFFIX(name,_name_end): ; \ lwz rOUT,0(rOUT) #endif +#ifdef USE_PPC64_NOTOC +# define NOTOC(l) l@notoc +#else +# define NOTOC(l) l +#endif + #else /* !__ASSEMBLER__ */ #if _CALL_ELF != 2 diff --git a/lib/libc/glibc/sysdeps/powerpc/sysdep.h b/lib/libc/glibc/sysdeps/powerpc/sysdep.h index e67b2a64ee..ab20890ca6 100644 --- a/lib/libc/glibc/sysdeps/powerpc/sysdep.h +++ b/lib/libc/glibc/sysdeps/powerpc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/nptl/pthread_atfork.c b/lib/libc/glibc/sysdeps/pthread/pthread_atfork.c similarity index 97% rename from lib/libc/glibc/nptl/pthread_atfork.c rename to lib/libc/glibc/sysdeps/pthread/pthread_atfork.c index bfb4af9053..515bd32a12 100644 --- a/lib/libc/glibc/nptl/pthread_atfork.c +++ b/lib/libc/glibc/sysdeps/pthread/pthread_atfork.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2002. diff --git a/lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h index c3c72d6c10..283b53ebac 100644 --- a/lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. RISC-V version. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,18 +21,22 @@ #include -#if __riscv_xlen == 64 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -# define __SIZEOF_PTHREAD_COND_T 48 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#if __WORDSIZE == 64 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 #else -# error "rv32i-based systems are not supported" +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_RWLOCK_T 48 +# define __SIZEOF_PTHREAD_BARRIER_T 20 #endif #define __LOCK_ALIGNMENT diff --git a/lib/libc/glibc/sysdeps/riscv/start.S b/lib/libc/glibc/sysdeps/riscv/start.S index 09511b1ef8..806f6aacd6 100644 --- a/lib/libc/glibc/sysdeps/riscv/start.S +++ b/lib/libc/glibc/sysdeps/riscv/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF RISC-V ABI. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT) REG_L a1, 0(sp) /* argc. */ addi a2, sp, SZREG /* argv. */ andi sp, sp, ALMASK /* Align stack. */ - lla a3, __libc_csu_init - lla a4, __libc_csu_fini + li a3, 0 /* Used to be init. */ + li a4, 0 /* Used to be fini. */ mv a6, sp /* stack_end. */ call __libc_start_main@plt diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/crti.S b/lib/libc/glibc/sysdeps/s390/s390-32/crti.S index 07f901753a..a9ff816793 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/crti.S +++ b/lib/libc/glibc/sysdeps/s390/s390-32/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for S/390. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/crtn.S b/lib/libc/glibc/sysdeps/s390/s390-32/crtn.S index 66f9085a3f..3ec9fec1bf 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/crtn.S +++ b/lib/libc/glibc/sysdeps/s390/s390-32/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for S/390. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h b/lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h index 2ff5c0101f..bd6fcbbb99 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/s390/s390-32/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. S/390 version. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/start.S b/lib/libc/glibc/sysdeps/s390/s390-32/start.S index af9dccfb9d..b6cfa4caf3 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/start.S +++ b/lib/libc/glibc/sysdeps/s390/s390-32/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF s390 ABI. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -175,18 +175,16 @@ _start: */ stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area la %r7,96(%r15) - l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini - l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init l %r2,.L3-.Llit(%r13) # load pointer to main l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main #ifdef PIC l %r12,.L5-.Llit(%r13) # load .got pointer - la %r6,0(%r13,%r6) - la %r5,0(%r13,%r5) la %r12,0(%r13,%r12) l %r2,0(%r12,%r2) la %r1,0(%r13,%r1) #endif + lhi %r6, 0 # Used to fini. + lhi %r5, 0 # Used to init. /* ok, now branch to the libc main routine */ basr %r14,%r1 @@ -197,13 +195,9 @@ _start: cfi_endproc .Llit: #ifndef PIC -.L1: .long __libc_csu_init -.L2: .long __libc_csu_fini .L3: .long main .L4: .long __libc_start_main #else -.L1: .long __libc_csu_init-.Llit -.L2: .long __libc_csu_fini-.Llit .L3: .long main@GOT .L4: .long __libc_start_main@plt-.Llit .L5: .long _GLOBAL_OFFSET_TABLE_-.Llit diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h b/lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h index 71691597db..7132d0db19 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h +++ b/lib/libc/glibc/sysdeps/s390/s390-32/symbol-hacks.h @@ -1,5 +1,5 @@ /* Hacks needed for symbol manipulation. s390 version. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h b/lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h index 3e41e6fbc2..099a95fd1a 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h +++ b/lib/libc/glibc/sysdeps/s390/s390-32/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for s390. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/s390/s390-64/crti.S b/lib/libc/glibc/sysdeps/s390/s390-64/crti.S index e135874343..3aa441187d 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-64/crti.S +++ b/lib/libc/glibc/sysdeps/s390/s390-64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for 64 bit S/390. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/s390/s390-64/crtn.S b/lib/libc/glibc/sysdeps/s390/s390-64/crtn.S index 2cd0d24250..2271f56981 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-64/crtn.S +++ b/lib/libc/glibc/sysdeps/s390/s390-64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for 64 bit S/390. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/s390/s390-64/start.S b/lib/libc/glibc/sysdeps/s390/s390-64/start.S index 02ed4aad51..4e6526308a 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-64/start.S +++ b/lib/libc/glibc/sysdeps/s390/s390-64/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the 64 bit S/390 ELF ABI. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -80,8 +80,8 @@ _start: */ stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area la %r7,160(%r15) - larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini - larl %r5,__libc_csu_init # load pointer to __libc_csu_init + lghi %r6,0 # Used to be fini. + lghi %r5,0 # Used to be init. /* Ok, now branch to the libc main routine. */ #ifdef PIC diff --git a/lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h b/lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h index 2da2b0049e..136f89e8fe 100644 --- a/lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h +++ b/lib/libc/glibc/sysdeps/s390/s390-64/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for 64 bit S/390. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/sh/crti.S b/lib/libc/glibc/sysdeps/sh/crti.S index 67ff55ae6c..ce10e7995a 100644 --- a/lib/libc/glibc/sysdeps/sh/crti.S +++ b/lib/libc/glibc/sysdeps/sh/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for SH. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sh/crtn.S b/lib/libc/glibc/sysdeps/sh/crtn.S index aa3d326a7d..f0e3f15bca 100644 --- a/lib/libc/glibc/sysdeps/sh/crtn.S +++ b/lib/libc/glibc/sysdeps/sh/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for SH. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index 64d9d43b3a..0000000000 --- a/lib/libc/glibc/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -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 - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#define __SIZEOF_PTHREAD_ATTR_T 36 -#define __SIZEOF_PTHREAD_MUTEX_T 24 -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 -#define __SIZEOF_PTHREAD_RWLOCK_T 32 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIER_T 20 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 0 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 1 -#define __PTHREAD_MUTEX_USE_UNION 1 - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; -#else - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -#endif - unsigned long int __cur_writer; -}; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -#endif /* bits/pthreadtypes.h */ diff --git a/lib/libc/glibc/sysdeps/sh/start.S b/lib/libc/glibc/sysdeps/sh/start.S index 433f67a259..606ee59222 100644 --- a/lib/libc/glibc/sysdeps/sh/start.S +++ b/lib/libc/glibc/sysdeps/sh/start.S @@ -1,5 +1,5 @@ /* Startup code for SH & ELF. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -70,12 +70,11 @@ _start: /* Push the last arguments to main() onto the stack */ mov.l r4,@-r15 - mov.l L_fini,r0 - mov.l r0,@-r15 + mov.l r14,@-r15 /* Used to be fini. */ /* Set up the other arguments for main() that go in registers */ mov.l L_main,r4 - mov.l L_init,r7 + mov #0,r7 /* Used to be init. */ /* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */ @@ -90,10 +89,6 @@ _start: .align 2 L_main: .long main -L_init: - .long __libc_csu_init -L_fini: - .long __libc_csu_fini L_libc_start_main: .long __libc_start_main L_abort: diff --git a/lib/libc/glibc/sysdeps/sh/sysdep.h b/lib/libc/glibc/sysdeps/sh/sysdep.h index cf83bab024..9620046d71 100644 --- a/lib/libc/glibc/sysdeps/sh/sysdep.h +++ b/lib/libc/glibc/sysdeps/sh/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for SH. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sparc/crti.S b/lib/libc/glibc/sysdeps/sparc/crti.S index 9a30eab7ee..55ee921723 100644 --- a/lib/libc/glibc/sysdeps/sparc/crti.S +++ b/lib/libc/glibc/sysdeps/sparc/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for sparc. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sparc/crtn.S b/lib/libc/glibc/sysdeps/sparc/crtn.S index 9a88188c44..e2ea73b905 100644 --- a/lib/libc/glibc/sysdeps/sparc/crtn.S +++ b/lib/libc/glibc/sysdeps/sparc/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for sparc. - Copyright (C) 1995-2020 Free Software Foundation, Inc. + Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h b/lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h index 1094529229..a247852bc3 100644 --- a/lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h +++ b/lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h @@ -1,5 +1,5 @@ /* Configuration of lookup functions. SPARC version. - Copyright (C) 2000-2020 Free Software Foundation, Inc. + Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sparc/dl-sysdep.h b/lib/libc/glibc/sysdeps/sparc/dl-sysdep.h index 5dfd3e314b..31e5aff1c3 100644 --- a/lib/libc/glibc/sysdeps/sparc/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/sparc/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. SPARC version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/sparc/sparc32/start.S b/lib/libc/glibc/sysdeps/sparc/sparc32/start.S index 5afc3f6e89..00bf898fb9 100644 --- a/lib/libc/glibc/sysdeps/sparc/sparc32/start.S +++ b/lib/libc/glibc/sysdeps/sparc/sparc32/start.S @@ -1,5 +1,5 @@ /* Startup code for elf32-sparc - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson , 1997. @@ -59,22 +59,14 @@ _start: /* Load the addresses of the user entry points. */ #ifndef PIC sethi %hi(main), %o0 - sethi %hi(__libc_csu_init), %o3 - sethi %hi(__libc_csu_fini), %o4 or %o0, %lo(main), %o0 - or %o3, %lo(__libc_csu_init), %o3 - or %o4, %lo(__libc_csu_fini), %o4 #else sethi %gdop_hix22(main), %o0 - sethi %gdop_hix22(__libc_csu_init), %o3 - sethi %gdop_hix22(__libc_csu_fini), %o4 xor %o0, %gdop_lox10(main), %o0 - xor %o3, %gdop_lox10(__libc_csu_init), %o3 - xor %o4, %gdop_lox10(__libc_csu_fini), %o4 ld [%l7 + %o0], %o0, %gdop(main) - ld [%l7 + %o3], %o3, %gdop(__libc_csu_init) - ld [%l7 + %o4], %o4, %gdop(__libc_csu_fini) #endif + mov 0, %o3 /* Used to be init. */ + mov 0, %o4 /* Used to be fini. */ /* When starting a binary via the dynamic linker, %g1 contains the address of the shared library termination function, which will be diff --git a/lib/libc/glibc/sysdeps/sparc/sparc64/start.S b/lib/libc/glibc/sysdeps/sparc/sparc64/start.S index 8167a3363d..8520717eba 100644 --- a/lib/libc/glibc/sysdeps/sparc/sparc64/start.S +++ b/lib/libc/glibc/sysdeps/sparc/sparc64/start.S @@ -1,5 +1,5 @@ /* Startup code for elf64-sparc - Copyright (C) 1997-2020 Free Software Foundation, Inc. + Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson , 1997. @@ -60,22 +60,14 @@ _start: /* Load the addresses of the user entry points. */ #ifndef PIC sethi %hi(main), %o0 - sethi %hi(__libc_csu_init), %o3 - sethi %hi(__libc_csu_fini), %o4 or %o0, %lo(main), %o0 - or %o3, %lo(__libc_csu_init), %o3 - or %o4, %lo(__libc_csu_fini), %o4 #else sethi %gdop_hix22(main), %o0 - sethi %gdop_hix22(__libc_csu_init), %o3 - sethi %gdop_hix22(__libc_csu_fini), %o4 xor %o0, %gdop_lox10(main), %o0 - xor %o3, %gdop_lox10(__libc_csu_init), %o3 - xor %o4, %gdop_lox10(__libc_csu_fini), %o4 ldx [%l7 + %o0], %o0, %gdop(main) - ldx [%l7 + %o3], %o3, %gdop(__libc_csu_init) - ldx [%l7 + %o4], %o4, %gdop(__libc_csu_fini) #endif + mov 0, %o3 /* Used to be init. */ + mov 0, %o4 /* Used to be fini. */ /* When starting a binary via the dynamic linker, %g1 contains the address of the shared library termination function, which will be diff --git a/lib/libc/glibc/sysdeps/sparc/sysdep.h b/lib/libc/glibc/sysdeps/sparc/sysdep.h index d0541d5492..5b4dc822b1 100644 --- a/lib/libc/glibc/sysdeps/sparc/sysdep.h +++ b/lib/libc/glibc/sysdeps/sparc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/alpha/sysdep.h b/lib/libc/glibc/sysdeps/unix/alpha/sysdep.h deleted file mode 100644 index 74db6b02b2..0000000000 --- a/lib/libc/glibc/sysdeps/unix/alpha/sysdep.h +++ /dev/null @@ -1,382 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Brendan Kehoe (brendan@zen.org). - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include /* Defines RTLD_PRIVATE_ERRNO. */ - -#ifdef __ASSEMBLER__ - -#ifdef __linux__ -# include -#else -# include -#endif - -#define __LABEL(x) x##: - -#define LEAF(name, framesize) \ - .globl name; \ - .align 4; \ - .ent name, 0; \ - __LABEL(name) \ - .frame sp, framesize, ra - -#define ENTRY(name) \ - .globl name; \ - .align 4; \ - .ent name, 0; \ - __LABEL(name) \ - .frame sp, 0, ra - -/* Mark the end of function SYM. */ -#undef END -#define END(sym) .end sym - -#ifdef PROF -# define PSEUDO_PROF \ - .set noat; \ - lda AT, _mcount; \ - jsr AT, (AT), _mcount; \ - .set at -#else -# define PSEUDO_PROF -#endif - -#ifdef PROF -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - ldgp gp,0(pv); \ - PSEUDO_PROF; \ - .prologue 1 -#elif defined PIC -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - .prologue 0 -#else -# define PSEUDO_PROLOGUE \ - .frame sp, 0, ra; \ - ldgp gp,0(pv); \ - .prologue 1 -#endif /* PROF */ - -#ifdef PROF -# define USEPV_PROF std -#else -# define USEPV_PROF no -#endif - -#if RTLD_PRIVATE_ERRNO -# define SYSCALL_ERROR_LABEL $syscall_error -# define SYSCALL_ERROR_HANDLER \ -$syscall_error: \ - stl v0, rtld_errno(gp) !gprel; \ - lda v0, -1; \ - ret -# define SYSCALL_ERROR_FALLTHRU -#elif defined(PIC) -# define SYSCALL_ERROR_LABEL __syscall_error !samegp -# define SYSCALL_ERROR_HANDLER -# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL -#else -# define SYSCALL_ERROR_LABEL $syscall_error -# define SYSCALL_ERROR_HANDLER \ -$syscall_error: \ - jmp $31, __syscall_error -# define SYSCALL_ERROR_FALLTHRU -#endif /* RTLD_PRIVATE_ERRNO */ - -/* Overridden by specific syscalls. */ -#undef PSEUDO_PREPARE_ARGS -#define PSEUDO_PREPARE_ARGS /* Nothing. */ - -#define PSEUDO(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; \ - bne a3, SYSCALL_ERROR_LABEL - -#undef PSEUDO_END -#define PSEUDO_END(sym) \ - SYSCALL_ERROR_HANDLER; \ - END(sym) - -#define PSEUDO_NOERRNO(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; - -#undef PSEUDO_END_NOERRNO -#define PSEUDO_END_NOERRNO(sym) END(sym) - -#define ret_NOERRNO ret - -#define PSEUDO_ERRVAL(name, syscall_name, args) \ - .globl name; \ - .align 4; \ - .ent name,0; \ -__LABEL(name) \ - PSEUDO_PROLOGUE; \ - PSEUDO_PREPARE_ARGS \ - lda v0, SYS_ify(syscall_name); \ - call_pal PAL_callsys; - -#undef PSEUDO_END_ERRVAL -#define PSEUDO_END_ERRVAL(sym) END(sym) - -#define ret_ERRVAL ret - -#define r0 v0 -#define r1 a4 - -#define MOVE(x,y) mov x,y - -#else /* !ASSEMBLER */ - -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#include - -/* ??? Linux needs to be able to override INLINE_SYSCALL for one - particular special case. Make this easy. */ - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - INLINE_SYSCALL1(name, nr, args) - -#define INLINE_SYSCALL1(name, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ - if (__builtin_expect (_sc_err, 0)) \ - { \ - __set_errno (_sc_ret); \ - _sc_ret = -1L; \ - } \ - _sc_ret; \ -}) - -#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ - INTERNAL_SYSCALL1(name, err_out, nr, args) - -#define INTERNAL_SYSCALL1(name, err_out, nr, args...) \ - INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args) - -#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(name, args); \ - err_out = _sc_err; \ - _sc_ret; \ -}) - -#define INTERNAL_SYSCALL_DECL(err) \ - long int err __attribute__((unused)) - -/* The normal Alpha calling convention sign-extends 32-bit quantties - no matter what the "real" sign of the 32-bit type. We want to - preserve that when filling in values for the kernel. */ -#define syscall_promote(arg) \ - (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) - -/* Make sure and "use" the variable that we're not returning, - in order to suppress unused variable warnings. */ -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void)val, err) -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void)err, val) - -#define inline_syscall_clobbers \ - "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ - "$22", "$23", "$24", "$25", "$27", "$28", "memory" - -/* It is moderately important optimization-wise to limit the lifetime - of the hard-register variables as much as possible. Thus we copy - in/out as close to the asm as possible. */ - -#define inline_syscall0(name, args...) \ -{ \ - register long _sc_19 __asm__("$19"); \ - register long _sc_0 = name; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2" \ - : "+v"(_sc_0), "=r"(_sc_19) \ - : : inline_syscall_clobbers, \ - "$16", "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall1(name,arg1) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3" \ - : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \ - : : inline_syscall_clobbers, \ - "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall2(name,arg1,arg2) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4" \ - : "+v"(_sc_0), "=r"(_sc_19), \ - "+r"(_sc_16), "+r"(_sc_17) \ - : : inline_syscall_clobbers, \ - "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall3(name,arg1,arg2,arg3) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19"); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5" \ - : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18) \ - : : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18) \ - : : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _tmp_20 = syscall_promote (arg5); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - register long _sc_20 __asm__("$20") = _tmp_20; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \ - : : inline_syscall_clobbers, "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -{ \ - register long _tmp_16 = syscall_promote (arg1); \ - register long _tmp_17 = syscall_promote (arg2); \ - register long _tmp_18 = syscall_promote (arg3); \ - register long _tmp_19 = syscall_promote (arg4); \ - register long _tmp_20 = syscall_promote (arg5); \ - register long _tmp_21 = syscall_promote (arg6); \ - register long _sc_0 = name; \ - register long _sc_16 __asm__("$16") = _tmp_16; \ - register long _sc_17 __asm__("$17") = _tmp_17; \ - register long _sc_18 __asm__("$18") = _tmp_18; \ - register long _sc_19 __asm__("$19") = _tmp_19; \ - register long _sc_20 __asm__("$20") = _tmp_20; \ - register long _sc_21 __asm__("$21") = _tmp_21; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ - : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ - "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \ - "+r"(_sc_21) \ - : : inline_syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} -#endif /* ASSEMBLER */ - -/* Pointer mangling support. Note that tls access is slow enough that - we don't deoptimize things by placing the pointer check value there. */ - -#ifdef __ASSEMBLER__ -# if IS_IN (rtld) -# define PTR_MANGLE(dst, src, tmp) \ - ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ - ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ - xor src, tmp, dst -# define PTR_MANGLE2(dst, src, tmp) \ - xor src, tmp, dst -# elif defined SHARED -# define PTR_MANGLE(dst, src, tmp) \ - ldq tmp, __pointer_chk_guard; \ - xor src, tmp, dst -# else -# define PTR_MANGLE(dst, src, tmp) \ - ldq tmp, __pointer_chk_guard_local; \ - xor src, tmp, dst -# endif -# define PTR_MANGLE2(dst, src, tmp) \ - xor src, tmp, dst -# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) -# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) -#else -# include -# if (IS_IN (rtld) \ - || (!defined SHARED && (IS_IN (libc) \ - || IS_IN (libpthread)))) -extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) -# else -extern uintptr_t __pointer_chk_guard attribute_relro; -# define PTR_MANGLE(var) \ - (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) -# endif -# define PTR_DEMANGLE(var) PTR_MANGLE(var) -#endif /* ASSEMBLER */ diff --git a/lib/libc/glibc/sysdeps/unix/arm/sysdep.h b/lib/libc/glibc/sysdeps/unix/arm/sysdep.h index ee5e374cd1..ca7bcfc0e6 100644 --- a/lib/libc/glibc/sysdeps/unix/arm/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/arm/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/i386/sysdep.h b/lib/libc/glibc/sysdeps/unix/i386/sysdep.h index 11ffec94d6..7ca4d89318 100644 --- a/lib/libc/glibc/sysdeps/unix/i386/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/i386/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/mips/entry.h b/lib/libc/glibc/sysdeps/unix/mips/entry.h new file mode 100644 index 0000000000..04d05d2b0a --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/mips/entry.h @@ -0,0 +1,5 @@ +#ifndef __ASSEMBLY__ +extern void __start (void); +#endif + +#define ENTRY_POINT __start diff --git a/lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h b/lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h index b09367347e..21f22462db 100644 --- a/lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). diff --git a/lib/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h b/lib/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h deleted file mode 100644 index 3d8b254017..0000000000 --- a/lib/libc/glibc/sysdeps/unix/mips/mips64/n64/sysdep.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Alexandre Oliva . - - 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 - . */ - -#include - -#ifdef __ASSEMBLER__ - -/* Note that while it's better structurally, going back to call __syscall_error - can make things confusing if you're debugging---it looks like it's jumping - backwards into the previous fn. */ -#ifdef __PIC__ -#define PSEUDO(name, syscall_name, args) \ - .align 2; \ - .set nomips16; \ - cfi_startproc; \ - 99:; \ - .set noat; \ - .cpsetup t9, $1, name; \ - cfi_register (gp, $1); \ - .set at; \ - dla t9,__syscall_error; \ - .cpreturn; \ - cfi_restore (gp); \ - jr t9; \ - cfi_endproc; \ - ENTRY(name) \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - bne a3, zero, 99b; \ -L(syse1): -#else -#define PSEUDO(name, syscall_name, args) \ - .set noreorder; \ - .align 2; \ - .set nomips16; \ - cfi_startproc; \ - 99: j __syscall_error; \ - nop; \ - cfi_endproc; \ - ENTRY(name) \ - .set noreorder; \ - li v0, SYS_ify(syscall_name); \ - syscall; \ - .set reorder; \ - bne a3, zero, 99b; \ -L(syse1): -#endif - -#endif diff --git a/lib/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h b/lib/libc/glibc/sysdeps/unix/mips/mips64/sysdep.h similarity index 94% rename from lib/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h rename to lib/libc/glibc/sysdeps/unix/mips/mips64/sysdep.h index 65ce7c5406..5232afc668 100644 --- a/lib/libc/glibc/sysdeps/unix/mips/mips64/n32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/mips/mips64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Alexandre Oliva . @@ -19,6 +19,7 @@ #include #ifdef __ASSEMBLER__ +#include /* Note that while it's better structurally, going back to call __syscall_error can make things confusing if you're debugging---it looks like it's jumping @@ -33,7 +34,7 @@ .cpsetup t9, $1, name; \ cfi_register (gp, $1); \ .set at; \ - la t9,__syscall_error; \ + PTR_LA t9,__syscall_error; \ .cpreturn; \ cfi_restore (gp); \ jr t9; \ diff --git a/lib/libc/glibc/sysdeps/unix/mips/sysdep.h b/lib/libc/glibc/sysdeps/unix/mips/sysdep.h index 7b162e9aa5..2910f8ece9 100644 --- a/lib/libc/glibc/sysdeps/unix/mips/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/mips/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Brendan Kehoe (brendan@zen.org). diff --git a/lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h b/lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h index ec698f27e5..5b5795b24d 100644 --- a/lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/powerpc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sh/sysdep.h b/lib/libc/glibc/sysdeps/unix/sh/sysdep.h index 9a294d1654..d112086ccf 100644 --- a/lib/libc/glibc/sysdeps/unix/sh/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sh/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysdep.h index c2f1bd3c63..664d093c05 100644 --- a/lib/libc/glibc/sysdeps/unix/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,24 +28,24 @@ #define __SYSCALL_CONCAT(a,b) __SYSCALL_CONCAT_X (a, b) -#define __INTERNAL_SYSCALL0(name, err) \ - INTERNAL_SYSCALL (name, err, 0) -#define __INTERNAL_SYSCALL1(name, err, a1) \ - INTERNAL_SYSCALL (name, err, 1, a1) -#define __INTERNAL_SYSCALL2(name, err, a1, a2) \ - INTERNAL_SYSCALL (name, err, 2, a1, a2) -#define __INTERNAL_SYSCALL3(name, err, a1, a2, a3) \ - INTERNAL_SYSCALL (name, err, 3, a1, a2, a3) -#define __INTERNAL_SYSCALL4(name, err, a1, a2, a3, a4) \ - INTERNAL_SYSCALL (name, err, 4, a1, a2, a3, a4) -#define __INTERNAL_SYSCALL5(name, err, a1, a2, a3, a4, a5) \ - INTERNAL_SYSCALL (name, err, 5, a1, a2, a3, a4, a5) -#define __INTERNAL_SYSCALL6(name, err, a1, a2, a3, a4, a5, a6) \ - INTERNAL_SYSCALL (name, err, 6, a1, a2, a3, a4, a5, a6) -#define __INTERNAL_SYSCALL7(name, err, a1, a2, a3, a4, a5, a6, a7) \ - INTERNAL_SYSCALL (name, err, 7, a1, a2, a3, a4, a5, a6, a7) +#define __INTERNAL_SYSCALL0(name) \ + INTERNAL_SYSCALL (name, 0) +#define __INTERNAL_SYSCALL1(name, a1) \ + INTERNAL_SYSCALL (name, 1, a1) +#define __INTERNAL_SYSCALL2(name, a1, a2) \ + INTERNAL_SYSCALL (name, 2, a1, a2) +#define __INTERNAL_SYSCALL3(name, a1, a2, a3) \ + INTERNAL_SYSCALL (name, 3, a1, a2, a3) +#define __INTERNAL_SYSCALL4(name, a1, a2, a3, a4) \ + INTERNAL_SYSCALL (name, 4, a1, a2, a3, a4) +#define __INTERNAL_SYSCALL5(name, a1, a2, a3, a4, a5) \ + INTERNAL_SYSCALL (name, 5, a1, a2, a3, a4, a5) +#define __INTERNAL_SYSCALL6(name, a1, a2, a3, a4, a5, a6) \ + INTERNAL_SYSCALL (name, 6, a1, a2, a3, a4, a5, a6) +#define __INTERNAL_SYSCALL7(name, a1, a2, a3, a4, a5, a6, a7) \ + INTERNAL_SYSCALL (name, 7, a1, a2, a3, a4, a5, a6, a7) -#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,o,...) o +#define __INTERNAL_SYSCALL_NARGS_X(a,b,c,d,e,f,g,h,n,...) n #define __INTERNAL_SYSCALL_NARGS(...) \ __INTERNAL_SYSCALL_NARGS_X (__VA_ARGS__,7,6,5,4,3,2,1,0,) #define __INTERNAL_SYSCALL_DISP(b,...) \ @@ -88,10 +88,17 @@ #define INLINE_SYSCALL_CALL(...) \ __INLINE_SYSCALL_DISP (__INLINE_SYSCALL, __VA_ARGS__) +#if IS_IN (rtld) +/* All cancellation points are compiled out in the dynamic loader. */ +# define NO_SYSCALL_CANCEL_CHECKING 1 +#else +# define NO_SYSCALL_CANCEL_CHECKING SINGLE_THREAD_P +#endif + #define SYSCALL_CANCEL(...) \ ({ \ long int sc_ret; \ - if (SINGLE_THREAD_P) \ + if (NO_SYSCALL_CANCEL_CHECKING) \ sc_ret = INLINE_SYSCALL_CALL (__VA_ARGS__); \ else \ { \ @@ -107,7 +114,7 @@ #define INTERNAL_SYSCALL_CANCEL(...) \ ({ \ long int sc_ret; \ - if (SINGLE_THREAD_P) \ + if (NO_SYSCALL_CANCEL_CHECKING) \ sc_ret = INTERNAL_SYSCALL_CALL (__VA_ARGS__); \ else \ { \ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h index 5f301bed6c..f08850b95e 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. AArch64 version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h index 2aa8dc77df..d25e717c43 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 00b8e241c8..b01911247f 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005-2020 Free Software Foundation, Inc. +/* Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -164,29 +164,10 @@ # define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" -/* Previously AArch64 used the generic version without the libc_hidden_def - which lead in a non existent __send symbol in libc.so. */ -# undef HAVE_INTERNAL_SEND_SYMBOL - # define SINGLE_THREAD_BY_GLOBAL 1 -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned long) -1; \ - } \ - (long) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ long _sys_result; \ { \ LOAD_ARGS_##nr (args) \ @@ -198,19 +179,12 @@ _sys_result; }) # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) # undef INTERNAL_SYSCALL_AARCH64 -# define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +# define INTERNAL_SYSCALL_AARCH64(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(__ARM_NR_##name, nr, args) # define LOAD_ARGS_0() \ register long _x0 asm ("x0"); @@ -253,8 +227,11 @@ # define ASM_ARGS_7 ASM_ARGS_6, "r" (_x6) # undef INTERNAL_SYSCALL_NCS -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW (number, err, nr, args) +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW (number, nr, args) + +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 #endif /* __ASSEMBLER__ */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h deleted file mode 100644 index 0064ca09ff..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/stat.h +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_GLIBC2 1 -#define _STAT_VER_GLIBC2_1 2 -#define _STAT_VER_KERNEL64 3 -#define _STAT_VER_GLIBC2_3_4 3 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - - -/* Nanosecond resolution timestamps are stored in a format equivalent to - 'struct timespec'. This is the type used whenever possible but the - Unix namespace rules do not allow the identifier 'timespec' to appear - in the header. Therefore we have to handle the use of - this header in strictly standard-compliant sources special. - - Use neat tidy anonymous unions and structures when possible. */ - -#ifdef __USE_XOPEN2K8 -# if __GNUC_PREREQ(3,3) -# define __ST_TIME(X) \ - __extension__ union { \ - struct timespec st_##X##tim; \ - struct { \ - __time_t st_##X##time; \ - unsigned long st_##X##timensec; \ - }; \ - } -# else -# define __ST_TIME(X) struct timespec st_##X##tim -# define st_atime st_atim.tv_sec -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# endif -#else -# define __ST_TIME(X) \ - __time_t st_##X##time; \ - unsigned long st_##X##timensec -#endif - - -struct stat - { - __dev_t st_dev; /* Device. */ -#ifdef __USE_FILE_OFFSET64 - __ino64_t st_ino; /* File serial number. */ -#else - __ino_t st_ino; /* File serial number. */ - int __pad0; /* 64-bit st_ino. */ -#endif - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -#ifdef __USE_FILE_OFFSET64 - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -#else - __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ - int __pad1; /* 64-bit st_blocks. */ -#endif - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __nlink_t st_nlink; /* Link count. */ - int __pad2; /* Real padding. */ - __ST_TIME(a); /* Time of last access. */ - __ST_TIME(m); /* Time of last modification. */ - __ST_TIME(c); /* Time of last status change. */ - long __glibc_reserved[3]; - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 is the same shape as stat. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __nlink_t st_nlink; /* Link count. */ - int __pad0; /* Real padding. */ - __ST_TIME(a); /* Time of last access. */ - __ST_TIME(m); /* Time of last modification. */ - __ST_TIME(c); /* Time of last status change. */ - long __glibc_reserved[3]; - }; -#endif - -#undef __ST_TIME - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h index 30356ba6d6..9bdc925168 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,6 +49,7 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __S64_TYPE +#define __SUSECONDS64_T_TYPE __S64_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -72,6 +73,9 @@ /* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 0 +/* And for getitimer, setitimer and rusage */ +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 + /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h index 5f003e634a..9e17d3f60c 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 2010-2020 Free Software Foundation, Inc. + Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h new file mode 100644 index 0000000000..a292920969 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -0,0 +1,91 @@ +/* Definition of `struct stat' used in the kernel. */ +struct kernel_stat + { + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + long int st_size; + unsigned long int st_atime_sec; + unsigned long int st_mtime_sec; + unsigned long int st_ctime_sec; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; + }; + +/* Definition of `struct stat64' used in the kernel. */ +struct kernel_stat64 + { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_rdev; + long st_size; + unsigned long st_blocks; + + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; + + unsigned long st_atime_sec; + unsigned long st_atimensec; + unsigned long st_mtime_sec; + unsigned long st_mtimensec; + unsigned long st_ctime_sec; + unsigned long st_ctimensec; + long __glibc_reserved[3]; + }; + +/* Definition of `struct stat' used by glibc 2.0. */ +struct glibc2_stat + { + __dev_t st_dev; + __ino_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + __off_t st_size; + __time_t st_atime_sec; + __time_t st_mtime_sec; + __time_t st_ctime_sec; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; + }; + +/* Definition of `struct stat' used by glibc 2.1. */ +struct glibc21_stat + { + __dev_t st_dev; + __ino64_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + __off_t st_size; + __time_t st_atime_sec; + __time_t st_mtime_sec; + __time_t st_ctime_sec; + __blkcnt64_t st_blocks; + __blksize_t st_blksize; + unsigned int st_flags; + unsigned int st_gen; + int __pad3; + long __glibc_reserved[4]; + }; + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h index f8c9e589ec..a000c845f1 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. @@ -19,14 +19,10 @@ #ifndef _LINUX_ALPHA_SYSDEP_H #define _LINUX_ALPHA_SYSDEP_H 1 -#ifdef __ASSEMBLER__ -#include -#include -#endif - /* There is some commonality. */ #include -#include +#include +#include /* Defines RTLD_PRIVATE_ERRNO. */ #include @@ -39,4 +35,325 @@ #define SINGLE_THREAD_BY_GLOBAL 1 -#endif /* _LINUX_ALPHA_SYSDEP_H */ +#ifdef __ASSEMBLER__ +#include +#include + +#define __LABEL(x) x##: + +#define LEAF(name, framesize) \ + .globl name; \ + .align 4; \ + .ent name, 0; \ + __LABEL(name) \ + .frame sp, framesize, ra + +#define ENTRY(name) \ + .globl name; \ + .align 4; \ + .ent name, 0; \ + __LABEL(name) \ + .frame sp, 0, ra + +/* Mark the end of function SYM. */ +#undef END +#define END(sym) .end sym + +#ifdef PROF +# define PSEUDO_PROF \ + .set noat; \ + lda AT, _mcount; \ + jsr AT, (AT), _mcount; \ + .set at +#else +# define PSEUDO_PROF +#endif + +#ifdef PROF +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + ldgp gp,0(pv); \ + PSEUDO_PROF; \ + .prologue 1 +#elif defined PIC +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + .prologue 0 +#else +# define PSEUDO_PROLOGUE \ + .frame sp, 0, ra; \ + ldgp gp,0(pv); \ + .prologue 1 +#endif /* PROF */ + +#ifdef PROF +# define USEPV_PROF std +#else +# define USEPV_PROF no +#endif + +#undef SYSCALL_ERROR_LABEL +#if RTLD_PRIVATE_ERRNO +# define SYSCALL_ERROR_LABEL $syscall_error +# define SYSCALL_ERROR_HANDLER \ +$syscall_error: \ + stl v0, rtld_errno(gp) !gprel; \ + lda v0, -1; \ + ret +# define SYSCALL_ERROR_FALLTHRU +#elif defined(PIC) +# define SYSCALL_ERROR_LABEL __syscall_error !samegp +# define SYSCALL_ERROR_HANDLER +# define SYSCALL_ERROR_FALLTHRU br SYSCALL_ERROR_LABEL +#else +# define SYSCALL_ERROR_LABEL $syscall_error +# define SYSCALL_ERROR_HANDLER \ +$syscall_error: \ + jmp $31, __syscall_error +# define SYSCALL_ERROR_FALLTHRU +#endif /* RTLD_PRIVATE_ERRNO */ + +/* Overridden by specific syscalls. */ +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS /* Nothing. */ + +#define PSEUDO(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; \ + bne a3, SYSCALL_ERROR_LABEL + +#undef PSEUDO_END +#define PSEUDO_END(sym) \ + SYSCALL_ERROR_HANDLER; \ + END(sym) + +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(sym) END(sym) + +#define ret_NOERRNO ret + +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .ent name,0; \ +__LABEL(name) \ + PSEUDO_PROLOGUE; \ + PSEUDO_PREPARE_ARGS \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(sym) END(sym) + +#define ret_ERRVAL ret + +#define r0 v0 +#define r1 a4 + +#define MOVE(x,y) mov x,y + +#else /* !ASSEMBLER */ + +#define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr(__NR_##name, args) + +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ + internal_syscall##nr(name, args) + +/* The normal Alpha calling convention sign-extends 32-bit quantties + no matter what the "real" sign of the 32-bit type. We want to + preserve that when filling in values for the kernel. */ +#define syscall_promote(arg) \ + (sizeof (arg) == 4 ? (long int)(int)(long int)(arg) : (long int)(arg)) + +#define internal_syscall_clobbers \ + "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ + "$22", "$23", "$24", "$25", "$27", "$28", "memory" + +/* It is moderately important optimization-wise to limit the lifetime + of the hard-register variables as much as possible. Thus we copy + in/out as close to the asm as possible. */ + +#define internal_syscall0(name, args...) \ +({ \ + register long int _sc_19 __asm__("$19"); \ + register long int _sc_0 = name; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2" \ + : "+v"(_sc_0), "=r"(_sc_19) \ + : : internal_syscall_clobbers, \ + "$16", "$17", "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall1(name,arg1) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3" \ + : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16) \ + : : internal_syscall_clobbers, \ + "$17", "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall2(name,arg1,arg2) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _tmp_17 = syscall_promote (arg2); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_17 __asm__("$17") = _tmp_17; \ + register long int _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4" \ + : "+v"(_sc_0), "=r"(_sc_19), \ + "+r"(_sc_16), "+r"(_sc_17) \ + : : internal_syscall_clobbers, \ + "$18", "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall3(name,arg1,arg2,arg3) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _tmp_17 = syscall_promote (arg2); \ + register long int _tmp_18 = syscall_promote (arg3); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_17 __asm__("$17") = _tmp_17; \ + register long int _sc_18 __asm__("$18") = _tmp_18; \ + register long int _sc_19 __asm__("$19"); \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5" \ + : "+v"(_sc_0), "=r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18) \ + : : internal_syscall_clobbers, "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall4(name,arg1,arg2,arg3,arg4) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _tmp_17 = syscall_promote (arg2); \ + register long int _tmp_18 = syscall_promote (arg3); \ + register long int _tmp_19 = syscall_promote (arg4); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_17 __asm__("$17") = _tmp_17; \ + register long int _sc_18 __asm__("$18") = _tmp_18; \ + register long int _sc_19 __asm__("$19") = _tmp_19; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18) \ + : : internal_syscall_clobbers, "$20", "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _tmp_17 = syscall_promote (arg2); \ + register long int _tmp_18 = syscall_promote (arg3); \ + register long int _tmp_19 = syscall_promote (arg4); \ + register long int _tmp_20 = syscall_promote (arg5); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_17 __asm__("$17") = _tmp_17; \ + register long int _sc_18 __asm__("$18") = _tmp_18; \ + register long int _sc_19 __asm__("$19") = _tmp_19; \ + register long int _sc_20 __asm__("$20") = _tmp_20; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20) \ + : : internal_syscall_clobbers, "$21"); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) + +#define internal_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ +({ \ + register long int _tmp_16 = syscall_promote (arg1); \ + register long int _tmp_17 = syscall_promote (arg2); \ + register long int _tmp_18 = syscall_promote (arg3); \ + register long int _tmp_19 = syscall_promote (arg4); \ + register long int _tmp_20 = syscall_promote (arg5); \ + register long int _tmp_21 = syscall_promote (arg6); \ + register long int _sc_0 = name; \ + register long int _sc_16 __asm__("$16") = _tmp_16; \ + register long int _sc_17 __asm__("$17") = _tmp_17; \ + register long int _sc_18 __asm__("$18") = _tmp_18; \ + register long int _sc_19 __asm__("$19") = _tmp_19; \ + register long int _sc_20 __asm__("$20") = _tmp_20; \ + register long int _sc_21 __asm__("$21") = _tmp_21; \ + __asm__ __volatile__ \ + ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ + : "+v"(_sc_0), "+r"(_sc_19), "+r"(_sc_16), \ + "+r"(_sc_17), "+r"(_sc_18), "+r"(_sc_20), \ + "+r"(_sc_21) \ + : : internal_syscall_clobbers); \ + _sc_19 != 0 ? -_sc_0 : _sc_0; \ +}) +#endif /* ASSEMBLER */ + +/* Pointer mangling support. Note that tls access is slow enough that + we don't deoptimize things by placing the pointer check value there. */ + +#ifdef __ASSEMBLER__ +# if IS_IN (rtld) +# define PTR_MANGLE(dst, src, tmp) \ + ldah tmp, __pointer_chk_guard_local($29) !gprelhigh; \ + ldq tmp, __pointer_chk_guard_local(tmp) !gprellow; \ + xor src, tmp, dst +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# elif defined SHARED +# define PTR_MANGLE(dst, src, tmp) \ + ldq tmp, __pointer_chk_guard; \ + xor src, tmp, dst +# else +# define PTR_MANGLE(dst, src, tmp) \ + ldq tmp, __pointer_chk_guard_local; \ + xor src, tmp, dst +# endif +# define PTR_MANGLE2(dst, src, tmp) \ + xor src, tmp, dst +# define PTR_DEMANGLE(dst, tmp) PTR_MANGLE(dst, dst, tmp) +# define PTR_DEMANGLE2(dst, tmp) PTR_MANGLE2(dst, dst, tmp) +#else +# include +# if (IS_IN (rtld) \ + || (!defined SHARED && (IS_IN (libc) \ + || IS_IN (libpthread)))) +extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden; +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) +# else +extern uintptr_t __pointer_chk_guard attribute_relro; +# define PTR_MANGLE(var) \ + (var) = (__typeof(var)) ((uintptr_t) (var) ^ __pointer_chk_guard) +# endif +# define PTR_DEMANGLE(var) PTR_MANGLE(var) +#endif /* ASSEMBLER */ + +#endif /* _LINUX_ALPHA_SYSDEP_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arc/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arc/sysdep.h new file mode 100644 index 0000000000..6b70ccc687 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/arc/sysdep.h @@ -0,0 +1,229 @@ +/* Assembler macros for ARC. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _LINUX_ARC_SYSDEP_H +#define _LINUX_ARC_SYSDEP_H 1 + +#include +#include + +/* "workarounds" for generic code needing to handle 64-bit time_t. */ + +/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ +#define __NR_clock_getres __NR_clock_getres_time64 +/* Fix sysdeps/nptl/lowlevellock-futex.h. */ +#define __NR_futex __NR_futex_time64 +/* Fix sysdeps/unix/sysv/linux/pause.c. */ +#define __NR_ppoll __NR_ppoll_time64 +/* Fix sysdeps/unix/sysv/linux/select.c. */ +#define __NR_pselect6 __NR_pselect6_time64 +/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ +#define __NR_recvmmsg __NR_recvmmsg_time64 +/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ +#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ +#define __NR_semtimedop __NR_semtimedop_time64 +/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ +#define __NR_utimensat __NR_utimensat_time64 + +/* For RTLD_PRIVATE_ERRNO. */ +#include + +#include + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +#ifdef __ASSEMBLER__ + +/* This is a "normal" system call stub: if there is an error, + it returns -1 and sets errno. */ + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + PSEUDO_NOERRNO(name, syscall_name, args) ASM_LINE_SEP \ + brhi r0, -4096, L (call_syscall_err) ASM_LINE_SEP + +# define ret j_s [blink] + +# undef PSEUDO_END +# define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER ASM_LINE_SEP \ + END (name) + +/* --------- Helper for SYSCALL_NOERRNO ----------- + This kind of system call stub never returns an error. + We return the return value register to the caller unexamined. */ + +# undef PSEUDO_NOERRNO +# define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text ASM_LINE_SEP \ + ENTRY (name) ASM_LINE_SEP \ + DO_CALL (syscall_name, args) ASM_LINE_SEP \ + +/* Return the return value register unexamined. Since r0 is both + syscall return reg and function return reg, no work needed. */ +# define ret_NOERRNO \ + j_s [blink] ASM_LINE_SEP + +# undef PSEUDO_END_NOERRNO +# define PSEUDO_END_NOERRNO(name) \ + END (name) + +/* --------- Helper for SYSCALL_ERRVAL ----------- + This kind of system call stub returns the errno code as its return + value, or zero for success. We may massage the kernel's return value + to meet that ABI, but we never set errno here. */ + +# undef PSEUDO_ERRVAL +# define PSEUDO_ERRVAL(name, syscall_name, args) \ + PSEUDO_NOERRNO(name, syscall_name, args) ASM_LINE_SEP + +/* Don't set errno, return kernel error (in errno form) or zero. */ +# define ret_ERRVAL \ + rsub r0, r0, 0 ASM_LINE_SEP \ + ret_NOERRNO + +# undef PSEUDO_END_ERRVAL +# define PSEUDO_END_ERRVAL(name) \ + END (name) + + +/* To reduce the code footprint, we confine the actual errno access + to single place in __syscall_error(). + This takes raw kernel error value, sets errno and returns -1. */ +# if IS_IN (libc) +# define CALL_ERRNO_SETTER_C bl PLTJMP(HIDDEN_JUMPTARGET(__syscall_error)) +# else +# define CALL_ERRNO_SETTER_C bl PLTJMP(__syscall_error) +# endif + +# define SYSCALL_ERROR_HANDLER \ +L (call_syscall_err): ASM_LINE_SEP \ + push_s blink ASM_LINE_SEP \ + cfi_adjust_cfa_offset (4) ASM_LINE_SEP \ + cfi_rel_offset (blink, 0) ASM_LINE_SEP \ + CALL_ERRNO_SETTER_C ASM_LINE_SEP \ + pop_s blink ASM_LINE_SEP \ + cfi_adjust_cfa_offset (-4) ASM_LINE_SEP \ + cfi_restore (blink) ASM_LINE_SEP \ + j_s [blink] + +# define DO_CALL(syscall_name, args) \ + mov r8, __NR_##syscall_name ASM_LINE_SEP \ + ARC_TRAP_INSN ASM_LINE_SEP + +# define ARC_TRAP_INSN trap_s 0 + +#else /* !__ASSEMBLER__ */ + +# define SINGLE_THREAD_BY_GLOBAL 1 + +# if IS_IN (libc) +extern long int __syscall_error (long int); +hidden_proto (__syscall_error) +# endif + +# define ARC_TRAP_INSN "trap_s 0 \n\t" + +# undef INTERNAL_SYSCALL_NCS +# define INTERNAL_SYSCALL_NCS(number, nr_args, args...) \ + ({ \ + /* Per ABI, r0 is 1st arg and return reg. */ \ + register long int __ret __asm__("r0"); \ + register long int _sys_num __asm__("r8"); \ + \ + LOAD_ARGS_##nr_args (number, args) \ + \ + __asm__ volatile ( \ + ARC_TRAP_INSN \ + : "+r" (__ret) \ + : "r"(_sys_num) ASM_ARGS_##nr_args \ + : "memory"); \ + \ + __ret; }) + +# undef INTERNAL_SYSCALL +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS(__NR_##name, nr, args) + +/* Macros for setting up inline __asm__ input regs. */ +# define ASM_ARGS_0 +# define ASM_ARGS_1 ASM_ARGS_0, "r" (__ret) +# define ASM_ARGS_2 ASM_ARGS_1, "r" (_arg2) +# define ASM_ARGS_3 ASM_ARGS_2, "r" (_arg3) +# define ASM_ARGS_4 ASM_ARGS_3, "r" (_arg4) +# define ASM_ARGS_5 ASM_ARGS_4, "r" (_arg5) +# define ASM_ARGS_6 ASM_ARGS_5, "r" (_arg6) +# define ASM_ARGS_7 ASM_ARGS_6, "r" (_arg7) + +/* Macros for converting sys-call wrapper args into sys call args. */ +# define LOAD_ARGS_0(nm, arg) \ + _sys_num = (long int) (nm); + +# define LOAD_ARGS_1(nm, arg1) \ + __ret = (long int) (arg1); \ + LOAD_ARGS_0 (nm, arg1) + +/* Note that the use of _tmpX might look superflous, however it is needed + to ensure that register variables are not clobbered if arg happens to be + a function call itself. e.g. sched_setaffinity() calling getpid() for arg2 + Also this specific order of recursive calling is important to segregate + the tmp args evaluation (function call case described above) and assigment + of register variables. */ + +# define LOAD_ARGS_2(nm, arg1, arg2) \ + long int _tmp2 = (long int) (arg2); \ + LOAD_ARGS_1 (nm, arg1) \ + register long int _arg2 __asm__ ("r1") = _tmp2; + +# define LOAD_ARGS_3(nm, arg1, arg2, arg3) \ + long int _tmp3 = (long int) (arg3); \ + LOAD_ARGS_2 (nm, arg1, arg2) \ + register long int _arg3 __asm__ ("r2") = _tmp3; + +#define LOAD_ARGS_4(nm, arg1, arg2, arg3, arg4) \ + long int _tmp4 = (long int) (arg4); \ + LOAD_ARGS_3 (nm, arg1, arg2, arg3) \ + register long int _arg4 __asm__ ("r3") = _tmp4; + +# define LOAD_ARGS_5(nm, arg1, arg2, arg3, arg4, arg5) \ + long int _tmp5 = (long int) (arg5); \ + LOAD_ARGS_4 (nm, arg1, arg2, arg3, arg4) \ + register long int _arg5 __asm__ ("r4") = _tmp5; + +# define LOAD_ARGS_6(nm, arg1, arg2, arg3, arg4, arg5, arg6)\ + long int _tmp6 = (long int) (arg6); \ + LOAD_ARGS_5 (nm, arg1, arg2, arg3, arg4, arg5) \ + register long int _arg6 __asm__ ("r5") = _tmp6; + +# define LOAD_ARGS_7(nm, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\ + long int _tmp7 = (int) (arg7); \ + LOAD_ARGS_6 (nm, arg1, arg2, arg3, arg4, arg5, arg6) \ + register long int _arg7 __asm__ ("r6") = _tmp7; + +/* Pointer mangling not yet supported. */ +# define PTR_MANGLE(var) (void) (var) +# define PTR_DEMANGLE(var) (void) (var) + +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + +#endif /* !__ASSEMBLER__ */ + +#endif /* linux/arc/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h index a148a4dc8c..61fa9436bc 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h index 591e0d8a88..3118f5a709 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h index 0c5f498583..c1722557bd 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. ARM changes by Philip Blundell, , May 1997. @@ -29,11 +29,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -317,21 +312,6 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #if defined(__thumb__) /* We can not expose the use of r7 to the compiler. GCC (as of 4.5) uses r7 as the hard frame pointer for Thumb - although @@ -348,7 +328,7 @@ __local_syscall_error: \ then unwinding will fail higher up the stack. So we move the syscall out of line and provide its own unwind information. */ # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ \ register int _a1 asm ("a1"); \ int _nametmp = name; \ @@ -361,7 +341,7 @@ __local_syscall_error: \ _a1; }) #else /* ARM */ # undef INTERNAL_SYSCALL_RAW -# define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_RAW(name, nr, args...) \ ({ \ register int _a1 asm ("r0"), _nr asm ("r7"); \ LOAD_ARGS_##nr (args) \ @@ -374,15 +354,8 @@ __local_syscall_error: \ #endif #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) #define VDSO_NAME "LINUX_2.6" #define VDSO_HASH 61765110 @@ -434,8 +407,8 @@ __local_syscall_error: \ /* For EABI, non-constant syscalls are actually pretty easy... */ #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - INTERNAL_SYSCALL_RAW (number, err, nr, args) +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW (number, nr, args) #define SINGLE_THREAD_BY_GLOBAL 1 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h index 240628a6f4..31868c81df 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,119 +22,7 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __ino64_t st_ino; /* File serial number. */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC +#include /* Encoding of the file mode. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h index 9adb0bcc60..ee37694e8f 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,6 +25,36 @@ struct timex { +# ifdef __USE_TIME_BITS64 + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror; /* maximum error (usec) */ + long long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + int :32; /* pad */ + long long constant; /* pll time constant */ + long long precision; /* clock precision (usec) (read only) */ + long long tolerance; /* clock frequency tolerance (ppm) (ro) */ + struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ + long long tick; /* (modified) usecs between clock ticks */ + long long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int :32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +# else unsigned int modes; /* mode selector */ __syscall_slong_t offset; /* time offset (usec) */ __syscall_slong_t freq; /* frequency offset (scaled ppm) */ @@ -51,6 +81,7 @@ struct timex int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; +# endif }; /* Mode codes (timex.mode) */ diff --git a/lib/libc/include/mips-linux-gnu/bits/wordsize.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/csky/kernel_stat.h similarity index 69% rename from lib/libc/include/mips-linux-gnu/bits/wordsize.h rename to lib/libc/glibc/sysdeps/unix/sysv/linux/csky/kernel_stat.h index 9e405e4e4e..e993021a81 100644 --- a/lib/libc/include/mips-linux-gnu/bits/wordsize.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/csky/kernel_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. +/* Internal definitions for stat functions. Linux/csky. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,17 +16,6 @@ License along with the GNU C Library. If not, see . */ -#include - -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 -#endif - -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/csky/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/csky/sysdep.h new file mode 100644 index 0000000000..fd29b64b63 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/csky/sysdep.h @@ -0,0 +1,515 @@ +/* Assembly macros for C-SKY. + 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 + 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 + . */ + +#ifndef _LINUX_CSKY_SYSDEP_H +#define _LINUX_CSKY_SYSDEP_H 1 + +/* There is some commonality. */ +#include +#include +#include + +/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */ +#include + +#include + +/* In order to get __set_errno() definition in INLINE_SYSCALL. */ +#ifndef __ASSEMBLER__ +# include +#endif + +#undef SYS_ify +#define SYS_ify(syscall_name) (__NR_##syscall_name) + +#ifdef __ASSEMBLER__ +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in R0 + is a real error number. Linus said he will make sure the no syscall + returns a value in -1 .. -4095 as a valid result so we can safely + test with -4095. */ + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name); \ + DO_CALL (syscall_name, args); + +# define GETGB \ + grs t0, .Lgetpc; \ +.Lgetpc: \ + lrw gb, .Lgetpc@GOTPC; \ + addu gb, t0; + +# if IS_IN (libc) +# ifdef __PIC__ +# define PSEUDO_RET \ + btsti a0, 31; \ + bf 1f; \ + subi sp, 8; \ + st.w lr, (sp); \ + st.w gb, (sp, 4); \ + GETGB; \ + lrw a2, SYSCALL_ERROR@PLT; \ + add a2, gb; \ + ld.w a2, (a2); \ + jsr a2; \ + ld.w lr, (sp); \ + ld.w gb, (sp, 4); \ + addi sp, 8; \ +1: \ + rts +# else +# define PSEUDO_RET \ + btsti a0, 31; \ + bf 1f; \ + jmpi SYSCALL_ERROR; \ +1: \ + rts +# endif +# else +# ifdef __PIC__ +# define PSEUDO_RET \ + btsti a0, 31; \ + bf 1f; \ + subi sp, 8; \ + st.w lr, (sp); \ + st.w gb, (sp, 4); \ + GETGB; \ + bsr SYSCALL_ERROR; \ + ld.w lr, (sp); \ + ld.w gb, (sp, 4); \ + addi sp, 8; \ +1: \ + rts +# else +# define PSEUDO_RET \ + btsti a0, 31; \ + bt SYSCALL_ERROR; \ + rts +# endif +# endif + +# undef ret +# define ret PSEUDO_RET + +# undef PSEUDO_END +# define PSEUDO_END(name) \ + .align 4; \ + SYSCALL_ERROR_HANDLER; \ + END (name) + +# undef PSEUDO_NOERRNO +# define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY (name); \ + DO_CALL (syscall_name, args) + +# define PSEUDO_RET_NOERRNO rts + +# undef ret_NOERRNO +# define ret_NOERRNO PSEUDO_RET_NOERRNO + +# undef PSEUDO_END_NOERRNO +# define PSEUDO_END_NOERRNO(name) END (name) + +/* The function has to return the error code. */ +# undef PSEUDO_ERRVAL +# define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + not a0; \ + addi a0, 1 + +# undef PSEUDO_END_ERRVAL +# define PSEUDO_END_ERRVAL(name) END (name) + +# define ret_ERRVAL rts + +# if !IS_IN (libc) +# define SYSCALL_ERROR __local_syscall_error +# if RTLD_PRIVATE_ERRNO +# ifdef __PIC__ +# define SYSCALL_ERROR_HANDLER \ +__local_syscall_error: \ + lrw a1, rtld_errno@PLT; \ + addu a1, gb; \ + ldw a1, (a1); \ + rsubi a0, 0; \ + stw a0, (a1); \ + bmaski a0, 0; \ + rts +# else /* __PIC__ */ +# define SYSCALL_ERROR_HANDLER \ +__local_syscall_error: \ + lrw a1, rtld_errno; \ + rsubi a0, 0; \ + stw a0, (a1); \ + bmaski a0, 0; \ + rts +# endif /* __PIC__ */ +# else /* !RTLD_PRIVATE_ERRNO */ +# ifdef __PIC__ +# define SYSCALL_ERROR_HANDLER \ +__local_syscall_error: \ + subi sp, 8; \ + stw a0, (sp, 0); \ + stw r15, (sp, 4); \ + lrw a1, __errno_location@PLT; \ + add a1, gb; \ + ldw a1, (a1); \ + jsr a1; \ + ldw a1, (sp, 0); /* load errno*/ \ + ldw r15, (sp, 4); \ + addi sp, 8; \ + movi a2, 0; \ + rsub a1, a1, a2; \ + stw a1, (a0); \ + bmaski a0, 0; \ + rts +# else +# define SYSCALL_ERROR_HANDLER \ +__local_syscall_error: \ + subi sp, 8; \ + stw a0, (sp, 0); \ + stw r15, (sp, 4); \ + lrw a1, __errno_location; \ + jsr a1; \ + ldw a1, (sp, 0); /* load errno */ \ + ldw r15, (sp, 4); \ + addi sp, 8; \ + movi a2, 0; \ + rsub a1, a1, a2; \ + stw a1, (a0); \ + bmaski a0, 0; \ + rts +# endif /* __PIC__ */ +# endif/* RTLD_PRIVATE_ERROR */ +# else +# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ +# define SYSCALL_ERROR __syscall_error +# endif/* IS_IN (libc) */ + +/* define DO_CALL */ +# undef DO_CALL +# define DO_CALL(syscall_name, args) \ + DOARGS_##args; \ + lrw r7, SYS_ify(syscall_name); \ + trap 0; \ + UNDOARGS_##args + +# undef DOARGS_0 +# define DOARGS_0 \ + subi sp, 8; \ + cfi_adjust_cfa_offset (8); \ + stw r7, (sp, 0); \ + cfi_rel_offset (r7, 0); + +# undef DOARGS_1 +# define DOARGS_1 DOARGS_0 +# undef DOARGS_2 +# define DOARGS_2 DOARGS_0 +# undef DOARGS_3 +# define DOARGS_3 DOARGS_0 +# undef DOARGS_4 +# define DOARGS_4 DOARGS_0 +# undef DOARGS_5 +# define DOARGS_5 \ + subi sp, 8; \ + cfi_adjust_cfa_offset (8); \ + stw r7, (sp, 0); \ + cfi_rel_offset (7, 0); \ + stw r4, (sp, 4); \ + cfi_rel_offset (4, 4); \ + ldw r4, (sp, 8) +# undef DOARGS_6 +# define DOARGS_6 \ + subi sp, 16; \ + cfi_adjust_cfa_offset (16); \ + stw r7, (sp, 0); \ + cfi_rel_offset (7, 0); \ + stw r4, (sp, 4); \ + cfi_rel_offset (4, 4); \ + stw r5, (sp, 8); \ + cfi_rel_offset (5, 8); \ + ldw r4, (sp, 16); \ + ldw r5, (sp, 20) + +# undef UNDOARGS_0 +# define UNDOARGS_0 \ + ldw r7, (sp, 0); \ + cfi_restore (r7); \ + addi sp, 8; \ + cfi_adjust_cfa_offset (-8); + +# undef UNDOARGS_1 +# define UNDOARGS_1 UNDOARGS_0 +# undef UNDOARGS_2 +# define UNDOARGS_2 UNDOARGS_0 +# undef UNDOARGS_3 +# define UNDOARGS_3 UNDOARGS_0 +# undef UNDOARGS_4 +# define UNDOARGS_4 UNDOARGS_0 +# undef UNDOARGS_5 +# define UNDOARGS_5 \ + ldw r7, (sp, 0); \ + cfi_restore (r4); \ + ldw r4, (sp, 4); \ + cfi_restore (r4); \ + addi sp, 8; \ + cfi_adjust_cfa_offset (-8); + +# undef UNDOARGS_6 +# define UNDOARGS_6 \ + ldw r7, (sp, 0); \ + cfi_restore (r7); \ + ldw r4, (sp, 4); \ + cfi_restore (r4); \ + ldw r5, (sp, 8); \ + cfi_restore (r5); \ + addi sp, 16; \ + cfi_adjust_cfa_offset (-16); + +#else /* not __ASSEMBLER__ */ + +# undef INTERNAL_SYSCALL_RAW +# define INTERNAL_SYSCALL_RAW0(name, dummy...) \ + ({unsigned int __sys_result; \ + { \ + register int _a1 __asm__ ("a0"), _nr __asm__ ("r7"); \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW1(name, arg1) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1); \ + { \ + register int _a1 __asm__ ("a0"), _nr __asm__ ("r7"); \ + _a1 = _tmp_arg1; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW2(name, arg1, arg2) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + _a1 = _tmp_arg1, _a2 = _tmp_arg2; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW3(name, arg1, arg2, arg3) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + register int _tmp_arg3 = (int)(arg3); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + register int _a3 __asm__ ("a2"); \ + _a1 = _tmp_arg1; \ + _a2 = _tmp_arg2; \ + _a3 = _tmp_arg3; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2), \ + "r" (_a3) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW4(name, arg1, arg2, arg3, arg4) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3"); \ + _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3; \ + _a4 = _tmp_arg4; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2), \ + "r" (_a3), "r" (_a4) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW5(name, arg1, arg2, arg3, arg4, \ + arg5) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ + register int _tmp_arg5 = (int)(arg5); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3"); \ + register int _a5 __asm__ ("r4"); \ + _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3; \ + _a4 = _tmp_arg4, _a5 = _tmp_arg5; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2), \ + "r" (_a3), "r" (_a4), "r" (_a5) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW6(name, arg1, arg2, arg3, arg4, \ + arg5, arg6) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ + register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3"); \ + register int _a5 __asm__ ("r4"), _a6 __asm__ ("r5"); \ + _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3; \ + _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2), \ + "r" (_a3), "r" (_a4), "r" (_a5), \ + "r" (_a6) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# define INTERNAL_SYSCALL_RAW7(name, arg1, arg2, arg3, arg4, \ + arg5, arg6, arg7) \ + ({unsigned int __sys_result; \ + register int _tmp_arg1 = (int)(arg1), _tmp_arg2 = (int)(arg2); \ + register int _tmp_arg3 = (int)(arg3), _tmp_arg4 = (int)(arg4); \ + register int _tmp_arg5 = (int)(arg5), _tmp_arg6 = (int)(arg6); \ + register int _tmp_arg7 = (int)(arg7); \ + { \ + register int _nr __asm__ ("r7"); \ + register int _a1 __asm__ ("a0"), _a2 __asm__ ("a1"); \ + register int _a3 __asm__ ("a2"), _a4 __asm__ ("a3"); \ + register int _a5 __asm__ ("r4"), _a6 __asm__ ("r5"); \ + register int _a7 __asm__ ("r6"); \ + _a1 = _tmp_arg1, _a2 = _tmp_arg2, _a3 = _tmp_arg3; \ + _a4 = _tmp_arg4, _a5 = _tmp_arg5, _a6 = _tmp_arg6; \ + _a7 = _tmp_arg7; \ + _nr = name; \ + __asm__ __volatile__ ("trap 0 \n\t" \ + : "=r" (_a1) \ + : "r" (_nr), "r" (_a1), "r" (_a2), \ + "r" (_a3), "r" (_a4), "r" (_a5), \ + "r" (_a6), "r" (_a7) \ + : "memory"); \ + __sys_result = _a1; \ + } \ + (int) __sys_result; }) + +# undef INTERNAL_SYSCALL +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW##nr(SYS_ify(name), args) + +# undef INTERNAL_SYSCALL_NCS +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW##nr (number, args) + +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + +#endif /* __ASSEMBLER__ */ + +/* Pointer mangling support. */ +#if (IS_IN (rtld) \ + || (!defined SHARED && (IS_IN (libc) || IS_IN (libpthread)))) +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(dst, src, guard) \ + grs t0, 1f; \ +1: \ + lrw guard, 1b@GOTPC; \ + addu t0, guard; \ + lrw guard, __pointer_chk_guard_local@GOT; \ + ldr.w guard, (t0, guard << 0); \ + ldw guard, (guard, 0); \ + xor dst, src, guard; +# define PTR_DEMANGLE(dst, src, guard) PTR_MANGLE (dst, src, guard) +# define PTR_MANGLE2(dst, src, guard) \ + xor dst, src, guard +# define PTR_DEMANGLE2(dst, src, guard) PTR_MANGLE2 (dst, src, guard) +# else +extern uintptr_t __pointer_chk_guard_local; +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE(dst, src, guard) \ + grs t0, 1f; \ +1: \ + lrw guard, 1b@GOTPC; \ + addu t0, guard; \ + lrw guard, __pointer_chk_guard@GOT; \ + ldr.w guard, (t0, guard << 0); \ + ldw guard, (guard, 0); \ + xor dst, src, guard; +# define PTR_DEMANGLE(dst, src, guard) PTR_MANGLE (dst, src, guard) +# define PTR_MANGLE2(dst, src, guard) \ + xor dst, src, guard +# define PTR_DEMANGLE2(dst, src, guard) PTR_MANGLE2 (dst, src, guard) +# else +extern uintptr_t __pointer_chk_guard; +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + +#endif /* linux/csky/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h index 8ed45503e7..f07c804065 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. Linux version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. + Copyright (C) 2005-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat.c new file mode 100644 index 0000000000..31a172dcc8 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat.c @@ -0,0 +1,37 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include +#include + +#if !XSTAT_IS_XSTAT64 +int +__fstat (int fd, struct stat *buf) +{ + if (fd < 0) + { + __set_errno (EBADF); + return -1; + } + return __fstatat (fd, "", buf, AT_EMPTY_PATH); +} + +weak_alias (__fstat, fstat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat64.c new file mode 100644 index 0000000000..46de80b663 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstat64.c @@ -0,0 +1,64 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __fstat __redirect___fstat +#define fstat __redirect_fstat +#include +#include +#include +#include +#include + +int +__fstat64_time64 (int fd, struct __stat64_t64 *buf) +{ + if (fd < 0) + { + __set_errno (EBADF); + return -1; + } + return __fstatat64_time64 (fd, "", buf, AT_EMPTY_PATH); +} +#if __TIMESIZE != 64 +hidden_def (__fstat64_time64) + +int +__fstat64 (int fd, struct stat64 *buf) +{ + if (fd < 0) + { + __set_errno (EBADF); + return -1; + } + + struct __stat64_t64 st_t64; + return __fstat64_time64 (fd, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); +} +#endif + +#undef __fstat +#undef fstat + +hidden_def (__fstat64) +weak_alias (__fstat64, fstat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__fstat64, __fstat) +weak_alias (__fstat64, fstat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c new file mode 100644 index 0000000000..f0171cf1ec --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c @@ -0,0 +1,82 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include +#include +#include + +#if !XSTAT_IS_XSTAT64 +# include + +static inline bool +in_time_t_range (__time64_t t) +{ + time_t s = t; + return s == t; +} + +static inline struct timespec +valid_timespec64_to_timespec (const struct __timespec64 ts64) +{ + struct timespec ts; + + ts.tv_sec = (time_t) ts64.tv_sec; + ts.tv_nsec = ts64.tv_nsec; + + return ts; +} + +int +__fstatat (int fd, const char *file, struct stat *buf, int flag) +{ + struct __stat64_t64 st64; + int r = __fstatat64_time64 (fd, file, &st64, flag); + if (r == 0) + { + if (! in_ino_t_range (st64.st_ino) + || ! in_off_t_range (st64.st_size) + || ! in_blkcnt_t_range (st64.st_blocks) + || ! in_time_t_range (st64.st_atim.tv_sec) + || ! in_time_t_range (st64.st_mtim.tv_sec) + || ! in_time_t_range (st64.st_ctim.tv_sec)) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); + + /* Clear internal pad and reserved fields. */ + memset (buf, 0, sizeof (*buf)); + + buf->st_dev = st64.st_dev; + buf->st_ino = st64.st_ino; + buf->st_mode = st64.st_mode; + buf->st_nlink = st64.st_nlink; + buf->st_uid = st64.st_uid; + buf->st_gid = st64.st_gid; + buf->st_rdev = st64.st_rdev; + buf->st_size = st64.st_size; + buf->st_blksize = st64.st_blksize; + buf->st_blocks = st64.st_blocks; + buf->st_atim = valid_timespec64_to_timespec (st64.st_atim); + buf->st_mtim = valid_timespec64_to_timespec (st64.st_mtim); + buf->st_ctim = valid_timespec64_to_timespec (st64.st_ctim); + } + return r; +} + +weak_alias (__fstatat, fstatat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c new file mode 100644 index 0000000000..ea1d6ce14f --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c @@ -0,0 +1,200 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __fstatat __redirect___fstatat +#define fstatat __redirect_fstatat +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if __TIMESIZE == 64 \ + && (__WORDSIZE == 32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) +/* Sanity check to avoid newer 32-bit ABI to support non-LFS calls. */ +_Static_assert (sizeof (__off_t) == sizeof (__off64_t), + "__blkcnt_t and __blkcnt64_t must match"); +_Static_assert (sizeof (__ino_t) == sizeof (__ino64_t), + "__blkcnt_t and __blkcnt64_t must match"); +_Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t), + "__blkcnt_t and __blkcnt64_t must match"); +#endif + +static inline int +fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, + int flag) +{ + /* 32-bit kABI with default 64-bit time_t, e.g. arc, riscv32. Also + 64-bit time_t support is done through statx syscall. */ + struct statx tmp; + int r = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, + STATX_BASIC_STATS, &tmp); + if (r != 0) + return r; + + *buf = (struct __stat64_t64) { + .st_dev = gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor), + .st_rdev = gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), + .st_ino = tmp.stx_ino, + .st_mode = tmp.stx_mode, + .st_nlink = tmp.stx_nlink, + .st_uid = tmp.stx_uid, + .st_gid = tmp.stx_gid, + .st_atime = tmp.stx_atime.tv_sec, + .st_atim.tv_nsec = tmp.stx_atime.tv_nsec, + .st_mtime = tmp.stx_mtime.tv_sec, + .st_mtim.tv_nsec = tmp.stx_mtime.tv_nsec, + .st_ctime = tmp.stx_ctime.tv_sec, + .st_ctim.tv_nsec = tmp.stx_ctime.tv_nsec, + .st_size = tmp.stx_size, + .st_blocks = tmp.stx_blocks, + .st_blksize = tmp.stx_blksize, + }; + + return r; +} + +static inline struct __timespec64 +valid_timespec_to_timespec64 (const struct timespec ts) +{ + struct __timespec64 ts64; + + ts64.tv_sec = ts.tv_sec; + ts64.tv_nsec = ts.tv_nsec; + + return ts64; +} + +static inline int +fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf, + int flag) +{ + int r; + +#if XSTAT_IS_XSTAT64 +# ifdef __NR_newfstatat + /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and + x86_64. */ + r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, buf, flag); +# elif defined __NR_fstatat64 +# if STAT64_IS_KERNEL_STAT64 + /* 64-bit kABI outlier, e.g. alpha */ + r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, buf, flag); +# else + /* 64-bit kABI outlier, e.g. sparc64. */ + struct kernel_stat64 kst64; + r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &kst64, flag); + if (r == 0) + __cp_stat64_kstat64 (buf, &kst64); +# endif +# endif +#else +# ifdef __NR_fstatat64 + /* All kABIs with non-LFS support and with old 32-bit time_t support + e.g. arm, csky, i386, hppa, m68k, microblaze, nios2, sh, powerpc32, + and sparc32. */ + struct stat64 st64; + r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); + if (r == 0) + { + /* Clear both pad and reserved fields. */ + memset (buf, 0, sizeof (*buf)); + + buf->st_dev = st64.st_dev, + buf->st_ino = st64.st_ino; + buf->st_mode = st64.st_mode; + buf->st_nlink = st64.st_nlink; + buf->st_uid = st64.st_uid; + buf->st_gid = st64.st_gid; + buf->st_rdev = st64.st_rdev; + buf->st_size = st64.st_size; + buf->st_blksize = st64.st_blksize; + buf->st_blocks = st64.st_blocks; + buf->st_atim = valid_timespec_to_timespec64 (st64.st_atim); + buf->st_mtim = valid_timespec_to_timespec64 (st64.st_mtim); + buf->st_ctim = valid_timespec_to_timespec64 (st64.st_ctim); + } +# else + /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ + struct kernel_stat kst; + r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); + if (r == 0) + __cp_kstat_stat64_t64 (&kst, buf); +# endif +#endif + + return r; +} + +#if (__WORDSIZE == 32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) \ + || defined STAT_HAS_TIME32 +# define FSTATAT_USE_STATX 1 +#else +# define FSTATAT_USE_STATX 0 +#endif + +int +__fstatat64_time64 (int fd, const char *file, struct __stat64_t64 *buf, + int flag) +{ + int r; + +#if FSTATAT_USE_STATX + r = fstatat64_time64_statx (fd, file, buf, flag); +# ifndef __ASSUME_STATX + if (r == -ENOSYS) + r = fstatat64_time64_stat (fd, file, buf, flag); +# endif +#else + r = fstatat64_time64_stat (fd, file, buf, flag); +#endif + + return INTERNAL_SYSCALL_ERROR_P (r) + ? INLINE_SYSCALL_ERROR_RETURN_VALUE (-r) + : 0; +} +#if __TIMESIZE != 64 +hidden_def (__fstatat64_time64) + +int +__fstatat64 (int fd, const char *file, struct stat64 *buf, int flags) +{ + struct __stat64_t64 st_t64; + return __fstatat64_time64 (fd, file, &st_t64, flags) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); +} +#endif + +#undef __fstatat +#undef fstatat + +hidden_def (__fstatat64) +weak_alias (__fstatat64, fstatat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__fstatat64, __fstatat) +weak_alias (__fstatat64, fstatat) +strong_alias (__fstatat64, __GI___fstatat); +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h deleted file mode 100644 index 8d0980f0f5..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -#include -#include - -/* 64-bit libc uses the kernel's 'struct stat', accessed via the - stat() syscall; 32-bit libc uses the kernel's 'struct stat64' - and accesses it via the stat64() syscall. All the various - APIs offered by libc use the kernel shape for their struct stat - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (specifically st_ino, st_size, and st_blocks). */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 0 -#define _STAT_VER _STAT_VER_KERNEL - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - -#if defined __USE_FILE_OFFSET64 -# define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T -# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T -# error "ino_t and off_t must both be the same type" -# endif -# define __field64(type, type64, name) type name -#elif __BYTE_ORDER == __LITTLE_ENDIAN -# define __field64(type, type64, name) \ - type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad -#else -# define __field64(type, type64, name) \ - int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name -#endif - -struct stat - { - __dev_t st_dev; /* Device. */ - __field64(__ino_t, __ino64_t, st_ino); /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - __dev_t __pad1; - __field64(__off_t, __off64_t, st_size); /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad2; - __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - int __glibc_reserved[2]; - }; - -#undef __field64 - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - __dev_t __pad1; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad2; - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - int __glibc_reserved[2]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index a916dea047..0dd33638f0 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. - Copyright (C) 2011-2020 Free Software Foundation, Inc. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. @@ -26,31 +26,45 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ +#if __TIMESIZE == 64 && __WORDSIZE == 32 +/* These are the "new" y2038 types defined for architectures added after + the 5.1 kernel. */ +# define __INO_T_TYPE __UQUAD_TYPE +# define __OFF_T_TYPE __SQUAD_TYPE +# define __RLIM_T_TYPE __UQUAD_TYPE +# define __BLKCNT_T_TYPE __SQUAD_TYPE +# define __FSBLKCNT_T_TYPE __UQUAD_TYPE +# define __FSFILCNT_T_TYPE __UQUAD_TYPE +# define __TIME_T_TYPE __SQUAD_TYPE +# define __SUSECONDS_T_TYPE __SQUAD_TYPE +#else +# define __INO_T_TYPE __ULONGWORD_TYPE +# define __OFF_T_TYPE __SLONGWORD_TYPE +# define __RLIM_T_TYPE __ULONGWORD_TYPE +# define __BLKCNT_T_TYPE __SLONGWORD_TYPE +# define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +# define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +# define __TIME_T_TYPE __SLONGWORD_TYPE +# define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#endif #define __DEV_T_TYPE __UQUAD_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE -#define __INO_T_TYPE __ULONGWORD_TYPE #define __INO64_T_TYPE __UQUAD_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE -#define __OFF_T_TYPE __SLONGWORD_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE #define __PID_T_TYPE __S32_TYPE -#define __RLIM_T_TYPE __ULONGWORD_TYPE #define __RLIM64_T_TYPE __UQUAD_TYPE -#define __BLKCNT_T_TYPE __SLONGWORD_TYPE #define __BLKCNT64_T_TYPE __SQUAD_TYPE -#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE #define __FSBLKCNT64_T_TYPE __UQUAD_TYPE -#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE #define __FSFILCNT64_T_TYPE __UQUAD_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE -#define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE -#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -62,7 +76,7 @@ #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE -#ifdef __LP64__ +#if defined __LP64__ || (__TIMESIZE == 64 && __WORDSIZE == 32) /* Tell the libc code that off_t and off64_t are actually the same type for all ABI purposes, even if possibly expressed as different base types for C type-checking purposes. */ @@ -76,11 +90,17 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 (__WORDSIZE == 64) #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif + /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h index 23defce7c3..19d5d8d1bf 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Chris Metcalf , 2011. @@ -25,11 +25,3 @@ #ifdef __NR_llseek # define __NR__llseek __NR_llseek #endif - -#if __WORDSIZE == 64 -/* By defining the older names, glibc will build syscall wrappers for - both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c - will suppress generating any separate code for pread64.c. */ -#define __NR_pread __NR_pread64 -#define __NR_pwrite __NR_pwrite64 -#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/xstatver.h new file mode 100644 index 0000000000..d8fd35beb6 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/generic/xstatver.h @@ -0,0 +1,10 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_LINUX 0 +#define _STAT_VER _STAT_VER_KERNEL + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 0 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h index 8548b5c258..e151894dfb 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 2006-2020 Free Software Foundation, Inc. + Copyright (C) 2006-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,11 +18,6 @@ . */ -/* Support for the utimes syscall was added in 3.14. */ -#if __LINUX_KERNEL_VERSION >= 0x030e00 -# define __ASSUME_UTIMES 1 -#endif - #include_next #define __ASSUME_RECV_SYSCALL 1 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h new file mode 100644 index 0000000000..e8ad135e70 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/kernel_stat.h @@ -0,0 +1,36 @@ +/* definition of "struct stat" from the kernel */ +struct kernel_stat { + unsigned long st_dev; /* dev_t is 32 bits on parisc */ + unsigned long st_ino; /* 32 bits */ + unsigned short st_mode; /* 16 bits */ + unsigned short st_nlink; /* 16 bits */ + unsigned short st_reserved1; /* old st_uid */ + unsigned short st_reserved2; /* old st_gid */ + unsigned long st_rdev; + unsigned long st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long st_blksize; + long st_blocks; + unsigned long __glibc_reserved1; /* ACL stuff */ + unsigned long __glibc_reserved2; /* network */ + unsigned long __glibc_reserved3; /* network */ + unsigned long __glibc_reserved4; /* cnodes */ + unsigned short __glibc_reserved5; /* netsite */ + short st_fstype; + unsigned long st_realdev; + unsigned short st_basemode; + unsigned short st_spareshort; + unsigned long st_uid; + unsigned long st_gid; + unsigned long st_spare4[3]; +}; + +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h deleted file mode 100644 index 5a1c641515..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/pthread.h +++ /dev/null @@ -1,1174 +0,0 @@ -/* Copyright (C) 2002-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _PTHREAD_H -#define _PTHREAD_H 1 - -#include -#include -#include -#include - -#include -#include -#include -#include - - -/* Detach state. */ -enum -{ - PTHREAD_CREATE_JOINABLE, -#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE - PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED -}; - - -/* Mutex types. */ -enum -{ - PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_ADAPTIVE_NP -#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 - , - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -#endif -#ifdef __USE_GNU - /* For compatibility. */ - , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP -#endif -}; - - -#ifdef __USE_XOPEN2K -/* Robust mutex or not flags. */ -enum -{ - PTHREAD_MUTEX_STALLED, - PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, - PTHREAD_MUTEX_ROBUST, - PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST -}; -#endif - - -#if defined __USE_POSIX199506 || defined __USE_UNIX98 -/* Mutex protocols. */ -enum -{ - PTHREAD_PRIO_NONE, - PTHREAD_PRIO_INHERIT, - PTHREAD_PRIO_PROTECT -}; -#endif - - -#define PTHREAD_MUTEX_INITIALIZER \ - { { 0, 0, 0, 0, { 0, 0, 0, 0 }, 0, { __PTHREAD_SPINS }, { 0, 0 } } } -#ifdef __USE_GNU -# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, { 0, 0, 0, 0 }, 0, \ - { __PTHREAD_SPINS }, { 0, 0 } } } -# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, { 0, 0, 0, 0 }, 0, \ - { __PTHREAD_SPINS }, { 0, 0 } } } -# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ - { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, { 0, 0, 0, 0 }, 0, \ - { __PTHREAD_SPINS }, { 0, 0 } } } -#endif - - -/* Read-write lock types. */ -#if defined __USE_UNIX98 || defined __USE_XOPEN2K -enum -{ - PTHREAD_RWLOCK_PREFER_READER_NP, - PTHREAD_RWLOCK_PREFER_WRITER_NP, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, - PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP -}; - -/* Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t - has the shared field. All 64-bit architectures have the shared field - in pthread_rwlock_t. */ -#ifndef __PTHREAD_RWLOCK_INT_FLAGS_SHARED -# if __WORDSIZE == 64 -# define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1 -# endif -#endif - - -/* Read-write lock initializers. */ -# define PTHREAD_RWLOCK_INITIALIZER \ - { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -# ifdef __USE_GNU -# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ - { { { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, 0, 0, 0 } } -# endif -#endif /* Unix98 or XOpen2K */ - - -/* Scheduler inheritance. */ -enum -{ - PTHREAD_INHERIT_SCHED, -#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED - PTHREAD_EXPLICIT_SCHED -#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED -}; - - -/* Scope handling. */ -enum -{ - PTHREAD_SCOPE_SYSTEM, -#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM - PTHREAD_SCOPE_PROCESS -#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS -}; - - -/* Process shared or private flag. */ -enum -{ - PTHREAD_PROCESS_PRIVATE, -#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE - PTHREAD_PROCESS_SHARED -#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED -}; - - -/* Conditional variable handling. */ -#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } } - - -/* Cleanup buffers */ -struct _pthread_cleanup_buffer -{ - void (*__routine) (void *); /* Function to call. */ - void *__arg; /* Its argument. */ - int __canceltype; /* Saved cancellation type. */ - struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ -}; - -/* Cancellation */ -enum -{ - PTHREAD_CANCEL_ENABLE, -#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE - PTHREAD_CANCEL_DISABLE -#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE -}; -enum -{ - PTHREAD_CANCEL_DEFERRED, -#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED - PTHREAD_CANCEL_ASYNCHRONOUS -#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS -}; -#define PTHREAD_CANCELED ((void *) -1) - - -/* Single execution handling. */ -#define PTHREAD_ONCE_INIT 0 - - -#ifdef __USE_XOPEN2K -/* Value returned by 'pthread_barrier_wait' for one of the threads after - the required number of threads have called this function. - -1 is distinct from 0 and all errno constants */ -# define PTHREAD_BARRIER_SERIAL_THREAD -1 -#endif - - -__BEGIN_DECLS - -/* Create a new thread, starting with execution of START-ROUTINE - getting passed ARG. Creation attributed come from ATTR. The new - handle is stored in *NEWTHREAD. */ -extern int pthread_create (pthread_t *__restrict __newthread, - const pthread_attr_t *__restrict __attr, - void *(*__start_routine) (void *), - void *__restrict __arg) __THROWNL __nonnull ((1, 3)); - -/* Terminate calling thread. - - The registered cleanup handlers are called via exception handling - so we cannot mark this function with __THROW.*/ -extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); - -/* Make calling thread wait for termination of the thread TH. The - exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN - is not NULL. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pthread_join (pthread_t __th, void **__thread_return); - -#ifdef __USE_GNU -/* Check whether thread TH has terminated. If yes return the status of - the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ -extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; - -/* Make calling thread wait for termination of the thread TH, but only - until TIMEOUT. The exit status of the thread is stored in - *THREAD_RETURN, if THREAD_RETURN is not NULL. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, - const struct timespec *__abstime); -#endif - -/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. - The resources of TH will therefore be freed immediately when it - terminates, instead of waiting for another thread to perform PTHREAD_JOIN - on it. */ -extern int pthread_detach (pthread_t __th) __THROW; - - -/* Obtain the identifier of the current thread. */ -extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); - -/* Compare two thread identifiers. */ -extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) - __THROW __attribute__ ((__const__)); - - -/* Thread attribute handling. */ - -/* Initialize thread attribute *ATTR with default attributes - (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, - no user-provided stack). */ -extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); - -/* Destroy thread attribute *ATTR. */ -extern int pthread_attr_destroy (pthread_attr_t *__attr) - __THROW __nonnull ((1)); - -/* Get detach state attribute. */ -extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, - int *__detachstate) - __THROW __nonnull ((1, 2)); - -/* Set detach state attribute. */ -extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, - int __detachstate) - __THROW __nonnull ((1)); - - -/* Get the size of the guard area created for stack overflow protection. */ -extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, - size_t *__guardsize) - __THROW __nonnull ((1, 2)); - -/* Set the size of the guard area created for stack overflow protection. */ -extern int pthread_attr_setguardsize (pthread_attr_t *__attr, - size_t __guardsize) - __THROW __nonnull ((1)); - - -/* Return in *PARAM the scheduling parameters of *ATTR. */ -extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, - struct sched_param *__restrict __param) - __THROW __nonnull ((1, 2)); - -/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ -extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, - const struct sched_param *__restrict - __param) __THROW __nonnull ((1, 2)); - -/* Return in *POLICY the scheduling policy of *ATTR. */ -extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict - __attr, int *__restrict __policy) - __THROW __nonnull ((1, 2)); - -/* Set scheduling policy in *ATTR according to POLICY. */ -extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) - __THROW __nonnull ((1)); - -/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ -extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict - __attr, int *__restrict __inherit) - __THROW __nonnull ((1, 2)); - -/* Set scheduling inheritance mode in *ATTR according to INHERIT. */ -extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, - int __inherit) - __THROW __nonnull ((1)); - - -/* Return in *SCOPE the scheduling contention scope of *ATTR. */ -extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, - int *__restrict __scope) - __THROW __nonnull ((1, 2)); - -/* Set scheduling contention scope in *ATTR according to SCOPE. */ -extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) - __THROW __nonnull ((1)); - -/* Return the previously set address for the stack. */ -extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict - __attr, void **__restrict __stackaddr) - __THROW __nonnull ((1, 2)) __attribute_deprecated__; - -/* Set the starting address of the stack of the thread to be created. - Depending on whether the stack grows up or down the value must either - be higher or lower than all the address in the memory block. The - minimal size of the block must be PTHREAD_STACK_MIN. */ -extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, - void *__stackaddr) - __THROW __nonnull ((1)) __attribute_deprecated__; - -/* Return the currently used minimal stack size. */ -extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict - __attr, size_t *__restrict __stacksize) - __THROW __nonnull ((1, 2)); - -/* Add information about the minimum stack size needed for the thread - to be started. This size must never be less than PTHREAD_STACK_MIN - and must also not exceed the system limits. */ -extern int pthread_attr_setstacksize (pthread_attr_t *__attr, - size_t __stacksize) - __THROW __nonnull ((1)); - -#ifdef __USE_XOPEN2K -/* Return the previously set address for the stack. */ -extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, - void **__restrict __stackaddr, - size_t *__restrict __stacksize) - __THROW __nonnull ((1, 2, 3)); - -/* The following two interfaces are intended to replace the last two. They - require setting the address as well as the size since only setting the - address will make the implementation on some architectures impossible. */ -extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, - size_t __stacksize) __THROW __nonnull ((1)); -#endif - -#ifdef __USE_GNU -/* Thread created with attribute ATTR will be limited to run only on - the processors represented in CPUSET. */ -extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, - size_t __cpusetsize, - const cpu_set_t *__cpuset) - __THROW __nonnull ((1, 3)); - -/* Get bit set in CPUSET representing the processors threads created with - ATTR can run on. */ -extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, - size_t __cpusetsize, - cpu_set_t *__cpuset) - __THROW __nonnull ((1, 3)); - -/* Get the default attributes used by pthread_create in this process. */ -extern int pthread_getattr_default_np (pthread_attr_t *__attr) - __THROW __nonnull ((1)); - -/* Set the default attributes to be used by pthread_create in this - process. */ -extern int pthread_setattr_default_np (const pthread_attr_t *__attr) - __THROW __nonnull ((1)); - -/* Initialize thread attribute *ATTR with attributes corresponding to the - already running thread TH. It shall be called on uninitialized ATTR - and destroyed with pthread_attr_destroy when no longer needed. */ -extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) - __THROW __nonnull ((2)); -#endif - - -/* Functions for scheduling control. */ - -/* Set the scheduling parameters for TARGET_THREAD according to POLICY - and *PARAM. */ -extern int pthread_setschedparam (pthread_t __target_thread, int __policy, - const struct sched_param *__param) - __THROW __nonnull ((3)); - -/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ -extern int pthread_getschedparam (pthread_t __target_thread, - int *__restrict __policy, - struct sched_param *__restrict __param) - __THROW __nonnull ((2, 3)); - -/* Set the scheduling priority for TARGET_THREAD. */ -extern int pthread_setschedprio (pthread_t __target_thread, int __prio) - __THROW; - - -#ifdef __USE_GNU -/* Get thread name visible in the kernel and its interfaces. */ -extern int pthread_getname_np (pthread_t __target_thread, char *__buf, - size_t __buflen) - __THROW __nonnull ((2)); - -/* Set thread name visible in the kernel and its interfaces. */ -extern int pthread_setname_np (pthread_t __target_thread, const char *__name) - __THROW __nonnull ((2)); -#endif - - -#ifdef __USE_UNIX98 -/* Determine level of concurrency. */ -extern int pthread_getconcurrency (void) __THROW; - -/* Set new concurrency level to LEVEL. */ -extern int pthread_setconcurrency (int __level) __THROW; -#endif - -#ifdef __USE_GNU -/* Yield the processor to another thread or process. - This function is similar to the POSIX `sched_yield' function but - might be differently implemented in the case of a m-on-n thread - implementation. */ -extern int pthread_yield (void) __THROW; - - -/* Limit specified thread TH to run only on the processors represented - in CPUSET. */ -extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, - const cpu_set_t *__cpuset) - __THROW __nonnull ((3)); - -/* Get bit set in CPUSET representing the processors TH can run on. */ -extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, - cpu_set_t *__cpuset) - __THROW __nonnull ((3)); -#endif - - -/* Functions for handling initialization. */ - -/* Guarantee that the initialization function INIT_ROUTINE will be called - only once, even if pthread_once is executed several times with the - same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or - extern variable initialized to PTHREAD_ONCE_INIT. - - The initialization functions might throw exception which is why - this function is not marked with __THROW. */ -extern int pthread_once (pthread_once_t *__once_control, - void (*__init_routine) (void)) __nonnull ((1, 2)); - - -/* Functions for handling cancellation. - - Note that these functions are explicitly not marked to not throw an - exception in C++ code. If cancellation is implemented by unwinding - this is necessary to have the compiler generate the unwind information. */ - -/* Set cancelability state of current thread to STATE, returning old - state in *OLDSTATE if OLDSTATE is not NULL. */ -extern int pthread_setcancelstate (int __state, int *__oldstate); - -/* Set cancellation state of current thread to TYPE, returning the old - type in *OLDTYPE if OLDTYPE is not NULL. */ -extern int pthread_setcanceltype (int __type, int *__oldtype); - -/* Cancel THREAD immediately or at the next possibility. */ -extern int pthread_cancel (pthread_t __th); - -/* Test for pending cancellation for the current thread and terminate - the thread as per pthread_exit(PTHREAD_CANCELED) if it has been - cancelled. */ -extern void pthread_testcancel (void); - - -/* Cancellation handling with integration into exception handling. */ - -typedef struct -{ - struct - { - __jmp_buf __cancel_jmp_buf; - int __mask_was_saved; - } __cancel_jmp_buf[1]; - void *__pad[4]; -} __pthread_unwind_buf_t __attribute__ ((__aligned__)); - -/* No special attributes by default. */ -#ifndef __cleanup_fct_attribute -# define __cleanup_fct_attribute -#endif - - -/* Structure to hold the cleanup handler information. */ -struct __pthread_cleanup_frame -{ - void (*__cancel_routine) (void *); - void *__cancel_arg; - int __do_it; - int __cancel_type; -}; - -#if defined __GNUC__ && defined __EXCEPTIONS -# ifdef __cplusplus -/* Class to handle cancellation handler invocation. */ -class __pthread_cleanup_class -{ - void (*__cancel_routine) (void *); - void *__cancel_arg; - int __do_it; - int __cancel_type; - - public: - __pthread_cleanup_class (void (*__fct) (void *), void *__arg) - : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } - ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); } - void __setdoit (int __newval) { __do_it = __newval; } - void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, - &__cancel_type); } - void __restore () const { pthread_setcanceltype (__cancel_type, 0); } -}; - -/* Install a cleanup handler: ROUTINE will be called with arguments ARG - when the thread is canceled or calls pthread_exit. ROUTINE will also - be called with arguments ARG when the matching pthread_cleanup_pop - is executed with non-zero EXECUTE argument. - - pthread_cleanup_push and pthread_cleanup_pop are macros and must always - be used in matching pairs at the same nesting level of braces. */ -# define pthread_cleanup_push(routine, arg) \ - do { \ - __pthread_cleanup_class __clframe (routine, arg) - -/* Remove a cleanup handler installed by the matching pthread_cleanup_push. - If EXECUTE is non-zero, the handler function is called. */ -# define pthread_cleanup_pop(execute) \ - __clframe.__setdoit (execute); \ - } while (0) - -# ifdef __USE_GNU -/* Install a cleanup handler as pthread_cleanup_push does, but also - saves the current cancellation type and sets it to deferred - cancellation. */ -# define pthread_cleanup_push_defer_np(routine, arg) \ - do { \ - __pthread_cleanup_class __clframe (routine, arg); \ - __clframe.__defer () - -/* Remove a cleanup handler as pthread_cleanup_pop does, but also - restores the cancellation type that was in effect when the matching - pthread_cleanup_push_defer was called. */ -# define pthread_cleanup_pop_restore_np(execute) \ - __clframe.__restore (); \ - __clframe.__setdoit (execute); \ - } while (0) -# endif -# else -/* Function called to call the cleanup handler. As an extern inline - function the compiler is free to decide inlining the change when - needed or fall back on the copy which must exist somewhere - else. */ -__extern_inline void -__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) -{ - if (__frame->__do_it) - __frame->__cancel_routine (__frame->__cancel_arg); -} - -/* Install a cleanup handler: ROUTINE will be called with arguments ARG - when the thread is canceled or calls pthread_exit. ROUTINE will also - be called with arguments ARG when the matching pthread_cleanup_pop - is executed with non-zero EXECUTE argument. - - pthread_cleanup_push and pthread_cleanup_pop are macros and must always - be used in matching pairs at the same nesting level of braces. */ -# define pthread_cleanup_push(routine, arg) \ - do { \ - struct __pthread_cleanup_frame __clframe \ - __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ - = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ - .__do_it = 1 }; - -/* Remove a cleanup handler installed by the matching pthread_cleanup_push. - If EXECUTE is non-zero, the handler function is called. */ -# define pthread_cleanup_pop(execute) \ - __clframe.__do_it = (execute); \ - } while (0) - -# ifdef __USE_GNU -/* Install a cleanup handler as pthread_cleanup_push does, but also - saves the current cancellation type and sets it to deferred - cancellation. */ -# define pthread_cleanup_push_defer_np(routine, arg) \ - do { \ - struct __pthread_cleanup_frame __clframe \ - __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ - = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ - .__do_it = 1 }; \ - (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \ - &__clframe.__cancel_type) - -/* Remove a cleanup handler as pthread_cleanup_pop does, but also - restores the cancellation type that was in effect when the matching - pthread_cleanup_push_defer was called. */ -# define pthread_cleanup_pop_restore_np(execute) \ - (void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \ - __clframe.__do_it = (execute); \ - } while (0) -# endif -# endif -#else -/* Install a cleanup handler: ROUTINE will be called with arguments ARG - when the thread is canceled or calls pthread_exit. ROUTINE will also - be called with arguments ARG when the matching pthread_cleanup_pop - is executed with non-zero EXECUTE argument. - - pthread_cleanup_push and pthread_cleanup_pop are macros and must always - be used in matching pairs at the same nesting level of braces. */ -# define pthread_cleanup_push(routine, arg) \ - do { \ - __pthread_unwind_buf_t __cancel_buf; \ - void (*__cancel_routine) (void *) = (routine); \ - void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ - if (__glibc_unlikely (__not_first_call)) \ - { \ - __cancel_routine (__cancel_arg); \ - __pthread_unwind_next (&__cancel_buf); \ - /* NOTREACHED */ \ - } \ - \ - __pthread_register_cancel (&__cancel_buf); \ - do { -extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute; - -/* Remove a cleanup handler installed by the matching pthread_cleanup_push. - If EXECUTE is non-zero, the handler function is called. */ -# define pthread_cleanup_pop(execute) \ - do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ - } while (0); \ - __pthread_unregister_cancel (&__cancel_buf); \ - if (execute) \ - __cancel_routine (__cancel_arg); \ - } while (0) -extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute; - -# ifdef __USE_GNU -/* Install a cleanup handler as pthread_cleanup_push does, but also - saves the current cancellation type and sets it to deferred - cancellation. */ -# define pthread_cleanup_push_defer_np(routine, arg) \ - do { \ - __pthread_unwind_buf_t __cancel_buf; \ - void (*__cancel_routine) (void *) = (routine); \ - void *__cancel_arg = (arg); \ - int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \ - __cancel_buf.__cancel_jmp_buf, 0); \ - if (__glibc_unlikely (__not_first_call)) \ - { \ - __cancel_routine (__cancel_arg); \ - __pthread_unwind_next (&__cancel_buf); \ - /* NOTREACHED */ \ - } \ - \ - __pthread_register_cancel_defer (&__cancel_buf); \ - do { -extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute; - -/* Remove a cleanup handler as pthread_cleanup_pop does, but also - restores the cancellation type that was in effect when the matching - pthread_cleanup_push_defer was called. */ -# define pthread_cleanup_pop_restore_np(execute) \ - do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ - } while (0); \ - __pthread_unregister_cancel_restore (&__cancel_buf); \ - if (execute) \ - __cancel_routine (__cancel_arg); \ - } while (0) -extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute; -# endif - -/* Internal interface to initiate cleanup. */ -extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) - __cleanup_fct_attribute __attribute__ ((__noreturn__)) -# ifndef SHARED - __attribute__ ((__weak__)) -# endif - ; -#endif - -/* Function used in the macros. */ -struct __jmp_buf_tag; -extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; - - -/* Mutex handling. */ - -/* Initialize a mutex. */ -extern int pthread_mutex_init (pthread_mutex_t *__mutex, - const pthread_mutexattr_t *__mutexattr) - __THROW __nonnull ((1)); - -/* Destroy a mutex. */ -extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) - __THROW __nonnull ((1)); - -/* Try locking a mutex. */ -extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) - __THROWNL __nonnull ((1)); - -/* Lock a mutex. */ -extern int pthread_mutex_lock (pthread_mutex_t *__mutex) - __THROWNL __nonnull ((1)); - -#ifdef __USE_XOPEN2K -/* Wait until lock becomes available, or specified time passes. */ -extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 2)); -#endif - -#ifdef __USE_GNU -extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, - clockid_t __clockid, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 3)); -#endif - -/* Unlock a mutex. */ -extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) - __THROWNL __nonnull ((1)); - - -/* Get the priority ceiling of MUTEX. */ -extern int pthread_mutex_getprioceiling (const pthread_mutex_t * - __restrict __mutex, - int *__restrict __prioceiling) - __THROW __nonnull ((1, 2)); - -/* Set the priority ceiling of MUTEX to PRIOCEILING, return old - priority ceiling value in *OLD_CEILING. */ -extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, - int __prioceiling, - int *__restrict __old_ceiling) - __THROW __nonnull ((1, 3)); - - -#ifdef __USE_XOPEN2K8 -/* Declare the state protected by MUTEX as consistent. */ -extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) - __THROW __nonnull ((1)); -# ifdef __USE_GNU -extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) - __THROW __nonnull ((1)); -# endif -#endif - - -/* Functions for handling mutex attributes. */ - -/* Initialize mutex attribute object ATTR with default attributes - (kind is PTHREAD_MUTEX_TIMED_NP). */ -extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) - __THROW __nonnull ((1)); - -/* Destroy mutex attribute object ATTR. */ -extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) - __THROW __nonnull ((1)); - -/* Get the process-shared flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * - __restrict __attr, - int *__restrict __pshared) - __THROW __nonnull ((1, 2)); - -/* Set the process-shared flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, - int __pshared) - __THROW __nonnull ((1)); - -#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 -/* Return in *KIND the mutex kind attribute in *ATTR. */ -extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict - __attr, int *__restrict __kind) - __THROW __nonnull ((1, 2)); - -/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, - PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or - PTHREAD_MUTEX_DEFAULT). */ -extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) - __THROW __nonnull ((1)); -#endif - -/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */ -extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * - __restrict __attr, - int *__restrict __protocol) - __THROW __nonnull ((1, 2)); - -/* Set the mutex protocol attribute in *ATTR to PROTOCOL (either - PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */ -extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, - int __protocol) - __THROW __nonnull ((1)); - -/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */ -extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * - __restrict __attr, - int *__restrict __prioceiling) - __THROW __nonnull ((1, 2)); - -/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */ -extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, - int __prioceiling) - __THROW __nonnull ((1)); - -#ifdef __USE_XOPEN2K -/* Get the robustness flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, - int *__robustness) - __THROW __nonnull ((1, 2)); -# ifdef __USE_GNU -extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, - int *__robustness) - __THROW __nonnull ((1, 2)); -# endif - -/* Set the robustness flag of the mutex attribute ATTR. */ -extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, - int __robustness) - __THROW __nonnull ((1)); -# ifdef __USE_GNU -extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, - int __robustness) - __THROW __nonnull ((1)); -# endif -#endif - - -#if defined __USE_UNIX98 || defined __USE_XOPEN2K -/* Functions for handling read-write locks. */ - -/* Initialize read-write lock RWLOCK using attributes ATTR, or use - the default values if later is NULL. */ -extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, - const pthread_rwlockattr_t *__restrict - __attr) __THROW __nonnull ((1)); - -/* Destroy read-write lock RWLOCK. */ -extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) - __THROW __nonnull ((1)); - -/* Acquire read lock for RWLOCK. */ -extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) - __THROWNL __nonnull ((1)); - -/* Try to acquire read lock for RWLOCK. */ -extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) - __THROWNL __nonnull ((1)); - -# ifdef __USE_XOPEN2K -/* Try to acquire read lock for RWLOCK or return after specfied time. */ -extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 2)); -# endif - -# ifdef __USE_GNU -extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, - clockid_t __clockid, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 3)); -# endif - -/* Acquire write lock for RWLOCK. */ -extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) - __THROWNL __nonnull ((1)); - -/* Try to acquire write lock for RWLOCK. */ -extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) - __THROWNL __nonnull ((1)); - -# ifdef __USE_XOPEN2K -/* Try to acquire write lock for RWLOCK or return after specfied time. */ -extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 2)); -# endif - -# ifdef __USE_GNU -extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, - clockid_t __clockid, - const struct timespec *__restrict - __abstime) __THROWNL __nonnull ((1, 3)); -# endif - -/* Unlock RWLOCK. */ -extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) - __THROWNL __nonnull ((1)); - - -/* Functions for handling read-write lock attributes. */ - -/* Initialize attribute object ATTR with default values. */ -extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) - __THROW __nonnull ((1)); - -/* Destroy attribute object ATTR. */ -extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) - __THROW __nonnull ((1)); - -/* Return current setting of process-shared attribute of ATTR in PSHARED. */ -extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * - __restrict __attr, - int *__restrict __pshared) - __THROW __nonnull ((1, 2)); - -/* Set process-shared attribute of ATTR to PSHARED. */ -extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, - int __pshared) - __THROW __nonnull ((1)); - -/* Return current setting of reader/writer preference. */ -extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * - __restrict __attr, - int *__restrict __pref) - __THROW __nonnull ((1, 2)); - -/* Set reader/write preference. */ -extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, - int __pref) __THROW __nonnull ((1)); -#endif - - -/* Functions for handling conditional variables. */ - -/* Initialize condition variable COND using attributes ATTR, or use - the default values if later is NULL. */ -extern int pthread_cond_init (pthread_cond_t *__restrict __cond, - const pthread_condattr_t *__restrict __cond_attr) - __THROW __nonnull ((1)); - -/* Destroy condition variable COND. */ -extern int pthread_cond_destroy (pthread_cond_t *__cond) - __THROW __nonnull ((1)); - -/* Wake up one thread waiting for condition variable COND. */ -extern int pthread_cond_signal (pthread_cond_t *__cond) - __THROWNL __nonnull ((1)); - -/* Wake up all threads waiting for condition variables COND. */ -extern int pthread_cond_broadcast (pthread_cond_t *__cond) - __THROWNL __nonnull ((1)); - -/* Wait for condition variable COND to be signaled or broadcast. - MUTEX is assumed to be locked before. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex) - __nonnull ((1, 2)); - -/* Wait for condition variable COND to be signaled or broadcast until - ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an - absolute time specification; zero is the beginning of the epoch - (00:00:00 GMT, January 1, 1970). - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex, - const struct timespec *__restrict __abstime) - __nonnull ((1, 2, 3)); - -# ifdef __USE_GNU -/* Wait for condition variable COND to be signaled or broadcast until - ABSTIME measured by the specified clock. MUTEX is assumed to be - locked before. CLOCK is the clock to use. ABSTIME is an absolute - time specification against CLOCK's epoch. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, - pthread_mutex_t *__restrict __mutex, - __clockid_t __clock_id, - const struct timespec *__restrict __abstime) - __nonnull ((1, 2, 4)); -# endif - -/* Functions for handling condition variable attributes. */ - -/* Initialize condition variable attribute ATTR. */ -extern int pthread_condattr_init (pthread_condattr_t *__attr) - __THROW __nonnull ((1)); - -/* Destroy condition variable attribute ATTR. */ -extern int pthread_condattr_destroy (pthread_condattr_t *__attr) - __THROW __nonnull ((1)); - -/* Get the process-shared flag of the condition variable attribute ATTR. */ -extern int pthread_condattr_getpshared (const pthread_condattr_t * - __restrict __attr, - int *__restrict __pshared) - __THROW __nonnull ((1, 2)); - -/* Set the process-shared flag of the condition variable attribute ATTR. */ -extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, - int __pshared) __THROW __nonnull ((1)); - -#ifdef __USE_XOPEN2K -/* Get the clock selected for the condition variable attribute ATTR. */ -extern int pthread_condattr_getclock (const pthread_condattr_t * - __restrict __attr, - __clockid_t *__restrict __clock_id) - __THROW __nonnull ((1, 2)); - -/* Set the clock selected for the condition variable attribute ATTR. */ -extern int pthread_condattr_setclock (pthread_condattr_t *__attr, - __clockid_t __clock_id) - __THROW __nonnull ((1)); -#endif - - -#ifdef __USE_XOPEN2K -/* Functions to handle spinlocks. */ - -/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can - be shared between different processes. */ -extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) - __THROW __nonnull ((1)); - -/* Destroy the spinlock LOCK. */ -extern int pthread_spin_destroy (pthread_spinlock_t *__lock) - __THROW __nonnull ((1)); - -/* Wait until spinlock LOCK is retrieved. */ -extern int pthread_spin_lock (pthread_spinlock_t *__lock) - __THROWNL __nonnull ((1)); - -/* Try to lock spinlock LOCK. */ -extern int pthread_spin_trylock (pthread_spinlock_t *__lock) - __THROWNL __nonnull ((1)); - -/* Release spinlock LOCK. */ -extern int pthread_spin_unlock (pthread_spinlock_t *__lock) - __THROWNL __nonnull ((1)); - - -/* Functions to handle barriers. */ - -/* Initialize BARRIER with the attributes in ATTR. The barrier is - opened when COUNT waiters arrived. */ -extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, - const pthread_barrierattr_t *__restrict - __attr, unsigned int __count) - __THROW __nonnull ((1)); - -/* Destroy a previously dynamically initialized barrier BARRIER. */ -extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) - __THROW __nonnull ((1)); - -/* Wait on barrier BARRIER. */ -extern int pthread_barrier_wait (pthread_barrier_t *__barrier) - __THROWNL __nonnull ((1)); - - -/* Initialize barrier attribute ATTR. */ -extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) - __THROW __nonnull ((1)); - -/* Destroy previously dynamically initialized barrier attribute ATTR. */ -extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) - __THROW __nonnull ((1)); - -/* Get the process-shared flag of the barrier attribute ATTR. */ -extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * - __restrict __attr, - int *__restrict __pshared) - __THROW __nonnull ((1, 2)); - -/* Set the process-shared flag of the barrier attribute ATTR. */ -extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, - int __pshared) - __THROW __nonnull ((1)); -#endif - - -/* Functions for handling thread-specific data. */ - -/* Create a key value identifying a location in the thread-specific - data area. Each thread maintains a distinct thread-specific data - area. DESTR_FUNCTION, if non-NULL, is called with the value - associated to that key when the key is destroyed. - DESTR_FUNCTION is not called if the value associated is NULL when - the key is destroyed. */ -extern int pthread_key_create (pthread_key_t *__key, - void (*__destr_function) (void *)) - __THROW __nonnull ((1)); - -/* Destroy KEY. */ -extern int pthread_key_delete (pthread_key_t __key) __THROW; - -/* Return current value of the thread-specific data slot identified by KEY. */ -extern void *pthread_getspecific (pthread_key_t __key) __THROW; - -/* Store POINTER in the thread-specific data slot identified by KEY. */ -extern int pthread_setspecific (pthread_key_t __key, - const void *__pointer) __THROW ; - - -#ifdef __USE_XOPEN2K -/* Get ID of CPU-time clock for thread THREAD_ID. */ -extern int pthread_getcpuclockid (pthread_t __thread_id, - __clockid_t *__clock_id) - __THROW __nonnull ((2)); -#endif - - -/* Install handlers to be called when a new process is created with FORK. - The PREPARE handler is called in the parent process just before performing - FORK. The PARENT handler is called in the parent process just after FORK. - The CHILD handler is called in the child process. Each of the three - handlers can be NULL, meaning that no handler needs to be called at that - point. - PTHREAD_ATFORK can be called several times, in which case the PREPARE - handlers are called in LIFO order (last added with PTHREAD_ATFORK, - first called before FORK), and the PARENT and CHILD handlers are called - in FIFO (first added, first called). */ - -extern int pthread_atfork (void (*__prepare) (void), - void (*__parent) (void), - void (*__child) (void)) __THROW; - - -#ifdef __USE_EXTERN_INLINES -/* Optimizations. */ -__extern_inline int -__NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) -{ - return __thread1 == __thread2; -} -#endif - -__END_DECLS - -#endif /* pthread.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h index 6c34189eca..779bc85e26 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for PA-RISC. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1999. Linux/PA-RISC changes by Philipp Rumpf, , March 2000. @@ -28,6 +28,8 @@ /* Defines RTLD_PRIVATE_ERRNO. */ #include +#include + /* In order to get __set_errno() definition in INLINE_SYSCALL. */ #ifndef __ASSEMBLER__ #include @@ -360,39 +362,9 @@ L(pre_end): ASM_LINE_SEP \ #define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \ "%r20", "%r29", "%r31" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ \ - long __sys_res = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, )); \ - __sys_res = -1; \ - } \ - __sys_res; \ -}) - -/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static - value to use within the context of the syscall - INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise - You are allowed to use the syscall result (val) and the DECL error - variable to determine what went wrong. - INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number. - In our case we just flip the sign. */ - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((val < 0) && (val > -4095)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Similar to INLINE_SYSCALL but we don't set errno */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ long __sys_res; \ { \ @@ -418,7 +390,7 @@ L(pre_end): ASM_LINE_SEP \ /* The _NCS variant allows non-constant syscall numbers. */ #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ long __sys_res; \ { \ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h index 03ba2922d7..f203d3ccd0 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. i386 version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h index 64202a1e84..8327f822b0 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. i386 version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 -# define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 @@ -41,6 +39,8 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL +# undef __ASSUME_SETSOCKOPT_SYSCALL #endif /* i686 only supports ipc syscall before 5.1. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h index 4aa7bb496a..8a9911b7ac 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. @@ -48,7 +48,7 @@ to compile glibc. Disable GCC 5 optimization when compiling for profiling or when -fno-omit-frame-pointer is used since asm ("ebp") can't be used to put the 6th argument in %ebp for syscall. */ -#if __GNUC_PREREQ (5,0) && !defined PROF && CAN_USE_REGISTER_ASM_EBP +#if !defined PROF && CAN_USE_REGISTER_ASM_EBP # define OPTIMIZE_FOR_GCC_5 #endif @@ -67,6 +67,7 @@ /* We don't want the label for the error handle to be global when we define it here. */ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __syscall_error #undef PSEUDO @@ -280,35 +281,6 @@ struct libc_do_syscall_args }; #endif -/* Define a macro which expands inline into the wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#if IS_IN (libc) -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )) \ - ? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, )) \ - : (int) resultvar; }) -#else -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) -#endif - -/* Set error number and return -1. Return the internal function, - __syscall_error, which sets errno from the negative error number - and returns -1, to avoid PIC. */ -#undef INLINE_SYSCALL_ERROR_RETURN_VALUE -#define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \ - __syscall_error (-(resultvar)) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -319,6 +291,11 @@ struct libc_do_syscall_args # define HAVE_TIME_VSYSCALL "__vdso_time" # define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLONE3_WRAPPER 1 + +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel @@ -327,25 +304,41 @@ struct libc_do_syscall_args The _NCS variant allows non-constant syscall numbers but it is not possible to use more than four parameters. */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_MAIN_0(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 0, args) -#define INTERNAL_SYSCALL_MAIN_1(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 1, args) -#define INTERNAL_SYSCALL_MAIN_2(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 2, args) -#define INTERNAL_SYSCALL_MAIN_3(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 3, args) -#define INTERNAL_SYSCALL_MAIN_4(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 4, args) -#define INTERNAL_SYSCALL_MAIN_5(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args) +#define INTERNAL_SYSCALL_MAIN_0(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 0, args) +#define INTERNAL_SYSCALL_MAIN_1(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 1, args) +#define INTERNAL_SYSCALL_MAIN_2(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 2, args) +#define INTERNAL_SYSCALL_MAIN_3(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 3, args) +#define INTERNAL_SYSCALL_MAIN_4(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 4, args) +#define INTERNAL_SYSCALL_MAIN_5(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args) + +#define INTERNAL_SYSCALL_MAIN_NCS_0(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 0, args) +#define INTERNAL_SYSCALL_MAIN_NCS_1(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 1, args) +#define INTERNAL_SYSCALL_MAIN_NCS_2(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 2, args) +#define INTERNAL_SYSCALL_MAIN_NCS_3(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 3, args) +#define INTERNAL_SYSCALL_MAIN_NCS_4(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 4, args) +#define INTERNAL_SYSCALL_MAIN_NCS_5(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 5, args) + /* Each object using 6-argument inline syscalls must include a definition of __libc_do_syscall. */ #ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \ - INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args) +# define INTERNAL_SYSCALL_MAIN_6(name, args...) \ + INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args) +# define INTERNAL_SYSCALL_MAIN_NCS_6(name, args...) \ + INTERNAL_SYSCALL_MAIN_NCS(name, 6, args) #else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \ +# define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3, \ arg4, arg5, arg6) \ struct libc_do_syscall_args _xv = \ { \ @@ -359,52 +352,67 @@ struct libc_do_syscall_args : "=a" (resultvar) \ : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ : "memory", "cc") +# define INTERNAL_SYSCALL_MAIN_NCS_6(name, arg1, arg2, arg3, \ + arg4, arg5, arg6) \ + struct libc_do_syscall_args _xv = \ + { \ + (int) (arg1), \ + (int) (arg5), \ + (int) (arg6) \ + }; \ + asm volatile ( \ + "movl %1, %%eax\n\t" \ + "call __libc_do_syscall" \ + : "=a" (resultvar) \ + : "a" (name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \ + : "memory", "cc") #endif /* GCC 5 */ -#define INTERNAL_SYSCALL(name, err, nr, args...) \ + +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ register unsigned int resultvar; \ - INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \ + INTERNAL_SYSCALL_MAIN_##nr (name, args); \ (int) resultvar; }) +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ + ({ \ + register unsigned int resultvar; \ + INTERNAL_SYSCALL_MAIN_NCS_##nr (name, args); \ + (int) resultvar; }) + #if I386_USE_SYSENTER # ifdef OPTIMIZE_FOR_GCC_5 # ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *%%gs:%P2" \ : "=a" (resultvar) \ : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *%%gs:%P2" \ : "=a" (resultvar) \ : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \ - ASMARGS_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + ASMARGS_##nr(args) : "memory", "cc") # else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *_dl_sysinfo" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "call *_dl_sysinfo" \ : "=a" (resultvar) \ - : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + : "a" (name) ASMARGS_##nr(args) : "memory", "cc") # endif # else /* GCC 5 */ # ifdef PIC -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -414,9 +422,7 @@ struct libc_do_syscall_args : "=a" (resultvar) \ : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \ ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -424,10 +430,9 @@ struct libc_do_syscall_args RESTOREARGS_##nr \ : "=a" (resultvar) \ : "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \ - ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + ASMFMT_##nr(args) : "memory", "cc") # else -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -436,38 +441,32 @@ struct libc_do_syscall_args RESTOREARGS_##nr \ : "=a" (resultvar) \ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ "call *_dl_sysinfo\n\t" \ RESTOREARGS_##nr \ : "=a" (resultvar) \ - : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + : "0" (name) ASMFMT_##nr(args) : "memory", "cc") # endif # endif /* GCC 5 */ #else # ifdef OPTIMIZE_FOR_GCC_5 -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "int $0x80" \ : "=a" (resultvar) \ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ LOADREGS_##nr(args) \ asm volatile ( \ "int $0x80" \ : "=a" (resultvar) \ - : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + : "a" (name) ASMARGS_##nr(args) : "memory", "cc") # else /* GCC 5 */ -# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ @@ -476,30 +475,17 @@ struct libc_do_syscall_args RESTOREARGS_##nr \ : "=a" (resultvar) \ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc") -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register unsigned int resultvar; \ +# define INTERNAL_SYSCALL_MAIN_NCS(name, nr, args...) \ EXTRAVAR_##nr \ asm volatile ( \ LOADARGS_##nr \ "int $0x80\n\t" \ RESTOREARGS_##nr \ : "=a" (resultvar) \ - : "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \ - (int) resultvar; }) + : "0" (name) ASMFMT_##nr(args) : "memory", "cc") # endif /* GCC 5 */ #endif -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOADARGS_0 #ifdef __PIC__ # if I386_USE_SYSENTER && defined PIC @@ -618,20 +604,6 @@ struct libc_do_syscall_args # define EXTRAVAR_5 #endif -/* Consistency check for position-independent code. */ -#if defined __PIC__ && !defined OPTIMIZE_FOR_GCC_5 -# define check_consistency() \ - ({ int __res; \ - __asm__ __volatile__ \ - (LOAD_PIC_REG_STR (cx) ";" \ - "subl %%ebx, %%ecx;" \ - "je 1f;" \ - "ud2;" \ - "1:\n" \ - : "=c" (__res)); \ - __res; }) -#endif - #endif /* __ASSEMBLER__ */ @@ -662,4 +634,9 @@ struct libc_do_syscall_args # endif #endif +/* Each shadow stack slot takes 4 bytes. Assuming that each stack + frame takes 128 bytes, this is used to compute shadow stack size + from stack size. */ +#define STACK_SIZE_TO_SHADOW_STACK_SIZE_SHIFT 5 + #endif /* linux/i386/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h deleted file mode 100644 index 608e988ae6..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/bits/stat.h +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_KERNEL 0 -#define _STAT_VER_LINUX 1 -#define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 - -struct stat - { - __dev_t st_dev; /* Device. */ - __ino_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __glibc_reserved0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ - long int __glibc_reserved[3]; - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 is the same shape as stat. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __glibc_reserved0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ - long int __glibc_reserved[3]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits//stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h index 78fa6dd2c9..24650ce31f 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/dl-sysdep.h @@ -1,5 +1,5 @@ /* System-specific settings for dynamic linker code. IA-64 version. - Copyright (C) 2003-2020 Free Software Foundation, Inc. + Copyright (C) 2003-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h index 2376d14e52..6661197573 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 2010-2020 Free Software Foundation, Inc. + Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h index 59442c50e9..7198c192a0 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Jes Sorensen, , April 1999. Based on code originally written by David Mosberger-Tang @@ -46,12 +46,6 @@ #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name -/* This is to help the old kernel headers where __NR_semtimedop is not - available. */ -#ifndef __NR_semtimedop -# define __NR_semtimedop 1247 -#endif - #if defined USE_DL_SYSINFO \ && (IS_IN (libc) \ || IS_IN (libpthread) || IS_IN (librt)) @@ -95,6 +89,7 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __syscall_error #undef PSEUDO @@ -177,6 +172,9 @@ #else /* not __ASSEMBLER__ */ +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #define BREAK_INSN_1(num) "break " #num ";;\n\t" #define BREAK_INSN(num) BREAK_INSN_1(num) @@ -191,13 +189,13 @@ #ifdef IA64_USE_NEW_STUB -# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ +({ \ LOAD_ARGS_##nr (args) \ register long _r8 __asm ("r8"); \ register long _r10 __asm ("r10"); \ register long _r15 __asm ("r15") = name; \ register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\ - long _retval; \ LOAD_REGS_##nr \ /* \ * Don't specify any unwind info here. We mark ar.pfs as \ @@ -209,60 +207,30 @@ ASM_OUTARGS_##nr \ : "0" (_b7), "3" (_r15) ASM_ARGS_##nr \ : "memory", "ar.pfs" ASM_CLOBBERS_##nr); \ - _retval = _r8; + _r10 == -1 ? -_r8 : _r8; \ +}) #else /* !IA64_USE_NEW_STUB */ -# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ +({ \ LOAD_ARGS_##nr (args) \ register long _r8 asm ("r8"); \ register long _r10 asm ("r10"); \ register long _r15 asm ("r15") = name; \ - long _retval; \ LOAD_REGS_##nr \ __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \ : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ ASM_OUTARGS_##nr \ : "2" (_r15) ASM_ARGS_##nr \ : "memory" ASM_CLOBBERS_##nr); \ - _retval = _r8; + _r10 == -1 ? -_r8 : _r8; \ +}) #endif /* !IA64_USE_NEW_STUB */ -#define DO_INLINE_SYSCALL(name, nr, args...) \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args) - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \ - if (_r10 == -1) \ - { \ - __set_errno (_retval); \ - _retval = -1; \ - } \ - _retval; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - DO_INLINE_SYSCALL_NCS (name, nr, args) \ - err = _r10; \ - _retval; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ({ (void) (val); \ - (err == -1); \ - }) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) #define LOAD_ARGS_0() #define LOAD_REGS_0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h index 319d566608..ec03813795 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -1,5 +1,5 @@ /* Internal declarations for sys/timex.h. - Copyright (C) 2014-2020 Free Software Foundation, Inc. + Copyright (C) 2014-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,7 +23,178 @@ # ifndef _ISOMAC +extern int __adjtimex (struct timex *__ntx); libc_hidden_proto (__adjtimex) +# include +# include +/* Local definition of 64 bit time supporting timex struct */ +# if __TIMESIZE == 64 +# define __timex64 timex +# define __clock_adjtime64 __clock_adjtime +# define ___adjtimex64 ___adjtimex +# define __ntptimeval64 ntptimeval +# define __ntp_gettime64 __ntp_gettime +# define __ntp_gettimex64 __ntp_gettimex +# else + +struct __timex64 +{ + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long int offset; /* time offset (usec) */ + long long int freq; /* frequency offset (scaled ppm) */ + long long int maxerror; /* maximum error (usec) */ + long long int esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + int :32; /* pad */ + long long int constant; /* pll time constant */ + long long int precision; /* clock precision (usec) (read only) */ + long long int tolerance; /* clock frequency tolerance (ppm) (ro) */ + struct __timeval64 time; /* (read only, except for ADJ_SETOFFSET) */ + long long int tick; /* (modified) usecs between clock ticks */ + long long int ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long long int jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int :32; /* pad */ + long long int stabil; /* pps stability (scaled ppm) (ro) */ + long long int jitcnt; /* jitter limit exceeded (ro) */ + long long int calcnt; /* calibration intervals (ro) */ + long long int errcnt; /* calibration errors (ro) */ + long long int stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; + int :32; +}; +extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64); +libc_hidden_proto (__clock_adjtime64); +extern int ___adjtimex64 (struct __timex64 *tx64); +libc_hidden_proto (___adjtimex64) + +struct __ntptimeval64 +{ + struct __timeval64 time; /* current time (ro) */ + long int maxerror; /* maximum error (us) (ro) */ + long int esterror; /* estimated error (us) (ro) */ + long int tai; /* TAI offset (ro) */ + + long int __glibc_reserved1; + long int __glibc_reserved2; + long int __glibc_reserved3; + long int __glibc_reserved4; +}; +extern int __ntp_gettime64 (struct __ntptimeval64 *ntv); +libc_hidden_proto (__ntp_gettime64) +extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv); +libc_hidden_proto (__ntp_gettimex64) + +# endif + +/* Convert a known valid struct timex into a struct __timex64. */ +static inline struct __timex64 +valid_timex_to_timex64 (const struct timex tx) +{ + struct __timex64 tx64; + + tx64.modes = tx.modes; + tx64.offset = tx.offset; + tx64.freq = tx.freq; + tx64.maxerror = tx.maxerror; + tx64.esterror = tx.esterror; + tx64.status = tx.status; + tx64.constant = tx.constant; + tx64.precision = tx.precision; + tx64.tolerance = tx.tolerance; + tx64.time = valid_timeval_to_timeval64 (tx.time); + tx64.tick = tx.tick; + tx64.ppsfreq = tx.ppsfreq; + tx64.jitter = tx.jitter; + tx64.shift = tx.shift; + tx64.stabil = tx.stabil; + tx64.jitcnt = tx.jitcnt; + tx64.calcnt = tx.calcnt; + tx64.errcnt = tx.errcnt; + tx64.stbcnt = tx.stbcnt; + tx64.tai = tx.tai; + + return tx64; +} + +/* Convert a known valid struct __timex64 into a struct timex. */ +static inline struct timex +valid_timex64_to_timex (const struct __timex64 tx64) +{ + struct timex tx; + + tx.modes = tx64.modes; + tx.offset = tx64.offset; + tx.freq = tx64.freq; + tx.maxerror = tx64.maxerror; + tx.esterror = tx64.esterror; + tx.status = tx64.status; + tx.constant = tx64.constant; + tx.precision = tx64.precision; + tx.tolerance = tx64.tolerance; + tx.time = valid_timeval64_to_timeval (tx64.time); + tx.tick = tx64.tick; + tx.ppsfreq = tx64.ppsfreq; + tx.jitter = tx64.jitter; + tx.shift = tx64.shift; + tx.stabil = tx64.stabil; + tx.jitcnt = tx64.jitcnt; + tx.calcnt = tx64.calcnt; + tx.errcnt = tx64.errcnt; + tx.stbcnt = tx64.stbcnt; + tx.tai = tx64.tai; + + return tx; +} + +/* Convert a known valid struct ntptimeval into a struct __ntptimeval64. */ +static inline struct __ntptimeval64 +valid_ntptimeval_to_ntptimeval64 (const struct ntptimeval ntv) +{ + struct __ntptimeval64 ntv64; + + ntv64.time = valid_timeval_to_timeval64 (ntv.time); + ntv64.maxerror = ntv.maxerror; + ntv64.esterror = ntv.esterror; + ntv64.tai = ntv.tai; + ntv64.__glibc_reserved1 = 0; + ntv64.__glibc_reserved2 = 0; + ntv64.__glibc_reserved3 = 0; + ntv64.__glibc_reserved4 = 0; + + return ntv64; +} + +/* Convert a known valid struct __ntptimeval64 into a struct ntptimeval. */ +static inline struct ntptimeval +valid_ntptimeval64_to_ntptimeval (const struct __ntptimeval64 ntp64) +{ + struct ntptimeval ntp; + + ntp.time = valid_timeval64_to_timeval (ntp64.time); + ntp.maxerror = ntp64.maxerror; + ntp.esterror = ntp64.esterror; + ntp.tai = ntp64.tai; + ntp.__glibc_reserved1 = 0; + ntp.__glibc_reserved2 = 0; + ntp.__glibc_reserved3 = 0; + ntp.__glibc_reserved4 = 0; + + return ntp; +} # endif /* _ISOMAC */ #endif /* sys/timex.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h index 32533e94cf..3930e14322 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,10 +49,6 @@ SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */ #define __ASSUME_PSELECT 1 -/* The *at syscalls were introduced just after 2.6.16-rc1. On PPC - they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */ -#define __ASSUME_ATFCTS 1 - /* Support for inter-process robust mutexes was added in 2.6.17 (but some architectures lack futex_atomic_cmpxchg_inatomic in some configurations). */ @@ -81,6 +77,8 @@ #define __ASSUME_ACCEPT4_SYSCALL 1 #define __ASSUME_RECVMMSG_SYSCALL 1 #define __ASSUME_SENDMMSG_SYSCALL 1 +#define __ASSUME_GETSOCKOPT_SYSCALL 1 +#define __ASSUME_SETSOCKOPT_SYSCALL 1 /* Support for SysV IPC through wired syscalls. All supported architectures either support ipc syscall and/or all the ipc correspondent syscalls. */ @@ -214,4 +212,12 @@ # define __ASSUME_WAITID_PID0_P_PGID #endif +/* The faccessat2 system call was introduced across all architectures + in Linux 5.8. */ +#if __LINUX_KERNEL_VERSION >= 0x050800 +# define __ASSUME_FACCESSAT2 1 +#else +# define __ASSUME_FACCESSAT2 0 +#endif + #endif /* kernel-features.h */ diff --git a/lib/libc/glibc/sysdeps/mach/hurd/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel_stat.h similarity index 67% rename from lib/libc/glibc/sysdeps/mach/hurd/kernel-features.h rename to lib/libc/glibc/sysdeps/unix/sysv/linux/kernel_stat.h index eb2e20f33d..6c1b175cb4 100644 --- a/lib/libc/glibc/sysdeps/mach/hurd/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/kernel_stat.h @@ -1,5 +1,5 @@ -/* Set flags signalling availability of certain operating system features. - Copyright (C) 2012-2020 Free Software Foundation, Inc. +/* Internal definitions for stat functions. + Copyright (C) 2021 Free Software 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,7 @@ License along with the GNU C Library; if not, see . */ -/* 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. */ +/* The default Linux ABI assumes only LFS support. */ +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64 +#define STAT_IS_KERNEL_STAT 1 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h new file mode 100644 index 0000000000..69397db0d2 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/kstat_cp.h @@ -0,0 +1,2 @@ +/* Empty, it is overridden by an architecture which might require copy to or + from a kernel_stat stat struct to glibc export stat{64}. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat.c new file mode 100644 index 0000000000..b79b4cb9f4 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat.c @@ -0,0 +1,31 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include + +#if !XSTAT_IS_XSTAT64 +int +__lstat (const char *file, struct stat *buf) +{ + return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} + +weak_alias (__lstat, lstat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat64.c new file mode 100644 index 0000000000..3b45187f61 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/lstat64.c @@ -0,0 +1,51 @@ +/* Get file status. + 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 + 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 + . */ + +#define __lstat __redirect___lstat +#define lstat __redirect_lstat +#include +#include +#include +#include + +int +__lstat64_time64 (const char *file, struct __stat64_t64 *buf) +{ + return __fstatat64_time64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW); +} +#if __TIMESIZE != 64 +hidden_def (__lstat64_time64) + +int +__lstat64 (const char *file, struct stat64 *buf) +{ + struct __stat64_t64 st_t64; + return __lstat64_time64 (file, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); +} +#endif +hidden_def (__lstat64) +weak_alias (__lstat64, lstat64) + +#undef __lstat +#undef lstat + +#if XSTAT_IS_XSTAT64 +strong_alias (__lstat64, __lstat) +weak_alias (__lstat64, lstat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h deleted file mode 100644 index 453dcac709..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/bits/stat.h +++ /dev/null @@ -1,172 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __ino64_t st_ino; /* File serial number. */ - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h index d641ee844c..a65dfce95a 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2020 Free Software Foundation, Inc. +/* Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h index 4cdaf93e6d..70f1154559 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 2008-2020 Free Software Foundation, Inc. + Copyright (C) 2008-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 -# define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 @@ -43,6 +41,8 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL +# undef __ASSUME_SETSOCKOPT_SYSCALL #endif /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h index dc468053f1..8d344f2324 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/m680x0/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2020 Free Software Foundation, Inc. +/* Copyright (C) 2010-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h index 5cd35fffcf..b29986339a 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2020 Free Software Foundation, Inc. +/* Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Andreas Schwab, , December 1995. @@ -44,6 +44,7 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ +#undef SYSCALL_ERROR_LABEL #ifdef PIC #define SYSCALL_ERROR_LABEL .Lsyscall_error #else @@ -221,27 +222,12 @@ SYSCALL_ERROR_LABEL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel gave back. */ #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ unsigned int _sys_result; \ { \ /* Load argument values in temporary variables @@ -257,15 +243,8 @@ SYSCALL_ERROR_LABEL: \ _sys_result = _d0; \ } \ (int) _sys_result; }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args) #define LOAD_ARGS_0() #define LOAD_REGS_0 @@ -313,6 +292,9 @@ SYSCALL_ERROR_LABEL: \ LOAD_REGS_5 #define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0) +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #endif /* not __ASSEMBLER__ */ /* Pointer mangling is not yet supported for M68K. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/xstatver.h new file mode 100644 index 0000000000..8e1801b603 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/xstatver.h @@ -0,0 +1,13 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h deleted file mode 100644 index c5817e5b77..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/bits/stat.h +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - -#ifndef __USE_FILE_OFFSET64 -struct stat -{ - __dev_t st_dev; /* Device. */ - __ino_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group. */ - __dev_t st_rdev; /* Device number, if device. */ - unsigned long __pad2; - __off_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad3; - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - * equivalent to 'struct timespec'. This is the type used - * whenever possible but the Unix namespace rules do not allow the - * identifier 'timespec' to appear in the header. - * Therefore we have to handle the use of this header in strictly - * standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned int __glibc_reserved4; - unsigned int __glibc_reserved5; -}; -#else /* __USE_FILE_OFFSET64 */ -/* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64 - * structure. Glibc has no type __dev64_t that's why I had to use standard - * type for st_dev and st_rdev. Several architectures uses pads after st_dev - * but this approach covers BIG and LITTLE endian. I think it is better to - * create one ifdef to separate stats structures. */ -struct stat -{ - unsigned long long st_dev; /* Device. */ - __ino64_t st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group. */ - unsigned long long st_rdev; /* Device number, if device. */ - unsigned long long __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad3; - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - * equivalent to 'struct timespec'. This is the type used - * whenever possible but the Unix namespace rules do not allow the - * identifier 'timespec' to appear in the header. - * Therefore we have to handle the use of this header in strictly - * standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned int __glibc_reserved4; - unsigned int __glibc_reserved5; -}; -#endif /* __USE_FILE_OFFSET64 */ - -#ifdef __USE_LARGEFILE64 -struct stat64 -{ - unsigned long long st_dev; /* Device. */ - __ino64_t st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group. */ - unsigned long long st_rdev; /* Device number, if device. */ - unsigned long long __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - int __pad3; - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - * equivalent to 'struct timespec'. This is the type used - * whenever possible but the Unix namespace rules do not allow the - * identifier 'timespec' to appear in the header. - * Therefore we have to handle the use of this header in strictly - * standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned int __glibc_reserved4; - unsigned int __glibc_reserved5; -}; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index def8408014..a8fbc67384 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2020 Free Software Foundation, Inc. +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 -#define __ASSUME_SETSOCKOPT_SYSCALL 1 #include_next diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h new file mode 100644 index 0000000000..af12ac60c3 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/kernel_stat.h @@ -0,0 +1,54 @@ +/* Definition of `struct stat' used in the kernel + Copyright (C) 2013-2021 Free Software 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 + . */ + +struct kernel_stat +{ + unsigned long st_dev; /* Device. */ + unsigned long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long st_rdev; /* Device number, if device. */ + unsigned long __pad2; +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT64___PAD2 + long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad3; +#define _HAVE_STAT___PAD3 +#define _HAVE_STAT64___PAD3 + long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64_NSEC + unsigned int __glibc_reserved4; +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT64___UNUSED4 + unsigned int __glibc_reserved5; +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT64___UNUSED5 +}; + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h index ed873d9dd4..52c1e3d8d0 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,6 +26,8 @@ /* Defines RTLD_PRIVATE_ERRNO. */ #include +#include + /* In order to get __set_errno() definition in INLINE_SYSCALL. */ #ifndef __ASSEMBLER__ # include @@ -60,6 +62,7 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ +# undef SYSCALL_ERROR_LABEL # ifdef PIC # define SYSCALL_ERROR_LABEL 0f # else @@ -163,42 +166,18 @@ SYSCALL_ERROR_LABEL_DCL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* Define a macro which expands inline into the wrapper code for a system call. This use is for internal calls that do not need to handle errors normally. It will never touch errno. This returns just what the kernel gave back. */ # undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL(name, err, nr, args...) \ +# define INTERNAL_SYSCALL(name, nr, args...) \ inline_syscall##nr(SYS_ify(name), args) # undef INTERNAL_SYSCALL_NCS -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ inline_syscall##nr(name, args) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" # define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6 # define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5 @@ -209,8 +188,8 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall0(name,dummy) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r12) \ @@ -219,9 +198,10 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall1(name,arg1) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ + long int __arg1 = (long int) (arg1); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r12) \ @@ -230,10 +210,12 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall2(name,arg1,arg2) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ + long int __arg1 = (long int) (arg1); \ + long int __arg2 = (long int) (arg2); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ + register long int __r6 __asm__("r6") = __arg2; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r12) \ @@ -243,11 +225,14 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall3(name,arg1,arg2,arg3) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ + long int __arg1 = (long int) (arg1); \ + long int __arg2 = (long int) (arg2); \ + long int __arg3 = (long int) (arg3); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ + register long int __r6 __asm__("r6") = __arg2; \ + register long int __r7 __asm__("r7") = __arg3; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r12) \ @@ -257,12 +242,16 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall4(name,arg1,arg2,arg3,arg4) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ + long int __arg1 = (long int) (arg1); \ + long int __arg2 = (long int) (arg2); \ + long int __arg3 = (long int) (arg3); \ + long int __arg4 = (long int) (arg4); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ + register long int __r6 __asm__("r6") = __arg2; \ + register long int __r7 __asm__("r7") = __arg3; \ + register long int __r8 __asm__("r8") = __arg4; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r12) \ @@ -272,13 +261,18 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ - register long __r9 __asm__("r9") = (long)(arg5); \ + long int __arg1 = (long int) (arg1); \ + long int __arg2 = (long int) (arg2); \ + long int __arg3 = (long int) (arg3); \ + long int __arg4 = (long int) (arg4); \ + long int __arg5 = (long int) (arg5); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ + register long int __r6 __asm__("r6") = __arg2; \ + register long int __r7 __asm__("r7") = __arg3; \ + register long int __r8 __asm__("r8") = __arg4; \ + register long int __r9 __asm__("r9") = __arg5; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r12) \ @@ -288,14 +282,20 @@ SYSCALL_ERROR_LABEL_DCL: \ # define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ ({ \ - register long __ret __asm__("r3"); \ - register long __r12 __asm__("r12") = name; \ - register long __r5 __asm__("r5") = (long)(arg1); \ - register long __r6 __asm__("r6") = (long)(arg2); \ - register long __r7 __asm__("r7") = (long)(arg3); \ - register long __r8 __asm__("r8") = (long)(arg4); \ - register long __r9 __asm__("r9") = (long)(arg5); \ - register long __r10 __asm__("r10") = (long)(arg6); \ + long int __arg1 = (long int) (arg1); \ + long int __arg2 = (long int) (arg2); \ + long int __arg3 = (long int) (arg3); \ + long int __arg4 = (long int) (arg4); \ + long int __arg5 = (long int) (arg5); \ + long int __arg6 = (long int) (arg6); \ + register long int __ret __asm__("r3"); \ + register long int __r12 __asm__("r12") = name; \ + register long int __r5 __asm__("r5") = __arg1; \ + register long int __r6 __asm__("r6") = __arg2; \ + register long int __r7 __asm__("r7") = __arg3; \ + register long int __r8 __asm__("r8") = __arg4; \ + register long int __r9 __asm__("r9") = __arg5; \ + register long int __r10 __asm__("r10") = __arg6; \ __asm__ __volatile__( "brki r14,8; nop;" \ : "=r"(__ret) \ : "r"(__r5), "r"(__r6), "r"(__r7), "r"(__r8),"r"(__r9), "r"(__r10), \ @@ -310,6 +310,9 @@ SYSCALL_ERROR_LABEL_DCL: \ # define SINGLE_THREAD_BY_GLOBAL 1 +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #endif /* not __ASSEMBLER__ */ #endif /* _LINUX_MICROBLAZE_SYSDEP_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h deleted file mode 100644 index b0e6726655..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/bits/stat.h +++ /dev/null @@ -1,263 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -#include - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -#if _MIPS_SIM == _ABIO32 -/* Structure describing file characteristics. */ -struct stat - { - unsigned long int st_dev; - long int st_pad1[3]; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - unsigned long int st_rdev; /* Device number, if device. */ -#ifndef __USE_FILE_OFFSET64 - long int st_pad2[2]; - __off_t st_size; /* Size of file, in bytes. */ - /* SVR4 added this extra long to allow for expansion of off_t. */ - long int st_pad3; -#else - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ -#else - long int st_pad4; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ -#endif - long int st_pad5[14]; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - unsigned long int st_dev; - long int st_pad1[3]; - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - unsigned long int st_rdev; /* Device number, if device. */ - long int st_pad2[3]; - __off64_t st_size; /* Size of file, in bytes. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - long int st_pad3; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ - long int st_pad4[14]; - }; -#endif -#else -struct stat - { - __dev_t st_dev; - int st_pad1[3]; /* Reserved for st_dev expansion */ -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; -#else - __ino64_t st_ino; -#endif - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; -#if !defined __USE_FILE_OFFSET64 - unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ - __off_t st_size; - int st_pad3; -#else - unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ - __off64_t st_size; -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; - unsigned int st_pad4; -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; -#else - __blkcnt64_t st_blocks; -#endif - int st_pad5[14]; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; - unsigned int st_pad1[3]; /* Reserved for st_dev expansion */ - __ino64_t st_ino; - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; - unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ - __off64_t st_size; -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __blksize_t st_blksize; - unsigned int st_pad3; - __blkcnt64_t st_blocks; - int st_pad4[14]; -}; -#endif -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h index a9862f92b7..7a7c5a0f2d 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h new file mode 100644 index 0000000000..19524f7ea4 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -0,0 +1,75 @@ +#ifndef _KERNEL_STAT_H +#define _KERNEL_STAT_H + +#include +/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the + userland data structures are not identical, because of different + padding. */ +/* Definition of `struct stat' used in the kernel. */ +#if _MIPS_SIM != _ABIO32 +struct kernel_stat + { + unsigned int st_dev; + unsigned int __pad1[3]; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + unsigned int st_rdev; + unsigned int __pad2[3]; + long long st_size; + unsigned int st_atime_sec; + unsigned int st_atime_nsec; + unsigned int st_mtime_sec; + unsigned int st_mtime_nsec; + unsigned int st_ctime_sec; + unsigned int st_ctime_nsec; + unsigned int st_blksize; + unsigned int __pad3; + unsigned long long st_blocks; + }; +#else +struct kernel_stat + { + unsigned long int st_dev; + long int __pad1[3]; /* Reserved for network id */ + unsigned long int st_ino; + unsigned long int st_mode; + unsigned long int st_nlink; + long int st_uid; + long int st_gid; + unsigned long int st_rdev; + long int __pad2[2]; + long int st_size; + long int __pad3; + unsigned int st_atime_sec; + unsigned int st_atime_nsec; + unsigned int st_mtime_sec; + unsigned int st_mtime_nsec; + unsigned int st_ctime_sec; + unsigned int st_ctime_nsec; + long int st_blksize; + long int st_blocks; + char st_fstype[16]; /* Filesystem type name, unsupported */ + long st_pad4[8]; + /* Linux specific fields */ + unsigned int st_flags; + unsigned int st_gen; + }; +#endif + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 0 +#define XSTAT_IS_XSTAT64 0 +#if _MIPS_SIM == _ABI64 +# define STATFS_IS_STATFS64 1 +#else +# define STATFS_IS_STATFS64 0 +#endif +/* MIPS64 has unsigned 32 bit timestamps fields, so use statx as well. */ +#if _MIPS_SIM == _ABI64 +# define STAT_HAS_TIME32 +#endif + +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index beefcf284b..b336a16de8 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,11 +25,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -42,32 +37,14 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ #ifdef __PIC__ +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 99b #endif #else /* ! __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the @@ -103,11 +80,11 @@ union __mips_syscall_return { - long long val; + long long int val; struct { - long v0; - long v1; + long int v0; + long int v1; } reg; }; @@ -121,14 +98,13 @@ union __mips_syscall_return # include -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args) +# define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args) -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ ({ \ union __mips_syscall_return _sc_ret; \ _sc_ret.val = __mips16_syscall##nr (args, number); \ - err = _sc_ret.reg.v1; \ _sc_ret.reg.v0; \ }) @@ -138,12 +114,12 @@ union __mips_syscall_return number, err, args) #else /* !__mips16 */ -# define INTERNAL_SYSCALL(name, err, nr, args...) \ +# define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ "IK" (SYS_ify (name)), \ SYS_ify (name), err, args) -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ "r" (__s0), \ number, err, args) @@ -152,13 +128,13 @@ union __mips_syscall_return #define internal_syscall0(v0_init, input, number, err, dummy...) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ + register long int __s0 asm ("$16") __attribute__ ((unused)) \ = (number); \ - register long __v0 asm ("$2"); \ - register long __a3 asm ("$7"); \ + register long int __v0 asm ("$2"); \ + register long int __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -167,22 +143,22 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) #define internal_syscall1(v0_init, input, number, err, arg1) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ + long int _arg1 = (long int) (arg1); \ + register long int __s0 asm ("$16") __attribute__ ((unused)) \ = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a3 asm ("$7"); \ + register long int __v0 asm ("$2"); \ + register long int __a0 asm ("$4") = _arg1; \ + register long int __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -191,23 +167,24 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) #define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + register long int __s0 asm ("$16") __attribute__ ((unused)) \ = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a3 asm ("$7"); \ + register long int __v0 asm ("$2"); \ + register long int __a0 asm ("$4") = _arg1; \ + register long int __a1 asm ("$5") = _arg2; \ + register long int __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -216,8 +193,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -225,16 +201,19 @@ union __mips_syscall_return #define internal_syscall3(v0_init, input, number, err, \ arg1, arg2, arg3) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + register long int __s0 asm ("$16") __attribute__ ((unused)) \ = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7"); \ + register long int __v0 asm ("$2"); \ + register long int __a0 asm ("$4") = _arg1; \ + register long int __a1 asm ("$5") = _arg2; \ + register long int __a2 asm ("$6") = _arg3; \ + register long int __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -243,8 +222,7 @@ union __mips_syscall_return : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -252,16 +230,20 @@ union __mips_syscall_return #define internal_syscall4(v0_init, input, number, err, \ arg1, arg2, arg3, arg4) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + register long int __s0 asm ("$16") __attribute__ ((unused)) \ = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ + register long int __v0 asm ("$2"); \ + register long int __a0 asm ("$4") = _arg1; \ + register long int __a1 asm ("$5") = _arg2; \ + register long int __a2 asm ("$6") = _arg3; \ + register long int __a3 asm ("$7") = _arg4; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -270,8 +252,7 @@ union __mips_syscall_return : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) @@ -285,65 +266,65 @@ union __mips_syscall_return compiler specifics required for the stack arguments to be pushed, which would be the case if these syscalls were inlined. */ -long long __nomips16 __mips_syscall5 (long arg1, long arg2, long arg3, - long arg4, long arg5, - long number); +long long int __nomips16 __mips_syscall5 (long int arg1, long int arg2, + long int arg3, long int arg4, + long int arg5, + long int number); libc_hidden_proto (__mips_syscall5, nomips16) #define internal_syscall5(v0_init, input, number, err, \ arg1, arg2, arg3, arg4, arg5) \ ({ \ union __mips_syscall_return _sc_ret; \ - _sc_ret.val = __mips_syscall5 ((long) (arg1), \ - (long) (arg2), \ - (long) (arg3), \ - (long) (arg4), \ - (long) (arg5), \ - (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.val = __mips_syscall5 ((long int) (arg1), \ + (long int) (arg2), \ + (long int) (arg3), \ + (long int) (arg4), \ + (long int) (arg5), \ + (long int) (number)); \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) -long long __nomips16 __mips_syscall6 (long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6, - long number); +long long int __nomips16 __mips_syscall6 (long int arg1, long int arg2, + long int arg3, long int arg4, + long int arg5, long int arg6, + long int number); libc_hidden_proto (__mips_syscall6, nomips16) #define internal_syscall6(v0_init, input, number, err, \ arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ union __mips_syscall_return _sc_ret; \ - _sc_ret.val = __mips_syscall6 ((long) (arg1), \ - (long) (arg2), \ - (long) (arg3), \ - (long) (arg4), \ - (long) (arg5), \ - (long) (arg6), \ - (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.val = __mips_syscall6 ((long int) (arg1), \ + (long int) (arg2), \ + (long int) (arg3), \ + (long int) (arg4), \ + (long int) (arg5), \ + (long int) (arg6), \ + (long int) (number)); \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) -long long __nomips16 __mips_syscall7 (long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6, - long arg7, - long number); +long long int __nomips16 __mips_syscall7 (long int arg1, long int arg2, + long int arg3, long int arg4, + long int arg5, long int arg6, + long int arg7, + long int number); libc_hidden_proto (__mips_syscall7, nomips16) #define internal_syscall7(v0_init, input, number, err, \ arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ ({ \ union __mips_syscall_return _sc_ret; \ - _sc_ret.val = __mips_syscall7 ((long) (arg1), \ - (long) (arg2), \ - (long) (arg3), \ - (long) (arg4), \ - (long) (arg5), \ - (long) (arg6), \ - (long) (arg7), \ - (long) (number)); \ - err = _sc_ret.reg.v1; \ - _sc_ret.reg.v0; \ + _sc_ret.val = __mips_syscall7 ((long int) (arg1), \ + (long int) (arg2), \ + (long int) (arg3), \ + (long int) (arg4), \ + (long int) (arg5), \ + (long int) (arg6), \ + (long int) (arg7), \ + (long int) (number)); \ + _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \ }) #if __mips_isa_rev >= 6 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h new file mode 100644 index 0000000000..ee853483cc --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h @@ -0,0 +1,73 @@ +/* Struct stat/stat64 to stat/stat64 conversion for Linux. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include + +static inline long int +__cp_kstat_stat (const struct kernel_stat *kst, struct stat *st) +{ + if (! in_ino_t_range (kst->st_ino) + || ! in_off_t_range (kst->st_size) + || ! in_blkcnt_t_range (kst->st_blocks)) + return -EOVERFLOW; + + st->st_dev = kst->st_dev; + memset (&st->st_pad1, 0, sizeof (st->st_pad1)); + st->st_ino = kst->st_ino; + st->st_mode = kst->st_mode; + st->st_nlink = kst->st_nlink; + st->st_uid = kst->st_uid; + st->st_gid = kst->st_gid; + st->st_rdev = kst->st_rdev; + memset (&st->st_pad2, 0, sizeof (st->st_pad2)); + st->st_size = kst->st_size; + st->st_pad3 = 0; + st->st_atim.tv_sec = kst->st_atime_sec; + st->st_atim.tv_nsec = kst->st_atime_nsec; + st->st_mtim.tv_sec = kst->st_mtime_sec; + st->st_mtim.tv_nsec = kst->st_mtime_nsec; + st->st_ctim.tv_sec = kst->st_ctime_sec; + st->st_ctim.tv_nsec = kst->st_ctime_nsec; + st->st_blksize = kst->st_blksize; + st->st_blocks = kst->st_blocks; + memset (&st->st_pad5, 0, sizeof (st->st_pad5)); + + return 0; +} + +static inline void +__cp_kstat_stat64_t64 (const struct kernel_stat *kst, struct __stat64_t64 *st) +{ + st->st_dev = kst->st_dev; + st->st_ino = kst->st_ino; + st->st_mode = kst->st_mode; + st->st_nlink = kst->st_nlink; + st->st_uid = kst->st_uid; + st->st_gid = kst->st_gid; + st->st_rdev = kst->st_rdev; + st->st_size = kst->st_size; + st->st_blksize = kst->st_blksize; + st->st_blocks = kst->st_blocks; + st->st_atim.tv_sec = kst->st_atime_sec; + st->st_atim.tv_nsec = kst->st_atime_nsec; + st->st_mtim.tv_sec = kst->st_mtime_sec; + st->st_mtim.tv_nsec = kst->st_mtime_nsec; + st->st_ctim.tv_sec = kst->st_ctime_sec; + st->st_ctim.tv_nsec = kst->st_ctime_nsec; +} diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h deleted file mode 100644 index 9d30291f84..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _LINUX_MIPS_SYSDEP_H -#define _LINUX_MIPS_SYSDEP_H 1 - -/* There is some commonality. */ -#include -#include -#include - -#include - -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifdef __ASSEMBLER__ - -/* We don't want the label for the error handler to be visible in the symbol - table when we define it here. */ -# define SYSCALL_ERROR_LABEL 99b - -#else /* ! __ASSEMBLER__ */ - -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) - -/* Note that the original Linux syscall restart convention required the - instruction immediately preceding SYSCALL to initialize $v0 with the - syscall number. Then if a restart triggered, $v0 would have been - clobbered by the syscall interrupted, and needed to be reinititalized. - The kernel would decrement the PC by 4 before switching back to the - user mode so that $v0 had been reloaded before SYSCALL was executed - again. This implied the place $v0 was loaded from must have been - preserved across a syscall, e.g. an immediate, static register, stack - slot, etc. - - The convention was relaxed in Linux with a change applied to the kernel - GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that - first appeared in the 2.6.36 release. Since then the kernel has had - code that reloads $v0 upon syscall restart and resumes right at the - SYSCALL instruction, so no special arrangement is needed anymore. - - For backwards compatibility with existing kernel binaries we support - the old convention by choosing the instruction preceding SYSCALL - carefully. This also means we have to force a 32-bit encoding of the - microMIPS MOVE instruction if one is used. */ - -#ifdef __mips_micromips -# define MOVE32 "move32" -#else -# define MOVE32 "move" -#endif - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ - "IK" (SYS_ify (name)), \ - 0, err, args) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ - "r" (__s0), \ - number, err, args) - -#define internal_syscall0(v0_init, input, number, err, dummy...) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall1(v0_init, input, number, err, arg1) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set reorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall3(v0_init, input, number, err, \ - arg1, arg2, arg3) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7"); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "=r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall4(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall5(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - register long __a4 asm ("$8") = (long) (arg5); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#define internal_syscall6(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5, arg6) \ -({ \ - long _sys_result; \ - \ - { \ - register long __s0 asm ("$16") __attribute__ ((unused)) \ - = (number); \ - register long __v0 asm ("$2"); \ - register long __a0 asm ("$4") = (long) (arg1); \ - register long __a1 asm ("$5") = (long) (arg2); \ - register long __a2 asm ("$6") = (long) (arg3); \ - register long __a3 asm ("$7") = (long) (arg4); \ - register long __a4 asm ("$8") = (long) (arg5); \ - register long __a5 asm ("$9") = (long) (arg6); \ - __asm__ volatile ( \ - ".set\tnoreorder\n\t" \ - v0_init \ - "syscall\n\t" \ - ".set\treorder" \ - : "=r" (__v0), "+r" (__a3) \ - : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ - "r" (__a5) \ - : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ - } \ - _sys_result; \ -}) - -#if __mips_isa_rev >= 6 -# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "memory" -#else -# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ - "$14", "$15", "$24", "$25", "hi", "lo", "memory" -#endif - -#endif /* __ASSEMBLER__ */ - -/* Pointer mangling is not yet supported for MIPS. */ -#define PTR_MANGLE(var) (void) (var) -#define PTR_DEMANGLE(var) (void) (var) - -#endif /* linux/mips/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h similarity index 55% rename from lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h rename to lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index f96636538a..405832d7c3 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,15 +21,10 @@ /* There is some commonality. */ #include #include -#include +#include #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -41,35 +36,23 @@ /* We don't want the label for the error handler to be visible in the symbol table when we define it here. */ +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 99b #else /* ! __ASSEMBLER__ */ +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + +#if _MIPS_SIM == _ABIN32 /* Convert X to a long long, without losing any bits if it is one already or warning if it is a 32-bit pointer. */ -#define ARGIFY(X) ((long long) (__typeof__ ((X) - (X))) (X)) - -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) ((void) (val), (long) (err)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) ((void) (err), val) +# define ARGIFY(X) ((long long int) (__typeof__ ((X) - (X))) (X)) +typedef long long int __syscall_arg_t; +#else +# define ARGIFY(X) ((long int) (X)) +typedef long int __syscall_arg_t; +#endif /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the @@ -99,26 +82,26 @@ #endif #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ "IK" (SYS_ify (name)), \ - 0, err, args) + 0, args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ "r" (__s0), \ - number, err, args) + number, args) -#define internal_syscall0(v0_init, input, number, err, dummy...) \ +#define internal_syscall0(v0_init, input, number, dummy...) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -127,22 +110,22 @@ : "=r" (__v0), "=r" (__a3) \ : input \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall1(v0_init, input, number, err, arg1) \ +#define internal_syscall1(v0_init, input, number, arg1) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -151,23 +134,24 @@ : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \ +#define internal_syscall2(v0_init, input, number, arg1, arg2) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + __syscall_arg_t _arg2 = ARGIFY (arg2); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a1 asm ("$5") = _arg2; \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -176,25 +160,26 @@ : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall3(v0_init, input, number, err, \ - arg1, arg2, arg3) \ +#define internal_syscall3(v0_init, input, number, arg1, arg2, arg3) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + __syscall_arg_t _arg2 = ARGIFY (arg2); \ + __syscall_arg_t _arg3 = ARGIFY (arg3); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7"); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a1 asm ("$5") = _arg2; \ + register __syscall_arg_t __a2 asm ("$6") = _arg3; \ + register __syscall_arg_t __a3 asm ("$7"); \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -203,25 +188,28 @@ : "=r" (__v0), "=r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall4(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4) \ +#define internal_syscall4(v0_init, input, number, arg1, arg2, arg3, \ + arg4) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + __syscall_arg_t _arg2 = ARGIFY (arg2); \ + __syscall_arg_t _arg3 = ARGIFY (arg3); \ + __syscall_arg_t _arg4 = ARGIFY (arg4); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a1 asm ("$5") = _arg2; \ + register __syscall_arg_t __a2 asm ("$6") = _arg3; \ + register __syscall_arg_t __a3 asm ("$7") = _arg4; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -230,26 +218,30 @@ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall5(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(v0_init, input, number, arg1, arg2, arg3, \ + arg4, arg5) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + __syscall_arg_t _arg2 = ARGIFY (arg2); \ + __syscall_arg_t _arg3 = ARGIFY (arg3); \ + __syscall_arg_t _arg4 = ARGIFY (arg4); \ + __syscall_arg_t _arg5 = ARGIFY (arg5); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ - register long long __a4 asm ("$8") = ARGIFY (arg5); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a1 asm ("$5") = _arg2; \ + register __syscall_arg_t __a2 asm ("$6") = _arg3; \ + register __syscall_arg_t __a3 asm ("$7") = _arg4; \ + register __syscall_arg_t __a4 asm ("$8") = _arg5; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -258,27 +250,32 @@ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) -#define internal_syscall6(v0_init, input, number, err, \ - arg1, arg2, arg3, arg4, arg5, arg6) \ +#define internal_syscall6(v0_init, input, number, arg1, arg2, arg3, \ + arg4, arg5, arg6) \ ({ \ - long _sys_result; \ + long int _sys_result; \ \ { \ - register long long __s0 asm ("$16") __attribute__ ((unused)) \ + __syscall_arg_t _arg1 = ARGIFY (arg1); \ + __syscall_arg_t _arg2 = ARGIFY (arg2); \ + __syscall_arg_t _arg3 = ARGIFY (arg3); \ + __syscall_arg_t _arg4 = ARGIFY (arg4); \ + __syscall_arg_t _arg5 = ARGIFY (arg5); \ + __syscall_arg_t _arg6 = ARGIFY (arg6); \ + register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\ = (number); \ - register long long __v0 asm ("$2"); \ - register long long __a0 asm ("$4") = ARGIFY (arg1); \ - register long long __a1 asm ("$5") = ARGIFY (arg2); \ - register long long __a2 asm ("$6") = ARGIFY (arg3); \ - register long long __a3 asm ("$7") = ARGIFY (arg4); \ - register long long __a4 asm ("$8") = ARGIFY (arg5); \ - register long long __a5 asm ("$9") = ARGIFY (arg6); \ + register __syscall_arg_t __v0 asm ("$2"); \ + register __syscall_arg_t __a0 asm ("$4") = _arg1; \ + register __syscall_arg_t __a1 asm ("$5") = _arg2; \ + register __syscall_arg_t __a2 asm ("$6") = _arg3; \ + register __syscall_arg_t __a3 asm ("$7") = _arg4; \ + register __syscall_arg_t __a4 asm ("$8") = _arg5; \ + register __syscall_arg_t __a5 asm ("$9") = _arg6; \ __asm__ volatile ( \ ".set\tnoreorder\n\t" \ v0_init \ @@ -288,8 +285,7 @@ : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \ "r" (__a5) \ : __SYSCALL_CLOBBERS); \ - err = __a3; \ - _sys_result = __v0; \ + _sys_result = __a3 != 0 ? -__v0 : __v0; \ } \ _sys_result; \ }) diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/sysdep.h new file mode 100644 index 0000000000..4a400a7fe3 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -0,0 +1,30 @@ +/* Syscall definitions, Linux MIPS generic version. + 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 + 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 + . */ + +#include + +#define VDSO_NAME "LINUX_2.6" +#define VDSO_HASH 61765110 + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +#if _MIPS_SIM != _ABI64 +# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64" +#endif +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +#define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/xstatver.h new file mode 100644 index 0000000000..8e1801b603 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mips/xstatver.h @@ -0,0 +1,13 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/mknodat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/mknodat.c new file mode 100644 index 0000000000..55df90a589 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/mknodat.c @@ -0,0 +1,37 @@ +/* Create a special or ordinary file. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include +#include +#include + +int +__mknodat (int fd, const char *path, mode_t mode, dev_t dev) +{ + /* The user-exported dev_t is 64-bit while the kernel interface is + 32-bit. */ + unsigned int k_dev = dev; + if (k_dev != dev) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); + + return INLINE_SYSCALL_CALL (mknodat, fd, path, mode, k_dev); +} +libc_hidden_def (__mknodat) +weak_alias (__mknodat, mknodat) diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/kernel_stat.h new file mode 100644 index 0000000000..1af30dab6f --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/kernel_stat.h @@ -0,0 +1,22 @@ +/* Internal definitions for stat functions. Linux/nios2. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/sysdep.h new file mode 100644 index 0000000000..bd802c40ff --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -0,0 +1,240 @@ +/* Assembler macros for Nios II. + 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 + 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 + . */ + +#ifndef _LINUX_NIOS2_SYSDEP_H +#define _LINUX_NIOS2_SYSDEP_H 1 + +#include +#include +#include + +/* For RTLD_PRIVATE_ERRNO. */ +#include + +#include + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +#ifdef __ASSEMBLER__ + +#undef SYSCALL_ERROR_LABEL +#define SYSCALL_ERROR_LABEL __local_syscall_error + +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + ENTRY (name) \ + DO_CALL (syscall_name, args) \ + bne r7, zero, SYSCALL_ERROR_LABEL; \ + +#undef PSEUDO_END +#define PSEUDO_END(name) \ + SYSCALL_ERROR_HANDLER \ + END (name) + +#undef PSEUDO_NOERRNO +#define PSEUDO_NOERRNO(name, syscall_name, args) \ + ENTRY (name) \ + DO_CALL (syscall_name, args) + +#undef PSEUDO_END_NOERRNO +#define PSEUDO_END_NOERRNO(name) \ + END (name) + +#undef ret_NOERRNO +#define ret_NOERRNO ret + +#undef DO_CALL +#define DO_CALL(syscall_name, args) \ + DOARGS_##args \ + movi r2, SYS_ify(syscall_name); \ + trap; + +#if defined(__PIC__) || defined(PIC) + +# if RTLD_PRIVATE_ERRNO + +# define SYSCALL_ERROR_HANDLER \ + SYSCALL_ERROR_LABEL: \ + nextpc r3; \ +1: \ + movhi r8, %hiadj(rtld_errno - 1b); \ + addi r8, r8, %lo(rtld_errno - 1b); \ + add r3, r3, r8; \ + stw r2, 0(r3); \ + movi r2, -1; \ + ret; + +# else + +# if IS_IN (libc) +# define SYSCALL_ERROR_ERRNO __libc_errno +# else +# define SYSCALL_ERROR_ERRNO errno +# endif +# define SYSCALL_ERROR_HANDLER \ + SYSCALL_ERROR_LABEL: \ + nextpc r3; \ +1: \ + movhi r8, %hiadj(_gp_got - 1b); \ + addi r8, r8, %lo(_gp_got - 1b); \ + add r3, r3, r8; \ + ldw r3, %tls_ie(SYSCALL_ERROR_ERRNO)(r3); \ + add r3, r23, r3; \ + stw r2, 0(r3); \ + movi r2, -1; \ + ret; + +# endif + +#else + +/* We can use a single error handler in the static library. */ +#define SYSCALL_ERROR_HANDLER \ + SYSCALL_ERROR_LABEL: \ + jmpi __syscall_error; + +#endif + +#define DOARGS_0 /* nothing */ +#define DOARGS_1 /* nothing */ +#define DOARGS_2 /* nothing */ +#define DOARGS_3 /* nothing */ +#define DOARGS_4 /* nothing */ +#define DOARGS_5 ldw r8, 0(sp); +#define DOARGS_6 ldw r9, 4(sp); ldw r8, 0(sp); + +/* The function has to return the error code. */ +#undef PSEUDO_ERRVAL +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + ENTRY (name) \ + DO_CALL (syscall_name, args) + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + +#define ret_ERRVAL ret + +#else /* __ASSEMBLER__ */ + +/* In order to get __set_errno() definition in INLINE_SYSCALL. */ +#include + +#undef INTERNAL_SYSCALL_RAW +#define INTERNAL_SYSCALL_RAW(name, nr, args...) \ + ({ unsigned int _sys_result; \ + { \ + /* Load argument values in temporary variables + to perform side effects like function calls + before the call-used registers are set. */ \ + LOAD_ARGS_##nr (args) \ + LOAD_REGS_##nr \ + register int _r2 asm ("r2") = (int)(name); \ + register int _err asm ("r7"); \ + asm volatile ("trap" \ + : "+r" (_r2), "=r" (_err) \ + : ASM_ARGS_##nr \ + : __SYSCALL_CLOBBERS); \ + _sys_result = _err != 0 ? -_r2 : _r2; \ + } \ + (int) _sys_result; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + INTERNAL_SYSCALL_RAW(number, nr, args) + +#define LOAD_ARGS_0() +#define LOAD_REGS_0 +#define ASM_ARGS_0 +#define LOAD_ARGS_1(a1) \ + LOAD_ARGS_0 () \ + int __arg1 = (int) (a1); +#define LOAD_REGS_1 \ + register int _r4 asm ("r4") = __arg1; \ + LOAD_REGS_0 +#define ASM_ARGS_1 "r" (_r4) +#define LOAD_ARGS_2(a1, a2) \ + LOAD_ARGS_1 (a1) \ + int __arg2 = (int) (a2); +#define LOAD_REGS_2 \ + register int _r5 asm ("r5") = __arg2; \ + LOAD_REGS_1 +#define ASM_ARGS_2 ASM_ARGS_1, "r" (_r5) +#define LOAD_ARGS_3(a1, a2, a3) \ + LOAD_ARGS_2 (a1, a2) \ + int __arg3 = (int) (a3); +#define LOAD_REGS_3 \ + register int _r6 asm ("r6") = __arg3; \ + LOAD_REGS_2 +#define ASM_ARGS_3 ASM_ARGS_2, "r" (_r6) +#define LOAD_ARGS_4(a1, a2, a3, a4) \ + LOAD_ARGS_3 (a1, a2, a3) \ + int __arg4 = (int) (a4); +#define LOAD_REGS_4 \ + register int _r7 asm ("r7") = __arg4; \ + LOAD_REGS_3 +#define ASM_ARGS_4 ASM_ARGS_3, "r" (_r7) +#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ + LOAD_ARGS_4 (a1, a2, a3, a4) \ + int __arg5 = (int) (a5); +#define LOAD_REGS_5 \ + register int _r8 asm ("r8") = __arg5; \ + LOAD_REGS_4 +#define ASM_ARGS_5 ASM_ARGS_4, "r" (_r8) +#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ + LOAD_ARGS_5 (a1, a2, a3, a4, a5) \ + int __arg6 = (int) (a6); +#define LOAD_REGS_6 \ + register int _r9 asm ("r9") = __arg6; \ + LOAD_REGS_5 +#define ASM_ARGS_6 ASM_ARGS_5, "r" (_r9) + +#define __SYSCALL_CLOBBERS "memory" + +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + +#endif /* __ASSEMBLER__ */ + +/* Pointer mangling support. */ +#if IS_IN (rtld) +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +#else +# ifdef __ASSEMBLER__ +# define PTR_MANGLE_GUARD(guard) ldw guard, POINTER_GUARD(r23) +# define PTR_MANGLE(dst, src, guard) xor dst, src, guard +# define PTR_DEMANGLE(dst, src, guard) PTR_MANGLE (dst, src, guard) +# else +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + + +#endif /* linux/nios2/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index a18a2ee97f..6c04e187ce 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. PowerPC version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 -#define __ASSUME_SETSOCKOPT_SYSCALL 1 /* Define this if your 32-bit syscall API requires 64-bit register pairs to start with an even-number register. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h new file mode 100644 index 0000000000..e89ee5fdc8 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h @@ -0,0 +1,53 @@ +/* Definition of `struct stat' used in the kernel. + 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 + 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 + . */ + +struct kernel_stat + { + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned short st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___UNUSED4 +#define _HAVE_STAT64___UNUSED5 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h deleted file mode 100644 index 725dfafde8..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ /dev/null @@ -1,214 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LINUX_POWERPC_SYSDEP_H -#define _LINUX_POWERPC_SYSDEP_H 1 - -#include -#include -#include -#include - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifndef __ASSEMBLER__ - -# include - -/* Define a macro which expands inline into the wrapper code for a VDSO - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ -# define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ - "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \ - : : "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) - -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. - On powerpc a system call basically clobbers the same registers like a - function call, with the exception of LR (which is needed for the - "sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal - an error return status). */ - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -# undef INTERNAL_SYSCALL -# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register long int r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - LOADARGS_##nr(name, args); \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %0" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), "=&r" (r6), "=&r" (r7), \ - "=&r" (r8), "=&r" (r9), "=&r" (r10), "=&r" (r11), "=&r" (r12) \ - : ASM_INPUT_##nr \ - : "cr0", "ctr", "memory"); \ - err = r0; \ - (int) r3; \ - }) -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -# define LOADARGS_0(name, dummy) \ - r0 = name -# define LOADARGS_1(name, __arg1) \ - long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ - extern void __illegally_sized_syscall_arg1 (void); \ - if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \ - __illegally_sized_syscall_arg1 (); \ - r3 = arg1 -# define LOADARGS_2(name, __arg1, __arg2) \ - long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ - extern void __illegally_sized_syscall_arg2 (void); \ - if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 4) \ - __illegally_sized_syscall_arg2 (); \ - r4 = arg2 -# define LOADARGS_3(name, __arg1, __arg2, __arg3) \ - long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ - extern void __illegally_sized_syscall_arg3 (void); \ - if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 4) \ - __illegally_sized_syscall_arg3 (); \ - r5 = arg3 -# define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ - long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ - extern void __illegally_sized_syscall_arg4 (void); \ - if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 4) \ - __illegally_sized_syscall_arg4 (); \ - r6 = arg4 -# define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ - long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ - extern void __illegally_sized_syscall_arg5 (void); \ - if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 4) \ - __illegally_sized_syscall_arg5 (); \ - r7 = arg5 -# define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ - long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ - extern void __illegally_sized_syscall_arg6 (void); \ - if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 4) \ - __illegally_sized_syscall_arg6 (); \ - r8 = arg6 - -# define ASM_INPUT_0 "0" (r0) -# define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) -# define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) -# define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) -# define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) -# define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) -# define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) - -#endif /* __ASSEMBLER__ */ - - -/* Pointer mangling support. */ -#if IS_IN (rtld) -/* We cannot use the thread descriptor because in ld.so we use setjmp - earlier than the descriptor is initialized. */ -#else -# ifdef __ASSEMBLER__ -# define PTR_MANGLE(reg, tmpreg) \ - lwz tmpreg,POINTER_GUARD(r2); \ - xor reg,tmpreg,reg -# define PTR_MANGLE2(reg, tmpreg) \ - xor reg,tmpreg,reg -# define PTR_MANGLE3(destreg, reg, tmpreg) \ - lwz tmpreg,POINTER_GUARD(r2); \ - xor destreg,tmpreg,reg -# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) -# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) -# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) -# else -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif - -#endif /* linux/powerpc/powerpc32/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index ee7f43653d..e8785aa8ea 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,202 +17,10 @@ /* Alan Modra rewrote the INLINE_SYSCALL macro */ -#ifndef _LINUX_POWERPC_SYSDEP_H -#define _LINUX_POWERPC_SYSDEP_H 1 +#ifndef _LINUX_POWERPC64_SYSDEP_H +#define _LINUX_POWERPC64_SYSDEP_H 1 #include -#include -#include -#include - -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - -#ifdef __ASSEMBLER__ - -/* This seems to always be the case on PPC. */ -# define ALIGNARG(log2) log2 -# define ASM_SIZE_DIRECTIVE(name) .size name,.-name - -#endif /* __ASSEMBLER__ */ - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. This returns just what the kernel - gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) - the negation of the return value in the kernel gets reverted. */ - -#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0\n\t" \ - "0:" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ - "+r" (r7), "+r" (r8) \ - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) - -/* This version is for kernels that implement system calls that - behave like function calls as far as register saving. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* Define a macro which expands inline into the wrapper code for a system - call. This use is for internal calls that do not need to handle errors - normally. It will never touch errno. This returns just what the kernel - gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) - the negation of the return value in the kernel gets reverted. */ - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - ({ \ - register long int r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - LOADARGS_##nr (name, ##args); \ - __asm__ __volatile__ \ - ("sc\n\t" \ - "mfcr %0\n\t" \ - "0:" \ - : "=&r" (r0), \ - "=&r" (r3), "=&r" (r4), "=&r" (r5), \ - "=&r" (r6), "=&r" (r7), "=&r" (r8) \ - : ASM_INPUT_##nr \ - : "r9", "r10", "r11", "r12", \ - "cr0", "ctr", "memory"); \ - err = r0; \ - r3; \ - }) -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) long int err __attribute__ ((unused)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (val) - -#define LOADARGS_0(name, dummy) \ - r0 = name -#define LOADARGS_1(name, __arg1) \ - long int arg1 = (long int) (__arg1); \ - LOADARGS_0(name, 0); \ - extern void __illegally_sized_syscall_arg1 (void); \ - if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 8) \ - __illegally_sized_syscall_arg1 (); \ - r3 = arg1 -#define LOADARGS_2(name, __arg1, __arg2) \ - long int arg2 = (long int) (__arg2); \ - LOADARGS_1(name, __arg1); \ - extern void __illegally_sized_syscall_arg2 (void); \ - if (__builtin_classify_type (__arg2) != 5 && sizeof (__arg2) > 8) \ - __illegally_sized_syscall_arg2 (); \ - r4 = arg2 -#define LOADARGS_3(name, __arg1, __arg2, __arg3) \ - long int arg3 = (long int) (__arg3); \ - LOADARGS_2(name, __arg1, __arg2); \ - extern void __illegally_sized_syscall_arg3 (void); \ - if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \ - __illegally_sized_syscall_arg3 (); \ - r5 = arg3 -#define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ - long int arg4 = (long int) (__arg4); \ - LOADARGS_3(name, __arg1, __arg2, __arg3); \ - extern void __illegally_sized_syscall_arg4 (void); \ - if (__builtin_classify_type (__arg4) != 5 && sizeof (__arg4) > 8) \ - __illegally_sized_syscall_arg4 (); \ - r6 = arg4 -#define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ - long int arg5 = (long int) (__arg5); \ - LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ - extern void __illegally_sized_syscall_arg5 (void); \ - if (__builtin_classify_type (__arg5) != 5 && sizeof (__arg5) > 8) \ - __illegally_sized_syscall_arg5 (); \ - r7 = arg5 -#define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ - long int arg6 = (long int) (__arg6); \ - LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ - extern void __illegally_sized_syscall_arg6 (void); \ - if (__builtin_classify_type (__arg6) != 5 && sizeof (__arg6) > 8) \ - __illegally_sized_syscall_arg6 (); \ - r8 = arg6 - -#define ASM_INPUT_0 "0" (r0) -#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) -#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) -#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) -#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) -#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) -#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) - - -/* Pointer mangling support. */ -#if IS_IN (rtld) -/* We cannot use the thread descriptor because in ld.so we use setjmp - earlier than the descriptor is initialized. */ -#else -# ifdef __ASSEMBLER__ -# define PTR_MANGLE(reg, tmpreg) \ - ld tmpreg,POINTER_GUARD(r13); \ - xor reg,tmpreg,reg -# define PTR_MANGLE2(reg, tmpreg) \ - xor reg,tmpreg,reg -# define PTR_MANGLE3(destreg, reg, tmpreg) \ - ld tmpreg,POINTER_GUARD(r13); \ - xor destreg,tmpreg,reg -# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) -# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) -# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) -# else -# define PTR_MANGLE(var) \ - (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) -# define PTR_DEMANGLE(var) PTR_MANGLE (var) -# endif -#endif /* In the PowerPC64 ABI, the unadorned F_GETLK* opcodes should be used even by largefile64 code. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/sysdep.h new file mode 100644 index 0000000000..4b9d43c636 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -0,0 +1,265 @@ +/* Syscall definitions, Linux PowerPC generic version. + 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 + 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 + . */ + +#ifndef _LINUX_POWERPC_SYSDEP_H +#define _LINUX_POWERPC_SYSDEP_H 1 + +#include +#include +#include +/* Define __set_errno() for INLINE_SYSCALL macro below. */ +#include + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +/* Define a macro which expands inline into the wrapper code for a system + call. This use is for internal calls that do not need to handle errors + normally. It will never touch errno. This returns just what the kernel + gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) + the negation of the return value in the kernel gets reverted. */ + +#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, type, nr, args...) \ + ({ \ + register void *r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); \ + register type rval __asm__ ("r3"); \ + LOADARGS_##nr (funcptr, args); \ + __asm__ __volatile__ \ + ("mtctr %0\n\t" \ + "bctrl\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ + "+r" (r7), "+r" (r8) \ + : : "r9", "r10", "r11", "r12", \ + "cr0", "cr1", "cr5", "cr6", "cr7", \ + "xer", "lr", "ctr", "memory"); \ + __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ + (long int) r0 & (1 << 28) ? -rval : rval; \ + }) + +#define INTERNAL_VSYSCALL_CALL(funcptr, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, long int, nr, args) + +#define DECLARE_REGS \ + register long int r0 __asm__ ("r0"); \ + register long int r3 __asm__ ("r3"); \ + register long int r4 __asm__ ("r4"); \ + register long int r5 __asm__ ("r5"); \ + register long int r6 __asm__ ("r6"); \ + register long int r7 __asm__ ("r7"); \ + register long int r8 __asm__ ("r8"); + +#define SYSCALL_SCV(nr) \ + ({ \ + __asm__ __volatile__ \ + (".machine \"push\"\n\t" \ + ".machine \"power9\"\n\t" \ + "scv 0\n\t" \ + ".machine \"pop\"\n\t" \ + "0:" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "cr0", "cr1", "cr5", "cr6", "cr7", \ + "xer", "lr", "ctr", "memory"); \ + r3; \ + }) + +#define SYSCALL_SC(nr) \ + ({ \ + __asm__ __volatile__ \ + ("sc\n\t" \ + "mfcr %0\n\t" \ + "0:" \ + : "=&r" (r0), \ + "=&r" (r3), "=&r" (r4), "=&r" (r5), \ + "=&r" (r6), "=&r" (r7), "=&r" (r8) \ + : ASM_INPUT_##nr \ + : "r9", "r10", "r11", "r12", \ + "xer", "cr0", "ctr", "memory"); \ + r0 & (1 << 28) ? -r3 : r3; \ + }) + +/* This will only be non-empty for 64-bit systems, see below. */ +#define TRY_SYSCALL_SCV(nr) + +#if defined(__PPC64__) || defined(__powerpc64__) +# define SYSCALL_ARG_SIZE 8 + +/* For the static case, unlike the dynamic loader, there is no compile-time way + to check if we are inside startup code. So we need to check if the thread + pointer has already been setup before trying to access the TLS. */ +# ifndef SHARED +# define CHECK_THREAD_POINTER (__thread_register != 0) +# else +# define CHECK_THREAD_POINTER (1) +# endif + +/* When inside the dynamic loader, the thread pointer may not have been + initialized yet, so don't check for scv support in that case. */ +# if defined(USE_PPC_SCV) && !IS_IN(rtld) +# undef TRY_SYSCALL_SCV +# define TRY_SYSCALL_SCV(nr) \ + CHECK_THREAD_POINTER && THREAD_GET_HWCAP() & PPC_FEATURE2_SCV ? \ + SYSCALL_SCV(nr) : +# endif + +#else +# define SYSCALL_ARG_SIZE 4 +#endif + +# define INTERNAL_SYSCALL_NCS(name, nr, args...) \ + ({ \ + DECLARE_REGS; \ + LOADARGS_##nr (name, ##args); \ + TRY_SYSCALL_SCV(nr) \ + SYSCALL_SC(nr); \ + }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + INTERNAL_SYSCALL_NCS (__NR_##name, nr, args) + +#define LOADARGS_0(name, dummy) \ + r0 = name +#define LOADARGS_1(name, __arg1) \ + long int _arg1 = (long int) (__arg1); \ + LOADARGS_0(name, 0); \ + extern void __illegally_sized_syscall_arg1 (void); \ + if (__builtin_classify_type (__arg1) != 5 \ + && sizeof (__arg1) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg1 (); \ + r3 = _arg1 +#define LOADARGS_2(name, __arg1, __arg2) \ + long int _arg2 = (long int) (__arg2); \ + LOADARGS_1(name, __arg1); \ + extern void __illegally_sized_syscall_arg2 (void); \ + if (__builtin_classify_type (__arg2) != 5 \ + && sizeof (__arg2) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg2 (); \ + r4 = _arg2 +#define LOADARGS_3(name, __arg1, __arg2, __arg3) \ + long int _arg3 = (long int) (__arg3); \ + LOADARGS_2(name, __arg1, __arg2); \ + extern void __illegally_sized_syscall_arg3 (void); \ + if (__builtin_classify_type (__arg3) != 5 \ + && sizeof (__arg3) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg3 (); \ + r5 = _arg3 +#define LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4) \ + long int _arg4 = (long int) (__arg4); \ + LOADARGS_3(name, __arg1, __arg2, __arg3); \ + extern void __illegally_sized_syscall_arg4 (void); \ + if (__builtin_classify_type (__arg4) != 5 \ + && sizeof (__arg4) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg4 (); \ + r6 = _arg4 +#define LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5) \ + long int _arg5 = (long int) (__arg5); \ + LOADARGS_4(name, __arg1, __arg2, __arg3, __arg4); \ + extern void __illegally_sized_syscall_arg5 (void); \ + if (__builtin_classify_type (__arg5) != 5 \ + && sizeof (__arg5) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg5 (); \ + r7 = _arg5 +#define LOADARGS_6(name, __arg1, __arg2, __arg3, __arg4, __arg5, __arg6) \ + long int _arg6 = (long int) (__arg6); \ + LOADARGS_5(name, __arg1, __arg2, __arg3, __arg4, __arg5); \ + extern void __illegally_sized_syscall_arg6 (void); \ + if (__builtin_classify_type (__arg6) != 5 \ + && sizeof (__arg6) > SYSCALL_ARG_SIZE) \ + __illegally_sized_syscall_arg6 (); \ + r8 = _arg6 + +#define ASM_INPUT_0 "0" (r0) +#define ASM_INPUT_1 ASM_INPUT_0, "1" (r3) +#define ASM_INPUT_2 ASM_INPUT_1, "2" (r4) +#define ASM_INPUT_3 ASM_INPUT_2, "3" (r5) +#define ASM_INPUT_4 ASM_INPUT_3, "4" (r6) +#define ASM_INPUT_5 ASM_INPUT_4, "5" (r7) +#define ASM_INPUT_6 ASM_INPUT_5, "6" (r8) + + +/* Pointer mangling support. */ +#if IS_IN (rtld) +/* We cannot use the thread descriptor because in ld.so we use setjmp + earlier than the descriptor is initialized. */ +#else +# ifdef __ASSEMBLER__ +# if defined(__PPC64__) || defined(__powerpc64__) +# define LOAD ld +# define TPREG r13 +# else +# define LOAD lwz +# define TPREG r2 +# endif +# define PTR_MANGLE(reg, tmpreg) \ + LOAD tmpreg,POINTER_GUARD(TPREG); \ + xor reg,tmpreg,reg +# define PTR_MANGLE2(reg, tmpreg) \ + xor reg,tmpreg,reg +# define PTR_MANGLE3(destreg, reg, tmpreg) \ + LOAD tmpreg,POINTER_GUARD(TPREG); \ + xor destreg,tmpreg,reg +# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) +# define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg) +# define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg) +# else +# define PTR_MANGLE(var) \ + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) +# define PTR_DEMANGLE(var) PTR_MANGLE (var) +# endif +#endif + +/* List of system calls which are supported as vsyscalls. */ +#define VDSO_NAME "LINUX_2.6.15" +#define VDSO_HASH 123718565 + +#if defined(__PPC64__) || defined(__powerpc64__) +#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" +#else +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" +#endif +#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" +#define HAVE_TIME_VSYSCALL "__kernel_time" +#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" +#define HAVE_GET_TBFREQ "__kernel_get_tbfreq" + +#if defined(__PPC64__) || defined(__powerpc64__) +# define HAVE_SIGTRAMP_RT64 "__kernel_sigtramp_rt64" +#else +# define HAVE_SIGTRAMP_32 "__kernel_sigtramp32" +# define HAVE_SIGTRAMP_RT32 "__kernel_sigtramp_rt32" +#endif + +#endif /* _LINUX_POWERPC_SYSDEP_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/xstatver.h new file mode 100644 index 0000000000..aa61dfd678 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/xstatver.h @@ -0,0 +1,17 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#if __WORDSIZE == 32 +# define _STAT_VER _STAT_VER_LINUX +#else +# define _STAT_VER _STAT_VER_KERNEL +#endif + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h index 65feee4890..74c4c27ca1 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. RISC-V version. - Copyright (C) 2018-2020 Free Software Foundation, Inc. + Copyright (C) 2018-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h index 201bf9a91b..37ff07a0d7 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -22,6 +22,32 @@ #include #include +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +#if __WORDSIZE == 32 + +/* Workarounds for generic code needing to handle 64-bit time_t. */ + +/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ +#define __NR_clock_getres __NR_clock_getres_time64 +/* Fix sysdeps/nptl/lowlevellock-futex.h. */ +#define __NR_futex __NR_futex_time64 +/* Fix sysdeps/unix/sysv/linux/pause.c. */ +#define __NR_ppoll __NR_ppoll_time64 +/* Fix sysdeps/unix/sysv/linux/select.c. */ +#define __NR_pselect6 __NR_pselect6_time64 +/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ +#define __NR_recvmmsg __NR_recvmmsg_time64 +/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ +#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ +#define __NR_semtimedop __NR_semtimedop_time64 +/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ +#define __NR_utimensat __NR_utimensat_time64 + +#endif /* __WORDSIZE == 32 */ + #ifdef __ASSEMBLER__ # include @@ -107,56 +133,38 @@ # undef ret_ERRVAL # define ret_ERRVAL ret -#endif /* __ASSEMBLER__ */ +#else /* !__ASSEMBLER__ */ -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -# include -#endif +# if __WORDSIZE == 64 +# define VDSO_NAME "LINUX_4.15" +# define VDSO_HASH 182943605 -#include +/* List of system calls which are supported as vsyscalls only + for RV64. */ +# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# else +# define VDSO_NAME "LINUX_5.4" +# define VDSO_HASH 61765876 -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name +/* RV32 does not support the gettime VDSO syscalls. */ +# endif -#ifndef __ASSEMBLER__ - -# define VDSO_NAME "LINUX_4.15" -# define VDSO_HASH 182943605 - -/* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" -# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" -# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +/* List of system calls which are supported as vsyscalls (for RV32 and + RV64). */ # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \ - __sys_result = (unsigned long) -1; \ - } \ - __sys_result; }) +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) +# define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr (SYS_ify (name), args) -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (val) > -4096UL) +# define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + internal_syscall##nr (number, args) -# define INTERNAL_SYSCALL_ERRNO(val, err) (-val) - -# define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr (SYS_ify (name), err, args) - -# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (number, err, args) - -# define internal_syscall0(number, err, dummy...) \ +# define internal_syscall0(number, dummy...) \ ({ \ long int _sys_result; \ \ @@ -173,13 +181,14 @@ _sys_result; \ }) -# define internal_syscall1(number, err, arg0) \ +# define internal_syscall1(number, arg0) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ + register long int __a0 asm ("a0") = _arg0; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -190,14 +199,16 @@ _sys_result; \ }) -# define internal_syscall2(number, err, arg0, arg1) \ +# define internal_syscall2(number, arg0, arg1) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -208,15 +219,18 @@ _sys_result; \ }) -# define internal_syscall3(number, err, arg0, arg1, arg2) \ +# define internal_syscall3(number, arg0, arg1, arg2) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -227,16 +241,20 @@ _sys_result; \ }) -# define internal_syscall4(number, err, arg0, arg1, arg2, arg3) \ +# define internal_syscall4(number, arg0, arg1, arg2, arg3) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -247,17 +265,22 @@ _sys_result; \ }) -# define internal_syscall5(number, err, arg0, arg1, arg2, arg3, arg4) \ +# define internal_syscall5(number, arg0, arg1, arg2, arg3, arg4) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -268,18 +291,24 @@ _sys_result; \ }) -# define internal_syscall6(number, err, arg0, arg1, arg2, arg3, arg4, arg5) \ +# define internal_syscall6(number, arg0, arg1, arg2, arg3, arg4, arg5) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ - register long int __a5 asm ("a5") = (long int) (arg5); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ + register long int __a5 asm ("a5") = _arg5; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ @@ -291,19 +320,26 @@ _sys_result; \ }) -# define internal_syscall7(number, err, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ +# define internal_syscall7(number, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ long int _sys_result; \ + long int _arg0 = (long int) (arg0); \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + long int _arg6 = (long int) (arg6); \ \ { \ register long int __a7 asm ("a7") = number; \ - register long int __a0 asm ("a0") = (long int) (arg0); \ - register long int __a1 asm ("a1") = (long int) (arg1); \ - register long int __a2 asm ("a2") = (long int) (arg2); \ - register long int __a3 asm ("a3") = (long int) (arg3); \ - register long int __a4 asm ("a4") = (long int) (arg4); \ - register long int __a5 asm ("a5") = (long int) (arg5); \ - register long int __a6 asm ("a6") = (long int) (arg6); \ + register long int __a0 asm ("a0") = _arg0; \ + register long int __a1 asm ("a1") = _arg1; \ + register long int __a2 asm ("a2") = _arg2; \ + register long int __a3 asm ("a3") = _arg3; \ + register long int __a4 asm ("a4") = _arg4; \ + register long int __a5 asm ("a5") = _arg5; \ + register long int __a6 asm ("a6") = _arg6; \ __asm__ volatile ( \ "scall\n\t" \ : "+r" (__a0) \ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h deleted file mode 100644 index b383a98692..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/stat.h +++ /dev/null @@ -1,265 +0,0 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -#include - -#if __WORDSIZE == 64 -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 -# define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 0 -#else -/* Versions of the `struct stat' data structure. */ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 -# define _STAT_VER _STAT_VER_LINUX - -/* Versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX -#endif - -#if __WORDSIZE == 64 -struct stat - { - __dev_t st_dev; /* Device. */ - __ino_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __glibc_reserved0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ - long int __glibc_reserved[3]; - }; -#else -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; -# ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -# else - __ino_t __st_ino; /* 32bit file serial number. */ -# endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; -# ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -# else - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -# ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ -# endif - }; -#endif - -#ifdef __USE_LARGEFILE64 -# if __WORDSIZE == 64 -/* Note stat64 is the same shape as stat. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - int __glibc_reserved0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ - long int __glibc_reserved[3]; - }; -# else -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - __ino64_t st_ino; /* File serial number. */ - }; -# endif -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index 45f70184ea..82e77e1e03 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/s390 version. - Copyright (C) 2003-2020 Free Software Foundation, Inc. + Copyright (C) 2003-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,7 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -81,10 +82,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h index 831d0ab7d5..4757e9eb02 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. S/390 version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,6 @@ # define __ASSUME_SOCKETPAIR_SYSCALL 1 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 -# define __ASSUME_SETSOCKOPT_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 @@ -43,6 +41,8 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL +# undef __ASSUME_SETSOCKOPT_SYSCALL #endif /* s390 only supports ipc syscall before 5.1. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index f52b8b8735..34fb5dbf5e 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -26,11 +26,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -38,9 +33,6 @@ /* in newer 2.1 kernels __NR_syscall is missing so we define it here */ #define __NR_syscall 0 -#undef SYS_ify -#define SYS_ify(syscall_name) __NR_##syscall_name - #ifdef __ASSEMBLER__ /* Linux uses a negative return value to indicate syscall errors, unlike @@ -88,7 +80,9 @@ #define PSEUDO_END_ERRVAL(name) \ END (name) +#undef SYSCALL_ERROR_LABEL #ifndef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ @@ -97,6 +91,7 @@ 2: .long syscall_error #else # if RTLD_PRIVATE_ERRNO +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ @@ -112,6 +107,7 @@ # else # define SYSCALL_ERROR_ERRNO errno # endif +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: lcr %r0,%r2; \ @@ -124,6 +120,7 @@ br %r14; \ 2: .long _GLOBAL_OFFSET_TABLE_-1b # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: basr %r1,0; \ @@ -178,100 +175,13 @@ #define ret_ERRVAL \ br 14 +#else + +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #endif /* __ASSEMBLER__ */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = 0xffffffff; \ - } \ - (int) _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_DIRECT -#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc %b1\n\t" \ - : "=d" (_ret) \ - : "i" (__NR_##name) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_SVC0 -#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(no); \ - register int _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - (((__NR_##name) < 256) \ - ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \ - : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - -#define DECLARGS_0() -#define DECLARGS_1(arg1) \ - register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ - DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); - -#define ASMFMT_0 -#define ASMFMT_1 , "0" (gpr2) -#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) -#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) -#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) -#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) - /* Pointer mangling support. */ #if IS_IN (rtld) /* We cannot use the thread descriptor because in ld.so we use setjmp diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 9ff4479dc3..cbf2553cd8 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for 64 bit S/390. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -27,11 +27,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -39,17 +34,6 @@ /* In newer 2.1 kernels __NR_syscall is missing so we define it here. */ #define __NR_syscall 0 -/* - * Newer kernel versions redefined __NR_pread and __NR_pwrite to - * __NR_pread64 and __NR_pwrite64. - */ -#ifndef __NR_pread -# define __NR_pread __NR_pread64 -#endif -#ifndef __NR_pwrite -# define __NR_pwrite __NR_pwrite64 -#endif - #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name @@ -102,11 +86,14 @@ SYSCALL_ERROR_HANDLER; \ END (name) +#undef SYSCALL_ERROR_LABEL #ifndef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL syscall_error # define SYSCALL_ERROR_HANDLER #else # if RTLD_PRIVATE_ERRNO +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: larl %r1,rtld_errno; \ @@ -120,6 +107,7 @@ # else # define SYSCALL_ERROR_ERRNO errno # endif +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: lcr %r0,%r2; \ @@ -132,6 +120,7 @@ lghi %r2,-1; \ br %r14 # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ 0: larl %r1,_GLOBAL_OFFSET_TABLE_; \ @@ -184,102 +173,13 @@ #define ret_ERRVAL \ br 14 +#else + +# undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +# define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #endif /* __ASSEMBLER__ */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - long _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = -1; \ - } \ - _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_DIRECT -#define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc %b1\n\t" \ - : "=d" (_ret) \ - : "i" (__NR_##name) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_SVC0 -#define INTERNAL_SYSCALL_SVC0(name, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(__NR_##name); \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ - ({ \ - DECLARGS_##nr(args) \ - register unsigned long _nr __asm__("1") = (unsigned long)(no); \ - register long _ret __asm__("2"); \ - __asm__ __volatile__ ( \ - "svc 0\n\t" \ - : "=d" (_ret) \ - : "d" (_nr) ASMFMT_##nr \ - : "memory" ); \ - _ret; }) - -#undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - (((__NR_##name) < 256) \ - ? INTERNAL_SYSCALL_DIRECT(name, err, nr, args) \ - : INTERNAL_SYSCALL_SVC0(name, err,nr, args)) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= -4095UL) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - -#define DECLARGS_0() -#define DECLARGS_1(arg1) \ - register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); -#define DECLARGS_2(arg1, arg2) \ - DECLARGS_1(arg1) \ - register unsigned long gpr3 __asm__ ("3") = (unsigned long)(arg2); -#define DECLARGS_3(arg1, arg2, arg3) \ - DECLARGS_2(arg1, arg2) \ - register unsigned long gpr4 __asm__ ("4") = (unsigned long)(arg3); -#define DECLARGS_4(arg1, arg2, arg3, arg4) \ - DECLARGS_3(arg1, arg2, arg3) \ - register unsigned long gpr5 __asm__ ("5") = (unsigned long)(arg4); -#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - DECLARGS_4(arg1, arg2, arg3, arg4) \ - register unsigned long gpr6 __asm__ ("6") = (unsigned long)(arg5); -#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ - DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ - register unsigned long gpr7 __asm__ ("7") = (unsigned long)(arg6); - -#define ASMFMT_0 -#define ASMFMT_1 , "0" (gpr2) -#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) -#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) -#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) -#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) -#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) - -#define SINGLE_THREAD_BY_GLOBAL 1 - /* Pointer mangling support. */ #if IS_IN (rtld) /* We cannot use the thread descriptor because in ld.so we use setjmp diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h index 4955e37b75..565277a1ea 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sysdep.h new file mode 100644 index 0000000000..683d1349c4 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -0,0 +1,113 @@ +/* Syscall definitions, Linux s390 version. + 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 + 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 + . */ + +#ifndef __ASSEMBLY__ + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + +#undef INTERNAL_SYSCALL_DIRECT +#define INTERNAL_SYSCALL_DIRECT(name, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register long int _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc %b1\n\t" \ + : "=d" (_ret) \ + : "i" (__NR_##name) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_SVC0 +#define INTERNAL_SYSCALL_SVC0(name, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long int _nr __asm__("1") = \ + (unsigned long int)(__NR_##name); \ + register long int _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long int _nr __asm__("1") = (unsigned long int)(no); \ + register long int _ret __asm__("2"); \ + __asm__ __volatile__ ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + (((__NR_##name) < 256) \ + ? INTERNAL_SYSCALL_DIRECT(name, nr, args) \ + : INTERNAL_SYSCALL_SVC0(name, nr, args)) + +#define DECLARGS_0() +#define DECLARGS_1(arg1) \ + register unsigned long int gpr2 __asm__ ("2") = (unsigned long int)(arg1); +#define DECLARGS_2(arg1, arg2) \ + DECLARGS_1(arg1) \ + register unsigned long int gpr3 __asm__ ("3") = (unsigned long int)(arg2); +#define DECLARGS_3(arg1, arg2, arg3) \ + DECLARGS_2(arg1, arg2) \ + register unsigned long int gpr4 __asm__ ("4") = (unsigned long int)(arg3); +#define DECLARGS_4(arg1, arg2, arg3, arg4) \ + DECLARGS_3(arg1, arg2, arg3) \ + register unsigned long int gpr5 __asm__ ("5") = (unsigned long int)(arg4); +#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + DECLARGS_4(arg1, arg2, arg3, arg4) \ + register unsigned long int gpr6 __asm__ ("6") = (unsigned long int)(arg5); +#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \ + DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \ + register unsigned long int gpr7 __asm__ ("7") = (unsigned long int)(arg6); + +#define ASMFMT_0 +#define ASMFMT_1 , "0" (gpr2) +#define ASMFMT_2 , "0" (gpr2), "d" (gpr3) +#define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4) +#define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5) +#define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) +#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) + +#define SINGLE_THREAD_BY_GLOBAL 1 + + +#define VDSO_NAME "LINUX_2.6.29" +#define VDSO_HASH 123718585 + +/* List of system calls which are supported as vsyscalls. */ +#ifdef __s390x__ +#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" +#else +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" +#endif +#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" +#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" + +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/xstatver.h new file mode 100644 index 0000000000..9923199e40 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/s390/xstatver.h @@ -0,0 +1,19 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ + +#include + +#if __WORDSIZE == 64 +# define _STAT_VER_KERNEL 0 +# define _STAT_VER_LINUX 1 +# define _MKNOD_VER_LINUX 0 +#else +# define _STAT_VER_LINUX_OLD 1 +# define _STAT_VER_KERNEL 1 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 +# define _MKNOD_VER_LINUX 1 +# define _MKNOD_VER_SVR4 2 +#endif +#define _STAT_VER _STAT_VER_LINUX +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h index 5bac608a11..15f5cc2c85 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. SH version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,8 +33,6 @@ #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 -#define __ASSUME_GETSOCKOPT_SYSCALL 1 -#define __ASSUME_SETSOCKOPT_SYSCALL 1 #include_next diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h index 703b042f4f..97aa92dfa2 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Copyright (C) 1992-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. Changed by Kaz Kojima, . @@ -287,19 +287,8 @@ register long int r1 asm ("%r1") = (long int) (_arg6); \ register long int r2 asm ("%r2") = (long int) (_arg7) -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) - #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#define INTERNAL_SYSCALL(name, nr, args...) \ ({ \ unsigned long int resultvar; \ register long int r3 asm ("%r3") = SYS_ify (name); \ @@ -313,7 +302,7 @@ (int) resultvar; }) /* The _NCS variant allows non-constant syscall numbers. */ -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ ({ \ unsigned long int resultvar; \ register long int r3 asm ("%r3") = (name); \ @@ -326,16 +315,6 @@ \ (int) resultvar; }) -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #endif /* __ASSEMBLER__ */ /* Pointer mangling support. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h index cc71def780..2fac8dcc11 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/single-thread.h @@ -1,5 +1,5 @@ /* Single thread optimization, Linux version. - Copyright (C) 2019-2020 Free Software Foundation, Inc. + Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,36 +27,18 @@ The ABI might define SINGLE_THREAD_BY_GLOBAL to enable the single thread check to use global variables instead of the pthread_t field. */ -#ifdef SINGLE_THREAD_BY_GLOBAL -# if IS_IN (libc) +#ifndef __ASSEMBLER__ extern int __libc_multiple_threads; -# define SINGLE_THREAD_P \ - __glibc_likely (__libc_multiple_threads == 0) -# elif IS_IN (libpthread) -extern int __pthread_multiple_threads; -# define SINGLE_THREAD_P \ - __glibc_likely (__pthread_multiple_threads == 0) -# elif IS_IN (librt) -# define SINGLE_THREAD_P \ - __glibc_likely (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0) -# else -/* For rtld, et cetera. */ -# define SINGLE_THREAD_P (1) -# endif -#else /* SINGLE_THREAD_BY_GLOBAL */ -# if IS_IN (libc) || IS_IN (libpthread) || IS_IN (librt) -# define SINGLE_THREAD_P \ - __glibc_likely (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0) -# else -/* For rtld, et cetera. */ -# define SINGLE_THREAD_P (1) -# endif -#endif /* SINGLE_THREAD_BY_GLOBAL */ +libc_hidden_proto (__libc_multiple_threads) +#endif -#define RTLD_SINGLE_THREAD_P \ - __glibc_likely (THREAD_GETMEM (THREAD_SELF, \ - header.multiple_threads) == 0) +#if !defined SINGLE_THREAD_BY_GLOBAL || IS_IN (rtld) +# define SINGLE_THREAD_P \ + (THREAD_GETMEM (THREAD_SELF, header.multiple_threads) == 0) +#else +# define SINGLE_THREAD_P (__libc_multiple_threads == 0) +#endif + +#define RTLD_SINGLE_THREAD_P SINGLE_THREAD_P #endif /* _SINGLE_THREAD_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h deleted file mode 100644 index 7379f2232d..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/stat.h +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ -#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64 - unsigned short int __pad1; - __ino_t st_ino; /* File serial number. */ -#else - __ino64_t st_ino; /* File serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ -# if __WORDSIZE == 64 - unsigned short int __pad1; -# endif - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index 1f3bbc8002..7aaca9757d 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. + Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,7 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __S32_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -75,10 +76,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h index ea642120e9..2c28393647 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. SPARC version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -38,10 +38,11 @@ # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL # undef __ASSUME_SENDTO_SYSCALL +# undef __ASSUME_GETSOCKOPT_SYSCALL +# undef __ASSUME_SETSOCKOPT_SYSCALL #else # define __ASSUME_SOCKET_SYSCALL 1 # define __ASSUME_SOCKETPAIR_SYSCALL 1 -# define __ASSUME_GETSOCKOPT_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -49,7 +50,6 @@ #if __LINUX_KERNEL_VERSION >= 0x040400 # define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 -# define __ASSUME_SETSOCKOPT_SYSCALL 1 #endif #ifdef __arch64__ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h new file mode 100644 index 0000000000..4a2df42d37 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/kernel_stat.h @@ -0,0 +1,37 @@ +/* Definition of `struct stat' used in the kernel */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned long int st_ino; + unsigned short int st_mode; + short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + long int st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long int st_blksize; + long int st_blocks; + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; + }; + +#define _HAVE___UNUSED4 +#define _HAVE___UNUSED5 + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT64___UNUSED4 +#define _HAVE_STAT64___UNUSED5 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index 8461261674..7cbfdada63 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza , January 1997. @@ -110,9 +110,8 @@ ENTRY(name); \ #define __SYSCALL_STRING \ "ta 0x10;" \ "bcc 1f;" \ - " mov 0, %%g1;" \ + " nop;" \ "sub %%g0, %%o0, %%o0;" \ - "mov 1, %%g1;" \ "1:" #define __SYSCALL_CLOBBERS \ @@ -122,6 +121,9 @@ ENTRY(name); \ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \ "cc", "memory" +#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1 + #endif /* __ASSEMBLER__ */ /* Pointer mangling support. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h new file mode 100644 index 0000000000..29d18908da --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h @@ -0,0 +1,58 @@ +#ifndef _KERNEL_STAT_H +#define _KERNEL_STAT_H + +/* Definition of `struct stat' used in the kernel */ +struct kernel_stat + { + unsigned int st_dev; + unsigned long int st_ino; + unsigned int st_mode; + short int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + long int st_size; + long int st_atime_sec; + long int st_mtime_sec; + long int st_ctime_sec; + long int st_blksize; + long int st_blocks; + unsigned long int __glibc_reserved1; + unsigned long int __glibc_reserved2; + }; + +/* Definition of `struct stat64' used in the kernel. */ +struct kernel_stat64 + { + unsigned long int st_dev; + unsigned long int st_ino; + unsigned long int st_nlink; + + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + + unsigned long int st_rdev; + long int st_size; + long int st_blksize; + long int st_blocks; + + unsigned long int st_atime_sec; + unsigned long int st_atime_nsec; + unsigned long int st_mtime_sec; + unsigned long int st_mtime_nsec; + unsigned long int st_ctime_sec; + unsigned long int st_ctime_nsec; + long int __glibc_reserved[3]; + }; + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 0 +#define XSTAT_IS_XSTAT64 1 +#ifdef __arch64__ +# define STATFS_IS_STATFS64 1 +#else +# define STATFS_IS_STATFS64 0 +#endif +#endif /* _KERNEL_STAT_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h new file mode 100644 index 0000000000..7d7c629add --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h @@ -0,0 +1,44 @@ +/* Struct kernel_stat64 to stat64. Linux/SPARC version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include + +static inline void +__cp_stat64_kstat64 (struct stat64 *st64, const struct kernel_stat64 *kst64) +{ + st64->st_dev = kst64->st_dev; + st64->__pad1 = 0; + st64->st_ino = kst64->st_ino; + st64->st_mode = kst64->st_mode; + st64->st_nlink = kst64->st_nlink; + st64->st_uid = kst64->st_uid; + st64->st_gid = kst64->st_gid; + st64->st_rdev = kst64->st_rdev; + st64->__pad2 = 0; + st64->st_size = kst64->st_size; + st64->st_blksize = kst64->st_blksize; + st64->st_blocks = kst64->st_blocks; + st64->st_atim.tv_sec = kst64->st_atime_sec; + st64->st_atim.tv_nsec = kst64->st_atime_nsec; + st64->st_mtim.tv_sec = kst64->st_mtime_sec; + st64->st_mtim.tv_nsec = kst64->st_mtime_nsec; + st64->st_ctim.tv_sec = kst64->st_ctime_sec; + st64->st_ctim.tv_nsec = kst64->st_ctime_nsec; + st64->__glibc_reserved4 = 0; + st64->__glibc_reserved5 = 0; +} diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index b9a4c75cbd..5aa80e32bf 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. +/* Copyright (C) 1997-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson , 1997. @@ -109,9 +109,8 @@ ENTRY(name); \ #define __SYSCALL_STRING \ "ta 0x6d;" \ "bcc,pt %%xcc, 1f;" \ - " mov 0, %%g1;" \ + " nop;" \ "sub %%g0, %%o0, %%o0;" \ - "mov 1, %%g1;" \ "1:" #define __SYSCALL_CLOBBERS \ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h index 0c32780d9c..0c55902178 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. +/* Copyright (C) 2000-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2000. @@ -34,13 +34,6 @@ #else /* __ASSEMBLER__ */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - _ret; \ - }) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -52,121 +45,119 @@ # endif # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) \ - register long err __asm__("g1"); - #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr(__SYSCALL_STRING, __NR_##name, args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, err, name, args) +#define INTERNAL_SYSCALL_NCS(name, nr, args...) \ + internal_syscall##nr(__SYSCALL_STRING, name, args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((void) (val), __builtin_expect((err) != 0, 0)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - -#define inline_syscall0(string,err,name,dummy...) \ +#define internal_syscall0(string,name,dummy...) \ ({ \ + register long int __g1 __asm__ ("g1") = (name); \ register long __o0 __asm__ ("o0"); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err) : \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall1(string,err,name,arg1) \ +#define internal_syscall1(string,name,arg1) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0) : \ + long int _arg1 = (long int) (arg1); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall2(string,err,name,arg1,arg2) \ +#define internal_syscall2(string,name,arg1,arg2) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1) : \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0), "r" (__o1) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall3(string,err,name,arg1,arg2,arg3) \ +#define internal_syscall3(string,name,arg1,arg2,arg3) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + register long int __o2 __asm__ ("o2") = _arg3; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0), "r" (__o1), \ "r" (__o2) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall4(string,err,name,arg1,arg2,arg3,arg4) \ +#define internal_syscall4(string,name,arg1,arg2,arg3,arg4) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + register long int __o2 __asm__ ("o2") = _arg3; \ + register long int __o3 __asm__ ("o3") = _arg4; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall5(string,err,name,arg1,arg2,arg3,arg4,arg5) \ +#define internal_syscall5(string,name,arg1,arg2,arg3,arg4,arg5) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + register long int __o2 __asm__ ("o2") = _arg3; \ + register long int __o3 __asm__ ("o3") = _arg4; \ + register long int __o4 __asm__ ("o4") = _arg5; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ __o0; \ }) -#define inline_syscall6(string,err,name,arg1,arg2,arg3,arg4,arg5,arg6) \ +#define internal_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __o5 __asm__ ("o5") = (long)(arg6); \ - err = name; \ - __asm __volatile (string : "=r" (err), "=r" (__o0) : \ - "0" (err), "1" (__o0), "r" (__o1), \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + long int _arg6 = (long int) (arg6); \ + register long int __g1 __asm__("g1") = (name); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + register long int __o2 __asm__ ("o2") = _arg3; \ + register long int __o3 __asm__ ("o3") = _arg4; \ + register long int __o4 __asm__ ("o4") = _arg5; \ + register long int __o5 __asm__ ("o5") = _arg6; \ + __asm __volatile (string : "=r" (__o0) : \ + "r" (__g1), "0" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4), \ "r" (__o5) : \ __SYSCALL_CLOBBERS); \ @@ -175,20 +166,25 @@ #define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \ ({ \ - register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __g1 __asm__ ("g1") = __NR_clone; \ + long int _arg1 = (long int) (arg1); \ + long int _arg2 = (long int) (arg2); \ + long int _arg3 = (long int) (arg3); \ + long int _arg4 = (long int) (arg4); \ + long int _arg5 = (long int) (arg5); \ + register long int __o0 __asm__ ("o0") = _arg1; \ + register long int __o1 __asm__ ("o1") = _arg2; \ + register long int __o2 __asm__ ("o2") = _arg3; \ + register long int __o3 __asm__ ("o3") = _arg4; \ + register long int __o4 __asm__ ("o4") = _arg5; \ + register long int __g1 __asm__ ("g1") = __NR_clone; \ __asm __volatile (__SYSCALL_STRING : \ - "=r" (__g1), "=r" (__o0), "=r" (__o1) : \ - "0" (__g1), "1" (__o0), "2" (__o1), \ + "=r" (__o0), "=r" (__o1) : \ + "r" (__g1), "0" (__o0), "1" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ __SYSCALL_CLOBBERS); \ - if (INTERNAL_SYSCALL_ERROR_P (__o0, __g1)) \ + if (__glibc_unlikely ((unsigned long int) (__o0) > -4096UL)) \ { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__o0, __g1)); \ + __set_errno (-__o0); \ __o0 = -1L; \ } \ else \ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/xstatver.h new file mode 100644 index 0000000000..693b41c3ac --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/xstatver.h @@ -0,0 +1,13 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/stat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat.c new file mode 100644 index 0000000000..95a50016fc --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat.c @@ -0,0 +1,31 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include + +#if !XSTAT_IS_XSTAT64 +int +__stat (const char *file, struct stat *buf) +{ + return __fstatat (AT_FDCWD, file, buf, 0); +} + +weak_alias (__stat, stat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/stat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat64.c new file mode 100644 index 0000000000..329ab11f4b --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat64.c @@ -0,0 +1,52 @@ +/* Get file status. Linux version. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __stat __redirect___stat +#define stat __redirect_stat +#include +#include +#include +#include + +int +__stat64_time64 (const char *file, struct __stat64_t64 *buf) +{ + return __fstatat64_time64 (AT_FDCWD, file, buf, 0); +} +#if __TIMESIZE != 64 +hidden_def (__stat64_time64) + +int +__stat64 (const char *file, struct stat64 *buf) +{ + struct __stat64_t64 st_t64; + return __stat64_time64 (file, &st_t64) + ?: __cp_stat64_t64_stat64 (&st_t64, buf); +} +#endif + +#undef __stat +#undef stat + +hidden_def (__stat64) +weak_alias (__stat64, stat64) + +#if XSTAT_IS_XSTAT64 +strong_alias (__stat64, __stat) +weak_alias (__stat64, stat) +#endif diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.c new file mode 100644 index 0000000000..0755584419 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.c @@ -0,0 +1,75 @@ +/* Struct stat/stat64 to stat/stat64 conversion for Linux. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#include +#include +#include +#include + +#if __TIMESIZE != 64 + +static inline bool +in_time_t_range (__time64_t t) +{ + time_t s = t; + return s == t; +} + +static inline struct timespec +valid_timespec64_to_timespec (const struct __timespec64 ts64) +{ + struct timespec ts; + + ts.tv_sec = (time_t) ts64.tv_sec; + ts.tv_nsec = ts64.tv_nsec; + + return ts; +} + +int +__cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64, + struct stat64 *st64) +{ + if (! in_time_t_range (st64_t64->st_atim.tv_sec) + || ! in_time_t_range (st64_t64->st_mtim.tv_sec) + || ! in_time_t_range (st64_t64->st_ctim.tv_sec)) + { + __set_errno (EOVERFLOW); + return -1; + } + + /* Clear both pad and reserved fields. */ + memset (st64, 0, sizeof (*st64)); + + st64->st_dev = st64_t64->st_dev, + st64->st_ino = st64_t64->st_ino; + st64->st_mode = st64_t64->st_mode; + st64->st_nlink = st64_t64->st_nlink; + st64->st_uid = st64_t64->st_uid; + st64->st_gid = st64_t64->st_gid; + st64->st_rdev = st64_t64->st_rdev; + st64->st_size = st64_t64->st_size; + st64->st_blksize = st64_t64->st_blksize; + st64->st_blocks = st64_t64->st_blocks; + st64->st_atim = valid_timespec64_to_timespec (st64_t64->st_atim); + st64->st_mtim = valid_timespec64_to_timespec (st64_t64->st_mtim); + st64->st_ctim = valid_timespec64_to_timespec (st64_t64->st_ctim); + + return 0; +} +#endif diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/wordsize.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.h similarity index 69% rename from lib/libc/include/mips64el-linux-gnuabi64/bits/wordsize.h rename to lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.h index 9e405e4e4e..94a8c8a60d 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/wordsize.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2002-2021 Free Software Foundation, Inc. +/* Copy to/from struct stat with and without 64-bit time_t support. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,17 +16,10 @@ License along with the GNU C Library. If not, see . */ -#include +#include -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 +#if __TIMESIZE != 64 +extern int __cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64, + struct stat64 *st64) + attribute_hidden; #endif - -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/struct_stat_time64.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/struct_stat_time64.h new file mode 100644 index 0000000000..260d1812be --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/struct_stat_time64.h @@ -0,0 +1,34 @@ +/* Struct stat with 64-bit time support. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _BITS_STRUCT_STAT_TIME64_H +#define _BITS_STRUCT_STAT_TIME64_H 1 + +#if __TIMESIZE == 64 +# define __stat64_t64 stat64 +#else +# include + +struct __stat64_t64 + { +# define __struct_timespec struct __timespec64 +# include + }; +#endif /* __TIMESIZE == 64 */ + +#endif /* _BITS_STRUCT_STAT_TIME64_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h index aa89a74e6b..e2344058ad 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/syscall.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h index 6979b86b72..e17265c607 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2020 Free Software Foundation, Inc. +/* Copyright (C) 1995-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -54,17 +54,34 @@ struct ntptimeval __BEGIN_DECLS -extern int __adjtimex (struct timex *__ntx) __THROW; +#ifndef __USE_TIME_BITS64 extern int adjtimex (struct timex *__ntx) __THROW; - -#ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), - ntp_gettimex); -#else extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; -# define ntp_gettime ntp_gettimex -#endif + +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), + ntp_gettimex); +# else +# define ntp_gettime ntp_gettimex +# endif extern int ntp_adjtime (struct timex *__tntx) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), + ___adjtimex64); +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), + __ntp_gettime64); +extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv), + __ntp_gettimex64); +extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx), + ___adjtimex64); +# else +# define adjtimex ___adjtimex64 +# define ntp_adjtime ___adjtimex64 +# define ntp_gettime __ntp_gettime64 +# define ntp_gettimex __ntp_gettimex64 +# endif +#endif __END_DECLS diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h index c7f3e54d37..3ef72dc805 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015-2020 Free Software Foundation, Inc. +/* Copyright (C) 2015-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,8 +15,40 @@ License along with the GNU C Library; if not, see . */ +#ifndef _SYSDEP_LINUX_H +#define _SYSDEP_LINUX_H + #include #include +#include +#include + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val) \ + ((unsigned long int) (val) > -4096UL) + +#ifndef SYSCALL_ERROR_LABEL +# define SYSCALL_ERROR_LABEL(sc_err) \ + ({ \ + __set_errno (sc_err); \ + -1L; \ + }) +#endif + +/* Define a macro which expands into the inline wrapper code for a system + call. It sets the errno and returns -1 on a failure, or the syscall + return value otherwise. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + long int sc_ret = INTERNAL_SYSCALL (name, nr, args); \ + __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret)) \ + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret)) \ + : sc_ret; \ + }) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) /* Set error number and return -1. A target may choose to return the internal function, __syscall_error, which sets errno and returns -1. @@ -63,6 +95,8 @@ (long) (val), \ (long) (((uint64_t) (val)) >> 32) -/* Exports the __send symbol on send.c linux implementation (some ABI have - it missing due the usage of a old generic version without it). */ -#define HAVE_INTERNAL_SEND_SYMBOL 1 +/* Export the ___brk_addr symbol on brk.c implementation (some ABIs export + it due and old crtstuff.c code). */ +#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 0 + +#endif /* _SYSDEP_LINUX_H */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h deleted file mode 100644 index 25dec69dda..0000000000 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/stat.h +++ /dev/null @@ -1,210 +0,0 @@ -/* Copyright (C) 1999-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." -#endif - -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 - -/* Versions of the `struct stat' data structure. */ -#ifndef __x86_64__ -# define _STAT_VER_LINUX_OLD 1 -# define _STAT_VER_KERNEL 1 -# define _STAT_VER_SVR4 2 -# define _STAT_VER_LINUX 3 - -/* i386 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 1 -# define _MKNOD_VER_SVR4 2 -# define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ -#else -# define _STAT_VER_KERNEL 0 -# define _STAT_VER_LINUX 1 - -/* x86-64 versions of the `xmknod' interface. */ -# define _MKNOD_VER_LINUX 0 -#endif - -#define _STAT_VER _STAT_VER_LINUX - -struct stat - { - __dev_t st_dev; /* Device. */ -#ifndef __x86_64__ - unsigned short int __pad1; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif -#ifndef __x86_64__ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -#else - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -#endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -#ifdef __x86_64__ - int __pad0; -#endif - __dev_t st_rdev; /* Device number, if device. */ -#ifndef __x86_64__ - unsigned short int __pad2; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -#else -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ -# endif -#endif - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 has the same shape as stat for x86-64. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ -# ifdef __x86_64__ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# else - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -# endif -# ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -# else - __ino64_t st_ino; /* File serial number. */ -# endif - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV -/* Nanosecond resolution time values are supported. */ -#define _STATBUF_ST_NSEC - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index d084145597..060af056f8 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -64,6 +64,7 @@ #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -87,10 +88,15 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h index 799e0c2792..1e49281e07 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2020 Free Software Foundation, Inc. +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/xstatver.h new file mode 100644 index 0000000000..678d5bc022 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86/xstatver.h @@ -0,0 +1,16 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#ifndef __x86_64__ +# define _STAT_VER_LINUX_OLD 1 +# define _STAT_VER_KERNEL 1 +# define _STAT_VER_SVR4 2 +# define _STAT_VER_LINUX 3 +# define _MKNOD_VER_LINUX 1 +# define _MKNOD_VER_SVR4 2 +#else +# define _STAT_VER_KERNEL 0 +# define _STAT_VER_LINUX 1 +# define _MKNOD_VER_LINUX 0 +#endif +#define _STAT_VER _STAT_VER_LINUX +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h index 80ff5684a7..84888db77c 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. x86-64 version. - Copyright (C) 1999-2020 Free Software Foundation, Inc. + Copyright (C) 1999-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h index c2eb37e575..327e59388b 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2020 Free Software Foundation, Inc. +/* Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,13 +33,6 @@ #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name -/* This is to help the old kernel headers where __NR_semtimedop is not - available. */ -#ifndef __NR_semtimedop -# define __NR_semtimedop 220 -#endif - - #ifdef __ASSEMBLER__ /* Linux uses a negative return value to indicate syscall errors, @@ -55,19 +48,40 @@ /* We don't want the label for the error handle to be global when we define it here. */ +# undef SYSCALL_ERROR_LABEL # ifdef PIC +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL 0f # else +# undef SYSCALL_ERROR_LABEL # define SYSCALL_ERROR_LABEL syscall_error # endif +/* PSEUDO and T_PSEUDO macros have 2 extra arguments for unsigned long + int arguments. */ +# define PSEUDOS_HAVE_ULONG_INDICES 1 + +# ifndef SYSCALL_ULONG_ARG_1 +# define SYSCALL_ULONG_ARG_1 0 +# define SYSCALL_ULONG_ARG_2 0 +# endif + # undef PSEUDO -# define PSEUDO(name, syscall_name, args) \ - .text; \ - ENTRY (name) \ - DO_CALL (syscall_name, args); \ - cmpq $-4095, %rax; \ +# if SYSCALL_ULONG_ARG_1 +# define PSEUDO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2); \ + cmpq $-4095, %rax; \ jae SYSCALL_ERROR_LABEL +# else +# define PSEUDO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, 0, 0); \ + cmpq $-4095, %rax; \ + jae SYSCALL_ERROR_LABEL +# endif # undef PSEUDO_END # define PSEUDO_END(name) \ @@ -75,10 +89,17 @@ END (name) # undef PSEUDO_NOERRNO -# define PSEUDO_NOERRNO(name, syscall_name, args) \ - .text; \ - ENTRY (name) \ - DO_CALL (syscall_name, args) +# if SYSCALL_ULONG_ARG_1 +# define PSEUDO_NOERRNO(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2) +# else +# define PSEUDO_NOERRNO(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, 0, 0) +# endif # undef PSEUDO_END_NOERRNO # define PSEUDO_END_NOERRNO(name) \ @@ -87,11 +108,19 @@ # define ret_NOERRNO ret # undef PSEUDO_ERRVAL -# define PSEUDO_ERRVAL(name, syscall_name, args) \ - .text; \ - ENTRY (name) \ - DO_CALL (syscall_name, args); \ +# if SYSCALL_ULONG_ARG_1 +# define PSEUDO_ERRVAL(name, syscall_name, args, ulong_arg_1, ulong_arg_2) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, ulong_arg_1, ulong_arg_2); \ negq %rax +# else +# define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args, 0, 0); \ + negq %rax +# endif # undef PSEUDO_END_ERRVAL # define PSEUDO_END_ERRVAL(name) \ @@ -163,8 +192,10 @@ Syscalls of more than 6 arguments are not supported. */ # undef DO_CALL -# define DO_CALL(syscall_name, args) \ +# define DO_CALL(syscall_name, args, ulong_arg_1, ulong_arg_2) \ DOARGS_##args \ + ZERO_EXTEND_##ulong_arg_1 \ + ZERO_EXTEND_##ulong_arg_2 \ movl $SYS_ify (syscall_name), %eax; \ syscall; @@ -176,57 +207,39 @@ # define DOARGS_5 DOARGS_4 # define DOARGS_6 DOARGS_5 +# define ZERO_EXTEND_0 /* nothing */ +# define ZERO_EXTEND_1 /* nothing */ +# define ZERO_EXTEND_2 /* nothing */ +# define ZERO_EXTEND_3 /* nothing */ +# define ZERO_EXTEND_4 /* nothing */ +# define ZERO_EXTEND_5 /* nothing */ +# define ZERO_EXTEND_6 /* nothing */ + #else /* !__ASSEMBLER__ */ -/* Define a macro which expands inline into the wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -/* Define a macro with explicit types for arguments, which expands inline - into the wrapper code for a system call. It should be used when size - of any argument > size of long int. */ -# undef INLINE_SYSCALL_TYPES -# define INLINE_SYSCALL_TYPES(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) /* Registers clobbered by syscall. */ # define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx" -/* Create a variable 'name' based on type 'X' to avoid explicit types. - This is mainly used set use 64-bits arguments in x32. */ -#define TYPEFY(X, name) __typeof__ ((X) - (X)) name -/* Explicit cast the argument to avoid integer from pointer warning on - x32. */ -#define ARGIFY(X) ((__typeof__ ((X) - (X))) (X)) +/* NB: This also works when X is an array. For an array X, type of + (X) - (X) is ptrdiff_t, which is signed, since size of ptrdiff_t + == size of pointer, cast is a NOP. */ +#define TYPEFY1(X) __typeof__ ((X) - (X)) +/* Explicit cast the argument. */ +#define ARGIFY(X) ((TYPEFY1 (X)) (X)) +/* Create a variable 'name' based on type of variable 'X' to avoid + explicit types. */ +#define TYPEFY(X, name) __typeof__ (ARGIFY (X)) name #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ - internal_syscall##nr (SYS_ify (name), err, args) +#define INTERNAL_SYSCALL(name, nr, args...) \ + internal_syscall##nr (SYS_ify (name), args) #undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ - internal_syscall##nr (number, err, args) +#define INTERNAL_SYSCALL_NCS(number, nr, args...) \ + internal_syscall##nr (number, args) #undef internal_syscall0 -#define internal_syscall0(number, err, dummy...) \ +#define internal_syscall0(number, dummy...) \ ({ \ unsigned long int resultvar; \ asm volatile ( \ @@ -238,7 +251,7 @@ }) #undef internal_syscall1 -#define internal_syscall1(number, err, arg1) \ +#define internal_syscall1(number, arg1) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg1, __arg1) = ARGIFY (arg1); \ @@ -252,7 +265,7 @@ }) #undef internal_syscall2 -#define internal_syscall2(number, err, arg1, arg2) \ +#define internal_syscall2(number, arg1, arg2) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg2, __arg2) = ARGIFY (arg2); \ @@ -268,7 +281,7 @@ }) #undef internal_syscall3 -#define internal_syscall3(number, err, arg1, arg2, arg3) \ +#define internal_syscall3(number, arg1, arg2, arg3) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg3, __arg3) = ARGIFY (arg3); \ @@ -286,7 +299,7 @@ }) #undef internal_syscall4 -#define internal_syscall4(number, err, arg1, arg2, arg3, arg4) \ +#define internal_syscall4(number, arg1, arg2, arg3, arg4) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg4, __arg4) = ARGIFY (arg4); \ @@ -306,7 +319,7 @@ }) #undef internal_syscall5 -#define internal_syscall5(number, err, arg1, arg2, arg3, arg4, arg5) \ +#define internal_syscall5(number, arg1, arg2, arg3, arg4, arg5) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg5, __arg5) = ARGIFY (arg5); \ @@ -329,7 +342,7 @@ }) #undef internal_syscall6 -#define internal_syscall6(number, err, arg1, arg2, arg3, arg4, arg5, arg6) \ +#define internal_syscall6(number, arg1, arg2, arg3, arg4, arg5, arg6) \ ({ \ unsigned long int resultvar; \ TYPEFY (arg6, __arg6) = ARGIFY (arg6); \ @@ -353,12 +366,6 @@ (long int) resultvar; \ }) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (long int) (val) >= -4095L) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -370,6 +377,8 @@ # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" # define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLONE3_WRAPPER 1 + # define SINGLE_THREAD_BY_GLOBAL 1 #endif /* __ASSEMBLER__ */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h index 5bf9eed80b..62c9737c6b 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2012-2020 Free Software Foundation, Inc. +/* Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,4 +26,39 @@ #undef LO_HI_LONG #define LO_HI_LONG(val) (val) +#ifdef __ASSEMBLER__ +/* Zero-extend 32-bit unsigned long int arguments to 64 bits. */ +# undef ZERO_EXTEND_1 +# define ZERO_EXTEND_1 movl %edi, %edi; +# undef ZERO_EXTEND_2 +# define ZERO_EXTEND_2 movl %esi, %esi; +# undef ZERO_EXTEND_3 +# define ZERO_EXTEND_3 movl %edx, %edx; +# if SYSCALL_ULONG_ARG_1 == 4 || SYSCALL_ULONG_ARG_2 == 4 +# undef DOARGS_4 +# define DOARGS_4 movl %ecx, %r10d; +# else +# undef ZERO_EXTEND_4 +# define ZERO_EXTEND_4 movl %r10d, %r10d; +# endif +# undef ZERO_EXTEND_5 +# define ZERO_EXTEND_5 movl %r8d, %r8d; +# undef ZERO_EXTEND_6 +# define ZERO_EXTEND_6 movl %r9d, %r9d; +#else /* !__ASSEMBLER__ */ +# undef ARGIFY +/* Enforce zero-extension for pointers and array system call arguments. + For integer types, extend to int64_t (the full register) using a + regular cast, resulting in zero or sign extension based on the + signedness of the original type. */ +# define ARGIFY(X) \ + ({ \ + _Pragma ("GCC diagnostic push"); \ + _Pragma ("GCC diagnostic ignored \"-Wpointer-to-int-cast\""); \ + (__builtin_classify_type (X) == 5 \ + ? (uintptr_t) (X) : (int64_t) (X)); \ + _Pragma ("GCC diagnostic pop"); \ + }) +#endif /* __ASSEMBLER__ */ + #endif /* linux/x86_64/x32/sysdep.h */ diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/xstatver.h b/lib/libc/glibc/sysdeps/unix/sysv/linux/xstatver.h new file mode 100644 index 0000000000..8e1801b603 --- /dev/null +++ b/lib/libc/glibc/sysdeps/unix/sysv/linux/xstatver.h @@ -0,0 +1,13 @@ +/* Versions of the 'struct stat' data structure used in compatibility xstat + functions. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX + +/* Versions of the 'xmknod' interface used in compatibility xmknod + functions. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX diff --git a/lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h b/lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h index c549dce4db..225b6bdebc 100644 --- a/lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h +++ b/lib/libc/glibc/sysdeps/unix/x86_64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2020 Free Software Foundation, Inc. +/* Copyright (C) 1991-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h b/lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h index 4d8187b570..3e7c54bd0c 100644 --- a/lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h +++ b/lib/libc/glibc/sysdeps/wordsize-32/divdi3-symbol-hacks.h @@ -1,5 +1,5 @@ /* Hacks needed for divdi3 symbol manipulation. - Copyright (C) 2004-2020 Free Software Foundation, Inc. + Copyright (C) 2004-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/x86/bits/select.h b/lib/libc/glibc/sysdeps/x86/bits/select.h deleted file mode 100644 index b2e3ac800a..0000000000 --- a/lib/libc/glibc/sysdeps/x86/bits/select.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (C) 1997-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _SYS_SELECT_H -# error "Never use directly; include instead." -#endif - -#include - - -#if defined __GNUC__ && __GNUC__ >= 2 - -# if __WORDSIZE == 64 -# define __FD_ZERO_STOS "stosq" -# else -# define __FD_ZERO_STOS "stosl" -# endif - -# define __FD_ZERO(fdsp) \ - do { \ - int __d0, __d1; \ - __asm__ __volatile__ ("cld; rep; " __FD_ZERO_STOS \ - : "=c" (__d0), "=D" (__d1) \ - : "a" (0), "0" (sizeof (fd_set) \ - / sizeof (__fd_mask)), \ - "1" (&__FDS_BITS (fdsp)[0]) \ - : "memory"); \ - } while (0) - -#else /* ! GNU CC */ - -/* We don't use `memset' because this would require a prototype and - the array isn't too big. */ -# define __FD_ZERO(set) \ - do { \ - unsigned int __i; \ - fd_set *__arr = (set); \ - for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ - __FDS_BITS (__arr)[__i] = 0; \ - } while (0) - -#endif /* GNU CC */ - -#define __FD_SET(d, set) \ - ((void) (__FDS_BITS (set)[__FD_ELT (d)] |= __FD_MASK (d))) -#define __FD_CLR(d, set) \ - ((void) (__FDS_BITS (set)[__FD_ELT (d)] &= ~__FD_MASK (d))) -#define __FD_ISSET(d, set) \ - ((__FDS_BITS (set)[__FD_ELT (d)] & __FD_MASK (d)) != 0) diff --git a/lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h index 399d4868a9..4ebc4f9748 100644 --- a/lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/glibc/sysdeps/x86/nptl/bits/pthreadtypes-arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Copyright (C) 2002-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/x86/sysdep.h b/lib/libc/glibc/sysdeps/x86/sysdep.h index f5039bc1b2..cac1d762fb 100644 --- a/lib/libc/glibc/sysdeps/x86/sysdep.h +++ b/lib/libc/glibc/sysdeps/x86/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for x86. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,6 +57,11 @@ enum cf_protection_level #define STATE_SAVE_MASK \ ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7)) +/* Constants for bits in __x86_string_control: */ + +/* Avoid short distance REP MOVSB. */ +#define X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB (1 << 0) + #ifdef __ASSEMBLER__ /* Syntactic details of assembler. */ diff --git a/lib/libc/glibc/sysdeps/x86_64/crti.S b/lib/libc/glibc/sysdeps/x86_64/crti.S index c2f1cc3c95..129d1befc7 100644 --- a/lib/libc/glibc/sysdeps/x86_64/crti.S +++ b/lib/libc/glibc/sysdeps/x86_64/crti.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86-64. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/x86_64/crtn.S b/lib/libc/glibc/sysdeps/x86_64/crtn.S index 5fa457d511..b06fe62f26 100644 --- a/lib/libc/glibc/sysdeps/x86_64/crtn.S +++ b/lib/libc/glibc/sysdeps/x86_64/crtn.S @@ -1,5 +1,5 @@ /* Special .init and .fini section support for x86-64. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/sysdeps/x86_64/start.S b/lib/libc/glibc/sysdeps/x86_64/start.S index 7477b632f7..1b3e36826b 100644 --- a/lib/libc/glibc/sysdeps/x86_64/start.S +++ b/lib/libc/glibc/sysdeps/x86_64/start.S @@ -1,5 +1,5 @@ /* Startup code compliant to the ELF x86-64 ABI. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2001. @@ -96,17 +96,13 @@ ENTRY (_start) which grow downwards). */ pushq %rsp -#ifdef PIC - /* Pass address of our own entry points to .fini and .init. */ - mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP - mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP + /* These used to be the addresses of .fini and .init. */ + xorl %r8d, %r8d + xorl %ecx, %ecx +#ifdef PIC mov main@GOTPCREL(%rip), %RDI_LP #else - /* Pass address of our own entry points to .fini and .init. */ - mov $__libc_csu_fini, %R8_LP - mov $__libc_csu_init, %RCX_LP - mov $main, %RDI_LP #endif diff --git a/lib/libc/glibc/sysdeps/x86_64/sysdep.h b/lib/libc/glibc/sysdeps/x86_64/sysdep.h index 0b73674f68..7bebdeb210 100644 --- a/lib/libc/glibc/sysdeps/x86_64/sysdep.h +++ b/lib/libc/glibc/sysdeps/x86_64/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for x86-64. - Copyright (C) 2001-2020 Free Software Foundation, Inc. + Copyright (C) 2001-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -95,6 +95,28 @@ lose: \ #define R14_LP r14 #define R15_LP r15 +/* Zero upper vector registers and return with xtest. NB: Use VZEROALL + to avoid RTM abort triggered by VZEROUPPER inside transactionally. */ +#define ZERO_UPPER_VEC_REGISTERS_RETURN_XTEST \ + xtest; \ + jz 1f; \ + vzeroall; \ + ret; \ +1: \ + vzeroupper; \ + ret + +/* Zero upper vector registers and return. */ +#ifndef ZERO_UPPER_VEC_REGISTERS_RETURN +# define ZERO_UPPER_VEC_REGISTERS_RETURN \ + VZEROUPPER; \ + ret +#endif + +#ifndef VZEROUPPER_RETURN +# define VZEROUPPER_RETURN VZEROUPPER; ret +#endif + #else /* __ASSEMBLER__ */ /* Long and pointer size in bytes. */ diff --git a/lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h b/lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h index 6498b22b07..e902176879 100644 --- a/lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h +++ b/lib/libc/glibc/sysdeps/x86_64/x32/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for x32. - Copyright (C) 2012-2020 Free Software Foundation, Inc. + Copyright (C) 2012-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/lib/libc/glibc/time/bits/types/struct_timespec.h b/lib/libc/glibc/time/bits/types/struct_timespec.h index d11c69cfd3..489e81136d 100644 --- a/lib/libc/glibc/time/bits/types/struct_timespec.h +++ b/lib/libc/glibc/time/bits/types/struct_timespec.h @@ -4,15 +4,20 @@ #include #include +#include /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { +#ifdef __USE_TIME_BITS64 + __time64_t tv_sec; /* Seconds. */ +#else __time_t tv_sec; /* Seconds. */ +#endif #if __WORDSIZE == 64 \ || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ - || __TIMESIZE == 32 + || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64) __syscall_slong_t tv_nsec; /* Nanoseconds. */ #else # if __BYTE_ORDER == __BIG_ENDIAN diff --git a/lib/libc/glibc/time/bits/types/struct_timeval.h b/lib/libc/glibc/time/bits/types/struct_timeval.h index 70394ce886..3466137c35 100644 --- a/lib/libc/glibc/time/bits/types/struct_timeval.h +++ b/lib/libc/glibc/time/bits/types/struct_timeval.h @@ -7,7 +7,12 @@ microsecond but also has a range of years. */ struct timeval { +#ifdef __USE_TIME_BITS64 + __time64_t tv_sec; /* Seconds. */ + __suseconds64_t tv_usec; /* Microseconds. */ +#else __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ +#endif }; #endif diff --git a/lib/libc/glibc/time/bits/types/time_t.h b/lib/libc/glibc/time/bits/types/time_t.h index ab8287c6fe..84d67f6ac3 100644 --- a/lib/libc/glibc/time/bits/types/time_t.h +++ b/lib/libc/glibc/time/bits/types/time_t.h @@ -4,6 +4,10 @@ #include /* Returned by `time'. */ +#ifdef __USE_TIME_BITS64 +typedef __time64_t time_t; +#else typedef __time_t time_t; +#endif #endif diff --git a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h deleted file mode 100644 index 61e25c0bcc..0000000000 --- a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages for systems with 64k - pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/aarch64-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/aarch64-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..b08307db0a --- /dev/null +++ b/lib/libc/include/aarch64-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,22 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/aarch64 version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64-linux-gnu/bits/statfs.h deleted file mode 100644 index 94a6e610fb..0000000000 --- a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_STATFS_H -# error "Never include directly; use instead." -#endif - -#include -#include -#include - -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - -#if defined __USE_FILE_OFFSET64 -# define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name -#elif __BYTE_ORDER == __LITTLE_ENDIAN -# define __field64(type, type64, name) \ - type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad -#else -# define __field64(type, type64, name) \ - int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name -#endif - -struct statfs - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; - -#undef __field64 - -#ifdef __USE_LARGEFILE64 -struct statfs64 - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATFS_F_NAMELEN -#define _STATFS_F_FRSIZE -#define _STATFS_F_FLAGS \ No newline at end of file diff --git a/lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h b/lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h index d25085e24f..f156f318c9 100644 --- a/lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h +++ b/lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h index 40f59658ab..a3c6247f68 100644 --- a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h @@ -25,6 +25,40 @@ __BEGIN_DECLS +/* Avoid collision if the linux ptrace header is already included. */ +#undef PTRACE_TRACEME +#undef PTRACE_PEEKTEXT +#undef PTRACE_PEEKDATA +#undef PTRACE_PEEKUSER +#undef PTRACE_POKETEXT +#undef PTRACE_POKEDATA +#undef PTRACE_POKEUSER +#undef PTRACE_CONT +#undef PTRACE_KILL +#undef PTRACE_SINGLESTEP +#undef PTRACE_ATTACH +#undef PTRACE_DETACH +#undef PTRACE_SYSCALL +#undef PTRACE_SYSEMU +#undef PTRACE_SYSEMU_SINGLESTEP +#undef PTRACE_PEEKMTETAGS +#undef PTRACE_POKEMTETAGS +#undef PTRACE_SETOPTIONS +#undef PTRACE_GETEVENTMSG +#undef PTRACE_GETSIGINFO +#undef PTRACE_SETSIGINFO +#undef PTRACE_GETREGSET +#undef PTRACE_SETREGSET +#undef PTRACE_SEIZE +#undef PTRACE_INTERRUPT +#undef PTRACE_LISTEN +#undef PTRACE_PEEKSIGINFO +#undef PTRACE_GETSIGMASK +#undef PTRACE_SETSIGMASK +#undef PTRACE_SECCOMP_GET_FILTER +#undef PTRACE_SECCOMP_GET_METADATA +#undef PTRACE_GET_SYSCALL_INFO + /* Type of the REQUEST argument to `ptrace.' */ enum __ptrace_request { @@ -82,6 +116,22 @@ enum __ptrace_request PTRACE_SYSCALL = 24, #define PT_SYSCALL PTRACE_SYSCALL + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 31, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 32, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + + /* Read MTE tags. */ + PTRACE_PEEKMTETAGS = 33, +#define PT_PEEKMTETAGS PTRACE_PEEKMTETAGS + + /* Write MTE tags. */ + PTRACE_POKEMTETAGS = 34, +#define PT_POKEMTETAGS PTRACE_POKEMTETAGS + /* Set ptrace filter options. */ PTRACE_SETOPTIONS = 0x4200, #define PT_SETOPTIONS PTRACE_SETOPTIONS diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h deleted file mode 100644 index 61e25c0bcc..0000000000 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages for systems with 64k - pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/aarch64_be-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..b08307db0a --- /dev/null +++ b/lib/libc/include/aarch64_be-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,22 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/aarch64 version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h deleted file mode 100644 index 94a6e610fb..0000000000 --- a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_STATFS_H -# error "Never include directly; use instead." -#endif - -#include -#include -#include - -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - -#if defined __USE_FILE_OFFSET64 -# define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name -#elif __BYTE_ORDER == __LITTLE_ENDIAN -# define __field64(type, type64, name) \ - type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad -#else -# define __field64(type, type64, name) \ - int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name -#endif - -struct statfs - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; - -#undef __field64 - -#ifdef __USE_LARGEFILE64 -struct statfs64 - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATFS_F_NAMELEN -#define _STATFS_F_FRSIZE -#define _STATFS_F_FLAGS \ No newline at end of file diff --git a/lib/libc/include/aarch64_be-linux-gnu/gnu/lib-names-lp64_be.h b/lib/libc/include/aarch64_be-linux-gnu/gnu/lib-names-lp64_be.h index fb1dd8a26c..7c11af71ef 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/gnu/lib-names-lp64_be.h +++ b/lib/libc/include/aarch64_be-linux-gnu/gnu/lib-names-lp64_be.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h index 40f59658ab..a3c6247f68 100644 --- a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h @@ -25,6 +25,40 @@ __BEGIN_DECLS +/* Avoid collision if the linux ptrace header is already included. */ +#undef PTRACE_TRACEME +#undef PTRACE_PEEKTEXT +#undef PTRACE_PEEKDATA +#undef PTRACE_PEEKUSER +#undef PTRACE_POKETEXT +#undef PTRACE_POKEDATA +#undef PTRACE_POKEUSER +#undef PTRACE_CONT +#undef PTRACE_KILL +#undef PTRACE_SINGLESTEP +#undef PTRACE_ATTACH +#undef PTRACE_DETACH +#undef PTRACE_SYSCALL +#undef PTRACE_SYSEMU +#undef PTRACE_SYSEMU_SINGLESTEP +#undef PTRACE_PEEKMTETAGS +#undef PTRACE_POKEMTETAGS +#undef PTRACE_SETOPTIONS +#undef PTRACE_GETEVENTMSG +#undef PTRACE_GETSIGINFO +#undef PTRACE_SETSIGINFO +#undef PTRACE_GETREGSET +#undef PTRACE_SETREGSET +#undef PTRACE_SEIZE +#undef PTRACE_INTERRUPT +#undef PTRACE_LISTEN +#undef PTRACE_PEEKSIGINFO +#undef PTRACE_GETSIGMASK +#undef PTRACE_SETSIGMASK +#undef PTRACE_SECCOMP_GET_FILTER +#undef PTRACE_SECCOMP_GET_METADATA +#undef PTRACE_GET_SYSCALL_INFO + /* Type of the REQUEST argument to `ptrace.' */ enum __ptrace_request { @@ -82,6 +116,22 @@ enum __ptrace_request PTRACE_SYSCALL = 24, #define PT_SYSCALL PTRACE_SYSCALL + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 31, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 32, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + + /* Read MTE tags. */ + PTRACE_PEEKMTETAGS = 33, +#define PT_PEEKMTETAGS PTRACE_PEEKMTETAGS + + /* Write MTE tags. */ + PTRACE_POKEMTETAGS = 34, +#define PT_POKEMTETAGS PTRACE_POKEMTETAGS + /* Set ptrace filter options. */ PTRACE_SETOPTIONS = 0x4200, #define PT_SETOPTIONS PTRACE_SETOPTIONS diff --git a/lib/libc/include/arm-linux-gnueabi/bits/floatn.h b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h similarity index 64% rename from lib/libc/include/mips64-linux-gnuabin32/bits/struct_rwlock.h rename to lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h index 6355f539b9..7431c5597f 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/struct_rwlock.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h @@ -1,4 +1,4 @@ -/* MIPS internal rwlock struct definitions. +/* Default read-write lock implementation struct definitions. Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,8 +16,15 @@ License along with the GNU C Library; if not, see . */ -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ struct __pthread_rwlock_arch_t { @@ -27,45 +34,28 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; -#if _MIPS_SIM == _ABI64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain + /* FLAGS must stay at its position in the structure to maintain binary compatibility. */ - unsigned int __flags; -# else -# if __BYTE_ORDER == __BIG_ENDIAN +#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. */ +#else unsigned char __flags; unsigned char __shared; unsigned char __pad1; unsigned char __pad2; -# endif - int __cur_writer; #endif + int __cur_writer; }; -#if _MIPS_SIM == _ABI64 +#if __BYTE_ORDER == __BIG_ENDIAN # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif #endif #endif \ No newline at end of file diff --git a/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h b/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h index 94f0282059..202df2c998 100644 --- a/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h +++ b/lib/libc/include/arm-linux-gnueabi/bits/struct_stat.h @@ -28,32 +28,35 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -63,28 +66,32 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 +# endif +# ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -#else +# else __ino64_t st_ino; /* File serial number. */ -#endif +# endif +#endif /* __USE_TIME_BITS64 */ }; #ifdef __USE_LARGEFILE64 struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; @@ -99,7 +106,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -109,15 +116,16 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# else +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __ino64_t st_ino; /* File serial number. */ +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h similarity index 64% rename from lib/libc/include/mips64el-linux-gnuabi64/bits/struct_rwlock.h rename to lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h index 6355f539b9..7431c5597f 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/struct_rwlock.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h @@ -1,4 +1,4 @@ -/* MIPS internal rwlock struct definitions. +/* Default read-write lock implementation struct definitions. Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,8 +16,15 @@ License along with the GNU C Library; if not, see . */ -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ struct __pthread_rwlock_arch_t { @@ -27,45 +34,28 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; -#if _MIPS_SIM == _ABI64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain + /* FLAGS must stay at its position in the structure to maintain binary compatibility. */ - unsigned int __flags; -# else -# if __BYTE_ORDER == __BIG_ENDIAN +#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. */ +#else unsigned char __flags; unsigned char __shared; unsigned char __pad1; unsigned char __pad2; -# endif - int __cur_writer; #endif + int __cur_writer; }; -#if _MIPS_SIM == _ABI64 +#if __BYTE_ORDER == __BIG_ENDIAN # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif #endif #endif \ No newline at end of file diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h b/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h index 94f0282059..202df2c998 100644 --- a/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h +++ b/lib/libc/include/arm-linux-gnueabihf/bits/struct_stat.h @@ -28,32 +28,35 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -63,28 +66,32 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 +# endif +# ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -#else +# else __ino64_t st_ino; /* File serial number. */ -#endif +# endif +#endif /* __USE_TIME_BITS64 */ }; #ifdef __USE_LARGEFILE64 struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; @@ -99,7 +106,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -109,15 +116,16 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# else +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __ino64_t st_ino; /* File serial number. */ +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h similarity index 64% rename from lib/libc/include/mips64-linux-gnuabi64/bits/struct_rwlock.h rename to lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h index 6355f539b9..7431c5597f 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/struct_rwlock.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h @@ -1,4 +1,4 @@ -/* MIPS internal rwlock struct definitions. +/* Default read-write lock implementation struct definitions. Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,8 +16,15 @@ License along with the GNU C Library; if not, see . */ -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ struct __pthread_rwlock_arch_t { @@ -27,45 +34,28 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; -#if _MIPS_SIM == _ABI64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain + /* FLAGS must stay at its position in the structure to maintain binary compatibility. */ - unsigned int __flags; -# else -# if __BYTE_ORDER == __BIG_ENDIAN +#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. */ +#else unsigned char __flags; unsigned char __shared; unsigned char __pad1; unsigned char __pad2; -# endif - int __cur_writer; #endif + int __cur_writer; }; -#if _MIPS_SIM == _ABI64 +#if __BYTE_ORDER == __BIG_ENDIAN # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif #endif #endif \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h b/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h index 94f0282059..202df2c998 100644 --- a/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h +++ b/lib/libc/include/armeb-linux-gnueabi/bits/struct_stat.h @@ -28,32 +28,35 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -63,28 +66,32 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 +# endif +# ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -#else +# else __ino64_t st_ino; /* File serial number. */ -#endif +# endif +#endif /* __USE_TIME_BITS64 */ }; #ifdef __USE_LARGEFILE64 struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; @@ -99,7 +106,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -109,15 +116,16 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# else +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __ino64_t st_ino; /* File serial number. */ +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + 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 + 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 + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +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; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h index 94f0282059..202df2c998 100644 --- a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_stat.h @@ -28,32 +28,35 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -63,28 +66,32 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 +# endif +# ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -#else +# else __ino64_t st_ino; /* File serial number. */ -#endif +# endif +#endif /* __USE_TIME_BITS64 */ }; #ifdef __USE_LARGEFILE64 struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; @@ -99,7 +106,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -109,15 +116,16 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# else +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __ino64_t st_ino; /* File serial number. */ +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/floatn.h b/lib/libc/include/csky-linux-gnueabi/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/statfs.h b/lib/libc/include/csky-linux-gnueabi/bits/statfs.h index 94a6e610fb..60421fc7fb 100644 --- a/lib/libc/include/csky-linux-gnueabi/bits/statfs.h +++ b/lib/libc/include/csky-linux-gnueabi/bits/statfs.h @@ -1,6 +1,5 @@ /* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -24,18 +23,8 @@ #include #include -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name #elif __BYTE_ORDER == __LITTLE_ENDIAN # define __field64(type, type64, name) \ type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad diff --git a/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + 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 + 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 + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +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; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h b/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabi/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h b/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h index 21c8322d29..aed5f023bf 100644 --- a/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h +++ b/lib/libc/include/csky-linux-gnueabi/gnu/lib-names.h @@ -9,6 +9,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h b/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h b/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h index 94a6e610fb..60421fc7fb 100644 --- a/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h +++ b/lib/libc/include/csky-linux-gnueabihf/bits/statfs.h @@ -1,6 +1,5 @@ /* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -24,18 +23,8 @@ #include #include -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name #elif __BYTE_ORDER == __LITTLE_ENDIAN # define __field64(type, type64, name) \ type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + 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 + 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 + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +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; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/csky-linux-gnueabihf/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h b/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h index a2d4ba2f42..9fe17746c0 100644 --- a/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h +++ b/lib/libc/include/csky-linux-gnueabihf/gnu/lib-names.h @@ -9,6 +9,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/aio.h b/lib/libc/include/generic-glibc/aio.h index 9ffd31d991..7a27495843 100644 --- a/lib/libc/include/generic-glibc/aio.h +++ b/lib/libc/include/generic-glibc/aio.h @@ -193,12 +193,17 @@ extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), extern int __REDIRECT_NTH (aio_cancel, (int __fildes, struct aiocb *__aiocbp), aio_cancel64); - +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTH (aio_suspend, + (const struct aiocb *const __list[], int __nent, + const struct timespec *__restrict __timeout), + __aio_suspend_time64) __nonnull ((1)); +# else extern int __REDIRECT_NTH (aio_suspend, (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout), aio_suspend64) __nonnull ((1)); - +# endif extern int __REDIRECT_NTH (aio_fsync, (int __operation, struct aiocb *__aiocbp), aio_fsync64) __nonnull ((2)); @@ -210,7 +215,11 @@ extern int __REDIRECT_NTH (aio_fsync, # define aio_error aio_error64 # define aio_return aio_return64 # define aio_cancel aio_cancel64 -# define aio_suspend aio_suspend64 +# ifdef __USE_TIME_BITS64 +# define aio_suspend __aio_suspend_time64 +# else +# define aio_suspend aio_suspend64 +# endif # define aio_fsync aio_fsync64 # endif #endif diff --git a/lib/libc/include/generic-glibc/arpa/inet.h b/lib/libc/include/generic-glibc/arpa/inet.h index 4a6afd6da9..16227d6ce9 100644 --- a/lib/libc/include/generic-glibc/arpa/inet.h +++ b/lib/libc/include/generic-glibc/arpa/inet.h @@ -74,7 +74,8 @@ extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW; /* Format a network number NET into presentation format and place result in buffer starting at BUF with length of LEN bytes. */ -extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW; +extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW + __attribute_deprecated_msg__ ("Use inet_ntop instead"); /* Convert network number for interface type AF in buffer starting at CP to presentation format. The result will specifiy BITS bits of diff --git a/lib/libc/include/generic-glibc/arpa/nameser.h b/lib/libc/include/generic-glibc/arpa/nameser.h index 0e049d3f6a..30fe567c2e 100644 --- a/lib/libc/include/generic-glibc/arpa/nameser.h +++ b/lib/libc/include/generic-glibc/arpa/nameser.h @@ -52,6 +52,12 @@ #include #include +#ifdef _LIBC +# define __NAMESER_DEPRECATED +#else +# define __NAMESER_DEPRECATED __attribute_deprecated__ +#endif + /* * Define constants based on RFC 883, RFC 1034, RFC 1035 */ @@ -401,14 +407,18 @@ int ns_skiprr (const unsigned char *, const unsigned char *, int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW; int ns_sprintrr (const ns_msg *, const ns_rr *, const char *, const char *, char *, size_t) - __THROW; + __THROW __NAMESER_DEPRECATED; int ns_sprintrrf (const unsigned char *, size_t, const char *, ns_class, ns_type, unsigned long, const unsigned char *, size_t, const char *, - const char *, char *, size_t) __THROW; -int ns_format_ttl (unsigned long, char *, size_t) __THROW; -int ns_parse_ttl (const char *, unsigned long *) __THROW; -uint32_t ns_datetosecs (const char *, int *) __THROW; + const char *, char *, size_t) + __THROW __NAMESER_DEPRECATED; +int ns_format_ttl (unsigned long, char *, size_t) + __THROW __NAMESER_DEPRECATED; +int ns_parse_ttl (const char *, unsigned long *) + __THROW __NAMESER_DEPRECATED; +uint32_t ns_datetosecs (const char *, int *) + __THROW __NAMESER_DEPRECATED; int ns_name_ntol (const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_ntop (const unsigned char *, char *, size_t) __THROW; @@ -431,10 +441,15 @@ int ns_name_skip (const unsigned char **, const unsigned char *) void ns_name_rollback (const unsigned char *, const unsigned char **, const unsigned char **) __THROW; -int ns_samedomain (const char *, const char *) __THROW; -int ns_subdomain (const char *, const char *) __THROW; -int ns_makecanon (const char *, char *, size_t) __THROW; -int ns_samename (const char *, const char *) __THROW; + +int ns_samedomain (const char *, const char *) __THROW + __NAMESER_DEPRECATED; +int ns_subdomain (const char *, const char *) __THROW + __NAMESER_DEPRECATED; +int ns_makecanon (const char *, char *, size_t) __THROW + __NAMESER_DEPRECATED; +int ns_samename (const char *, const char *) __THROW + __NAMESER_DEPRECATED; __END_DECLS #include diff --git a/lib/libc/include/generic-glibc/bits/confname.h b/lib/libc/include/generic-glibc/bits/confname.h index b6bcdd460d..a364471509 100644 --- a/lib/libc/include/generic-glibc/bits/confname.h +++ b/lib/libc/include/generic-glibc/bits/confname.h @@ -525,8 +525,14 @@ enum _SC_THREAD_ROBUST_PRIO_INHERIT, #define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT - _SC_THREAD_ROBUST_PRIO_PROTECT + _SC_THREAD_ROBUST_PRIO_PROTECT, #define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT + + _SC_MINSIGSTKSZ, +#define _SC_MINSIGSTKSZ _SC_MINSIGSTKSZ + + _SC_SIGSTKSZ +#define _SC_SIGSTKSZ _SC_SIGSTKSZ }; /* Values for the NAME argument to `confstr'. */ diff --git a/lib/libc/include/generic-glibc/bits/floatn.h b/lib/libc/include/generic-glibc/bits/floatn.h index 18018fa9f8..c05a5e55e0 100644 --- a/lib/libc/include/generic-glibc/bits/floatn.h +++ b/lib/libc/include/generic-glibc/bits/floatn.h @@ -1,4 +1,4 @@ -/* Macros to control TS 18661-3 glibc features. +/* Macros to control TS 18661-3 glibc features on MIPS platforms. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,10 +16,24 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_FLOATN_H +#define _BITS_FLOATN_H + +#include +#include + /* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this glibc - includes corresponding *f128 interfaces for it. */ -#define __HAVE_FLOAT128 0 + floating-point type with the IEEE 754 binary128 format, and this + glibc includes corresponding *f128 interfaces for it. */ +#ifndef __NO_LONG_DOUBLE_MATH +# define __HAVE_FLOAT128 1 +#else +/* glibc does not support _Float128 for platforms where long double is + normally binary128 when building with long double as binary64. + GCC's default for supported scalar modes does not support it either + in that case. */ +# define __HAVE_FLOAT128 0 +#endif /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct from the default float, double and long double types in this glibc. */ @@ -28,25 +42,56 @@ /* Defined to 1 if the current compiler invocation provides a floating-point type with the right format for _Float64x, and this glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X 0 +#define __HAVE_FLOAT64X __HAVE_FLOAT128 /* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has the format of _Float128, which must be different from that of long double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE 0 +#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 #ifndef __ASSEMBLER__ /* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. - E.g.: #define __f128(x) x##f128. */ -# undef __f128 + types, if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* The literal suffix f128 exists only since GCC 7.0. */ +# define __f128(x) x##l +# else +# define __f128(x) x##f128 +# endif +# endif -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. - E.g.: #define __CFLOAT128 _Complex _Float128. */ -# undef __CFLOAT128 +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +# define __CFLOAT128 _Complex long double +# else +# define __CFLOAT128 _Complex _Float128 +# endif +# endif + +/* The remaining of this file provides support for older compilers. */ +# if __HAVE_FLOAT128 + +/* The type _Float128 exists only since GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +typedef long double _Float128; +# endif + +/* Various built-in functions do not exist before GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf128() (__builtin_huge_vall ()) +# define __builtin_inff128() (__builtin_infl ()) +# define __builtin_nanf128(x) (__builtin_nanl (x)) +# define __builtin_nansf128(x) (__builtin_nansl (x)) +# endif + +# endif #endif /* !__ASSEMBLER__. */ -#include \ No newline at end of file +#include + +#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/libc-header-start.h b/lib/libc/include/generic-glibc/bits/libc-header-start.h index 402725f4b2..3bb5101e05 100644 --- a/lib/libc/include/generic-glibc/bits/libc-header-start.h +++ b/lib/libc/include/generic-glibc/bits/libc-header-start.h @@ -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 diff --git a/lib/libc/include/generic-glibc/bits/local_lim.h b/lib/libc/include/generic-glibc/bits/local_lim.h index af2e6b3471..0dccd480b1 100644 --- a/lib/libc/include/generic-glibc/bits/local_lim.h +++ b/lib/libc/include/generic-glibc/bits/local_lim.h @@ -77,8 +77,8 @@ priority level. */ #define AIO_PRIO_DELTA_MAX 20 -/* Minimum size for a thread. We are free to choose a reasonable value. */ -#define PTHREAD_STACK_MIN 16384 +/* Arrange for the definition of PTHREAD_STACK_MIN. */ +#include /* Maximum number of timer expiration overruns. */ #define DELAYTIMER_MAX 2147483647 diff --git a/lib/libc/include/generic-glibc/bits/mathcalls.h b/lib/libc/include/generic-glibc/bits/mathcalls.h index 61796cb512..526f3f3e53 100644 --- a/lib/libc/include/generic-glibc/bits/mathcalls.h +++ b/lib/libc/include/generic-glibc/bits/mathcalls.h @@ -364,17 +364,21 @@ __MATHDECL (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round, __MATHDECL (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round, unsigned int __width)); +/* Canonicalize floating-point representation. */ +__MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x)); +#endif + +#if (__GLIBC_USE (IEC_60559_BFP_EXT) \ + || (__MATH_DECLARING_FLOATN \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X)))) /* Return value with maximum magnitude. */ __MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); /* Return value with minimum magnitude. */ __MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); - -/* Canonicalize floating-point representation. */ -__MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x)); #endif -#if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN +#if __GLIBC_USE (IEC_60559_EXT) || __MATH_DECLARING_FLOATN /* Total order operation. */ __MATHDECL_1 (int, totalorder,, (const _Mdouble_ *__x, const _Mdouble_ *__y)) diff --git a/lib/libc/include/generic-glibc/bits/msq.h b/lib/libc/include/generic-glibc/bits/msq.h index f770dba088..ec07f9f195 100644 --- a/lib/libc/include/generic-glibc/bits/msq.h +++ b/lib/libc/include/generic-glibc/bits/msq.h @@ -26,6 +26,7 @@ typedef __syscall_ulong_t msgqnum_t; typedef __syscall_ulong_t msglen_t; #include +#include /* Define options for message queue functions. */ #define MSG_NOERROR 010000 /* no error if message is too big */ diff --git a/lib/libc/include/generic-glibc/bits/platform/x86.h b/lib/libc/include/generic-glibc/bits/platform/x86.h new file mode 100644 index 0000000000..214f2a93a8 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/platform/x86.h @@ -0,0 +1,311 @@ +/* Constants and data structures for x86 CPU features. + This file is part of the GNU C Library. + Copyright (C) 2008-2020 Free Software Foundation, Inc. + + 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 + . */ + +#ifndef _SYS_PLATFORM_X86_H +# error "Never include directly; use instead." +#endif + +enum +{ + CPUID_INDEX_1 = 0, + CPUID_INDEX_7, + CPUID_INDEX_80000001, + CPUID_INDEX_D_ECX_1, + CPUID_INDEX_80000007, + CPUID_INDEX_80000008, + CPUID_INDEX_7_ECX_1, + CPUID_INDEX_19, + CPUID_INDEX_14_ECX_0 +}; + +struct cpuid_feature +{ + unsigned int cpuid_array[4]; + unsigned int active_array[4]; +}; + +enum cpuid_register_index +{ + cpuid_register_index_eax = 0, + cpuid_register_index_ebx, + cpuid_register_index_ecx, + cpuid_register_index_edx +}; + +/* CPU features. */ + +enum +{ + x86_cpu_index_1_ecx + = (CPUID_INDEX_1 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ecx * 8 * sizeof (unsigned int)), + + x86_cpu_SSE3 = x86_cpu_index_1_ecx, + x86_cpu_PCLMULQDQ = x86_cpu_index_1_ecx + 1, + x86_cpu_DTES64 = x86_cpu_index_1_ecx + 2, + x86_cpu_MONITOR = x86_cpu_index_1_ecx + 3, + x86_cpu_DS_CPL = x86_cpu_index_1_ecx + 4, + x86_cpu_VMX = x86_cpu_index_1_ecx + 5, + x86_cpu_SMX = x86_cpu_index_1_ecx + 6, + x86_cpu_EIST = x86_cpu_index_1_ecx + 7, + x86_cpu_TM2 = x86_cpu_index_1_ecx + 8, + x86_cpu_SSSE3 = x86_cpu_index_1_ecx + 9, + x86_cpu_CNXT_ID = x86_cpu_index_1_ecx + 10, + x86_cpu_SDBG = x86_cpu_index_1_ecx + 11, + x86_cpu_FMA = x86_cpu_index_1_ecx + 12, + x86_cpu_CMPXCHG16B = x86_cpu_index_1_ecx + 13, + x86_cpu_XTPRUPDCTRL = x86_cpu_index_1_ecx + 14, + x86_cpu_PDCM = x86_cpu_index_1_ecx + 15, + x86_cpu_INDEX_1_ECX_16 = x86_cpu_index_1_ecx + 16, + x86_cpu_PCID = x86_cpu_index_1_ecx + 17, + x86_cpu_DCA = x86_cpu_index_1_ecx + 18, + x86_cpu_SSE4_1 = x86_cpu_index_1_ecx + 19, + x86_cpu_SSE4_2 = x86_cpu_index_1_ecx + 20, + x86_cpu_X2APIC = x86_cpu_index_1_ecx + 21, + x86_cpu_MOVBE = x86_cpu_index_1_ecx + 22, + x86_cpu_POPCNT = x86_cpu_index_1_ecx + 23, + x86_cpu_TSC_DEADLINE = x86_cpu_index_1_ecx + 24, + x86_cpu_AES = x86_cpu_index_1_ecx + 25, + x86_cpu_XSAVE = x86_cpu_index_1_ecx + 26, + x86_cpu_OSXSAVE = x86_cpu_index_1_ecx + 27, + x86_cpu_AVX = x86_cpu_index_1_ecx + 28, + x86_cpu_F16C = x86_cpu_index_1_ecx + 29, + x86_cpu_RDRAND = x86_cpu_index_1_ecx + 30, + x86_cpu_INDEX_1_ECX_31 = x86_cpu_index_1_ecx + 31, + + x86_cpu_index_1_edx + = (CPUID_INDEX_1 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_edx * 8 * sizeof (unsigned int)), + + x86_cpu_FPU = x86_cpu_index_1_edx, + x86_cpu_VME = x86_cpu_index_1_edx + 1, + x86_cpu_DE = x86_cpu_index_1_edx + 2, + x86_cpu_PSE = x86_cpu_index_1_edx + 3, + x86_cpu_TSC = x86_cpu_index_1_edx + 4, + x86_cpu_MSR = x86_cpu_index_1_edx + 5, + x86_cpu_PAE = x86_cpu_index_1_edx + 6, + x86_cpu_MCE = x86_cpu_index_1_edx + 7, + x86_cpu_CX8 = x86_cpu_index_1_edx + 8, + x86_cpu_APIC = x86_cpu_index_1_edx + 9, + x86_cpu_INDEX_1_EDX_10 = x86_cpu_index_1_edx + 10, + x86_cpu_SEP = x86_cpu_index_1_edx + 11, + x86_cpu_MTRR = x86_cpu_index_1_edx + 12, + x86_cpu_PGE = x86_cpu_index_1_edx + 13, + x86_cpu_MCA = x86_cpu_index_1_edx + 14, + x86_cpu_CMOV = x86_cpu_index_1_edx + 15, + x86_cpu_PAT = x86_cpu_index_1_edx + 16, + x86_cpu_PSE_36 = x86_cpu_index_1_edx + 17, + x86_cpu_PSN = x86_cpu_index_1_edx + 18, + x86_cpu_CLFSH = x86_cpu_index_1_edx + 19, + x86_cpu_INDEX_1_EDX_20 = x86_cpu_index_1_edx + 20, + x86_cpu_DS = x86_cpu_index_1_edx + 21, + x86_cpu_ACPI = x86_cpu_index_1_edx + 22, + x86_cpu_MMX = x86_cpu_index_1_edx + 23, + x86_cpu_FXSR = x86_cpu_index_1_edx + 24, + x86_cpu_SSE = x86_cpu_index_1_edx + 25, + x86_cpu_SSE2 = x86_cpu_index_1_edx + 26, + x86_cpu_SS = x86_cpu_index_1_edx + 27, + x86_cpu_HTT = x86_cpu_index_1_edx + 28, + x86_cpu_TM = x86_cpu_index_1_edx + 29, + x86_cpu_INDEX_1_EDX_30 = x86_cpu_index_1_edx + 30, + x86_cpu_PBE = x86_cpu_index_1_edx + 31, + + x86_cpu_index_7_ebx + = (CPUID_INDEX_7 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), + + x86_cpu_FSGSBASE = x86_cpu_index_7_ebx, + x86_cpu_TSC_ADJUST = x86_cpu_index_7_ebx + 1, + x86_cpu_SGX = x86_cpu_index_7_ebx + 2, + x86_cpu_BMI1 = x86_cpu_index_7_ebx + 3, + x86_cpu_HLE = x86_cpu_index_7_ebx + 4, + x86_cpu_AVX2 = x86_cpu_index_7_ebx + 5, + x86_cpu_INDEX_7_EBX_6 = x86_cpu_index_7_ebx + 6, + x86_cpu_SMEP = x86_cpu_index_7_ebx + 7, + x86_cpu_BMI2 = x86_cpu_index_7_ebx + 8, + x86_cpu_ERMS = x86_cpu_index_7_ebx + 9, + x86_cpu_INVPCID = x86_cpu_index_7_ebx + 10, + x86_cpu_RTM = x86_cpu_index_7_ebx + 11, + x86_cpu_RDT_M = x86_cpu_index_7_ebx + 12, + x86_cpu_DEPR_FPU_CS_DS = x86_cpu_index_7_ebx + 13, + x86_cpu_MPX = x86_cpu_index_7_ebx + 14, + x86_cpu_RDT_A = x86_cpu_index_7_ebx + 15, + x86_cpu_AVX512F = x86_cpu_index_7_ebx + 16, + x86_cpu_AVX512DQ = x86_cpu_index_7_ebx + 17, + x86_cpu_RDSEED = x86_cpu_index_7_ebx + 18, + x86_cpu_ADX = x86_cpu_index_7_ebx + 19, + x86_cpu_SMAP = x86_cpu_index_7_ebx + 20, + x86_cpu_AVX512_IFMA = x86_cpu_index_7_ebx + 21, + x86_cpu_INDEX_7_EBX_22 = x86_cpu_index_7_ebx + 22, + x86_cpu_CLFLUSHOPT = x86_cpu_index_7_ebx + 23, + x86_cpu_CLWB = x86_cpu_index_7_ebx + 24, + x86_cpu_TRACE = x86_cpu_index_7_ebx + 25, + x86_cpu_AVX512PF = x86_cpu_index_7_ebx + 26, + x86_cpu_AVX512ER = x86_cpu_index_7_ebx + 27, + x86_cpu_AVX512CD = x86_cpu_index_7_ebx + 28, + x86_cpu_SHA = x86_cpu_index_7_ebx + 29, + x86_cpu_AVX512BW = x86_cpu_index_7_ebx + 30, + x86_cpu_AVX512VL = x86_cpu_index_7_ebx + 31, + + x86_cpu_index_7_ecx + = (CPUID_INDEX_7 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ecx * 8 * sizeof (unsigned int)), + + x86_cpu_PREFETCHWT1 = x86_cpu_index_7_ecx, + x86_cpu_AVX512_VBMI = x86_cpu_index_7_ecx + 1, + x86_cpu_UMIP = x86_cpu_index_7_ecx + 2, + x86_cpu_PKU = x86_cpu_index_7_ecx + 3, + x86_cpu_OSPKE = x86_cpu_index_7_ecx + 4, + x86_cpu_WAITPKG = x86_cpu_index_7_ecx + 5, + x86_cpu_AVX512_VBMI2 = x86_cpu_index_7_ecx + 6, + x86_cpu_SHSTK = x86_cpu_index_7_ecx + 7, + x86_cpu_GFNI = x86_cpu_index_7_ecx + 8, + x86_cpu_VAES = x86_cpu_index_7_ecx + 9, + x86_cpu_VPCLMULQDQ = x86_cpu_index_7_ecx + 10, + x86_cpu_AVX512_VNNI = x86_cpu_index_7_ecx + 11, + x86_cpu_AVX512_BITALG = x86_cpu_index_7_ecx + 12, + x86_cpu_INDEX_7_ECX_13 = x86_cpu_index_7_ecx + 13, + x86_cpu_AVX512_VPOPCNTDQ = x86_cpu_index_7_ecx + 14, + x86_cpu_INDEX_7_ECX_1 = x86_cpu_index_7_ecx + 15, + x86_cpu_INDEX_7_ECX_16 = x86_cpu_index_7_ecx + 16, +/* Note: Bits 17-21: The value of MAWAU used by the BNDLDX and BNDSTX + instructions in 64-bit mode. */ + x86_cpu_RDPID = x86_cpu_index_7_ecx + 22, + x86_cpu_KL = x86_cpu_index_7_ecx + 23, + x86_cpu_INDEX_7_ECX_24 = x86_cpu_index_7_ecx + 24, + x86_cpu_CLDEMOTE = x86_cpu_index_7_ecx + 25, + x86_cpu_INDEX_7_ECX_26 = x86_cpu_index_7_ecx + 26, + x86_cpu_MOVDIRI = x86_cpu_index_7_ecx + 27, + x86_cpu_MOVDIR64B = x86_cpu_index_7_ecx + 28, + x86_cpu_ENQCMD = x86_cpu_index_7_ecx + 29, + x86_cpu_SGX_LC = x86_cpu_index_7_ecx + 30, + x86_cpu_PKS = x86_cpu_index_7_ecx + 31, + + x86_cpu_index_7_edx + = (CPUID_INDEX_7 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_edx * 8 * sizeof (unsigned int)), + + x86_cpu_INDEX_7_EDX_0 = x86_cpu_index_7_edx, + x86_cpu_INDEX_7_EDX_1 = x86_cpu_index_7_edx + 1, + x86_cpu_AVX512_4VNNIW = x86_cpu_index_7_edx + 2, + x86_cpu_AVX512_4FMAPS = x86_cpu_index_7_edx + 3, + x86_cpu_FSRM = x86_cpu_index_7_edx + 4, + x86_cpu_UINTR = x86_cpu_index_7_edx + 5, + x86_cpu_INDEX_7_EDX_6 = x86_cpu_index_7_edx + 6, + x86_cpu_INDEX_7_EDX_7 = x86_cpu_index_7_edx + 7, + x86_cpu_AVX512_VP2INTERSECT = x86_cpu_index_7_edx + 8, + x86_cpu_INDEX_7_EDX_9 = x86_cpu_index_7_edx + 9, + x86_cpu_MD_CLEAR = x86_cpu_index_7_edx + 10, + x86_cpu_RTM_ALWAYS_ABORT = x86_cpu_index_7_edx + 11, + x86_cpu_INDEX_7_EDX_12 = x86_cpu_index_7_edx + 12, + x86_cpu_INDEX_7_EDX_13 = x86_cpu_index_7_edx + 13, + x86_cpu_SERIALIZE = x86_cpu_index_7_edx + 14, + x86_cpu_HYBRID = x86_cpu_index_7_edx + 15, + x86_cpu_TSXLDTRK = x86_cpu_index_7_edx + 16, + x86_cpu_INDEX_7_EDX_17 = x86_cpu_index_7_edx + 17, + x86_cpu_PCONFIG = x86_cpu_index_7_edx + 18, + x86_cpu_INDEX_7_EDX_19 = x86_cpu_index_7_edx + 19, + x86_cpu_IBT = x86_cpu_index_7_edx + 20, + x86_cpu_INDEX_7_EDX_21 = x86_cpu_index_7_edx + 21, + x86_cpu_AMX_BF16 = x86_cpu_index_7_edx + 22, + x86_cpu_AVX512_FP16 = x86_cpu_index_7_edx + 23, + x86_cpu_AMX_TILE = x86_cpu_index_7_edx + 24, + x86_cpu_AMX_INT8 = x86_cpu_index_7_edx + 25, + x86_cpu_IBRS_IBPB = x86_cpu_index_7_edx + 26, + x86_cpu_STIBP = x86_cpu_index_7_edx + 27, + x86_cpu_L1D_FLUSH = x86_cpu_index_7_edx + 28, + x86_cpu_ARCH_CAPABILITIES = x86_cpu_index_7_edx + 29, + x86_cpu_CORE_CAPABILITIES = x86_cpu_index_7_edx + 30, + x86_cpu_SSBD = x86_cpu_index_7_edx + 31, + + x86_cpu_index_80000001_ecx + = (CPUID_INDEX_80000001 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ecx * 8 * sizeof (unsigned int)), + + x86_cpu_LAHF64_SAHF64 = x86_cpu_index_80000001_ecx, + x86_cpu_SVM = x86_cpu_index_80000001_ecx + 2, + x86_cpu_LZCNT = x86_cpu_index_80000001_ecx + 5, + x86_cpu_SSE4A = x86_cpu_index_80000001_ecx + 6, + x86_cpu_PREFETCHW = x86_cpu_index_80000001_ecx + 8, + x86_cpu_XOP = x86_cpu_index_80000001_ecx + 11, + x86_cpu_LWP = x86_cpu_index_80000001_ecx + 15, + x86_cpu_FMA4 = x86_cpu_index_80000001_ecx + 16, + x86_cpu_TBM = x86_cpu_index_80000001_ecx + 21, + + x86_cpu_index_80000001_edx + = (CPUID_INDEX_80000001 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_edx * 8 * sizeof (unsigned int)), + + x86_cpu_SYSCALL_SYSRET = x86_cpu_index_80000001_edx + 11, + x86_cpu_NX = x86_cpu_index_80000001_edx + 20, + x86_cpu_PAGE1GB = x86_cpu_index_80000001_edx + 26, + x86_cpu_RDTSCP = x86_cpu_index_80000001_edx + 27, + x86_cpu_LM = x86_cpu_index_80000001_edx + 29, + + x86_cpu_index_d_ecx_1_eax + = (CPUID_INDEX_D_ECX_1 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_eax * 8 * sizeof (unsigned int)), + + x86_cpu_XSAVEOPT = x86_cpu_index_d_ecx_1_eax, + x86_cpu_XSAVEC = x86_cpu_index_d_ecx_1_eax + 1, + x86_cpu_XGETBV_ECX_1 = x86_cpu_index_d_ecx_1_eax + 2, + x86_cpu_XSAVES = x86_cpu_index_d_ecx_1_eax + 3, + x86_cpu_XFD = x86_cpu_index_d_ecx_1_eax + 4, + + x86_cpu_index_80000007_edx + = (CPUID_INDEX_80000007 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_edx * 8 * sizeof (unsigned int)), + + x86_cpu_INVARIANT_TSC = x86_cpu_index_80000007_edx + 8, + + x86_cpu_index_80000008_ebx + = (CPUID_INDEX_80000008 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), + + x86_cpu_WBNOINVD = x86_cpu_index_80000008_ebx + 9, + x86_cpu_AMD_IBPB = x86_cpu_index_80000008_ebx + 12, + x86_cpu_AMD_IBRS = x86_cpu_index_80000008_ebx + 14, + x86_cpu_AMD_STIBP = x86_cpu_index_80000008_ebx + 15, + x86_cpu_AMD_SSBD = x86_cpu_index_80000008_ebx + 24, + x86_cpu_AMD_VIRT_SSBD = x86_cpu_index_80000008_ebx + 25, + + x86_cpu_index_7_ecx_1_eax + = (CPUID_INDEX_7_ECX_1 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_eax * 8 * sizeof (unsigned int)), + + x86_cpu_AVX_VNNI = x86_cpu_index_7_ecx_1_eax + 4, + x86_cpu_AVX512_BF16 = x86_cpu_index_7_ecx_1_eax + 5, + x86_cpu_FZLRM = x86_cpu_index_7_ecx_1_eax + 10, + x86_cpu_FSRS = x86_cpu_index_7_ecx_1_eax + 11, + x86_cpu_FSRCS = x86_cpu_index_7_ecx_1_eax + 12, + x86_cpu_HRESET = x86_cpu_index_7_ecx_1_eax + 22, + x86_cpu_LAM = x86_cpu_index_7_ecx_1_eax + 26, + + x86_cpu_index_19_ebx + = (CPUID_INDEX_19 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), + + x86_cpu_AESKLE = x86_cpu_index_19_ebx, + x86_cpu_WIDE_KL = x86_cpu_index_19_ebx + 2, + + x86_cpu_index_14_ecx_0_ebx + = (CPUID_INDEX_14_ECX_0 * 8 * 4 * sizeof (unsigned int) + + cpuid_register_index_ebx * 8 * sizeof (unsigned int)), + + x86_cpu_PTWRITE = x86_cpu_index_14_ecx_0_ebx + 4 +}; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/poll2.h b/lib/libc/include/generic-glibc/bits/poll2.h index b7b5ca466c..10bcf5b7f1 100644 --- a/lib/libc/include/generic-glibc/bits/poll2.h +++ b/lib/libc/include/generic-glibc/bits/poll2.h @@ -26,13 +26,14 @@ __BEGIN_DECLS extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, int __timeout), poll); extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, - __SIZE_TYPE__ __fdslen); + __SIZE_TYPE__ __fdslen) + __attr_access ((__write_only__, 1, 2)); extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, int __timeout, __SIZE_TYPE__ __fdslen), __poll_chk) __warnattr ("poll called with fds buffer too small file nfds entries"); -__fortify_function int +__fortify_function __attr_access ((__write_only__, 1, 2)) int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) { if (__glibc_objsize (__fds) != (__SIZE_TYPE__) -1) @@ -54,7 +55,8 @@ extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, const __sigset_t *__ss), ppoll); extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, - const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); + const __sigset_t *__ss, __SIZE_TYPE__ __fdslen) + __attr_access ((__write_only__, 1, 2)); extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss, @@ -62,7 +64,7 @@ extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, __ppoll_chk) __warnattr ("ppoll called with fds buffer too small file nfds entries"); -__fortify_function int +__fortify_function __attr_access ((__write_only__, 1, 2)) int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss) { diff --git a/lib/libc/include/generic-glibc/bits/pthread_stack_min-dynamic.h b/lib/libc/include/generic-glibc/bits/pthread_stack_min-dynamic.h new file mode 100644 index 0000000000..a01a2eb280 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/pthread_stack_min-dynamic.h @@ -0,0 +1,31 @@ +/* Definition of PTHREAD_STACK_MIN, possibly dynamic. + Copyright (C) 2021 Free Software 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 + . */ + +#ifndef PTHREAD_STACK_MIN +# if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE +# ifndef __ASSEMBLER__ +# define __SC_THREAD_STACK_MIN_VALUE 75 +__BEGIN_DECLS +extern long int __sysconf (int __name) __THROW; +__END_DECLS +# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE) +# endif +# else +# include +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/pthread_stack_min.h b/lib/libc/include/generic-glibc/bits/pthread_stack_min.h new file mode 100644 index 0000000000..af78521be7 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 16384 \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/sem.h b/lib/libc/include/generic-glibc/bits/sem.h index 9189fceda4..efab0d3b07 100644 --- a/lib/libc/include/generic-glibc/bits/sem.h +++ b/lib/libc/include/generic-glibc/bits/sem.h @@ -22,6 +22,7 @@ #include #include #include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ diff --git a/lib/libc/include/generic-glibc/bits/shm.h b/lib/libc/include/generic-glibc/bits/shm.h index 56d36a3d66..28b171ed98 100644 --- a/lib/libc/include/generic-glibc/bits/shm.h +++ b/lib/libc/include/generic-glibc/bits/shm.h @@ -43,6 +43,7 @@ __BEGIN_DECLS typedef __syscall_ulong_t shmatt_t; #include +#include #ifdef __USE_MISC diff --git a/lib/libc/include/generic-glibc/bits/sigstksz.h b/lib/libc/include/generic-glibc/bits/sigstksz.h new file mode 100644 index 0000000000..b9cda80f3e --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/sigstksz.h @@ -0,0 +1,33 @@ +/* Definition of MINSIGSTKSZ and SIGSTKSZ. Linux version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +#if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE +# include + +/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). */ +# undef SIGSTKSZ +# define SIGSTKSZ sysconf (_SC_SIGSTKSZ) + +/* Minimum stack size for a signal handler: SIGSTKSZ. */ +# undef MINSIGSTKSZ +# define MINSIGSTKSZ SIGSTKSZ +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/socket-constants.h b/lib/libc/include/generic-glibc/bits/socket-constants.h index 1f67ca36fb..f82406abd8 100644 --- a/lib/libc/include/generic-glibc/bits/socket-constants.h +++ b/lib/libc/include/generic-glibc/bits/socket-constants.h @@ -32,19 +32,50 @@ #define SO_OOBINLINE 10 #define SO_RCVBUF 8 #define SO_RCVLOWAT 18 -#if (__TIMESIZE == 64 && __WORDSIZE == 32 \ - && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) -# define SO_RCVTIMEO 66 -#else -# define SO_RCVTIMEO 20 -#endif #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_SNDLOWAT 19 +#define SO_TYPE 3 + #if (__TIMESIZE == 64 && __WORDSIZE == 32 \ && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) +# define SO_RCVTIMEO 66 # define SO_SNDTIMEO 67 +# define SO_TIMESTAMP 63 +# define SO_TIMESTAMPNS 64 +# define SO_TIMESTAMPING 65 #else -# define SO_SNDTIMEO 21 -#endif -#define SO_TYPE 3 \ No newline at end of file +# if __TIMESIZE == 64 +# define SO_RCVTIMEO 20 +# define SO_SNDTIMEO 21 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +# else +# define SO_RCVTIMEO_OLD 20 +# define SO_SNDTIMEO_OLD 21 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/struct_rwlock.h b/lib/libc/include/generic-glibc/bits/struct_rwlock.h index 7431c5597f..6355f539b9 100644 --- a/lib/libc/include/generic-glibc/bits/struct_rwlock.h +++ b/lib/libc/include/generic-glibc/bits/struct_rwlock.h @@ -1,4 +1,4 @@ -/* Default read-write lock implementation struct definitions. +/* MIPS internal rwlock struct definitions. Copyright (C) 2019-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,15 +16,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef __RWLOCK_INTERNAL_H -#define __RWLOCK_INTERNAL_H - -#include - -/* Generic struct for both POSIX read-write lock. New ports are expected - to use the default layout, however archictetures can redefine it to add - arch-specific extensions (such as lock-elision). The struct have a size - of 32 bytes on both LP32 and LP64 architectures. */ +#ifndef _RWLOCK_INTERNAL_H +#define _RWLOCK_INTERNAL_H struct __pthread_rwlock_arch_t { @@ -34,28 +27,45 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; - /* FLAGS must stay at its position in the structure to maintain - binary compatibility. */ -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - unsigned char __flags; -#else - unsigned char __flags; - unsigned char __shared; - unsigned char __pad1; - unsigned char __pad2; -#endif +#if _MIPS_SIM == _ABI64 int __cur_writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned int __flags; +# else +# 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; +#endif }; -#if __BYTE_ORDER == __BIG_ENDIAN +#if _MIPS_SIM == _ABI64 # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags #else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +# if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +# else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +# endif #endif #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/struct_stat.h b/lib/libc/include/generic-glibc/bits/struct_stat.h index 29d304519a..49c901ce9a 100644 --- a/lib/libc/include/generic-glibc/bits/struct_stat.h +++ b/lib/libc/include/generic-glibc/bits/struct_stat.h @@ -29,28 +29,31 @@ /* Structure describing file characteristics. */ struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else unsigned long int st_dev; long int st_pad1[3]; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino64_t st_ino; /* File serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ unsigned long int st_rdev; /* Device number, if device. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 long int st_pad2[2]; __off_t st_size; /* Size of file, in bytes. */ /* SVR4 added this extra long to allow for expansion of off_t. */ long int st_pad3; -#else +# else long int st_pad2[3]; __off64_t st_size; /* Size of file, in bytes. */ -#endif -#ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -60,30 +63,34 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ -#else +# else long int st_pad4; __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ -#endif +# endif long int st_pad5[14]; +# endif /* __USE_TIME_BITS64 */ }; -#ifdef __USE_LARGEFILE64 +# ifdef __USE_LARGEFILE64 struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else unsigned long int st_dev; long int st_pad1[3]; __ino64_t st_ino; /* File serial number. */ @@ -94,6 +101,56 @@ struct stat64 unsigned long int st_rdev; /* Device number, if device. */ long int st_pad2[3]; __off64_t st_size; /* Size of file, in bytes. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + long int st_pad3; + __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ + long int st_pad4[14]; +# endif /* __USE_TIME_BITS64 */ + }; +# endif /* __USE_LARGEFILE64 */ + +#else /* _MIPS_SIM != _ABIO32 */ + +struct stat + { + __dev_t st_dev; + int st_pad1[3]; /* Reserved for st_dev expansion */ +# ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; +# else + __ino64_t st_ino; +# endif + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; +# if !defined __USE_FILE_OFFSET64 + unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ + __off_t st_size; + int st_pad3; +# else + unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ + __off64_t st_size; +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -104,6 +161,9 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec # else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ @@ -112,63 +172,13 @@ struct stat64 __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - long int st_pad3; - __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ - long int st_pad4[14]; - }; -#endif -#else -struct stat - { - __dev_t st_dev; - int st_pad1[3]; /* Reserved for st_dev expansion */ -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; -#else - __ino64_t st_ino; -#endif - __mode_t st_mode; - __nlink_t st_nlink; - __uid_t st_uid; - __gid_t st_gid; - __dev_t st_rdev; -#if !defined __USE_FILE_OFFSET64 - unsigned int st_pad2[2]; /* Reserved for st_rdev expansion */ - __off_t st_size; - int st_pad3; -#else - unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ - __off64_t st_size; -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif __blksize_t st_blksize; unsigned int st_pad4; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; -#else +# else __blkcnt64_t st_blocks; -#endif +# endif int st_pad5[14]; }; @@ -185,7 +195,7 @@ struct stat64 __dev_t st_rdev; unsigned int st_pad2[3]; /* Reserved for st_rdev expansion */ __off64_t st_size; -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -195,20 +205,21 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# else +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __blksize_t st_blksize; unsigned int st_pad3; __blkcnt64_t st_blocks; int st_pad4[14]; }; #endif + #endif /* Tell code we have these members. */ diff --git a/lib/libc/include/generic-glibc/bits/struct_stat_time64_helper.h b/lib/libc/include/generic-glibc/bits/struct_stat_time64_helper.h new file mode 100644 index 0000000000..15f02c4dc1 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/struct_stat_time64_helper.h @@ -0,0 +1,66 @@ +/* Definition for helper to define struct stat with 64-bit time. + Copyright (C) 2021 Free Software 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 + . */ + + /* Content of internal __stat64_t64 struct. */ + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group. */ + __dev_t st_rdev; /* Device number, if device. */ + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#ifdef __USE_XOPEN2K8 +# ifndef __struct_timespec +# define __struct_timespec struct timespec +# endif + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + __struct_timespec st_atim; + __struct_timespec st_mtim; + __struct_timespec st_ctim; +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# undef __struct_timespec +#else +/* The definition should be equal to the 'struct __timespec64' internal + layout. */ +# if __BYTE_ORDER == __BIG_ENDIAN +# define __fieldts64(name) \ + __time64_t name; __int32_t :32; __int32_t name ## nsec +# else +# define __fieldts64(name) \ + __time64_t name; __int32_t name ## nsec; __int32_t :32 +# endif + + __fieldts64 (st_atime); + __fieldts64 (st_mtime); + __fieldts64 (st_ctime); + + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; + +# undef __fieldts64 +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/syscall.h b/lib/libc/include/generic-glibc/bits/syscall.h index f418df3294..5cd10027e1 100644 --- a/lib/libc/include/generic-glibc/bits/syscall.h +++ b/lib/libc/include/generic-glibc/bits/syscall.h @@ -1,11 +1,11 @@ /* Generated at libc build time from syscall list. */ -/* The system call list corresponds to kernel 5.10. */ +/* The system call list corresponds to kernel 5.13. */ #ifndef _SYSCALL_H # error "Never use directly; include instead." #endif -#define __GLIBC_LINUX_VERSION_CODE 330240 +#define __GLIBC_LINUX_VERSION_CODE 331008 #ifdef __NR_FAST_atomic_update # define SYS_FAST_atomic_update __NR_FAST_atomic_update @@ -291,6 +291,10 @@ # define SYS_epoll_pwait __NR_epoll_pwait #endif +#ifdef __NR_epoll_pwait2 +# define SYS_epoll_pwait2 __NR_epoll_pwait2 +#endif + #ifdef __NR_epoll_wait # define SYS_epoll_wait __NR_epoll_wait #endif @@ -803,6 +807,18 @@ # define SYS_kill __NR_kill #endif +#ifdef __NR_landlock_add_rule +# define SYS_landlock_add_rule __NR_landlock_add_rule +#endif + +#ifdef __NR_landlock_create_ruleset +# define SYS_landlock_create_ruleset __NR_landlock_create_ruleset +#endif + +#ifdef __NR_landlock_restrict_self +# define SYS_landlock_restrict_self __NR_landlock_restrict_self +#endif + #ifdef __NR_lchown # define SYS_lchown __NR_lchown #endif @@ -939,6 +955,10 @@ # define SYS_mount __NR_mount #endif +#ifdef __NR_mount_setattr +# define SYS_mount_setattr __NR_mount_setattr +#endif + #ifdef __NR_move_mount # define SYS_move_mount __NR_move_mount #endif diff --git a/lib/libc/include/generic-glibc/bits/time.h b/lib/libc/include/generic-glibc/bits/time.h index 2665b86352..2cc9c18c35 100644 --- a/lib/libc/include/generic-glibc/bits/time.h +++ b/lib/libc/include/generic-glibc/bits/time.h @@ -77,6 +77,16 @@ __BEGIN_DECLS /* Tune a POSIX clock. */ extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT_NTH) +extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, + struct timex *__utx), + __clock_adjtime64); +# else +# define clock_adjtime __clock_adjtime64 +# endif +#endif + __END_DECLS #endif /* use GNU */ diff --git a/lib/libc/include/generic-glibc/bits/timex.h b/lib/libc/include/generic-glibc/bits/timex.h index 9042996de3..40295471b4 100644 --- a/lib/libc/include/generic-glibc/bits/timex.h +++ b/lib/libc/include/generic-glibc/bits/timex.h @@ -25,6 +25,36 @@ struct timex { +# ifdef __USE_TIME_BITS64 + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror; /* maximum error (usec) */ + long long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + int :32; /* pad */ + long long constant; /* pll time constant */ + long long precision; /* clock precision (usec) (read only) */ + long long tolerance; /* clock frequency tolerance (ppm) (ro) */ + struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ + long long tick; /* (modified) usecs between clock ticks */ + long long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int :32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +# else unsigned int modes; /* mode selector */ __syscall_slong_t offset; /* time offset (usec) */ __syscall_slong_t freq; /* frequency offset (scaled ppm) */ @@ -51,6 +81,7 @@ struct timex int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; +# endif }; /* Mode codes (timex.mode) */ diff --git a/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds.h new file mode 100644 index 0000000000..44e70eddae --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds.h @@ -0,0 +1,30 @@ +/* Generic implementation of the SysV message struct msqid64_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#if __TIMESIZE == 64 +# define __msqid64_ds msqid_ds +#else +struct __msqid64_ds +{ +# include +}; +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds_helper.h b/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds_helper.h new file mode 100644 index 0000000000..9887c5f478 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_msqid64_ds_helper.h @@ -0,0 +1,30 @@ +/* Common definitions for struct msqid_ds with 64-bit time. + Copyright (C) 2021 Free Software 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 + . */ + + /* Content of internal __msqid64_ds. */ + struct ipc_perm msg_perm; /* structure describing operation permission */ + __time64_t msg_stime; /* time of last msgsnd command */ + __time64_t msg_rtime; /* time of last msgsnd command */ + __time64_t msg_ctime; /* time of last change */ + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h index 9ccafc23d6..4ed63d1742 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds.h new file mode 100644 index 0000000000..b6f423abe0 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds.h @@ -0,0 +1,30 @@ +/* Generic implementation of the semaphore struct semid64_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +#if __TIMESIZE == 64 +# define __semid64_ds semid_ds +#else +struct __semid64_ds +{ +# include +}; +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds_helper.h b/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds_helper.h new file mode 100644 index 0000000000..f9d237db03 --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_semid64_ds_helper.h @@ -0,0 +1,25 @@ +/* Common definitions for struct semid_ds with 64-bit time. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + + /* Content of internal __semid64_ds. */ + struct ipc_perm sem_perm; /* operation permission struct */ + __time64_t sem_otime; /* last semop() time */ + __time64_t sem_ctime; /* last time changed by semctl() */ + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + unsigned long int __glibc_reserved3; + unsigned long int __glibc_reserved4; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h index b7b46007a1..fcbf6447fc 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t __sem_ctime_high; -#else +# else __time_t sem_otime; __time_t sem_ctime; -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds.h new file mode 100644 index 0000000000..ec2c97d59c --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds.h @@ -0,0 +1,30 @@ +/* Generic implementation of the shared memory struct shmid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +#if __TIMESIZE == 64 +# define __shmid64_ds shmid_ds +#else +struct __shmid64_ds +{ +# include +}; +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds_helper.h b/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds_helper.h new file mode 100644 index 0000000000..157d363e8d --- /dev/null +++ b/lib/libc/include/generic-glibc/bits/types/struct_shmid64_ds_helper.h @@ -0,0 +1,28 @@ +/* Common definitions for struct semid_ds with 64-bit time. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time64_t shm_atime; /* time of last shmat() */ + __time64_t shm_dtime; /* time of last shmdt() */ + __time64_t shm_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + unsigned long int __glibc_reserved5; + unsigned long int __glibc_reserved6; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h b/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h index 4c4670b47b..07ecb8c0d3 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_shmid_ds.h @@ -23,23 +23,27 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_atime_high; __time_t shm_dtime; /* time of last shmdt() */ unsigned long int __shm_dtime_high; __time_t shm_ctime; /* time of last change by shmctl() */ unsigned long int __shm_ctime_high; -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/struct_timespec.h b/lib/libc/include/generic-glibc/bits/types/struct_timespec.h index 3df95ada11..d008a04a4b 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_timespec.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_timespec.h @@ -4,15 +4,20 @@ #include #include +#include /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { +#ifdef __USE_TIME_BITS64 + __time64_t tv_sec; /* Seconds. */ +#else __time_t tv_sec; /* Seconds. */ +#endif #if __WORDSIZE == 64 \ || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ - || __TIMESIZE == 32 + || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64) __syscall_slong_t tv_nsec; /* Nanoseconds. */ #else # if __BYTE_ORDER == __BIG_ENDIAN diff --git a/lib/libc/include/generic-glibc/bits/types/struct_timeval.h b/lib/libc/include/generic-glibc/bits/types/struct_timeval.h index 5144612f07..176b5e4f4e 100644 --- a/lib/libc/include/generic-glibc/bits/types/struct_timeval.h +++ b/lib/libc/include/generic-glibc/bits/types/struct_timeval.h @@ -7,7 +7,12 @@ microsecond but also has a range of years. */ struct timeval { +#ifdef __USE_TIME_BITS64 + __time64_t tv_sec; /* Seconds. */ + __suseconds64_t tv_usec; /* Microseconds. */ +#else __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ +#endif }; #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/types/time_t.h b/lib/libc/include/generic-glibc/bits/types/time_t.h index cba3ced0ec..073c25016b 100644 --- a/lib/libc/include/generic-glibc/bits/types/time_t.h +++ b/lib/libc/include/generic-glibc/bits/types/time_t.h @@ -4,6 +4,10 @@ #include /* Returned by `time'. */ +#ifdef __USE_TIME_BITS64 +typedef __time64_t time_t; +#else typedef __time_t time_t; +#endif #endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/unistd_ext.h b/lib/libc/include/generic-glibc/bits/unistd_ext.h index 94ad5474d2..7ea3163bf6 100644 --- a/lib/libc/include/generic-glibc/bits/unistd_ext.h +++ b/lib/libc/include/generic-glibc/bits/unistd_ext.h @@ -33,4 +33,27 @@ not detached and has not been joined. */ extern __pid_t gettid (void) __THROW; -#endif \ No newline at end of file +#ifdef __has_include +# if __has_include ("linux/close_range.h") +# include "linux/close_range.h" +# endif +#endif +/* Unshare the file descriptor table before closing file descriptors. */ +#ifndef CLOSE_RANGE_UNSHARE +# define CLOSE_RANGE_UNSHARE (1U << 1) +#endif +/* Set the FD_CLOEXEC bit instead of closing the file descriptor. */ +#ifndef CLOSE_RANGE_CLOEXEC +# define CLOSE_RANGE_CLOEXEC (1U << 2) +#endif + +/* Close all file descriptors in the range FD up to MAX_FD. The flag FLAGS + are define by the CLOSE_RANGE prefix. This function behaves like close + on the range, but in a fail-safe where it will either fail and not close + any file descriptor or close all of them. Gaps where the file descriptor + is invalid are ignored. Returns 0 on successor or -1 for failure (and + sets errno accordingly). */ +extern int close_range (unsigned int __fd, unsigned int __max_fd, + int __flags) __THROW; + +#endif /* __USE_GNU */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/bits/wordsize.h b/lib/libc/include/generic-glibc/bits/wordsize.h index 6561e924f5..9e405e4e4e 100644 --- a/lib/libc/include/generic-glibc/bits/wordsize.h +++ b/lib/libc/include/generic-glibc/bits/wordsize.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2021 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 @@ -12,10 +12,20 @@ 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 + License along with the GNU C Library. If not, see . */ -#define __WORDSIZE 32 -#define __WORDSIZE_TIME64_COMPAT32 0 +#include + +#define __WORDSIZE _MIPS_SZPTR + +#if _MIPS_SIM == _ABI64 +# define __WORDSIZE_TIME64_COMPAT32 1 +#else +# define __WORDSIZE_TIME64_COMPAT32 0 +#endif + +#if __WORDSIZE == 32 #define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file +#define __WORDSIZE32_PTRDIFF_LONG 0 +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/elf.h b/lib/libc/include/generic-glibc/elf.h index 4cf698fa9f..e55c74a275 100644 --- a/lib/libc/include/generic-glibc/elf.h +++ b/lib/libc/include/generic-glibc/elf.h @@ -336,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 */ @@ -813,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. */ diff --git a/lib/libc/include/generic-glibc/fcntl.h b/lib/libc/include/generic-glibc/fcntl.h index d84aefa62f..ceeb63138b 100644 --- a/lib/libc/include/generic-glibc/fcntl.h +++ b/lib/libc/include/generic-glibc/fcntl.h @@ -172,17 +172,30 @@ typedef __pid_t pid_t; This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_FILE_OFFSET64 +#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 +# ifdef __REDIRECT +extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); +# else +# define fcntl fcntl64 +# endif # endif -#endif -#ifdef __USE_LARGEFILE64 +# 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. diff --git a/lib/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h b/lib/libc/include/generic-glibc/features-time64.h similarity index 52% rename from lib/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h rename to lib/libc/include/generic-glibc/features-time64.h index 1fe3964103..8e8163f6a3 100644 --- a/lib/libc/glibc/sysdeps/mach/hurd/dl-sysdep.h +++ b/lib/libc/include/generic-glibc/features-time64.h @@ -1,5 +1,5 @@ -/* System-specific settings for dynamic linker code. Hurd version. - Copyright (C) 2002-2020 Free Software Foundation, Inc. +/* Features part to handle 64-bit time_t support. + Copyright (C) 2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,16 +16,22 @@ License along with the GNU C Library; if not, see . */ -/* The private errno doesn't make sense on the Hurd. errno is always the - thread-local slot shared with libc, and it matters to share the cell - with libc because after startup we use libc functions that set errno - (open, mmap, etc). */ +/* We need to know the word size in order to check the time size. */ +#include +#include -#define RTLD_PRIVATE_ERRNO 0 - -#ifdef SHARED -/* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching - libc initializer for using cthreads might write into it. */ -# define DL_ARGV_NOT_RELRO 1 -# define LIBC_STACK_END_NOT_RELRO 1 -#endif +#if defined _TIME_BITS +# if _TIME_BITS == 64 +# if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 +# error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" +# elif __TIMESIZE == 32 +# define __USE_TIME_BITS64 1 +# endif +# elif _TIME_BITS == 32 +# if __TIMESIZE > 32 +# error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32" +# endif +# else +# error Invalid _TIME_BITS value (can only be 32 or 64-bit) +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/features.h b/lib/libc/include/generic-glibc/features.h index 47b1935cb3..62ffeace4b 100644 --- a/lib/libc/include/generic-glibc/features.h +++ b/lib/libc/include/generic-glibc/features.h @@ -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 + #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 @@ -462,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__ 33 +#define __GLIBC_MINOR__ 34 #define __GLIBC_PREREQ(maj, min) \ ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) diff --git a/lib/libc/include/generic-glibc/fts.h b/lib/libc/include/generic-glibc/fts.h index 88183efb90..2705c1c67a 100644 --- a/lib/libc/include/generic-glibc/fts.h +++ b/lib/libc/include/generic-glibc/fts.h @@ -187,6 +187,7 @@ FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; #else # ifdef __REDIRECT +# ifndef __USE_TIME_BITS64 FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); int __REDIRECT (fts_close, (FTS *), fts64_close); FTS *__REDIRECT (fts_open, (char * const *, int, @@ -194,21 +195,53 @@ FTS *__REDIRECT (fts_open, (char * const *, int, fts64_open); FTSENT *__REDIRECT (fts_read, (FTS *), fts64_read); int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), fts64_set); +# else +FTSENT *__REDIRECT (fts_children, (FTS *, int), __fts64_children_time64); +int __REDIRECT (fts_close, (FTS *), __fts64_close_time64); +FTS *__REDIRECT (fts_open, (char * const *, int, + int (*)(const FTSENT **, const FTSENT **)), + __fts64_open_time64); +FTSENT *__REDIRECT (fts_read, (FTS *), __fts64_read_time64); +int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), + __fts64_set_time64); +# endif # else -# define fts_children fts64_children -# define fts_close fts64_close -# define fts_open fts64_open -# define fts_read fts64_read -# define fts_set fts64_set +# ifndef __USE_TIME_BITS64 +# define fts_children fts64_children +# define fts_close fts64_close +# define fts_open fts64_open +# define fts_read fts64_read +# define fts_set fts64_set +# else +# endif # endif #endif #ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 FTSENT64 *fts64_children (FTS64 *, int); int fts64_close (FTS64 *); FTS64 *fts64_open (char * const *, int, int (*)(const FTSENT64 **, const FTSENT64 **)); FTSENT64 *fts64_read (FTS64 *); int fts64_set (FTS64 *, FTSENT64 *, int) __THROW; +# else +# ifdef __REDIRECT +FTSENT *__REDIRECT (fts64_children, (FTS64 *, int), __fts64_children_time64); +int __REDIRECT (fts64_close, (FTS64 *), __fts64_close_time64); +FTS *__REDIRECT (fts64_open, (char * const *, int, + int (*)(const FTSENT64 **, const FTSENT64 **)), + __fts64_open_time64); +FTSENT *__REDIRECT (fts64_read, (FTS64 *), __fts64_read_time64); +int __REDIRECT_NTH (fts64_set, (FTS64 *, FTSENT64 *, int), + __fts64_set_time64); +# else +# define fts_children __fts64_children_time64 +# define fts_close __fts64_close_time64 +# define fts_open __fts64_open_time64 +# define fts_read __fts64_read_time64 +# define fts_set __fts64_set_time64 +# endif +# endif #endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/ftw.h b/lib/libc/include/generic-glibc/ftw.h index 6f7b312bd3..14531bc774 100644 --- a/lib/libc/include/generic-glibc/ftw.h +++ b/lib/libc/include/generic-glibc/ftw.h @@ -137,15 +137,36 @@ extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) __nonnull ((1, 2)); #else # ifdef __REDIRECT +# ifndef __USE_TIME_BITS64 extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, int __descriptors), ftw64) __nonnull ((1, 2)); +# else +extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, + int __descriptors), __ftw64_time64) + __nonnull ((1, 2)); +# endif # else -# define ftw ftw64 +# ifndef __USE_TIME_BITS64 +# define ftw ftw64 +# else +# define ftw __ftw64_time64 +# endif # endif #endif #ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int ftw64 (const char *__dir, __ftw64_func_t __func, int __descriptors) __nonnull ((1, 2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (ftw64, (const char *__dir, __ftw64_func_t __func, + int __descriptors), + __ftw64_time64) + __nonnull ((1, 2)); +# else +# define nftw64 __nftw64_time64 +# endif +# endif #endif #ifdef __USE_XOPEN_EXTENDED @@ -159,16 +180,37 @@ extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT +# ifndef __USE_TIME_BITS64 extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag), nftw64) __nonnull ((1, 2)); +# else +extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, + int __descriptors, int __flag), __nftw64_time64) + __nonnull ((1, 2)); +# endif # else -# define nftw nftw64 +# ifndef __USE_TIME_BITS64 +# define nftw nftw64 +# else +# define nftw __nftw64_time64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int nftw64 (const char *__dir, __nftw64_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (nftw64, (const char *__dir, __nftw64_func_t __func, + int __descriptors, int __flag), + __nftw64_time64) + __nonnull ((1, 2)); +# else +# define nftw64 __nftw64_time64 +# endif +# endif # endif #endif diff --git a/lib/libc/include/generic-glibc/glob.h b/lib/libc/include/generic-glibc/glob.h index 07645f1229..a014ec4db5 100644 --- a/lib/libc/include/generic-glibc/glob.h +++ b/lib/libc/include/generic-glibc/glob.h @@ -145,25 +145,47 @@ typedef struct #if !defined __USE_FILE_OFFSET64 extern int glob (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), - glob_t *__restrict __pglob) __THROW; + glob_t *__restrict __pglob) __THROWNL; /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree (glob_t *__pglob) __THROW; #else -extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern, - int __flags, - int (*__errfunc) (const char *, int), - glob_t *__restrict __pglob), glob64); +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern, + int __flags, + int (*__errfunc) (const char *, int), + glob_t *__restrict __pglob), + __glob64_time64); + +extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), + __globfree64_time64); +# else +extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern, + int __flags, + int (*__errfunc) (const char *, int), + glob_t *__restrict __pglob), glob64); extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); +# endif #endif #ifdef __USE_LARGEFILE64 +# ifdef __USE_TIME_BITS64 +extern int __REDIRECT_NTHNL (glob64, (const char *__restrict __pattern, + int __flags, + int (*__errfunc) (const char *, int), + glob64_t *__restrict __pglob), + __glob64_time64); + +extern void __REDIRECT_NTH (globfree64, (glob64_t *__pglob), + __globfree64_time64); +# else extern int glob64 (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), - glob64_t *__restrict __pglob) __THROW; + glob64_t *__restrict __pglob) __THROWNL; extern void globfree64 (glob64_t *__pglob) __THROW; +# endif #endif diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-32.h b/lib/libc/include/generic-glibc/gnu/lib-names-32.h index 3e05ce280d..94b406673b 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-32.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-32.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-hard.h b/lib/libc/include/generic-glibc/gnu/lib-names-hard.h index dd2cb9fb78..eab9583670 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-hard.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-hard.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-ilp32d.h b/lib/libc/include/generic-glibc/gnu/lib-names-ilp32d.h new file mode 100644 index 0000000000..da6ef4813b --- /dev/null +++ b/lib/libc/include/generic-glibc/gnu/lib-names-ilp32d.h @@ -0,0 +1,30 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_LINUX_RISCV32_ILP32D_SO "ld-linux-riscv32-ilp32d.so.1" +#define LD_SO "ld-linux-riscv32-ilp32d.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-n32_hard.h b/lib/libc/include/generic-glibc/gnu/lib-names-n32_hard.h index 4ec7514060..a941c82ff7 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-n32_hard.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-n32_hard.h @@ -7,6 +7,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-n64_hard.h b/lib/libc/include/generic-glibc/gnu/lib-names-n64_hard.h index 1f8eed349b..740f99f84f 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-n64_hard.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-n64_hard.h @@ -7,6 +7,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-o32_hard.h b/lib/libc/include/generic-glibc/gnu/lib-names-o32_hard.h index 8a3a04cb2d..e5bde87e45 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-o32_hard.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-o32_hard.h @@ -7,6 +7,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-o32_soft.h b/lib/libc/include/generic-glibc/gnu/lib-names-o32_soft.h new file mode 100644 index 0000000000..2eb6ca4f6a --- /dev/null +++ b/lib/libc/include/generic-glibc/gnu/lib-names-o32_soft.h @@ -0,0 +1,29 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_SO "ld.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/gnu/lib-names-soft.h b/lib/libc/include/generic-glibc/gnu/lib-names-soft.h index 3c3e1769fa..bcafe34bdd 100644 --- a/lib/libc/include/generic-glibc/gnu/lib-names-soft.h +++ b/lib/libc/include/generic-glibc/gnu/lib-names-soft.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/generic-glibc/gnu/stubs-ilp32.h b/lib/libc/include/generic-glibc/gnu/stubs-ilp32.h new file mode 100644 index 0000000000..b9af396166 --- /dev/null +++ b/lib/libc/include/generic-glibc/gnu/stubs-ilp32.h @@ -0,0 +1,38 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_feclearexcept +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetenv +#define __stub_fegetexcept +#define __stub_fegetexceptflag +#define __stub_fegetmode +#define __stub_fegetround +#define __stub_feholdexcept +#define __stub_feraiseexcept +#define __stub_fesetenv +#define __stub_fesetexcept +#define __stub_fesetexceptflag +#define __stub_fesetmode +#define __stub_fesetround +#define __stub_fetestexcept +#define __stub_feupdateenv +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/lib/libc/include/generic-glibc/gnu/stubs-ilp32d.h b/lib/libc/include/generic-glibc/gnu/stubs-ilp32d.h new file mode 100644 index 0000000000..4d4c0d146a --- /dev/null +++ b/lib/libc/include/generic-glibc/gnu/stubs-ilp32d.h @@ -0,0 +1,24 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetexcept +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/lib/libc/include/generic-glibc/gnu/stubs-o32_soft.h b/lib/libc/include/generic-glibc/gnu/stubs-o32_soft.h new file mode 100644 index 0000000000..5c4857a869 --- /dev/null +++ b/lib/libc/include/generic-glibc/gnu/stubs-o32_soft.h @@ -0,0 +1,33 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub_chflags +#define __stub_fchflags +#define __stub_feclearexcept +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetenv +#define __stub_fegetexcept +#define __stub_fegetexceptflag +#define __stub_fegetmode +#define __stub_fegetround +#define __stub_feholdexcept +#define __stub_feraiseexcept +#define __stub_fesetenv +#define __stub_fesetexcept +#define __stub_fesetexceptflag +#define __stub_fesetmode +#define __stub_fesetround +#define __stub_fetestexcept +#define __stub_feupdateenv +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/malloc.h b/lib/libc/include/generic-glibc/malloc.h index 893014fc39..d9be803a6f 100644 --- a/lib/libc/include/generic-glibc/malloc.h +++ b/lib/libc/include/generic-glibc/malloc.h @@ -56,30 +56,25 @@ __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); the same pointer that was passed to it, aliasing needs to be allowed 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)); + __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2, 3)) + __attr_dealloc_free; /* Free a block allocated by `malloc', `realloc' or `calloc'. */ extern void free (void *__ptr) __THROW; /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ extern void *memalign (size_t __alignment, size_t __size) -__THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur; + __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur + __attr_dealloc_free; /* Allocate SIZE bytes on a page boundary. */ extern void *valloc (size_t __size) __THROW __attribute_malloc__ - __attribute_alloc_size__ ((1)) __wur; + __attribute_alloc_size__ ((1)) __wur __attr_dealloc_free; /* Equivalent to valloc(minimum-page-that-holds(n)), that is, round up __size to nearest pagesize. */ -extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ __wur; - -/* Underlying allocation function; successive calls should return - contiguous pieces of memory. */ -extern void *(*__morecore) (ptrdiff_t __size) __MALLOC_DEPRECATED; - -/* Default value of `__morecore'. */ -extern void *__default_morecore (ptrdiff_t __size) -__THROW __attribute_malloc__ __MALLOC_DEPRECATED; +extern void *pvalloc (size_t __size) __THROW __attribute_malloc__ + __wur __attr_dealloc_free; /* SVID2/XPG mallinfo structure */ @@ -161,24 +156,5 @@ extern void malloc_stats (void) __THROW; /* Output information about state of allocator to stream FP. */ extern int malloc_info (int __options, FILE *__fp) __THROW; -/* Hooks for debugging and user-defined versions. */ -extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr, - const void *) -__MALLOC_DEPRECATED; -extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size, - const void *) -__MALLOC_DEPRECATED; -extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr, - size_t __size, - const void *) -__MALLOC_DEPRECATED; -extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, - size_t __size, - const void *) -__MALLOC_DEPRECATED; -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) - __MALLOC_DEPRECATED; - - __END_DECLS #endif /* malloc.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/math.h b/lib/libc/include/generic-glibc/math.h index 99c89c05ef..3c95334ab8 100644 --- a/lib/libc/include/generic-glibc/math.h +++ b/lib/libc/include/generic-glibc/math.h @@ -104,7 +104,7 @@ __BEGIN_DECLS # endif #endif /* __USE_ISOC99 */ -#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) +#if __GLIBC_USE (IEC_60559_BFP_EXT) /* Signaling NaN macros, if supported. */ # if __GNUC_PREREQ (3, 3) # define SNANF (__builtin_nansf ("")) @@ -112,25 +112,39 @@ __BEGIN_DECLS # define SNANL (__builtin_nansl ("")) # endif #endif -#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT16 \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF16 (__builtin_nansf16 ("")) #endif -#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT32 \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF32 (__builtin_nansf32 ("")) #endif -#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT64 \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF64 (__builtin_nansf64 ("")) #endif -#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT128 \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF128 (__builtin_nansf128 ("")) #endif -#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT32X \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF32X (__builtin_nansf32x ("")) #endif -#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT64X \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF64X (__builtin_nansf64x ("")) #endif -#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) +#if (__HAVE_FLOAT128X \ + && __GLIBC_USE (IEC_60559_TYPES_EXT) \ + && (defined __USE_GNU || !__GLIBC_USE (ISOC2X))) # define SNANF128X (__builtin_nansf128x ("")) #endif diff --git a/lib/libc/include/generic-glibc/monetary.h b/lib/libc/include/generic-glibc/monetary.h index 94fd5f87dd..4df23ee58c 100644 --- a/lib/libc/include/generic-glibc/monetary.h +++ b/lib/libc/include/generic-glibc/monetary.h @@ -37,7 +37,8 @@ __BEGIN_DECLS /* Formatting a monetary value according to the current locale. */ extern ssize_t strfmon (char *__restrict __s, size_t __maxsize, const char *__restrict __format, ...) - __THROW __attribute_format_strfmon__ (3, 4); + __THROW __attribute_format_strfmon__ (3, 4) + __attr_access ((__write_only__, 1, 2)); #ifdef __USE_XOPEN2K8 /* POSIX.1-2008 extended locale interface (see locale.h). */ @@ -47,7 +48,8 @@ extern ssize_t strfmon (char *__restrict __s, size_t __maxsize, extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize, locale_t __loc, const char *__restrict __format, ...) - __THROW __attribute_format_strfmon__ (4, 5); + __THROW __attribute_format_strfmon__ (4, 5) + __attr_access ((__write_only__, 1, 2)); #endif #include diff --git a/lib/libc/include/generic-glibc/mqueue.h b/lib/libc/include/generic-glibc/mqueue.h index b2d0257f58..99066fff8e 100644 --- a/lib/libc/include/generic-glibc/mqueue.h +++ b/lib/libc/include/generic-glibc/mqueue.h @@ -71,6 +71,7 @@ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio) __nonnull ((2)); #ifdef __USE_XOPEN2K +# ifndef __USE_TIME_BITS64 /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, @@ -85,6 +86,27 @@ extern int mq_timedsend (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio, const struct timespec *__abs_timeout) __nonnull ((2, 5)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (mq_timedreceive, (mqd_t __mqdes, + char *__restrict __msg_ptr, + size_t __msg_len, + unsigned int *__restrict __msg_prio, + const struct timespec *__restrict __abs_timeout), + __mq_timedreceive_time64) + __nonnull ((2, 5)); + +extern int __REDIRECT (mq_timedsend, (mqd_t __mqdes, + const char *__msg_ptr, size_t __msg_len, + unsigned int __msg_prio, + const struct timespec *__abs_timeout), + __mq_timedsend_time64) + __nonnull ((2, 5)); +# else +# define mq_timedreceive __mq_timedreceive_time64 +# define mq_timedsend __mq_timedsend_time64 +# endif +# endif #endif /* Define some inlines helping to catch common problems. */ diff --git a/lib/libc/include/generic-glibc/net/if.h b/lib/libc/include/generic-glibc/net/if.h index 592dfaf274..299ac38fd6 100644 --- a/lib/libc/include/generic-glibc/net/if.h +++ b/lib/libc/include/generic-glibc/net/if.h @@ -191,7 +191,9 @@ __BEGIN_DECLS /* Convert an interface name to an index, and vice versa. */ extern unsigned int if_nametoindex (const char *__ifname) __THROW; -extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW; +extern char *if_indextoname (unsigned int __ifindex, + char __ifname[IF_NAMESIZE]) __THROW + __attr_access ((__write_only__, 2)); /* Return a list of all interfaces and their indices. */ extern struct if_nameindex *if_nameindex (void) __THROW; diff --git a/lib/libc/include/generic-glibc/netdb.h b/lib/libc/include/generic-glibc/netdb.h index 1fe8f37e8f..ffdd666793 100644 --- a/lib/libc/include/generic-glibc/netdb.h +++ b/lib/libc/include/generic-glibc/netdb.h @@ -701,6 +701,17 @@ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], extern int gai_suspend (const struct gaicb *const __list[], int __ent, const struct timespec *__timeout); +# ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (gai_suspend, (const struct gaicb *const __list[], + int __ent, + const struct timespec *__timeout), + __gai_suspend_time64); +# else +# define gai_suspend __gai_suspend_time64 +# endif +# endif + /* Get the error status of the request REQ. */ extern int gai_error (struct gaicb *__req) __THROW; diff --git a/lib/libc/include/generic-glibc/netinet/icmp6.h b/lib/libc/include/generic-glibc/netinet/icmp6.h index df2aadac34..04a482ead8 100644 --- a/lib/libc/include/generic-glibc/netinet/icmp6.h +++ b/lib/libc/include/generic-glibc/netinet/icmp6.h @@ -69,6 +69,8 @@ struct icmp6_hdr #define MLD_LISTENER_QUERY 130 #define MLD_LISTENER_REPORT 131 #define MLD_LISTENER_REDUCTION 132 +#define ICMPV6_EXT_ECHO_REQUEST 160 +#define ICMPV6_EXT_ECHO_REPLY 161 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ #define ICMP6_DST_UNREACH_ADMIN 1 /* communication with destination */ diff --git a/lib/libc/include/generic-glibc/netinet/ip_icmp.h b/lib/libc/include/generic-glibc/netinet/ip_icmp.h index 0d19d729f2..47abfae972 100644 --- a/lib/libc/include/generic-glibc/netinet/ip_icmp.h +++ b/lib/libc/include/generic-glibc/netinet/ip_icmp.h @@ -89,6 +89,24 @@ struct icmphdr #define ICMP_EXC_TTL 0 /* TTL count exceeded */ #define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */ +/* Codes for ICMP_EXT_ECHO (PROBE) */ +#define ICMP_EXT_ECHO 42 +#define ICMP_EXT_ECHOREPLY 43 +#define ICMP_EXT_CODE_MAL_QUERY 1 /* Malformed Query */ +#define ICMP_EXT_CODE_NO_IF 2 /* No such Interface */ +#define ICMP_EXT_CODE_NO_TABLE_ENT 3 /* No table entry */ +#define ICMP_EXT_CODE_MULT_IFS 4 /* Multiple Interfaces Satisfy Query */ + +/* Constants for EXT_ECHO (PROBE) */ +#define ICMP_EXT_ECHOREPLY_ACTIVE (1 << 2)/* active bit in reply */ +#define ICMP_EXT_ECHOREPLY_IPV4 (1 << 1)/* ipv4 bit in reply */ +#define ICMP_EXT_ECHOREPLY_IPV6 1 /* ipv6 bit in reply */ +#define ICMP_EXT_ECHO_CTYPE_NAME 1 +#define ICMP_EXT_ECHO_CTYPE_INDEX 2 +#define ICMP_EXT_ECHO_CTYPE_ADDR 3 +#define ICMP_AFI_IP 1 /* Address Family Identifier for IPV4 */ +#define ICMP_AFI_IP6 2 /* Address Family Identifier for IPV6 */ + #ifdef __USE_MISC /* diff --git a/lib/libc/include/generic-glibc/nss.h b/lib/libc/include/generic-glibc/nss.h index 09c496fb38..53187118a1 100644 --- a/lib/libc/include/generic-glibc/nss.h +++ b/lib/libc/include/generic-glibc/nss.h @@ -196,7 +196,7 @@ typedef enum nss_status nss_setspent (int); extern nss_endgrent _nss_##module##_endgrent; \ extern nss_endhostent _nss_##module##_endhostent; \ extern nss_endnetent _nss_##module##_endnetent; \ - extern nss_endnetgrent _nss_##module##__endnetgrent; \ + extern nss_endnetgrent _nss_##module##_endnetgrent; \ extern nss_endprotoent _nss_##module##_endprotoent; \ extern nss_endpwent _nss_##module##_endpwent; \ extern nss_endrpcent _nss_##module##_endrpcent; \ diff --git a/lib/libc/include/generic-glibc/pthread.h b/lib/libc/include/generic-glibc/pthread.h index 28ba72711d..4c46be9a6a 100644 --- a/lib/libc/include/generic-glibc/pthread.h +++ b/lib/libc/include/generic-glibc/pthread.h @@ -29,7 +29,9 @@ #include #include #include - +#ifdef __USE_MISC +# include +#endif /* Detach state. */ enum @@ -221,6 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; +# ifndef __USE_TIME_BITS64 /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. @@ -240,6 +243,23 @@ extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, clockid_t __clockid, const struct timespec *__abstime); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_timedjoin_np, + (pthread_t __th, void **__thread_return, + const struct timespec *__abstime), + __pthread_timedjoin_np64); + +extern int __REDIRECT (pthread_clockjoin_np, + (pthread_t __th, void **__thread_return, + clockid_t __clockid, + const struct timespec *__abstime), + __pthread_clockjoin_np64); +# else +# define pthread_timedjoin_np __pthread_timedjoin_np64 +# define pthread_clockjoin_np __pthread_clockjoin_np64 +# endif +# endif #endif /* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. @@ -454,11 +474,14 @@ extern int pthread_setconcurrency (int __level) __THROW; #endif #ifdef __USE_GNU -/* Yield the processor to another thread or process. - This function is similar to the POSIX `sched_yield' function but - might be differently implemented in the case of a m-on-n thread - implementation. */ extern int pthread_yield (void) __THROW; +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) + __attribute_deprecated_msg__ ("\ +pthread_yield is deprecated, use sched_yield instead"); +# else +# define pthread_yield sched_yield +# endif /* Limit specified thread TH to run only on the processors represented @@ -773,16 +796,39 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ +# ifndef __USE_TIME_BITS64 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, + (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_mutex_timedlock64) __nonnull ((1, 2)); +# else +# define pthread_mutex_timedlock __pthread_mutex_timedlock64 +# endif +# endif #endif #ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock, + (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_mutex_clocklock64) __nonnull ((1, 3)); +# else +# define pthread_mutex_clocklock __pthread_mutex_clocklock64 +# endif +# endif #endif /* Unlock a mutex. */ @@ -809,8 +855,14 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) __THROW __nonnull ((1)); # ifdef __USE_GNU -extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex) - __THROW __nonnull ((1)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *), + pthread_mutex_consistent) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent"); +# else +# define pthread_mutex_consistent_np pthread_mutex_consistent +# endif # endif #endif @@ -879,9 +931,15 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, int *__robustness) __THROW __nonnull ((1, 2)); # ifdef __USE_GNU -extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr, - int *__robustness) - __THROW __nonnull ((1, 2)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np, + (pthread_mutex_t *, int *), + pthread_mutexattr_getrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust"); +# else +# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust +# endif # endif /* Set the robustness flag of the mutex attribute ATTR. */ @@ -889,13 +947,18 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, int __robustness) __THROW __nonnull ((1)); # ifdef __USE_GNU -extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr, - int __robustness) - __THROW __nonnull ((1)); +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np, + (pthread_mutex_t *, int), + pthread_mutexattr_setrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust"); +# else +# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust +# endif # endif #endif - #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ @@ -919,16 +982,41 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specfied time. */ +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedrdlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64 +# endif +# endif # endif # ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockrdlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64 +# endif +# endif # endif /* Acquire write lock for RWLOCK. */ @@ -941,16 +1029,42 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specfied time. */ +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedwrlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64 +# endif +# endif # endif # ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 3)); + +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockwrlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64 +# endif +# endif # endif /* Unlock RWLOCK. */ @@ -1027,10 +1141,23 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 3)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_timedwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_cond_timedwait64) + __nonnull ((1, 2, 3)); +# else +# define pthread_cond_timedwait __pthread_cond_timedwait64 +# endif +# endif # ifdef __USE_GNU /* Wait for condition variable COND to be signaled or broadcast until @@ -1040,11 +1167,25 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __clockid_t __clock_id, const struct timespec *__restrict __abstime) __nonnull ((1, 2, 4)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_clockwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, + const struct timespec *__restrict __abstime), + __pthread_cond_clockwait64) + __nonnull ((1, 2, 4)); +# else +# define pthread_cond_clockwait __pthread_cond_clockwait64 +# endif +# endif # endif /* Functions for handling condition variable attributes. */ @@ -1165,7 +1306,8 @@ extern void *pthread_getspecific (pthread_key_t __key) __THROW; /* Store POINTER in the thread-specific data slot identified by KEY. */ extern int pthread_setspecific (pthread_key_t __key, - const void *__pointer) __THROW ; + const void *__pointer) + __THROW __attr_access_none (2); #ifdef __USE_XOPEN2K diff --git a/lib/libc/include/generic-glibc/pwd.h b/lib/libc/include/generic-glibc/pwd.h index 1d8329440a..382a580c2b 100644 --- a/lib/libc/include/generic-glibc/pwd.h +++ b/lib/libc/include/generic-glibc/pwd.h @@ -139,20 +139,23 @@ extern struct passwd *getpwnam (const char *__name) __nonnull ((1)); extern int getpwent_r (struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) - __nonnull ((1, 2, 4)); + __nonnull ((1, 2, 4)) + __attr_access ((__write_only__, 2, 3)); # endif extern int getpwuid_r (__uid_t __uid, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) - __nonnull ((2, 3, 5)); + __nonnull ((2, 3, 5)) + __attr_access ((__write_only__, 3, 4)); extern int getpwnam_r (const char *__restrict __name, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) - __nonnull ((1, 2, 3, 5)); + __nonnull ((1, 2, 3, 5)) + __attr_access ((__write_only__, 3, 4)); # ifdef __USE_MISC @@ -167,7 +170,8 @@ extern int fgetpwent_r (FILE *__restrict __stream, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) - __nonnull ((1, 2, 3, 5)); + __nonnull ((1, 2, 3, 5)) + __attr_access ((__write_only__, 3, 4)); # endif #endif /* POSIX or reentrant */ diff --git a/lib/libc/include/generic-glibc/regex.h b/lib/libc/include/generic-glibc/regex.h index ef5937f67b..0d44e6a12a 100644 --- a/lib/libc/include/generic-glibc/regex.h +++ b/lib/libc/include/generic-glibc/regex.h @@ -536,7 +536,8 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax); 'regcomp', with a malloc'ed value, or set to NULL before calling 'regfree'. */ extern const char *re_compile_pattern (const char *__pattern, size_t __length, - struct re_pattern_buffer *__buffer); + struct re_pattern_buffer *__buffer) + __attr_access ((__read_only__, 1, 2)); /* Compile a fastmap for the compiled pattern in BUFFER; used to @@ -553,7 +554,8 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer); extern regoff_t re_search (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, regoff_t __start, regoff_t __range, - struct re_registers *__regs); + struct re_registers *__regs) + __attr_access ((__read_only__, 2, 3)); /* Like 're_search', but search in the concatenation of STRING1 and @@ -563,14 +565,17 @@ extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer, const char *__string2, regoff_t __length2, regoff_t __start, regoff_t __range, struct re_registers *__regs, - regoff_t __stop); + regoff_t __stop) + __attr_access ((__read_only__, 2, 3)) + __attr_access ((__read_only__, 4, 5)); /* Like 're_search', but return how many characters in STRING the regexp in BUFFER matched, starting at position START. */ extern regoff_t re_match (struct re_pattern_buffer *__buffer, const char *__String, regoff_t __length, - regoff_t __start, struct re_registers *__regs); + regoff_t __start, struct re_registers *__regs) + __attr_access ((__read_only__, 2, 3)); /* Relates to 're_match' as 're_search_2' relates to 're_search'. */ @@ -578,7 +583,9 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer, const char *__string1, regoff_t __length1, const char *__string2, regoff_t __length2, regoff_t __start, struct re_registers *__regs, - regoff_t __stop); + regoff_t __stop) + __attr_access ((__read_only__, 2, 3)) + __attr_access ((__read_only__, 4, 5)); /* Set REGS to hold NUM_REGS registers, storing them in STARTS and @@ -648,10 +655,12 @@ extern int regcomp (regex_t *_Restrict_ __preg, extern int regexec (const regex_t *_Restrict_ __preg, const char *_Restrict_ __String, size_t __nmatch, regmatch_t __pmatch[_Restrict_arr_], - int __eflags); + int __eflags) + __attr_access ((__write_only__, 4, 3)); extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, - char *_Restrict_ __errbuf, size_t __errbuf_size); + char *_Restrict_ __errbuf, size_t __errbuf_size) + __attr_access ((__write_only__, 3, 4)); extern void regfree (regex_t *__preg); diff --git a/lib/libc/include/generic-glibc/resolv.h b/lib/libc/include/generic-glibc/resolv.h index 55f0916179..aadb9e79a7 100644 --- a/lib/libc/include/generic-glibc/resolv.h +++ b/lib/libc/include/generic-glibc/resolv.h @@ -168,20 +168,28 @@ __END_DECLS #define res_close __res_close #define res_init __res_init #define res_isourserver __res_isourserver -#define res_mkquery __res_mkquery -#define res_query __res_query -#define res_querydomain __res_querydomain -#define res_search __res_search -#define res_send __res_send + +#ifdef _LIBC +# define __RESOLV_DEPRECATED +# define __RESOLV_DEPRECATED_MSG(msg) +#else +# define __RESOLV_DEPRECATED __attribute_deprecated__ +# define __RESOLV_DEPRECATED_MSG(msg) __attribute_deprecated_msg__ (msg) +#endif __BEGIN_DECLS -void fp_nquery (const unsigned char *, int, FILE *) __THROW; -void fp_query (const unsigned char *, FILE *) __THROW; -const char * hostalias (const char *) __THROW; -void p_query (const unsigned char *) __THROW; +void fp_nquery (const unsigned char *, int, FILE *) __THROW + __RESOLV_DEPRECATED; +void fp_query (const unsigned char *, FILE *) __THROW + __RESOLV_DEPRECATED; +const char * hostalias (const char *) __THROW + __RESOLV_DEPRECATED_MSG ("use getaddrinfo instead"); +void p_query (const unsigned char *) __THROW + __RESOLV_DEPRECATED; void res_close (void) __THROW; int res_init (void) __THROW; -int res_isourserver (const struct sockaddr_in *) __THROW; +int res_isourserver (const struct sockaddr_in *) __THROW + __RESOLV_DEPRECATED; int res_mkquery (int, const char *, int, int, const unsigned char *, int, const unsigned char *, unsigned char *, int) __THROW; @@ -197,10 +205,7 @@ __END_DECLS #define b64_ntop __b64_ntop #define b64_pton __b64_pton -#define dn_comp __dn_comp #define dn_count_labels __dn_count_labels -#define dn_expand __dn_expand -#define dn_skipname __dn_skipname #define fp_resstat __fp_resstat #define loc_aton __loc_aton #define loc_ntoa __loc_ntoa @@ -215,19 +220,10 @@ __END_DECLS #define p_rcode __p_rcode #define putlong __putlong #define putshort __putshort -#define res_dnok __res_dnok -#define res_hnok __res_hnok #define res_hostalias __res_hostalias -#define res_mailok __res_mailok #define res_nameinquery __res_nameinquery #define res_nclose __res_nclose #define res_ninit __res_ninit -#define res_nmkquery __res_nmkquery -#define res_nquery __res_nquery -#define res_nquerydomain __res_nquerydomain -#define res_nsearch __res_nsearch -#define res_nsend __res_nsend -#define res_ownok __res_ownok #define res_queriesmatch __res_queriesmatch #define res_randomid __res_randomid #define sym_ntop __sym_ntop @@ -238,50 +234,61 @@ int res_hnok (const char *) __THROW; int res_ownok (const char *) __THROW; int res_mailok (const char *) __THROW; int res_dnok (const char *) __THROW; -int sym_ston (const struct res_sym *, const char *, int *) __THROW; -const char * sym_ntos (const struct res_sym *, int, int *) __THROW; -const char * sym_ntop (const struct res_sym *, int, int *) __THROW; +int sym_ston (const struct res_sym *, const char *, int *) __THROW + __RESOLV_DEPRECATED; +const char * sym_ntos (const struct res_sym *, int, int *) __THROW + __RESOLV_DEPRECATED; +const char * sym_ntop (const struct res_sym *, int, int *) __THROW + __RESOLV_DEPRECATED; int b64_ntop (const unsigned char *, size_t, char *, size_t) - __THROW; + __THROW; int b64_pton (char const *, unsigned char *, size_t) __THROW; -int loc_aton (const char *__ascii, unsigned char *__binary) __THROW; -const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW; +int loc_aton (const char *__ascii, unsigned char *__binary) __THROW + __RESOLV_DEPRECATED; +const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW + __RESOLV_DEPRECATED; int dn_skipname (const unsigned char *, const unsigned char *) - __THROW; -void putlong (uint32_t, unsigned char *) __THROW; -void putshort (uint16_t, unsigned char *) __THROW; -const char * p_class (int) __THROW; -const char * p_time (uint32_t) __THROW; -const char * p_type (int) __THROW; -const char * p_rcode (int) __THROW; -const unsigned char * p_cdnname (const unsigned char *, - const unsigned char *, int, FILE *) __THROW; + __THROW; +void putlong (uint32_t, unsigned char *) __THROW + __RESOLV_DEPRECATED_MSG ("use NS_PUT16 instead"); +void putshort (uint16_t, unsigned char *) __THROW + __RESOLV_DEPRECATED_MSG ("use NS_PUT32 instead"); +const char * p_class (int) __THROW __RESOLV_DEPRECATED; +const char * p_time (uint32_t) __THROW __RESOLV_DEPRECATED; +const char * p_type (int) __THROW __RESOLV_DEPRECATED; +const char * p_rcode (int) __THROW __RESOLV_DEPRECATED; +const unsigned char * p_cdnname (const unsigned char *, const unsigned char *, + int, FILE *) __THROW __RESOLV_DEPRECATED; const unsigned char * p_cdname (const unsigned char *, const unsigned char *, - FILE *) __THROW; + FILE *) __THROW __RESOLV_DEPRECATED; const unsigned char * p_fqnname (const unsigned char *__cp, const unsigned char *__msg, - int, char *, int) __THROW; -const unsigned char * p_fqname (const unsigned char *, - const unsigned char *, FILE *) __THROW; -const char * p_option (unsigned long __option) __THROW; -int dn_count_labels (const char *) __THROW; + int, char *, int) __THROW __RESOLV_DEPRECATED; +const unsigned char * p_fqname (const unsigned char *, const unsigned char *, + FILE *) __THROW __RESOLV_DEPRECATED; +const char * p_option (unsigned long __option) __THROW __RESOLV_DEPRECATED; +int dn_count_labels (const char *) __THROW __RESOLV_DEPRECATED; int dn_comp (const char *, unsigned char *, int, unsigned char **, unsigned char **) __THROW; int dn_expand (const unsigned char *, const unsigned char *, const unsigned char *, char *, int) __THROW; -unsigned int res_randomid (void) __THROW; +unsigned int res_randomid (void) __THROW + __RESOLV_DEPRECATED_MSG ("use getentropy instead"); int res_nameinquery (const char *, int, int, const unsigned char *, - const unsigned char *) __THROW; + const unsigned char *) __THROW + __RESOLV_DEPRECATED; int res_queriesmatch (const unsigned char *, const unsigned char *, const unsigned char *, - const unsigned char *) __THROW; + const unsigned char *) __THROW + __RESOLV_DEPRECATED; /* Things involving a resolver context. */ int res_ninit (res_state) __THROW; -void fp_resstat (const res_state, FILE *) __THROW; +void fp_resstat (const res_state, FILE *) __THROW + __RESOLV_DEPRECATED; const char * res_hostalias (const res_state, const char *, char *, size_t) - __THROW; + __THROW __RESOLV_DEPRECATED_MSG ("use getaddrinfo instead"); int res_nquery (res_state, const char *, int, int, unsigned char *, int) __THROW; int res_nsearch (res_state, const char *, int, int, diff --git a/lib/libc/include/generic-glibc/sched.h b/lib/libc/include/generic-glibc/sched.h index cea5f6874c..2ecd9b3377 100644 --- a/lib/libc/include/generic-glibc/sched.h +++ b/lib/libc/include/generic-glibc/sched.h @@ -74,8 +74,17 @@ extern int sched_get_priority_max (int __algorithm) __THROW; extern int sched_get_priority_min (int __algorithm) __THROW; /* Get the SCHED_RR interval for the named process. */ +#ifndef __USE_TIME_BITS64 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; - +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (sched_rr_get_interval, + (__pid_t __pid, struct timespec *__t), + __sched_rr_get_interval64); +# else +# define sched_rr_get_interval __sched_rr_get_interval64 +# endif +#endif #ifdef __USE_GNU /* Access macros for `cpu_set'. */ diff --git a/lib/libc/include/generic-glibc/semaphore.h b/lib/libc/include/generic-glibc/semaphore.h index 2eff18a327..f62f4d300c 100644 --- a/lib/libc/include/generic-glibc/semaphore.h +++ b/lib/libc/include/generic-glibc/semaphore.h @@ -59,16 +59,41 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1)); This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int sem_timedwait (sem_t *__restrict __sem, const struct timespec *__restrict __abstime) __nonnull ((1, 2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (sem_timedwait, + (sem_t *__restrict __sem, + const struct timespec *__restrict __abstime), + __sem_timedwait64) + __nonnull ((1, 2)); +# else +# define sem_timedwait __sem_timedwait64 +# endif +# endif #endif #ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 extern int sem_clockwait (sem_t *__restrict __sem, clockid_t clock, const struct timespec *__restrict __abstime) __nonnull ((1, 3)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (sem_clockwait, + (sem_t *__restrict __sem, + clockid_t clock, + const struct timespec *__restrict __abstime), + __sem_clockwait64) + __nonnull ((1, 3)); +# else +# define sem_clockwait __sem_clockwait64 +# endif +# endif #endif /* Test whether SEM is posted. */ diff --git a/lib/libc/include/generic-glibc/signal.h b/lib/libc/include/generic-glibc/signal.h index b3ac843ae6..d73d1f710e 100644 --- a/lib/libc/include/generic-glibc/signal.h +++ b/lib/libc/include/generic-glibc/signal.h @@ -269,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. */ @@ -312,6 +325,7 @@ extern int siginterrupt (int __sig, int __interrupt) __THROW __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead"); # include +# include # include /* Alternate signal handler stack interface. diff --git a/lib/libc/include/generic-glibc/spawn.h b/lib/libc/include/generic-glibc/spawn.h index 466dab6970..b48b07c1b4 100644 --- a/lib/libc/include/generic-glibc/spawn.h +++ b/lib/libc/include/generic-glibc/spawn.h @@ -213,6 +213,14 @@ extern int posix_spawn_file_actions_addchdir_np (posix_spawn_file_actions_t * extern int posix_spawn_file_actions_addfchdir_np (posix_spawn_file_actions_t *, int __fd) __THROW __nonnull ((1)); + +/* Add an action to close all file descriptor greater than or equal to FROM + during spawn. This affects the subsequent file actions. */ +extern int +posix_spawn_file_actions_addclosefrom_np (posix_spawn_file_actions_t *, + int __from) + __THROW __nonnull ((1)); + #endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/stdio.h b/lib/libc/include/generic-glibc/stdio.h index 7381342f71..9f5bc7efd5 100644 --- a/lib/libc/include/generic-glibc/stdio.h +++ b/lib/libc/include/generic-glibc/stdio.h @@ -165,31 +165,43 @@ extern int renameat2 (int __oldfd, const char *__old, int __newfd, const char *__new, unsigned int __flags) __THROW; #endif +/* Close STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fclose (FILE *__stream); + +#undef __attr_dealloc_fclose +#define __attr_dealloc_fclose __attr_dealloc (fclose, 1) + /* Create a temporary file and open it read/write. This function is a possible cancellation point and therefore not marked with __THROW. */ #ifndef __USE_FILE_OFFSET64 -extern FILE *tmpfile (void) __wur; +extern FILE *tmpfile (void) + __attribute_malloc__ __attr_dealloc_fclose __wur; #else # ifdef __REDIRECT -extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur; +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) + __attribute_malloc__ __attr_dealloc_fclose __wur; # else # define tmpfile tmpfile64 # endif #endif #ifdef __USE_LARGEFILE64 -extern FILE *tmpfile64 (void) __wur; +extern FILE *tmpfile64 (void) + __attribute_malloc__ __attr_dealloc_fclose __wur; #endif /* Generate a temporary filename. */ -extern char *tmpnam (char *__s) __THROW __wur; +extern char *tmpnam (char[L_tmpnam]) __THROW __wur; #ifdef __USE_MISC /* This is the reentrant variant of `tmpnam'. The only difference is that it does not allow S to be NULL. */ -extern char *tmpnam_r (char *__s) __THROW __wur; +extern char *tmpnam_r (char __s[L_tmpnam]) __THROW __wur; #endif @@ -202,15 +214,9 @@ extern char *tmpnam_r (char *__s) __THROW __wur; P_tmpdir is tried and finally "/tmp". The storage for the filename is allocated by `malloc'. */ extern char *tempnam (const char *__dir, const char *__pfx) - __THROW __attribute_malloc__ __wur; + __THROW __attribute_malloc__ __wur __attr_dealloc_free; #endif - -/* Close STREAM. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern int fclose (FILE *__stream); /* Flush STREAM, or all streams if STREAM is NULL. This function is a possible cancellation point and therefore not @@ -244,7 +250,8 @@ extern int fcloseall (void); This function is a possible cancellation point and therefore not marked with __THROW. */ extern FILE *fopen (const char *__restrict __filename, - const char *__restrict __modes) __wur; + const char *__restrict __modes) + __attribute_malloc__ __attr_dealloc_fclose __wur; /* Open a file, replacing an existing stream with it. This function is a possible cancellation point and therefore not @@ -256,7 +263,7 @@ extern FILE *freopen (const char *__restrict __filename, # ifdef __REDIRECT extern FILE *__REDIRECT (fopen, (const char *__restrict __filename, const char *__restrict __modes), fopen64) - __wur; + __attribute_malloc__ __attr_dealloc_fclose __wur; extern FILE *__REDIRECT (freopen, (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream), freopen64) @@ -268,7 +275,8 @@ extern FILE *__REDIRECT (freopen, (const char *__restrict __filename, #endif #ifdef __USE_LARGEFILE64 extern FILE *fopen64 (const char *__restrict __filename, - const char *__restrict __modes) __wur; + const char *__restrict __modes) + __attribute_malloc__ __attr_dealloc_fclose __wur; extern FILE *freopen64 (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) __wur; @@ -276,7 +284,8 @@ extern FILE *freopen64 (const char *__restrict __filename, #ifdef __USE_POSIX /* Create a new stream that refers to an existing system file descriptor. */ -extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur; +extern FILE *fdopen (int __fd, const char *__modes) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; #endif #ifdef __USE_GNU @@ -284,20 +293,29 @@ extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur; and uses the given functions for input and output. */ extern FILE *fopencookie (void *__restrict __magic_cookie, const char *__restrict __modes, - cookie_io_functions_t __io_funcs) __THROW __wur; + cookie_io_functions_t __io_funcs) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; #endif #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) /* Create a new stream that refers to a memory buffer. */ extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) - __THROW __wur; + __THROW __attribute_malloc__ __attr_dealloc_fclose __wur; /* Open a stream that writes into a malloc'd buffer that is expanded as necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ -extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur; -#endif +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; +#ifdef _WCHAR_H +/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces + a wide character string. Declared here only to add attribute malloc + and only if has been previously #included. */ +extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose; +# endif +#endif /* If BUF is NULL, make STREAM unbuffered. Else make it use buffer BUF, of size BUFSIZ. */ @@ -792,29 +810,33 @@ extern int fileno_unlocked (FILE *__stream) __THROW __wur; #ifdef __USE_POSIX2 -/* Create a new stream connected to a pipe running the given command. - - This function is a possible cancellation point and therefore not - marked with __THROW. */ -extern FILE *popen (const char *__command, const char *__modes) __wur; - /* Close a stream opened by popen and return the status of its child. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int pclose (FILE *__stream); + +/* Create a new stream connected to a pipe running the given command. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *popen (const char *__command, const char *__modes) + __attribute_malloc__ __attr_dealloc (pclose, 1) __wur; + #endif #ifdef __USE_POSIX /* Return the name of the controlling terminal. */ -extern char *ctermid (char *__s) __THROW; +extern char *ctermid (char *__s) __THROW + __attr_access ((__write_only__, 1)); #endif /* Use POSIX. */ #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU /* Return the name of the current user. */ -extern char *cuserid (char *__s); +extern char *cuserid (char *__s) + __attr_access ((__write_only__, 1)); #endif /* Use X/Open, but not issue 6. */ diff --git a/lib/libc/include/generic-glibc/stdlib.h b/lib/libc/include/generic-glibc/stdlib.h index cbafd640e9..d04a49c967 100644 --- a/lib/libc/include/generic-glibc/stdlib.h +++ b/lib/libc/include/generic-glibc/stdlib.h @@ -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 @@ -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 diff --git a/lib/libc/include/generic-glibc/sys/cdefs.h b/lib/libc/include/generic-glibc/sys/cdefs.h index fc2e4be563..2d594e1ba6 100644 --- a/lib/libc/include/generic-glibc/sys/cdefs.h +++ b/lib/libc/include/generic-glibc/sys/cdefs.h @@ -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. */ @@ -48,16 +70,17 @@ /* GCC can always grok prototypes. For C++ programs we add throw() to help it optimize the function calls. But this only works with - gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions + 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 @@ -74,7 +97,7 @@ # endif # endif -#else /* Not GCC. */ +#else /* Not GCC or clang. */ # if (defined __cplusplus \ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) @@ -87,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. */ @@ -149,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 @@ -179,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 @@ -204,17 +218,17 @@ */ #endif -/* GCC has various useful declarations that can be made with the - `__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !defined __GNUC__ || __GNUC__ < 2 +/* GCC and clang have various useful declarations that can be made with + the '__attribute__' syntax. All of the ways we use this do fine if + they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__) # define __attribute__(xyz) /* Ignore */ #endif /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,96) +#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) # define __attribute_malloc__ __attribute__ ((__malloc__)) #else # define __attribute_malloc__ /* Ignore */ @@ -232,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 @@ -257,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 */ @@ -267,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 @@ -280,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 */ @@ -290,27 +310,42 @@ attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ -#if __GNUC_PREREQ (2,97) +#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) # define __attribute_format_strfmon__(a,b) \ __attribute__ ((__format__ (__strfmon__, a, b))) #else # define __attribute_format_strfmon__(a,b) /* Ignore */ #endif -/* The nonull function attribute allows to mark pointer parameters which +/* The nonnull function attribute marks pointer parameters that must not be NULL. */ -#if __GNUC_PREREQ (3,3) -# define __nonnull(params) __attribute__ ((__nonnull__ params)) -#else -# define __nonnull(params) +#ifndef __nonnull +# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) +# define __nonnull(params) __attribute__ ((__nonnull__ params)) +# else +# define __nonnull(params) +# endif +#elif !defined __GLIBC__ +# undef __nonnull +# define __nonnull(params) _GL_ATTRIBUTE_NONNULL (params) +#endif + +/* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +#ifndef __returns_nonnull +# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) +# define __returns_nonnull __attribute__ ((__returns_nonnull__)) +# else +# define __returns_nonnull +# endif #endif /* If fortification mode, we warn about unused results of certain function calls which can lead to problems. */ -#if __GNUC_PREREQ (3,4) +#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) # define __attribute_warn_unused_result__ \ __attribute__ ((__warn_unused_result__)) -# if __USE_FORTIFY_LEVEL > 0 +# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 # define __wur __attribute_warn_unused_result__ # endif #else @@ -321,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. */ @@ -334,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 */ @@ -377,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 @@ -392,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__ @@ -408,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 @@ -416,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 @@ -453,14 +486,19 @@ #if (!defined _Static_assert && !defined __cplusplus \ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__)) + && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ + || defined __STRICT_ANSI__)) # define _Static_assert(expr, diagnostic) \ extern int (*__Static_assert_function (void)) \ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] #endif -#include -#include +/* The #ifndef lets Gnulib avoid including these on non-glibc + platforms, where the includes typically do not exist. */ +#ifdef __GLIBC__ +# include +# include +#endif #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 # ifdef __REDIRECT @@ -550,7 +588,7 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf 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 @@ -564,9 +602,26 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf array according to access mode, or at least one element when size-index is not provided: access (access-mode, [, ]) */ -#define __attr_access(x) __attribute__ ((__access__ x)) +# 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 diff --git a/lib/libc/include/generic-glibc/sys/ioctl.h b/lib/libc/include/generic-glibc/sys/ioctl.h index f74a78b3c3..0bf578863e 100644 --- a/lib/libc/include/generic-glibc/sys/ioctl.h +++ b/lib/libc/include/generic-glibc/sys/ioctl.h @@ -38,7 +38,17 @@ __BEGIN_DECLS /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ +#ifndef __USE_TIME_BITS64 extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; +#else +# ifdef __REDIRECT +extern int __REDIRECT (ioctl, (int __fd, unsigned long int __request, ...), + __ioctl_time64) __THROW; +# else +extern int __ioctl_time64 (int __fd, unsigned long int __request, ...) __THROW; +# define ioctl __ioctl_time64 +# endif +#endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/mount.h b/lib/libc/include/generic-glibc/sys/mount.h index 1eb8f0d067..ea7a023b09 100644 --- a/lib/libc/include/generic-glibc/sys/mount.h +++ b/lib/libc/include/generic-glibc/sys/mount.h @@ -48,6 +48,8 @@ enum #define MS_MANDLOCK MS_MANDLOCK MS_DIRSYNC = 128, /* Directory modifications are synchronous. */ #define MS_DIRSYNC MS_DIRSYNC + MS_NOSYMFOLLOW = 256, /* Do not follow symlinks. */ +#define MS_NOSYMFOLLOW MS_NOSYMFOLLOW MS_NOATIME = 1024, /* Do not update access times. */ #define MS_NOATIME MS_NOATIME MS_NODIRATIME = 2048, /* Do not update directory access times. */ diff --git a/lib/libc/include/generic-glibc/sys/msg.h b/lib/libc/include/generic-glibc/sys/msg.h index 6e421f1d22..325812a981 100644 --- a/lib/libc/include/generic-glibc/sys/msg.h +++ b/lib/libc/include/generic-glibc/sys/msg.h @@ -58,7 +58,17 @@ struct msgbuf __BEGIN_DECLS /* Message queue control operation. */ +#ifndef __USE_TIME_BITS64 extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (msgctl, + (int __msqid, int __cmd, struct msqid_ds *__buf), + __msgctl64); +# else +# define msgctl __msgctl64 +# endif +#endif /* Get messages queue. */ extern int msgget (key_t __key, int __msgflg) __THROW; diff --git a/lib/libc/include/generic-glibc/sys/platform/x86.h b/lib/libc/include/generic-glibc/sys/platform/x86.h index 4ff21517be..1d0d73c948 100644 --- a/lib/libc/include/generic-glibc/sys/platform/x86.h +++ b/lib/libc/include/generic-glibc/sys/platform/x86.h @@ -30,7 +30,7 @@ extern const struct cpuid_feature *__x86_get_cpuid_feature_leaf (unsigned int) __attribute__ ((pure)); static __inline__ _Bool -x86_cpu_has_feature (unsigned int __index) +x86_cpu_present (unsigned int __index) { const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf (__index / (8 * sizeof (unsigned int) * 4)); @@ -43,7 +43,7 @@ x86_cpu_has_feature (unsigned int __index) } static __inline__ _Bool -x86_cpu_is_usable (unsigned int __index) +x86_cpu_active (unsigned int __index) { const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf (__index / (8 * sizeof (unsigned int) * 4)); @@ -52,13 +52,13 @@ x86_cpu_is_usable (unsigned int __index) unsigned int __bit = __reg & (8 * sizeof (unsigned int) - 1); __reg /= 8 * sizeof (unsigned int); - return __ptr->usable_array[__reg] & (1 << __bit); + return __ptr->active_array[__reg] & (1 << __bit); } -/* HAS_CPU_FEATURE evaluates to true if CPU supports the feature. */ -#define HAS_CPU_FEATURE(name) x86_cpu_has_feature (x86_cpu_##name) -/* CPU_FEATURE_USABLE evaluates to true if the feature is usable. */ -#define CPU_FEATURE_USABLE(name) x86_cpu_is_usable (x86_cpu_##name) +/* CPU_FEATURE_PRESENT evaluates to true if CPU supports the feature. */ +#define CPU_FEATURE_PRESENT(name) x86_cpu_present (x86_cpu_##name) +/* CPU_FEATURE_ACTIVE evaluates to true if the feature is active. */ +#define CPU_FEATURE_ACTIVE(name) x86_cpu_active (x86_cpu_##name) __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/poll.h b/lib/libc/include/generic-glibc/sys/poll.h index b5947952ff..358e8c2b80 100644 --- a/lib/libc/include/generic-glibc/sys/poll.h +++ b/lib/libc/include/generic-glibc/sys/poll.h @@ -51,7 +51,8 @@ __BEGIN_DECLS This function is a cancellation point and therefore not marked with __THROW. */ -extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); +extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) + __attr_access ((__write_only__, 1, 2)); #ifdef __USE_GNU /* Like poll, but before waiting the threads signal mask is replaced @@ -62,7 +63,20 @@ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); __THROW. */ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, - const __sigset_t *__ss); + const __sigset_t *__ss) + __attr_access ((__write_only__, 1, 2)); + +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT +extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss), + __ppoll64) + __attr_access ((__write_only__, 1, 2)); +# else +# define ppoll __ppoll64 +# endif +# endif #endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/prctl.h b/lib/libc/include/generic-glibc/sys/prctl.h index b22bbe264b..5435c0473a 100644 --- a/lib/libc/include/generic-glibc/sys/prctl.h +++ b/lib/libc/include/generic-glibc/sys/prctl.h @@ -25,10 +25,6 @@ we're picking up... */ /* Memory tagging control operations (for AArch64). */ -#ifndef PR_TAGGED_ADDR_ENABLE -# define PR_TAGGED_ADDR_ENABLE (1UL << 8) -#endif - #ifndef PR_MTE_TCF_SHIFT # define PR_MTE_TCF_SHIFT 1 # define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT) @@ -42,7 +38,17 @@ __BEGIN_DECLS /* Control process execution. */ +#ifndef __USE_TIME_BITS64 extern int prctl (int __option, ...) __THROW; +#else +# ifdef __REDIRECT +extern int __REDIRECT (prctl, (int __option, ...), __prctl_time64) __THROW; +# else +extern int __prctl_time64 (int __option,d ...) __THROW; +# define ioctl __prctl_time64 +# endif +#endif + __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/resource.h b/lib/libc/include/generic-glibc/sys/resource.h index 52ea01a148..da44ec0320 100644 --- a/lib/libc/include/generic-glibc/sys/resource.h +++ b/lib/libc/include/generic-glibc/sys/resource.h @@ -48,18 +48,19 @@ typedef int __priority_which_t; Returns 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int getrlimit (__rlimit_resource_t __resource, - struct rlimit *__rlimits) __THROW; + struct rlimit *__rlimits) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource, - struct rlimit *__rlimits), getrlimit64); + struct rlimit *__rlimits), getrlimit64) + __nonnull ((2)); # else # define getrlimit getrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int getrlimit64 (__rlimit_resource_t __resource, - struct rlimit64 *__rlimits) __THROW; + struct rlimit64 *__rlimits) __THROW __nonnull ((2)); #endif /* Set the soft and hard limits for RESOURCE to *RLIMITS. @@ -67,25 +68,36 @@ extern int getrlimit64 (__rlimit_resource_t __resource, Return 0 if successful, -1 if not (and sets errno). */ #ifndef __USE_FILE_OFFSET64 extern int setrlimit (__rlimit_resource_t __resource, - const struct rlimit *__rlimits) __THROW; + const struct rlimit *__rlimits) __THROW __nonnull ((2)); #else # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource, const struct rlimit *__rlimits), - setrlimit64); + setrlimit64) __nonnull ((2)); # else # define setrlimit setrlimit64 # endif #endif #ifdef __USE_LARGEFILE64 extern int setrlimit64 (__rlimit_resource_t __resource, - const struct rlimit64 *__rlimits) __THROW; + const struct rlimit64 *__rlimits) __THROW + __nonnull ((2)); #endif /* Return resource usage information on process indicated by WHO and put it in *USAGE. Returns 0 for success, -1 for failure. */ extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT_NTH) +extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who, + struct rusage *__usage), + __getrusage64); +# else +# define getrusage __getrusage64 +# endif +#endif + /* Return the highest priority of any process specified by WHICH and WHO (see above); if WHO is zero, the current process, process group, or user (as specified by WHO) is used. A lower priority number means higher diff --git a/lib/libc/include/generic-glibc/sys/select.h b/lib/libc/include/generic-glibc/sys/select.h index ecf5c60674..47298cf1fa 100644 --- a/lib/libc/include/generic-glibc/sys/select.h +++ b/lib/libc/include/generic-glibc/sys/select.h @@ -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 diff --git a/lib/libc/include/generic-glibc/sys/sem.h b/lib/libc/include/generic-glibc/sys/sem.h index a1ba6ef73d..f8d45b1038 100644 --- a/lib/libc/include/generic-glibc/sys/sem.h +++ b/lib/libc/include/generic-glibc/sys/sem.h @@ -48,7 +48,17 @@ struct sembuf __BEGIN_DECLS /* Semaphore control operation. */ +#ifndef __USE_TIME_BITS64 extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (semctl, + (int __semid, int __semnum, int __cmd, ...), + __semctl64); +# else +# define semctl __semctl64 +# endif +#endif /* Get semaphore. */ extern int semget (key_t __key, int __nsems, int __semflg) __THROW; @@ -58,8 +68,19 @@ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; #ifdef __USE_GNU /* Operate on semaphore with timeout. */ +# ifndef __USE_TIME_BITS64 extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, const struct timespec *__timeout) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (semtimedop, (int __semid, struct sembuf *__sops, + size_t __nsops, + const struct timespec *__timeout), + __semtimedop64); +# else +# define semtimedop __semtimedop64 +# endif +# endif #endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/shm.h b/lib/libc/include/generic-glibc/sys/shm.h index bd4d8e9703..6fbac17523 100644 --- a/lib/libc/include/generic-glibc/sys/shm.h +++ b/lib/libc/include/generic-glibc/sys/shm.h @@ -46,7 +46,17 @@ __BEGIN_DECLS facility. The definition is found in XPG4.2. */ /* Shared memory control operation. */ +#ifndef __USE_TIME_BITS64 extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (shmctl, + (int __shmid, int __cmd, struct shmid_ds *__buf), + __shmctl64); +# else +# define shmctl __shmctl64 +# endif +#endif /* Get shared memory segment. */ extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW; diff --git a/lib/libc/include/generic-glibc/sys/socket.h b/lib/libc/include/generic-glibc/sys/socket.h index b2ed8b968c..2599db5d59 100644 --- a/lib/libc/include/generic-glibc/sys/socket.h +++ b/lib/libc/include/generic-glibc/sys/socket.h @@ -170,8 +170,20 @@ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, This function is a cancellation point and therefore not marked with __THROW. */ +#ifndef __USE_TIME_BITS64 extern ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags); +#else +# ifdef __REDIRECT +extern ssize_t __REDIRECT (sendmsg, (int __fd, const struct msghdr *__message, + int __flags), + __sendmsg64); +# else +extern ssize_t __sendmsg64 (int __fd, const struct msghdr *__message, + int __flags); +# defien sendmsg __sendmsg64 +# endif +#endif #ifdef __USE_GNU /* Send a VLEN messages as described by VMESSAGES to socket FD. @@ -179,16 +191,39 @@ extern ssize_t sendmsg (int __fd, const struct msghdr *__message, This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags); -#endif +# else +# ifdef __REDIRECT +extern int __REDIRECT (sendmmsg, (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags), + __sendmmsg64); +# else +extern int __sendmmsg64 (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); +# define sendmmsg __sendmmsg64 +# endif +# endif /* __USE_TIME_BITS64 */ +#endif /* __USE_GNU */ /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. This function is a cancellation point and therefore not marked with __THROW. */ +#ifndef __USE_TIME_BITS64 extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); +#else +# ifdef __REDIRECT +extern ssize_t __REDIRECT (recvmsg, + (int __fd, struct msghdr *__message, int __flags), + __recvmsg64); +# else +extern ssize_t __recvmsg64 (int __fd, struct msghdr *__message, int __flags); +# define recvmsg __recvmsg64 +# endif +#endif #ifdef __USE_GNU /* Receive up to VLEN messages as described by VMESSAGES from socket FD. @@ -196,24 +231,63 @@ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, struct timespec *__tmo); +# else +# ifdef __REDIRECT +extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags, + struct timespec *__tmo), + __recvmmsg64); +# else +# define recvmmsg __recvmmsg64 +# endif +# endif #endif /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's actual length. Returns 0 on success, -1 for errors. */ +#ifndef __USE_TIME_BITS64 extern int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, socklen_t *__restrict __optlen) __THROW; +#else +# ifdef __REDIRECT +extern int __REDIRECT_NTH (getsockopt, + (int __fd, int __level, int __optname, + void *__restrict __optval, + socklen_t *__restrict __optlen), + __getsockopt64); +# else +extern int __getsockopt64 (int __fd, int __level, int __optname, + void *__restrict __optval, + socklen_t *__restrict __optlen) __THROW; +# define getsockopt __getsockopt64 +# endif +#endif /* Set socket FD's option OPTNAME at protocol level LEVEL to *OPTVAL (which is OPTLEN bytes long). Returns 0 on success, -1 for errors. */ +#ifndef __USE_TIME_BITS64 extern int setsockopt (int __fd, int __level, int __optname, const void *__optval, socklen_t __optlen) __THROW; +#else +# ifdef __REDIRECT +extern int __REDIRECT_NTH (setsockopt, + (int __fd, int __level, int __optname, + const void *__optval, socklen_t __optlen), + __setsockopt64); +# else +extern int __setsockopt64 (int __fd, int __level, int __optname, + const void *__optval, socklen_t __optlen) __THROW; +# define setsockopt __setsockopt64 +# endif +#endif /* Prepare to accept connections on socket FD. diff --git a/lib/libc/include/generic-glibc/sys/stat.h b/lib/libc/include/generic-glibc/sys/stat.h index 77e0e23e08..f1248327fb 100644 --- a/lib/libc/include/generic-glibc/sys/stat.h +++ b/lib/libc/include/generic-glibc/sys/stat.h @@ -209,21 +209,51 @@ extern int stat (const char *__restrict __file, that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (stat, (const char *__restrict __file, + struct stat *__restrict __buf), + __stat64_time64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), + __fstat64_time64) + __nonnull ((2)); +# else +# define stat __stat64_time64 +# define fstat __fstat64_time64 +# endif +# else +# ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), stat64) __nonnull ((1, 2)); extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) __nonnull ((2)); -# else -# define stat stat64 -# define fstat fstat64 +# else +# define stat stat64 +# define fstat fstat64 +# endif # endif #endif #ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (stat64, (const char *__restrict __file, + struct stat64 *__restrict __buf), + __stat64_time64) + __nonnull ((1, 2)); +extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf), + __fstat64_time64) + __nonnull ((2)); +# else +# define stat64 __stat64_time64 +# define fstat64 __fstat64_time +# endif +# endif #endif #ifdef __USE_ATFILE @@ -235,20 +265,44 @@ extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, + struct stat *__restrict __buf, + int __flag), + __fstatat64_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, int __flag), fstatat64) __nonnull ((2, 3)); -# else -# define fstatat fstatat64 +# else +# define fstatat fstatat64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (fstatat64, (int __fd, + const char *__restrict __file, + struct stat64 *__restrict __buf, + int __flag), + __fstatat64_time64) + __nonnull ((2, 3)); +# else +# define fstatat64 __fstatat64_time64 +# endif +# endif # endif #endif @@ -259,19 +313,37 @@ extern int fstatat64 (int __fd, const char *__restrict __file, extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else -# ifdef __REDIRECT_NTH +# ifdef __USE_TIME_BITS64 +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (lstat, + (const char *__restrict __file, + struct stat *__restrict __buf), __lstat64_time64) + __nonnull ((1, 2)); +# else +# define lstat __lstat64_time64 +# endif +# else +# ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, struct stat *__restrict __buf), lstat64) __nonnull ((1, 2)); -# else -# define lstat lstat64 +# else +# define lstat lstat64 +# endif # endif # endif # ifdef __USE_LARGEFILE64 +# ifndef __USE_TIME_BITS64 extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); +# else +extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file, + struct stat64 *__restrict __buf), + __lstat64_time64) + __nonnull ((1, 2)); +# endif # endif #endif @@ -355,17 +427,38 @@ 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; + +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]), + __futimens64); +# else +# define futimens __futimens64 +# endif +# endif #endif #ifdef __USE_GNU diff --git a/lib/libc/include/generic-glibc/sys/statvfs.h b/lib/libc/include/generic-glibc/sys/statvfs.h index bcb73bc191..a36a9ada1d 100644 --- a/lib/libc/include/generic-glibc/sys/statvfs.h +++ b/lib/libc/include/generic-glibc/sys/statvfs.h @@ -21,7 +21,7 @@ #include -/* Get the system-specific definition of `struct statfs'. */ +/* Get the system-specific definition of `struct statvfs'. */ #include #ifndef __USE_FILE_OFFSET64 diff --git a/lib/libc/include/generic-glibc/sys/time.h b/lib/libc/include/generic-glibc/sys/time.h index 4f935c1cae..35bad81116 100644 --- a/lib/libc/include/generic-glibc/sys/time.h +++ b/lib/libc/include/generic-glibc/sys/time.h @@ -63,10 +63,21 @@ struct timezone use localtime etc. instead. This function itself is semi-obsolete; most callers should use time or clock_gettime instead. */ +#ifndef __USE_TIME_BITS64 extern int gettimeofday (struct timeval *__restrict __tv, void *__restrict __tz) __THROW __nonnull ((1)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict __tv, + void *__restrict __tz), + __gettimeofday64) __nonnull ((1)); +# else +# define gettimeofday __gettimeofday64 +# endif +#endif #ifdef __USE_MISC +# ifndef __USE_TIME_BITS64 /* Set the current time of day and timezone information. This call is restricted to the super-user. Setting the timezone in this way is obsolete, but we don't yet @@ -82,6 +93,20 @@ extern int settimeofday (const struct timeval *__tv, This call is restricted to the super-user. */ extern int adjtime (const struct timeval *__delta, struct timeval *__olddelta) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (settimeofday, (const struct timeval *__tv, + const struct timezone *__tz), + __settimeofday64); + +extern int __REDIRECT_NTH (adjtime, (const struct timeval *__delta, + struct timeval *__olddelta), + __adjtime64); +# else +# define settimeofday __settimeofday64 +# define adjtime __adjtime64 +# endif +# endif #endif @@ -118,6 +143,7 @@ typedef enum __itimer_which __itimer_which_t; typedef int __itimer_which_t; #endif +#ifndef __USE_TIME_BITS64 /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ extern int getitimer (__itimer_which_t __which, @@ -136,21 +162,66 @@ extern int setitimer (__itimer_which_t __which, extern int utimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (getitimer, (__itimer_which_t __which, + struct itimerval *__value), + __getitimer64); + +extern int __REDIRECT_NTH (setitimer, (__itimer_which_t __which, + const struct itimerval *__restrict __new, + struct itimerval *__restrict __old), + __setitimer64); + +extern int __REDIRECT_NTH (utimes, (const char *__file, + const struct timeval __tvp[2]), + __utimes64) __nonnull ((1)); +# else +# define getitimer __getitimer64 +# define setitimer __setitimer64 +# define utimes __utimes64 +# endif +#endif + #ifdef __USE_MISC +# ifndef __USE_TIME_BITS64 /* Same as `utimes', but does not follow symbolic links. */ extern int lutimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); /* Same as `utimes', but takes an open file descriptor instead of a name. */ extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (lutimes, (const char *__file, + const struct timeval __tvp[2]), + __lutimes64) __nonnull ((1)); + +extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval __tvp[2]), + __futimes64); +# else +# define lutimes __lutimes64 +# define futimes __futimes64 +# endif +# endif #endif #ifdef __USE_GNU +# ifndef __USE_TIME_BITS64 /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ extern int futimesat (int __fd, const char *__file, const struct timeval __tvp[2]) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (futimesat, (int __fd, const char *__file, + const struct timeval __tvp[2]), + __futimesat64); +# else +# define futimesat __futimesat64 +# endif +# endif #endif diff --git a/lib/libc/include/generic-glibc/sys/timerfd.h b/lib/libc/include/generic-glibc/sys/timerfd.h index 18acd489ea..32643a90a1 100644 --- a/lib/libc/include/generic-glibc/sys/timerfd.h +++ b/lib/libc/include/generic-glibc/sys/timerfd.h @@ -47,9 +47,31 @@ extern int timerfd_settime (int __ufd, int __flags, const struct itimerspec *__utmr, struct itimerspec *__otmr) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT_NTH) +extern int __REDIRECT_NTH (timerfd_settime, + (int __ufd, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue), + __timerfd_settime64); +# else +# define timerfd_settime __timerfd_settime64 +# endif +#endif + /* Return the next expiration time of UFD. */ extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT_NTH) +extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd, + struct itimerspec *__otmr), + __timerfd_gettime64); +# else +# define timerfd_gettime __timerfd_gettime64 +# endif +#endif + __END_DECLS #endif /* sys/timerfd.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/sys/timex.h b/lib/libc/include/generic-glibc/sys/timex.h index 0e82ddced7..2ca80d7baf 100644 --- a/lib/libc/include/generic-glibc/sys/timex.h +++ b/lib/libc/include/generic-glibc/sys/timex.h @@ -54,17 +54,34 @@ struct ntptimeval __BEGIN_DECLS -extern int __adjtimex (struct timex *__ntx) __THROW; +#ifndef __USE_TIME_BITS64 extern int adjtimex (struct timex *__ntx) __THROW; - -#ifdef __REDIRECT_NTH -extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), - ntp_gettimex); -#else extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW; -# define ntp_gettime ntp_gettimex -#endif + +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), + ntp_gettimex); +# else +# define ntp_gettime ntp_gettimex +# endif extern int ntp_adjtime (struct timex *__tntx) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx), + ___adjtimex64); +extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv), + __ntp_gettime64); +extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv), + __ntp_gettimex64); +extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx), + ___adjtimex64); +# else +# define adjtimex ___adjtimex64 +# define ntp_adjtime ___adjtimex64 +# define ntp_gettime __ntp_gettime64 +# define ntp_gettimex __ntp_gettimex64 +# endif +#endif __END_DECLS diff --git a/lib/libc/include/generic-glibc/sys/uio.h b/lib/libc/include/generic-glibc/sys/uio.h index 7d14d63881..8a8846a5de 100644 --- a/lib/libc/include/generic-glibc/sys/uio.h +++ b/lib/libc/include/generic-glibc/sys/uio.h @@ -39,7 +39,7 @@ __BEGIN_DECLS This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count) - __wur; + __wur __attr_access ((__read_only__, 2, 3)); /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD. @@ -50,7 +50,7 @@ extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count) This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count) - __wur; + __wur __attr_access ((__read_only__, 2, 3)); #ifdef __USE_MISC @@ -65,7 +65,8 @@ extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count) This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, - __off_t __offset) __wur; + __off_t __offset) + __wur __attr_access ((__read_only__, 2, 3)); /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given @@ -77,16 +78,19 @@ extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, - __off_t __offset) __wur; + __off_t __offset) + __wur __attr_access ((__read_only__, 2, 3)); # else # ifdef __REDIRECT extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), - preadv64) __wur; + preadv64) + __wur __attr_access ((__read_only__, 2, 3)); extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset), - pwritev64) __wur; + pwritev64) + __wur __attr_access ((__read_only__, 2, 3)); # else # define preadv preadv64 # define pwritev pwritev64 @@ -104,7 +108,8 @@ extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec, This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count, - __off64_t __offset) __wur; + __off64_t __offset) + __wur __attr_access ((__read_only__, 2, 3)); /* Write data pointed by the buffers described by IOVEC, which is a vector of COUNT 'struct iovec's, to file descriptor FD at the given @@ -116,7 +121,8 @@ extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count, This function is a cancellation point and therefore not marked with __THROW. */ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, - __off64_t __offset) __wur; + __off64_t __offset) + __wur __attr_access ((__read_only__, 2, 3)); # endif #endif /* Use misc. */ @@ -125,7 +131,8 @@ extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count, # ifndef __USE_FILE_OFFSET64 /* Same as preadv but with an additional flag argumenti defined at uio.h. */ extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count, - __off_t __offset, int ___flags) __wur; + __off_t __offset, int ___flags) + __wur __attr_access ((__read_only__, 2, 3)); /* Same as preadv but with an additional flag argument defined at uio.h. */ extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count, @@ -136,11 +143,13 @@ extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count, extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset, int __flags), - pwritev64v2) __wur; + pwritev64v2) + __wur __attr_access ((__read_only__, 2, 3)); extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset, int __flags), - preadv64v2) __wur; + preadv64v2) + __wur __attr_access ((__read_only__, 2, 3)); # else # define preadv2 preadv64v2 # define pwritev2 pwritev64v2 @@ -151,12 +160,14 @@ extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec, /* Same as preadv but with an additional flag argumenti defined at uio.h. */ extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec, int __count, __off64_t __offset, - int ___flags) __wur; + int ___flags) + __wur __attr_access ((__read_only__, 2, 3)); /* Same as preadv but with an additional flag argument defined at uio.h. */ extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev, int __count, __off64_t __offset, - int __flags) __wur; + int __flags) + __wur __attr_access ((__read_only__, 2, 3)); # endif #endif /* Use GNU. */ diff --git a/lib/libc/include/generic-glibc/sys/wait.h b/lib/libc/include/generic-glibc/sys/wait.h index 8a0a954eb7..17d2be0a62 100644 --- a/lib/libc/include/generic-glibc/sys/wait.h +++ b/lib/libc/include/generic-glibc/sys/wait.h @@ -144,14 +144,34 @@ struct rusage; nil, store information about the child's resource usage there. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ +# ifndef __USE_TIME_BITS64 extern __pid_t wait3 (int *__stat_loc, int __options, struct rusage * __usage) __THROWNL; +# else +# ifdef __REDIRECT_NTHNL +extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int __options, + struct rusage * __usage), + __wait3_time64); +# else +# define wait3 __wait3_time64 +# endif +# endif #endif #ifdef __USE_MISC +# ifndef __USE_TIME_BITS64 /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options, struct rusage *__usage) __THROWNL; +# else +# ifdef __REDIRECT_NTHNL +extern __pid_t __REDIRECT_NTHNL (wait4, (__pid_t __pid, int *__stat_loc, + int __options, struct rusage *__usage), + __wait4_time64); +# else +# define wait4 __wait4_time64 +# endif +# endif #endif /* Use misc. */ diff --git a/lib/libc/include/generic-glibc/threads.h b/lib/libc/include/generic-glibc/threads.h index a6b2089453..4f99432495 100644 --- a/lib/libc/include/generic-glibc/threads.h +++ b/lib/libc/include/generic-glibc/threads.h @@ -88,8 +88,18 @@ extern thrd_t thrd_current (void); __TIME_POINT. The current thread may resume if receives a signal. In that case, if __REMAINING is not NULL, the remaining time is stored in the object pointed by it. */ +#ifndef __USE_TIME_BITS64 extern int thrd_sleep (const struct timespec *__time_point, struct timespec *__remaining); +#else +# ifdef __REDIRECT +extern int __REDIRECT (thrd_sleep, (const struct timespec *__time_point, + struct timespec *__remaining), + __thrd_sleep64); +# else +# define thrd_sleep __thrd_sleep64 +# endif +#endif /* Terminate current thread execution, cleaning up any thread local storage and freeing resources. Returns the value specified in __RES. */ @@ -131,8 +141,19 @@ extern int mtx_lock (mtx_t *__mutex); /* Block the current thread until the mutex pointed by __MUTEX is unlocked or time pointed by __TIME_POINT is reached. In case the mutex is unlock, the current thread will not be blocked. */ +#ifndef __USE_TIME_BITS64 extern int mtx_timedlock (mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); +#else +# ifdef __REDIRECT +extern int __REDIRECT (mtx_timedlock, (mtx_t *__restrict __mutex, + const struct timespec *__restrict + __time_point), + __mtx_timedlock64); +# else +# define mtx_timedlock __mtx_timedlock64 +# endif +#endif /* Try to lock the mutex pointed by __MUTEX without blocking. If the mutex is free the current threads takes control of it, otherwise it returns @@ -171,9 +192,21 @@ extern int cnd_wait (cnd_t *__cond, mtx_t *__mutex); /* Block current thread on the condition variable until condition variable pointed by __COND is signaled or time pointed by __TIME_POINT is reached. */ +#ifndef __USE_TIME_BITS64 extern int cnd_timedwait (cnd_t *__restrict __cond, mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); +#else +# ifdef __REDIRECT +extern int __REDIRECT (cnd_timedwait, (cnd_t *__restrict __cond, + mtx_t *__restrict __mutex, + const struct timespec *__restrict + __time_point), + __cnd_timedwait64); +# else +# define cnd_timedwait __cnd_timedwait64 +# endif +#endif /* Destroy condition variable pointed by __cond and free all of its resources. */ diff --git a/lib/libc/include/generic-glibc/time.h b/lib/libc/include/generic-glibc/time.h index 878ba90789..10ad9d992e 100644 --- a/lib/libc/include/generic-glibc/time.h +++ b/lib/libc/include/generic-glibc/time.h @@ -71,6 +71,7 @@ __BEGIN_DECLS The result / CLOCKS_PER_SEC is program time in seconds. */ extern clock_t clock (void) __THROW; +#ifndef __USE_TIME_BITS64 /* Return the current time and put it in *TIMER if TIMER is not NULL. */ extern time_t time (time_t *__timer) __THROW; @@ -80,7 +81,18 @@ extern double difftime (time_t __time1, time_t __time0) /* Return the `time_t' representation of TP and normalize TP. */ extern time_t mktime (struct tm *__tp) __THROW; - +#else +# ifdef __REDIRECT_NTH +extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64); +extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t __time0), + __difftime64) __attribute__ ((__const__)); +extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64); +# else +# define time __time64 +# define difftime __difftime64 +# define mktime __mktime64 +# endif +#endif /* Format TP into S according to FORMAT. Write no more than MAXSIZE characters and return the number @@ -114,6 +126,7 @@ extern char *strptime_l (const char *__restrict __s, #endif +#ifndef __USE_TIME_BITS64 /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ extern struct tm *gmtime (const time_t *__timer) __THROW; @@ -122,7 +135,20 @@ extern struct tm *gmtime (const time_t *__timer) __THROW; of *TIMER in the local timezone. */ extern struct tm *localtime (const time_t *__timer) __THROW; +#else +# ifdef __REDIRECT_NTH +extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer), __gmtime64); +extern struct tm *__REDIRECT_NTH (localtime, (const time_t *__timer), + __localtime64); +# else +# define gmtime __gmtime64 +# define localtime __localtime64 +# endif +#endif + + #if defined __USE_POSIX || __GLIBC_USE (ISOC2X) +# ifndef __USE_TIME_BITS64 /* Return the `struct tm' representation of *TIMER in UTC, using *TP to store the result. */ extern struct tm *gmtime_r (const time_t *__restrict __timer, @@ -132,6 +158,20 @@ extern struct tm *gmtime_r (const time_t *__restrict __timer, using *TP to store the result. */ extern struct tm *localtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp) __THROW; +# else +# ifdef __REDIRECT_NTH +extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t *__restrict __timer, + struct tm *__restrict __tp), + __gmtime64_r); + +extern struct tm*__REDIRECT_NTH (localtime_r, (const time_t *__restrict __t, + struct tm *__restrict __tp), + __localtime64_r); +# else +# define gmtime_r __gmtime64_r +# define localtime_r __localtime_r +# endif +# endif #endif /* POSIX || C2X */ /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" @@ -139,9 +179,17 @@ extern struct tm *localtime_r (const time_t *__restrict __timer, extern char *asctime (const struct tm *__tp) __THROW; /* Equivalent to `asctime (localtime (timer))'. */ +#ifndef __USE_TIME_BITS64 extern char *ctime (const time_t *__timer) __THROW; +#else +# ifdef __REDIRECT_NTH +extern char *__REDIRECT_NTH (ctime, (const time_t *__timer), __ctime64); +# else +# define ctime __ctime64 +# endif +#endif -#if defined __USE_POSIX || __GLIBC_USE (ISOC2X) +#ifdef __USE_POSIX /* Reentrant versions of the above functions. */ /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" @@ -150,9 +198,19 @@ extern char *asctime_r (const struct tm *__restrict __tp, char *__restrict __buf) __THROW; /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +#ifndef __USE_TIME_BITS64 extern char *ctime_r (const time_t *__restrict __timer, char *__restrict __buf) __THROW; -#endif /* POSIX || C2X */ +#else +# ifdef __REDIRECT_NTH +extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict __timer, + char *__restrict __buf), __ctime64_r); +# else +# define ctime_r __ctime64_r +# endif +#endif + +#endif /* POSIX */ /* Defined in localtime.c. */ @@ -186,11 +244,19 @@ extern long int timezone; /* Miscellaneous functions many Unices inherited from the public domain localtime package. These are included only for compatibility. */ +#ifndef __USE_TIME_BITS64 /* Like `mktime', but for TP represents Universal Time, not local time. */ extern time_t timegm (struct tm *__tp) __THROW; - /* Another name for `mktime'. */ extern time_t timelocal (struct tm *__tp) __THROW; +#else +# ifdef __REDIRECT_NTH +extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64); +extern time_t __REDIRECT_NTH (timelocal, (struct tm *__tp), __mktime64); +# else +# define timegm __timegm64 +# endif +#endif /* Return the number of days in YEAR. */ extern int dysize (int __year) __THROW __attribute__ ((__const__)); @@ -198,6 +264,7 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); #ifdef __USE_POSIX199309 +# ifndef __USE_TIME_BITS64 /* Pause execution for a number of nanoseconds. This function is a cancellation point and therefore not marked with @@ -205,7 +272,6 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); extern int nanosleep (const struct timespec *__requested_time, struct timespec *__remaining); - /* Get resolution of clock CLOCK_ID. */ extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; @@ -215,15 +281,46 @@ extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW; /* Set clock CLOCK_ID to value TP. */ extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) __THROW; +# else +# ifdef __REDIRECT +extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time, + struct timespec *__remaining), + __nanosleep64); +extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id, + struct timespec *__res), + __clock_getres64); +extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct + timespec *__tp), __clock_gettime64); +extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct + timespec *__tp), __clock_settime64); +# else +# define nanosleep __nanosleep64 +# define clock_getres __clock_getres64 +# define clock_gettime __clock_gettime64 +# define clock_settime __clock_settime64 +# endif +# endif + # ifdef __USE_XOPEN2K /* High-resolution sleep with the specified clock. This function is a cancellation point and therefore not marked with __THROW. */ +# ifndef __USE_TIME_BITS64 extern int clock_nanosleep (clockid_t __clock_id, int __flags, const struct timespec *__req, struct timespec *__rem); +# else +# ifdef __REDIRECT +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem), + __clock_nanosleep_time64); +# else +# define clock_nanosleep __clock_nanosleep_time64 +# endif +# endif /* Return clock ID for CPU-time clock. */ extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; @@ -239,6 +336,7 @@ extern int timer_create (clockid_t __clock_id, extern int timer_delete (timer_t __timerid) __THROW; /* Set timer TIMERID to VALUE, returning old value in OVALUE. */ +# ifndef __USE_TIME_BITS64 extern int timer_settime (timer_t __timerid, int __flags, const struct itimerspec *__restrict __value, struct itimerspec *__restrict __ovalue) __THROW; @@ -246,6 +344,21 @@ extern int timer_settime (timer_t __timerid, int __flags, /* Get current value of timer TIMERID and store it in VALUE. */ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue), + __timer_settime64); + +extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid, + struct itimerspec *__value), + __timer_gettime64); +# else +# define timer_settime __timer_settime64 +# define timer_gettime __timer_gettime64 +# endif +# endif /* Get expiration overrun for timer TIMERID. */ extern int timer_getoverrun (timer_t __timerid) __THROW; @@ -253,9 +366,35 @@ extern int timer_getoverrun (timer_t __timerid) __THROW; #ifdef __USE_ISOC11 +# ifndef __USE_TIME_BITS64 /* Set TS to calendar time based in time base BASE. */ extern int timespec_get (struct timespec *__ts, int __base) __THROW __nonnull ((1)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base), + __timespec_get64) __nonnull ((1)); +# else +# define timespec_get __timespec_get64 +# endif +# endif +#endif + + +#if __GLIBC_USE (ISOC2X) +# ifndef __USE_TIME_BITS64 +/* Set TS to resolution of time base BASE. */ +extern int timespec_getres (struct timespec *__ts, int __base) + __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timespec_getres, (struct timespec *__ts, + int __base), + __timespec_getres64); +# else +# define timespec_getres __timespec_getres64 +# endif +# endif #endif diff --git a/lib/libc/include/generic-glibc/unistd.h b/lib/libc/include/generic-glibc/unistd.h index 59ac4a72d1..61a801716c 100644 --- a/lib/libc/include/generic-glibc/unistd.h +++ b/lib/libc/include/generic-glibc/unistd.h @@ -295,6 +295,11 @@ extern int euidaccess (const char *__name, int __type) /* An alias for `euidaccess', used by some other systems. */ extern int eaccess (const char *__name, int __type) __THROW __nonnull ((1)); + +/* Execute program relative to a directory file descriptor. */ +extern int execveat (int __fd, const char *__path, char *const __argv[], + char *const __envp[], int __flags) + __THROW __nonnull ((2, 3)); #endif #ifdef __USE_ATFILE @@ -352,6 +357,12 @@ extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence) __THROW. */ extern int close (int __fd); +#ifdef __USE_MISC +/* Close all open file descriptors greater than or equal to LOWFD. + Negative LOWFD is clamped to 0. */ +extern void closefrom (int __lowfd) __THROW; +#endif + /* Read NBYTES into BUF from FD. Return the number read, -1 for errors or 0 for EOF. @@ -776,6 +787,13 @@ extern __pid_t fork (void) __THROWNL; extern __pid_t vfork (void) __THROW; #endif /* Use misc or XPG < 7. */ +#ifdef __USE_GNU +/* This is similar to fork, however it does not run the atfork handlers + neither reinitialize any internal locks in multithread case. + Different than fork, _Fork is async-signal-safe. */ +extern __pid_t _Fork (void) __THROW; +#endif + /* Return the pathname of the terminal FD is open on, or NULL on errors. The returned storage is good only until the next call to this function. */ diff --git a/lib/libc/include/generic-glibc/utime.h b/lib/libc/include/generic-glibc/utime.h index 7f75dbf882..0a86b5413f 100644 --- a/lib/libc/include/generic-glibc/utime.h +++ b/lib/libc/include/generic-glibc/utime.h @@ -35,16 +35,32 @@ __BEGIN_DECLS /* Structure describing file times. */ struct utimbuf { +#ifdef __USE_TIME_BITS64 + __time64_t actime; /* Access time. */ + __time64_t modtime; /* Modification time. */ +#else __time_t actime; /* Access time. */ __time_t modtime; /* Modification time. */ +#endif }; /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ +#ifndef __USE_TIME_BITS64 extern int utime (const char *__file, const struct utimbuf *__file_times) __THROW __nonnull ((1)); +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (utime, (const char *__file, + const struct utimbuf *__file_times), + __utime64); +# else +# define utime __utime64 +# endif +#endif + __END_DECLS #endif /* utime.h */ \ No newline at end of file diff --git a/lib/libc/include/generic-glibc/wchar.h b/lib/libc/include/generic-glibc/wchar.h index 2b4d5cfc49..6957f38294 100644 --- a/lib/libc/include/generic-glibc/wchar.h +++ b/lib/libc/include/generic-glibc/wchar.h @@ -151,7 +151,8 @@ extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2, size_t __n, locale_t __loc) __THROW; /* Duplicate S, returning an identical malloc'd string. */ -extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__; +extern wchar_t *wcsdup (const wchar_t *__s) __THROW + __attribute_malloc__ __attr_dealloc_free; #endif /* Find the first occurrence of WC in WCS. */ @@ -562,9 +563,23 @@ extern wchar_t *wcpncpy (wchar_t *__restrict __dest, /* Wide character I/O functions. */ #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) +# ifndef __attr_dealloc_fclose +# if defined __has_builtin +# if __has_builtin (__builtin_fclose) +/* If the attribute macro hasn't been defined yet (by ) and + fclose is a built-in, use it. */ +# define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1) +# endif +# endif +# endif +# ifndef __attr_dealloc_fclose +# define __attr_dealloc_fclose /* empty */ +# endif + /* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces a wide character string. */ -extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW; +extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose; #endif #if defined __USE_ISOC95 || defined __USE_UNIX98 diff --git a/lib/libc/include/i386-linux-gnu/bits/struct_stat.h b/lib/libc/include/i386-linux-gnu/bits/struct_stat.h index 4a34470345..b3674c73c4 100644 --- a/lib/libc/include/i386-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/i386-linux-gnu/bits/struct_stat.h @@ -25,103 +25,45 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad1; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif -#ifndef __x86_64__ +# endif +# ifndef __x86_64__ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ -#else +# else __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ -#endif +# endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ -#ifdef __x86_64__ +# ifdef __x86_64__ int __pad0; -#endif +# endif __dev_t st_rdev; /* Device number, if device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad2; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -#else -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ # endif -#endif - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 has the same shape as stat for x86-64. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ -# ifdef __x86_64__ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# else - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -132,6 +74,9 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec # else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ @@ -143,8 +88,71 @@ struct stat64 # ifdef __x86_64__ __syscall_slong_t __glibc_reserved[3]; # else - __ino64_t st_ino; /* File serial number. */ +# ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif # endif +#endif /* __USE_TIME_BITS64 */ + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 has the same shape as stat for x86-64. */ +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ +# ifdef __x86_64__ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +# else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +# endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +# ifdef __x86_64__ + int __pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +# else + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ +# endif +# ifdef __x86_64__ + __syscall_slong_t __glibc_reserved[3]; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h index 76ea9f63dc..6713836d1e 100644 --- a/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/i386-linux-gnu/bits/types/struct_semid_ds.h @@ -23,6 +23,9 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; @@ -31,4 +34,5 @@ struct semid_ds __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/m68k-linux-gnu/bits/floatn.h b/lib/libc/include/m68k-linux-gnu/bits/floatn.h new file mode 100644 index 0000000000..18018fa9f8 --- /dev/null +++ b/lib/libc/include/m68k-linux-gnu/bits/floatn.h @@ -0,0 +1,52 @@ +/* Macros to control TS 18661-3 glibc features. + 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 + 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 + . */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#define __HAVE_FLOAT128 0 + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#define __HAVE_DISTINCT_FLOAT128 0 + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 0 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. + E.g.: #define __f128(x) x##f128. */ +# undef __f128 + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. + E.g.: #define __CFLOAT128 _Complex _Float128. */ +# undef __CFLOAT128 + +#endif /* !__ASSEMBLER__. */ + +#include \ No newline at end of file diff --git a/lib/libc/include/m68k-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/m68k-linux-gnu/bits/struct_rwlock.h new file mode 100644 index 0000000000..7431c5597f --- /dev/null +++ b/lib/libc/include/m68k-linux-gnu/bits/struct_rwlock.h @@ -0,0 +1,61 @@ +/* Default read-write lock implementation struct definitions. + 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 + 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 + . */ + +#ifndef __RWLOCK_INTERNAL_H +#define __RWLOCK_INTERNAL_H + +#include + +/* Generic struct for both POSIX read-write lock. New ports are expected + to use the default layout, however archictetures can redefine it to add + arch-specific extensions (such as lock-elision). The struct have a size + of 32 bytes on both LP32 and LP64 architectures. */ + +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; + /* FLAGS must stay at its position in the structure to maintain + binary compatibility. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +#else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +#endif + int __cur_writer; +}; + +#if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/m68k-linux-gnu/bits/struct_stat.h b/lib/libc/include/m68k-linux-gnu/bits/struct_stat.h index e85f20f65c..07a734438f 100644 --- a/lib/libc/include/m68k-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/m68k-linux-gnu/bits/struct_stat.h @@ -25,77 +25,34 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; - - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -106,6 +63,9 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec # else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ @@ -114,7 +74,55 @@ struct stat64 __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif +# ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +#endif /* __USE_TIME_BITS64 */ + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ + unsigned short int __pad1; + + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif __ino64_t st_ino; /* File serial number. */ +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/m68k-linux-gnu/bits/wordsize.h b/lib/libc/include/m68k-linux-gnu/bits/wordsize.h new file mode 100644 index 0000000000..6561e924f5 --- /dev/null +++ b/lib/libc/include/m68k-linux-gnu/bits/wordsize.h @@ -0,0 +1,21 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#define __WORDSIZE 32 +#define __WORDSIZE_TIME64_COMPAT32 0 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 \ No newline at end of file diff --git a/lib/libc/include/m68k-linux-gnu/gnu/lib-names.h b/lib/libc/include/m68k-linux-gnu/gnu/lib-names.h index 8d51e1156c..666f9805be 100644 --- a/lib/libc/include/m68k-linux-gnu/gnu/lib-names.h +++ b/lib/libc/include/m68k-linux-gnu/gnu/lib-names.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.2" diff --git a/lib/libc/include/mips-linux-gnu/bits/floatn.h b/lib/libc/include/mips-linux-gnu/bits/floatn.h deleted file mode 100644 index c05a5e55e0..0000000000 --- a/lib/libc/include/mips-linux-gnu/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. - 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 - 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH -# define __HAVE_FLOAT128 1 -#else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X __HAVE_FLOAT128 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -# define __CFLOAT128 _Complex long double -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; -# endif - -/* Various built-in functions do not exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/local_lim.h b/lib/libc/include/mips-linux-gnu/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mips-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/dlfcn.h b/lib/libc/include/mips-linux-gnueabi/bits/dlfcn.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/dlfcn.h rename to lib/libc/include/mips-linux-gnueabi/bits/dlfcn.h diff --git a/lib/libc/include/mips-linux-gnu/bits/errno.h b/lib/libc/include/mips-linux-gnueabi/bits/errno.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/errno.h rename to lib/libc/include/mips-linux-gnueabi/bits/errno.h diff --git a/lib/libc/include/mips-linux-gnu/bits/eventfd.h b/lib/libc/include/mips-linux-gnueabi/bits/eventfd.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/eventfd.h rename to lib/libc/include/mips-linux-gnueabi/bits/eventfd.h diff --git a/lib/libc/include/mips-linux-gnu/bits/inotify.h b/lib/libc/include/mips-linux-gnueabi/bits/inotify.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/inotify.h rename to lib/libc/include/mips-linux-gnueabi/bits/inotify.h diff --git a/lib/libc/include/mips-linux-gnu/bits/ioctl-types.h b/lib/libc/include/mips-linux-gnueabi/bits/ioctl-types.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/ioctl-types.h rename to lib/libc/include/mips-linux-gnueabi/bits/ioctl-types.h diff --git a/lib/libc/include/mips-linux-gnu/bits/ipctypes.h b/lib/libc/include/mips-linux-gnueabi/bits/ipctypes.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/ipctypes.h rename to lib/libc/include/mips-linux-gnueabi/bits/ipctypes.h diff --git a/lib/libc/include/mips-linux-gnu/bits/mman.h b/lib/libc/include/mips-linux-gnueabi/bits/mman.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/mman.h rename to lib/libc/include/mips-linux-gnueabi/bits/mman.h diff --git a/lib/libc/include/mips-linux-gnu/bits/poll.h b/lib/libc/include/mips-linux-gnueabi/bits/poll.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/poll.h rename to lib/libc/include/mips-linux-gnueabi/bits/poll.h diff --git a/lib/libc/include/mips-linux-gnueabi/bits/pthread_stack_min.h b/lib/libc/include/mips-linux-gnueabi/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips-linux-gnueabi/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/mips-linux-gnueabi/bits/pthreadtypes-arch.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h rename to lib/libc/include/mips-linux-gnueabi/bits/pthreadtypes-arch.h diff --git a/lib/libc/include/mips-linux-gnu/bits/resource.h b/lib/libc/include/mips-linux-gnueabi/bits/resource.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/resource.h rename to lib/libc/include/mips-linux-gnueabi/bits/resource.h diff --git a/lib/libc/include/mips-linux-gnu/bits/semaphore.h b/lib/libc/include/mips-linux-gnueabi/bits/semaphore.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/semaphore.h rename to lib/libc/include/mips-linux-gnueabi/bits/semaphore.h diff --git a/lib/libc/include/mips-linux-gnu/bits/shmlba.h b/lib/libc/include/mips-linux-gnueabi/bits/shmlba.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/shmlba.h rename to lib/libc/include/mips-linux-gnueabi/bits/shmlba.h diff --git a/lib/libc/include/mips-linux-gnu/bits/sigaction.h b/lib/libc/include/mips-linux-gnueabi/bits/sigaction.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/sigaction.h rename to lib/libc/include/mips-linux-gnueabi/bits/sigaction.h diff --git a/lib/libc/include/mips-linux-gnu/bits/sigcontext.h b/lib/libc/include/mips-linux-gnueabi/bits/sigcontext.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/sigcontext.h rename to lib/libc/include/mips-linux-gnueabi/bits/sigcontext.h diff --git a/lib/libc/include/mips-linux-gnu/bits/siginfo-arch.h b/lib/libc/include/mips-linux-gnueabi/bits/siginfo-arch.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/siginfo-arch.h rename to lib/libc/include/mips-linux-gnueabi/bits/siginfo-arch.h diff --git a/lib/libc/include/mips-linux-gnu/bits/signalfd.h b/lib/libc/include/mips-linux-gnueabi/bits/signalfd.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/signalfd.h rename to lib/libc/include/mips-linux-gnueabi/bits/signalfd.h diff --git a/lib/libc/include/mips-linux-gnu/bits/signum-arch.h b/lib/libc/include/mips-linux-gnueabi/bits/signum-arch.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/signum-arch.h rename to lib/libc/include/mips-linux-gnueabi/bits/signum-arch.h diff --git a/lib/libc/include/mips-linux-gnu/bits/socket-constants.h b/lib/libc/include/mips-linux-gnueabi/bits/socket-constants.h similarity index 57% rename from lib/libc/include/mips-linux-gnu/bits/socket-constants.h rename to lib/libc/include/mips-linux-gnueabi/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mips-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/mips-linux-gnueabi/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/socket_type.h b/lib/libc/include/mips-linux-gnueabi/bits/socket_type.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/socket_type.h rename to lib/libc/include/mips-linux-gnueabi/bits/socket_type.h diff --git a/lib/libc/include/mips-linux-gnu/bits/statfs.h b/lib/libc/include/mips-linux-gnueabi/bits/statfs.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/statfs.h rename to lib/libc/include/mips-linux-gnueabi/bits/statfs.h diff --git a/lib/libc/include/mips-linux-gnu/bits/struct_mutex.h b/lib/libc/include/mips-linux-gnueabi/bits/struct_mutex.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/struct_mutex.h rename to lib/libc/include/mips-linux-gnueabi/bits/struct_mutex.h diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/mips-linux-gnueabi/bits/termios-c_cc.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/termios-c_cc.h rename to lib/libc/include/mips-linux-gnueabi/bits/termios-c_cc.h diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/mips-linux-gnueabi/bits/termios-c_lflag.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/termios-c_lflag.h rename to lib/libc/include/mips-linux-gnueabi/bits/termios-c_lflag.h diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-struct.h b/lib/libc/include/mips-linux-gnueabi/bits/termios-struct.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/termios-struct.h rename to lib/libc/include/mips-linux-gnueabi/bits/termios-struct.h diff --git a/lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h b/lib/libc/include/mips-linux-gnueabi/bits/termios-tcflow.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/termios-tcflow.h rename to lib/libc/include/mips-linux-gnueabi/bits/termios-tcflow.h diff --git a/lib/libc/include/mips-linux-gnu/bits/timerfd.h b/lib/libc/include/mips-linux-gnueabi/bits/timerfd.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/timerfd.h rename to lib/libc/include/mips-linux-gnueabi/bits/timerfd.h diff --git a/lib/libc/include/mips-linux-gnu/bits/types/stack_t.h b/lib/libc/include/mips-linux-gnueabi/bits/types/stack_t.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/bits/types/stack_t.h rename to lib/libc/include/mips-linux-gnueabi/bits/types/stack_t.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_msqid_ds.h similarity index 93% rename from lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h rename to lib/libc/include/mips-linux-gnueabi/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_semid_ds.h similarity index 93% rename from lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h rename to lib/libc/include/mips-linux-gnueabi/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_shmid_ds.h similarity index 92% rename from lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h rename to lib/libc/include/mips-linux-gnueabi/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips-linux-gnueabi/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/ieee754.h b/lib/libc/include/mips-linux-gnueabi/ieee754.h similarity index 100% rename from lib/libc/include/mips-linux-gnu/ieee754.h rename to lib/libc/include/mips-linux-gnueabi/ieee754.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h b/lib/libc/include/mips-linux-gnueabihf/bits/dlfcn.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/dlfcn.h rename to lib/libc/include/mips-linux-gnueabihf/bits/dlfcn.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/errno.h b/lib/libc/include/mips-linux-gnueabihf/bits/errno.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/errno.h rename to lib/libc/include/mips-linux-gnueabihf/bits/errno.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/eventfd.h b/lib/libc/include/mips-linux-gnueabihf/bits/eventfd.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/eventfd.h rename to lib/libc/include/mips-linux-gnueabihf/bits/eventfd.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/inotify.h b/lib/libc/include/mips-linux-gnueabihf/bits/inotify.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/inotify.h rename to lib/libc/include/mips-linux-gnueabihf/bits/inotify.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h b/lib/libc/include/mips-linux-gnueabihf/bits/ioctl-types.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/ioctl-types.h rename to lib/libc/include/mips-linux-gnueabihf/bits/ioctl-types.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h b/lib/libc/include/mips-linux-gnueabihf/bits/ipctypes.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/ipctypes.h rename to lib/libc/include/mips-linux-gnueabihf/bits/ipctypes.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/mman.h b/lib/libc/include/mips-linux-gnueabihf/bits/mman.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/mman.h rename to lib/libc/include/mips-linux-gnueabihf/bits/mman.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/poll.h b/lib/libc/include/mips-linux-gnueabihf/bits/poll.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/poll.h rename to lib/libc/include/mips-linux-gnueabihf/bits/poll.h diff --git a/lib/libc/include/mips-linux-gnueabihf/bits/pthread_stack_min.h b/lib/libc/include/mips-linux-gnueabihf/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips-linux-gnueabihf/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/mips-linux-gnueabihf/bits/pthreadtypes-arch.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h rename to lib/libc/include/mips-linux-gnueabihf/bits/pthreadtypes-arch.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/resource.h b/lib/libc/include/mips-linux-gnueabihf/bits/resource.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/resource.h rename to lib/libc/include/mips-linux-gnueabihf/bits/resource.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/semaphore.h b/lib/libc/include/mips-linux-gnueabihf/bits/semaphore.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/semaphore.h rename to lib/libc/include/mips-linux-gnueabihf/bits/semaphore.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/shmlba.h b/lib/libc/include/mips-linux-gnueabihf/bits/shmlba.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/shmlba.h rename to lib/libc/include/mips-linux-gnueabihf/bits/shmlba.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/sigaction.h b/lib/libc/include/mips-linux-gnueabihf/bits/sigaction.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/sigaction.h rename to lib/libc/include/mips-linux-gnueabihf/bits/sigaction.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h b/lib/libc/include/mips-linux-gnueabihf/bits/sigcontext.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/sigcontext.h rename to lib/libc/include/mips-linux-gnueabihf/bits/sigcontext.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/siginfo-arch.h b/lib/libc/include/mips-linux-gnueabihf/bits/siginfo-arch.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/siginfo-arch.h rename to lib/libc/include/mips-linux-gnueabihf/bits/siginfo-arch.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/signalfd.h b/lib/libc/include/mips-linux-gnueabihf/bits/signalfd.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/signalfd.h rename to lib/libc/include/mips-linux-gnueabihf/bits/signalfd.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h b/lib/libc/include/mips-linux-gnueabihf/bits/signum-arch.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/signum-arch.h rename to lib/libc/include/mips-linux-gnueabihf/bits/signum-arch.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h b/lib/libc/include/mips-linux-gnueabihf/bits/socket-constants.h similarity index 57% rename from lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h rename to lib/libc/include/mips-linux-gnueabihf/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mipsel-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/mips-linux-gnueabihf/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/socket_type.h b/lib/libc/include/mips-linux-gnueabihf/bits/socket_type.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/socket_type.h rename to lib/libc/include/mips-linux-gnueabihf/bits/socket_type.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/statfs.h b/lib/libc/include/mips-linux-gnueabihf/bits/statfs.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/statfs.h rename to lib/libc/include/mips-linux-gnueabihf/bits/statfs.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h b/lib/libc/include/mips-linux-gnueabihf/bits/struct_mutex.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h rename to lib/libc/include/mips-linux-gnueabihf/bits/struct_mutex.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/mips-linux-gnueabihf/bits/termios-c_cc.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/termios-c_cc.h rename to lib/libc/include/mips-linux-gnueabihf/bits/termios-c_cc.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/mips-linux-gnueabihf/bits/termios-c_lflag.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/termios-c_lflag.h rename to lib/libc/include/mips-linux-gnueabihf/bits/termios-c_lflag.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h b/lib/libc/include/mips-linux-gnueabihf/bits/termios-struct.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/termios-struct.h rename to lib/libc/include/mips-linux-gnueabihf/bits/termios-struct.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h b/lib/libc/include/mips-linux-gnueabihf/bits/termios-tcflow.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/termios-tcflow.h rename to lib/libc/include/mips-linux-gnueabihf/bits/termios-tcflow.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/timerfd.h b/lib/libc/include/mips-linux-gnueabihf/bits/timerfd.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/timerfd.h rename to lib/libc/include/mips-linux-gnueabihf/bits/timerfd.h diff --git a/lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h b/lib/libc/include/mips-linux-gnueabihf/bits/types/stack_t.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/bits/types/stack_t.h rename to lib/libc/include/mips-linux-gnueabihf/bits/types/stack_t.h diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_msqid_ds.h similarity index 93% rename from lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h rename to lib/libc/include/mips-linux-gnueabihf/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_semid_ds.h similarity index 93% rename from lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h rename to lib/libc/include/mips-linux-gnueabihf/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_shmid_ds.h similarity index 92% rename from lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h rename to lib/libc/include/mips-linux-gnueabihf/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mips-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips-linux-gnueabihf/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/ieee754.h b/lib/libc/include/mips-linux-gnueabihf/ieee754.h similarity index 100% rename from lib/libc/include/mipsel-linux-gnu/ieee754.h rename to lib/libc/include/mips-linux-gnueabihf/ieee754.h diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h b/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h deleted file mode 100644 index c05a5e55e0..0000000000 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. - 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 - 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH -# define __HAVE_FLOAT128 1 -#else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X __HAVE_FLOAT128 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -# define __CFLOAT128 _Complex long double -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; -# endif - -/* Various built-in functions do not exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h b/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/pthread_stack_min.h b/lib/libc/include/mips64-linux-gnuabi64/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h b/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabi64/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h b/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h deleted file mode 100644 index c05a5e55e0..0000000000 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. - 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 - 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH -# define __HAVE_FLOAT128 1 -#else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X __HAVE_FLOAT128 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -# define __CFLOAT128 _Complex long double -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; -# endif - -/* Various built-in functions do not exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h b/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/pthread_stack_min.h b/lib/libc/include/mips64-linux-gnuabin32/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h b/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64-linux-gnuabin32/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/pthread_stack_min.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabi64/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h deleted file mode 100644 index c05a5e55e0..0000000000 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. - 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 - 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH -# define __HAVE_FLOAT128 1 -#else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X __HAVE_FLOAT128 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -# define __CFLOAT128 _Complex long double -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; -# endif - -/* Various built-in functions do not exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/pthread_stack_min.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h index d696a579f6..3e95d151ca 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 4100 -#define SO_RCVTIMEO 4102 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4099 -#define SO_SNDTIMEO 4101 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_rwlock.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_rwlock.h deleted file mode 100644 index 6355f539b9..0000000000 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/struct_rwlock.h +++ /dev/null @@ -1,71 +0,0 @@ -/* MIPS internal rwlock struct definitions. - 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 - 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 - . */ - -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H - -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 _MIPS_SIM == _ABI64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -# else -# 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; -#endif -}; - -#if _MIPS_SIM == _ABI64 -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h index d40f4ffc82..c7dcdf23d9 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_msqid_ds.h @@ -20,32 +20,37 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 -# ifdef __MIPSEL__ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_stime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_ctime; /* time of last change */ unsigned long int __msg_ctime_high; -# else +# else unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ # endif -#else - __time_t msg_stime; /* time of last msgsnd command */ - __time_t msg_rtime; /* time of last msgsnd command */ - __time_t msg_ctime; /* time of last change */ -#endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -53,4 +58,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h index dfdf05cc71..c1961e1bb1 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_semid_ds.h @@ -23,10 +23,14 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __sem_otime_high; __syscall_ulong_t __sem_ctime_high; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h index c59e4e25b6..2e8525c1a5 100644 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/mips64el-linux-gnuabin32/bits/types/struct_shmid_ds.h @@ -23,27 +23,31 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned short int __shm_atime_high; unsigned short int __shm_dtime_high; unsigned short int __shm_ctime_high; unsigned short int __glibc_reserved4; -#else +# else __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +# endif #endif }; \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabin32/bits/wordsize.h b/lib/libc/include/mips64el-linux-gnuabin32/bits/wordsize.h deleted file mode 100644 index 9e405e4e4e..0000000000 --- a/lib/libc/include/mips64el-linux-gnuabin32/bits/wordsize.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 - 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 - . */ - -#include - -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 -#endif - -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/floatn.h b/lib/libc/include/mipsel-linux-gnu/bits/floatn.h deleted file mode 100644 index c05a5e55e0..0000000000 --- a/lib/libc/include/mipsel-linux-gnu/bits/floatn.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. - 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 - 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 - . */ - -#ifndef _BITS_FLOATN_H -#define _BITS_FLOATN_H - -#include -#include - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH -# define __HAVE_FLOAT128 1 -#else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ -# define __HAVE_FLOAT128 0 -#endif - -/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 - -/* Defined to 1 if the current compiler invocation provides a - floating-point type with the right format for _Float64x, and this - glibc includes corresponding *f64x interfaces for it. */ -#define __HAVE_FLOAT64X __HAVE_FLOAT128 - -/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format - of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has - the format of _Float128, which must be different from that of long - double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 - -#ifndef __ASSEMBLER__ - -/* Defined to concatenate the literal suffix to be used with _Float128 - types, if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l -# else -# define __f128(x) x##f128 -# endif -# endif - -/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ -# if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -# define __CFLOAT128 _Complex long double -# else -# define __CFLOAT128 _Complex _Float128 -# endif -# endif - -/* The remaining of this file provides support for older compilers. */ -# if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; -# endif - -/* Various built-in functions do not exist before GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) -# endif - -# endif - -#endif /* !__ASSEMBLER__. */ - -#include - -#endif /* _BITS_FLOATN_H */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h b/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h deleted file mode 100644 index cf2974b434..0000000000 --- a/lib/libc/include/mipsel-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. MIPS Linux version. - Copyright (C) 1993-2021 Free Software 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 - . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages with 64k pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/mipsel-linux-gnu/bits/struct_rwlock.h deleted file mode 100644 index 6355f539b9..0000000000 --- a/lib/libc/include/mipsel-linux-gnu/bits/struct_rwlock.h +++ /dev/null @@ -1,71 +0,0 @@ -/* MIPS internal rwlock struct definitions. - 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 - 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 - . */ - -#ifndef _RWLOCK_INTERNAL_H -#define _RWLOCK_INTERNAL_H - -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 _MIPS_SIM == _ABI64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -# else -# 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; -#endif -}; - -#if _MIPS_SIM == _ABI64 -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags -#else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif -#endif - -#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnu/bits/wordsize.h b/lib/libc/include/mipsel-linux-gnu/bits/wordsize.h deleted file mode 100644 index 9e405e4e4e..0000000000 --- a/lib/libc/include/mipsel-linux-gnu/bits/wordsize.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 - 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 - . */ - -#include - -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 -#endif - -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/dlfcn.h b/lib/libc/include/mipsel-linux-gnueabi/bits/dlfcn.h new file mode 100644 index 0000000000..733090d634 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/dlfcn.h @@ -0,0 +1,64 @@ +/* System dependent definitions for run-time dynamic loading. + 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 + 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 + . */ + +#ifndef _DLFCN_H +# error "Never use directly; include instead." +#endif + +/* The MODE argument to `dlopen' contains one of the following: */ +#define RTLD_LAZY 0x0001 /* Lazy function call binding. */ +#define RTLD_NOW 0x0002 /* Immediate function call binding. */ +#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ +#define RTLD_NOLOAD 0x00008 /* Do not load the object. */ +#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */ + +/* If the following bit is set in the MODE argument to `dlopen', + the symbols of the loaded object and its dependencies are made + visible as if the object were linked directly into the program. */ +#define RTLD_GLOBAL 0x0004 + +/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. + The implementation does this by default and so we can define the + value to zero. */ +#define RTLD_LOCAL 0 + +/* Do not delete object when closed. */ +#define RTLD_NODELETE 0x01000 + +#ifdef __USE_GNU +/* To support profiling of shared objects it is a good idea to call + the function found using `dlsym' using the following macro since + these calls do not use the PLT. But this would mean the dynamic + loader has no chance to find out when the function is called. The + macro applies the necessary magic so that profiling is possible. + Rewrite + foo = (*fctp) (arg1, arg2); + into + foo = DL_CALL_FCT (fctp, (arg1, arg2)); +*/ +# define DL_CALL_FCT(fctp, args) \ + (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) + +__BEGIN_DECLS + +/* This function calls the profiling functions. */ +extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; + +__END_DECLS + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/errno.h b/lib/libc/include/mipsel-linux-gnueabi/bits/errno.h new file mode 100644 index 0000000000..0362f92048 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/errno.h @@ -0,0 +1,52 @@ +/* Error constants. MIPS/Linux specific version. + 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 + 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 + . */ + +#ifndef _BITS_ERRNO_H + +#if !defined _ERRNO_H +# error "Never include directly; use instead." +#endif + +# include + +/* Older Linux headers do not define these constants. */ +# ifndef ENOTSUP +# define ENOTSUP EOPNOTSUPP +# endif + +# ifndef ECANCELED +# define ECANCELED 158 +# endif + +# ifndef EOWNERDEAD +# define EOWNERDEAD 165 +# endif + +# ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 166 +# endif + +# ifndef ERFKILL +# define ERFKILL 167 +# endif + +# ifndef EHWPOISON +# define EHWPOISON 168 +# endif + +#endif /* bits/errno.h. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/eventfd.h b/lib/libc/include/mipsel-linux-gnueabi/bits/eventfd.h new file mode 100644 index 0000000000..a0f8f94d0c --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/eventfd.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2007-2021 Free Software 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 + . */ + +#ifndef _SYS_EVENTFD_H +# error "Never use directly; include instead." +#endif + +/* Flags for eventfd. */ +enum + { + EFD_SEMAPHORE = 00000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE + EFD_CLOEXEC = 02000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 00000200 +#define EFD_NONBLOCK EFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/inotify.h b/lib/libc/include/mipsel-linux-gnueabi/bits/inotify.h new file mode 100644 index 0000000000..f72c8dc639 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/inotify.h @@ -0,0 +1,29 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_INOTIFY_H +# error "Never use directly; include instead." +#endif + +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 02000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 00000200 +#define IN_NONBLOCK IN_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/ioctl-types.h b/lib/libc/include/mipsel-linux-gnueabi/bits/ioctl-types.h new file mode 100644 index 0000000000..84081f4bfd --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/ioctl-types.h @@ -0,0 +1,75 @@ +/* Structure types for pre-termios terminal ioctls. Linux/MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Get definition of constants for use with `ioctl'. */ +#include + +struct winsize + { + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; + +#define NCC 8 +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + char c_line; /* line discipline */ + /* Yes, this is really NCCS. */ + unsigned char c_cc[32 /* NCCS */]; /* control characters */ + }; + +/* modem lines */ +#define TIOCM_LE 0x001 /* line enable */ +#define TIOCM_DTR 0x002 /* data terminal ready */ +#define TIOCM_RTS 0x004 /* request to send */ +#define TIOCM_ST 0x010 /* secondary transmit */ +#define TIOCM_SR 0x020 /* secondary receive */ +#define TIOCM_CTS 0x040 /* clear to send */ +#define TIOCM_CAR 0x100 /* carrier detect */ +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0x200 /* ring */ +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0x400 /* data set ready */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Mobitex module */ +#define N_R3964 9 /* Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Profibus */ +#define N_IRDA 11 /* Linux IR */ +#define N_SMSBLOCK 12 /* SMS block mode */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/ipctypes.h b/lib/libc/include/mipsel-linux-gnueabi/bits/ipctypes.h new file mode 100644 index 0000000000..aa6d3772af --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/ipctypes.h @@ -0,0 +1,31 @@ +/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS 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 + 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 + . */ + +/* + * Never include directly. + */ + +#ifndef _BITS_IPCTYPES_H +#define _BITS_IPCTYPES_H 1 + +#include + +typedef __SLONG32_TYPE __ipc_pid_t; + + +#endif /* bits/ipctypes.h */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/mman.h b/lib/libc/include/mipsel-linux-gnueabi/bits/mman.h new file mode 100644 index 0000000000..726689ddec --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/mman.h @@ -0,0 +1,48 @@ +/* Definitions for POSIX memory map interface. Linux/MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_NORESERVE 0x0400 /* don't check for reservations */ +# define MAP_GROWSDOWN 0x1000 /* stack-like segment */ +# define MAP_DENYWRITE 0x2000 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +# define MAP_LOCKED 0x8000 /* pages are locked */ +# define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +# define MAP_NONBLOCK 0x20000 /* do not block on IO */ +# define MAP_STACK 0x40000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */ +# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap + underlying mapping. */ +#endif + +#define __MAP_ANONYMOUS 0x0800 + +/* Include generic Linux declarations. */ +#include + +#ifdef __USE_MISC +# define MAP_RENAME MAP_ANONYMOUS +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/poll.h b/lib/libc/include/mipsel-linux-gnueabi/bits/poll.h new file mode 100644 index 0000000000..fd12b70920 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/poll.h @@ -0,0 +1,49 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* These are extensions for Linux. */ +# define POLLMSG 0x400 +# define POLLREMOVE 0x1000 +# define POLLRDHUP 0x2000 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/pthread_stack_min.h b/lib/libc/include/mipsel-linux-gnueabi/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h b/lib/libc/include/mipsel-linux-gnueabi/bits/pthreadtypes-arch.h similarity index 50% rename from lib/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h rename to lib/libc/include/mipsel-linux-gnueabi/bits/pthreadtypes-arch.h index 9629ea8be1..b6894a757e 100644 --- a/lib/libc/glibc/sysdeps/s390/nptl/bits/pthreadtypes-arch.h +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/pthreadtypes-arch.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2003-2019 Free Software Foundation, Inc. +/* Machine-specific pthread type layouts. MIPS version. + 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 @@ -12,15 +13,15 @@ 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 - . */ + License along with the GNU C Library. If not, see + . */ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include -#if __WORDSIZE == 64 +#if _MIPS_SIM == _ABI64 # define __SIZEOF_PTHREAD_ATTR_T 56 # define __SIZEOF_PTHREAD_MUTEX_T 40 # define __SIZEOF_PTHREAD_RWLOCK_T 56 @@ -32,48 +33,12 @@ # define __SIZEOF_PTHREAD_BARRIER_T 20 #endif #define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_CONDATTR_T 4 #define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 #define __SIZEOF_PTHREAD_BARRIERATTR_T 4 -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 1 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) -#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) - #define __LOCK_ALIGNMENT #define __ONCE_ALIGNMENT -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#if __WORDSIZE == 64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -# else - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - int __cur_writer; -#endif -}; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -#endif /* bits/pthreadtypes.h */ +#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/resource.h b/lib/libc/include/mipsel-linux-gnueabi/bits/resource.h new file mode 100644 index 0000000000..743dc1b9ad --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/resource.h @@ -0,0 +1,231 @@ +/* Bit values & structures for resource limits. Linux/MIPS version. + Copyright (C) 1994-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + __RLIMIT_RSS = 7, +#define RLIMIT_RSS __RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 5, + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE __RLIMIT_OFILE + + /* Address space limit (?) */ + RLIMIT_AS = 6, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + __RLIMIT_NPROC = 8, +#define RLIMIT_NPROC __RLIMIT_NPROC + + /* Locked-in-memory address space. */ + __RLIMIT_MEMLOCK = 9, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + /* Maximum CPU time in microseconds that a process scheduled under a real-time + scheduling policy may consume without making a blocking system + call before being forcibly descheduled. */ + __RLIMIT_RTTIME = 15, +#define RLIMIT_RTTIME __RLIMIT_RTTIME + + __RLIMIT_NLIMITS = 16, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#if _MIPS_SIM == _ABI64 +/* The N64 syscall uses this value. */ +# define RLIM_INFINITY 0xffffffffffffffffUL +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffUL +# endif +#else +/* The O32 and N32 syscalls use 0x7fffffff. */ +# ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +# else +# define RLIM_INFINITY 0xffffffffffffffffULL +# endif +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffULL +# endif +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + +#ifdef __USE_GNU + , + /* The calling thread. */ + RUSAGE_THREAD = 1 +# define RUSAGE_THREAD RUSAGE_THREAD + /* Name for the same functionality on Solaris. */ +# define RUSAGE_LWP RUSAGE_THREAD +#endif +}; + +#include +#include + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; + + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Modify and return resource limits of a process atomically. */ +# ifndef __USE_FILE_OFFSET64 +extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, + enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit), prlimit64); +# else +# define prlimit prlimit64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit64 *__new_limit, + struct rlimit64 *__old_limit) __THROW; +# endif +#endif + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabin32/bits/wordsize.h b/lib/libc/include/mipsel-linux-gnueabi/bits/semaphore.h similarity index 72% rename from lib/libc/include/mips64-linux-gnuabin32/bits/wordsize.h rename to lib/libc/include/mipsel-linux-gnueabi/bits/semaphore.h index 9e405e4e4e..73abfb8078 100644 --- a/lib/libc/include/mips64-linux-gnuabin32/bits/wordsize.h +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/semaphore.h @@ -15,17 +15,22 @@ License along with the GNU C Library. If not, see . */ -#include - -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 +#ifndef _SEMAPHORE_H +# error "Never use directly; include instead." #endif -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file +#if _MIPS_SIM == _ABI64 +# define __SIZEOF_SEM_T 32 +#else +# define __SIZEOF_SEM_T 16 +#endif + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + + +typedef union +{ + char __size[__SIZEOF_SEM_T]; + long int __align; +} sem_t; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/shmlba.h b/lib/libc/include/mipsel-linux-gnueabi/bits/shmlba.h new file mode 100644 index 0000000000..357defb2ba --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/shmlba.h @@ -0,0 +1,24 @@ +/* Define SHMLBA. MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never use directly; include instead." +#endif + +/* Segment low boundary address multiple. */ +#define SHMLBA 0x40000 \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/sigaction.h b/lib/libc/include/mipsel-linux-gnueabi/bits/sigaction.h new file mode 100644 index 0000000000..f968c4d10d --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/sigaction.h @@ -0,0 +1,94 @@ +/* The proper definitions for Linux/MIPS's sigaction. + Copyright (C) 1993-2021 Free Software 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 + . */ + +#ifndef _BITS_SIGACTION_H +#define _BITS_SIGACTION_H 1 + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Special flags. */ + int sa_flags; + + /* Signal handler. */ +#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* The ABI says here are two unused ints following. */ + /* Restore handler. */ + void (*sa_restorer) (void); + +#if _MIPS_SZPTR < 64 + int sa_resv[1]; +#endif + }; + +/* Bits in `sa_flags'. */ +/* Please note that some Linux kernels versions use different values for these + flags which is a bug in those kernel versions. */ +#define SA_NOCLDSTOP 0x00000001 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x00010000 /* Don't create zombie on child death. */ +#define SA_SIGINFO 0x00000008 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC +# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ +#endif +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ +# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when + its handler is being executed. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historical no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_NOP 0 /* 0 is unused to catch errors */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ +#ifdef __USE_MISC +# define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: + set only the low 32 bit of the sigset. */ +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/sigcontext.h b/lib/libc/include/mipsel-linux-gnueabi/bits/sigcontext.h new file mode 100644 index 0000000000..cdf767d48a --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/sigcontext.h @@ -0,0 +1,82 @@ +/* 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 + 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 + . */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use directly; include instead." +#endif + +#include + +#if _MIPS_SIM == _ABIO32 + +/* Certain unused fields were replaced with new ones in 2.6.12-rc4. + The changes were as follows: + + sc_cause -> sc_hi1 + sc_badvaddr -> sc_lo1 + sc_sigset[0] -> sc_hi2 + sc_sigset[1] -> sc_lo2 + sc_sigset[2] -> sc_hi3 + sc_sigset[3] -> sc_lo3 + + sc_regmask, sc_ownedfp and sc_fpc_eir are not used. */ +struct sigcontext { + unsigned int sc_regmask; + unsigned int sc_status; + __extension__ unsigned long long sc_pc; + __extension__ unsigned long long sc_regs[32]; + __extension__ unsigned long long sc_fpregs[32]; + unsigned int sc_ownedfp; + unsigned int sc_fpc_csr; + unsigned int sc_fpc_eir; + unsigned int sc_used_math; + unsigned int sc_dsp; + __extension__ unsigned long long sc_mdhi; + __extension__ unsigned long long sc_mdlo; + unsigned long sc_hi1; + unsigned long sc_lo1; + unsigned long sc_hi2; + unsigned long sc_lo2; + unsigned long sc_hi3; + unsigned long sc_lo3; +}; + +#else + +/* This structure changed in 2.6.12-rc4 when DSP support was added. */ +struct sigcontext { + __extension__ unsigned long long sc_regs[32]; + __extension__ unsigned long long sc_fpregs[32]; + __extension__ unsigned long long sc_mdhi; + __extension__ unsigned long long sc_hi1; + __extension__ unsigned long long sc_hi2; + __extension__ unsigned long long sc_hi3; + __extension__ unsigned long long sc_mdlo; + __extension__ unsigned long long sc_lo1; + __extension__ unsigned long long sc_lo2; + __extension__ unsigned long long sc_lo3; + __extension__ unsigned long long sc_pc; + unsigned int sc_fpc_csr; + unsigned int sc_used_math; + unsigned int sc_dsp; + unsigned int sc_reserved; +}; + +#endif /* _MIPS_SIM != _ABIO32 */ +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/siginfo-arch.h b/lib/libc/include/mipsel-linux-gnueabi/bits/siginfo-arch.h new file mode 100644 index 0000000000..d639ba2076 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/siginfo-arch.h @@ -0,0 +1,13 @@ +/* Architecture-specific adjustments to siginfo_t. MIPS version. */ +#ifndef _BITS_SIGINFO_ARCH_H +#define _BITS_SIGINFO_ARCH_H 1 + +/* MIPS has the si_code and si_errno fields in the opposite order from + all other architectures. */ +#define __SI_ERRNO_THEN_CODE 0 + +/* MIPS also has different values for SI_ASYNCIO, SI_MESGQ, and SI_TIMER + than all other architectures. */ +#define __SI_ASYNCIO_AFTER_SIGIO 0 + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/signalfd.h b/lib/libc/include/mipsel-linux-gnueabi/bits/signalfd.h new file mode 100644 index 0000000000..10b69b2df4 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/signalfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2007-2021 Free Software 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 + . */ + +#ifndef _SYS_SIGNALFD_H +# error "Never use directly; include instead." +#endif + +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 02000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 00000200 +#define SFD_NONBLOCK SFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/signum-arch.h b/lib/libc/include/mipsel-linux-gnueabi/bits/signum-arch.h new file mode 100644 index 0000000000..a217ddd443 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/signum-arch.h @@ -0,0 +1,65 @@ +/* Signal number definitions. Linux/MIPS version. + 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 + . */ + +#ifndef _BITS_SIGNUM_H +#define _BITS_SIGNUM_H 1 + +#ifndef _SIGNAL_H +#error "Never include directly; use instead." +#endif + +/* Adjustments and additions to the signal number constants for + Linux/MIPS. */ + +#define SIGEMT 7 /* Emulator trap. */ +#define SIGPWR 19 /* Power failure imminent. */ + +/* Historical signals specified by POSIX. */ +#define SIGBUS 10 /* Bus error. */ +#define SIGSYS 12 /* Bad system call. */ + +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ +#define SIGURG 21 /* Urgent data is available at a socket. */ +#define SIGSTOP 23 /* Stop, unblockable. */ +#define SIGTSTP 24 /* Keyboard stop. */ +#define SIGCONT 25 /* Continue. */ +#define SIGCHLD 18 /* Child terminated or stopped. */ +#define SIGTTIN 26 /* Background read from control terminal. */ +#define SIGTTOU 27 /* Background write to control terminal. */ +#define SIGPOLL 22 /* Pollable event occurred (System V). */ +#define SIGXCPU 30 /* CPU time limit exceeded. */ +#define SIGVTALRM 28 /* Virtual timer expired. */ +#define SIGPROF 29 /* Profiling timer expired. */ +#define SIGXFSZ 31 /* File size limit exceeded. */ +#define SIGUSR1 16 /* User-defined signal 1. */ +#define SIGUSR2 17 /* User-defined signal 2. */ + +/* Nonstandard signals found in all modern POSIX systems + (including both BSD and Linux). */ +#define SIGWINCH 20 /* 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. */ +#define SIGCLD SIGCHLD /* Old System V name */ + +/* By default no real-time signals are supported. */ +#define __SIGRTMIN 32 +#define __SIGRTMAX 127 + +#endif /* included. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/socket-constants.h b/lib/libc/include/mipsel-linux-gnueabi/bits/socket-constants.h new file mode 100644 index 0000000000..3e95d151ca --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/socket-constants.h @@ -0,0 +1,70 @@ +/* Socket constants which vary among Linux architectures. Version for MIPS. + 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 + 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 + . */ + +#ifndef _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +#define SOL_SOCKET 65535 +#define SO_ACCEPTCONN 4105 +#define SO_BROADCAST 32 +#define SO_DONTROUTE 16 +#define SO_ERROR 4103 +#define SO_KEEPALIVE 8 +#define SO_LINGER 128 +#define SO_OOBINLINE 256 +#define SO_RCVBUF 4098 +#define SO_RCVLOWAT 4100 +#define SO_REUSEADDR 4 +#define SO_SNDBUF 4097 +#define SO_SNDLOWAT 4099 +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/socket_type.h b/lib/libc/include/mipsel-linux-gnueabi/bits/socket_type.h new file mode 100644 index 0000000000..f66bd0ea5f --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/socket_type.h @@ -0,0 +1,55 @@ +/* Define enum __socket_type for Linux/MIPS. + 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 + . */ + +#ifndef _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_STREAM = 2, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_DCCP = 6, +#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */ + SOCK_PACKET = 10, /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ + + SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 00000200 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/statfs.h b/lib/libc/include/mipsel-linux-gnueabi/bits/statfs.h new file mode 100644 index 0000000000..0e18718b24 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/statfs.h @@ -0,0 +1,73 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include /* for __fsid_t and __fsblkcnt_t*/ + +struct statfs + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ +#ifndef __USE_FILE_OFFSET64 + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_files; + __fsblkcnt_t f_ffree; + __fsblkcnt_t f_bavail; +#else + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; +#endif + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_flags; + long int f_spare[5]; + }; + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_flags; + long int f_spare[5]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/struct_mutex.h b/lib/libc/include/mipsel-linux-gnueabi/bits/struct_mutex.h new file mode 100644 index 0000000000..8ddb89ce24 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/struct_mutex.h @@ -0,0 +1,56 @@ +/* MIPS internal mutex struct definitions. + 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 + 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 + . */ + +#ifndef _THREAD_MUTEX_INTERNAL_H +#define _THREAD_MUTEX_INTERNAL_H 1 + +struct __pthread_mutex_s +{ + int __lock; + unsigned int __count; + int __owner; +#if _MIPS_SIM == _ABI64 + unsigned int __nusers; +#endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; +#if _MIPS_SIM == _ABI64 + int __spins; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else + unsigned int __nusers; + __extension__ union + { + int __spins; + __pthread_slist_t __list; + }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif +}; + +#if _MIPS_SIM == _ABI64 +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, 0, __kind, 0, { 0, 0 } +#else +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, __kind, 0, { 0 } +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_cc.h b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_cc.h new file mode 100644 index 0000000000..8e67783a9e --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_cc.h @@ -0,0 +1,43 @@ +/* termios c_cc symbolic constant definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_cc characters */ +#define VINTR 0 /* Interrupt character [ISIG]. */ +#define VQUIT 1 /* Quit character [ISIG]. */ +#define VERASE 2 /* Erase character [ICANON]. */ +#define VKILL 3 /* Kill-line character [ICANON]. */ +#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */ +#define VEOL2 6 /* Second EOL character [ICANON]. */ +#define VSWTC 7 +#define VSWTCH VSWTC +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ + /* VDSUSP is not supported on Linux. */ +/* #define VDSUSP 11 / * Delayed suspend character [ISIG]. */ +#define VREPRINT 12 /* Reprint-line character [ICANON]. */ +#define VDISCARD 13 /* Discard character [IEXTEN]. */ +#define VWERASE 14 /* Word-erase character [ICANON]. */ +#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ +#define VEOF 16 /* End-of-file character [ICANON]. */ +#define VEOL 17 /* End-of-line character [ICANON]. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_lflag.h b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_lflag.h new file mode 100644 index 0000000000..6ef207b1a2 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-c_lflag.h @@ -0,0 +1,46 @@ +/* termios local mode definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_lflag bits */ +#define ISIG 0000001 /* Enable signals. */ +#define ICANON 0000002 /* Do erase and kill processing. */ +#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# define XCASE 0000004 +#endif +#define ECHO 0000010 /* Enable echo. */ +#define ECHOE 0000020 /* Visual erase for ERASE. */ +#define ECHOK 0000040 /* Echo NL after KILL. */ +#define ECHONL 0000100 /* Echo NL even if ECHO is off. */ +#define NOFLSH 0000200 /* Disable flush after interrupt. */ +#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */ +#ifdef __USE_MISC +# define ECHOCTL 0001000 /* Echo control characters as ^X. */ +# define ECHOPRT 0002000 /* Hardcopy visual erase. */ +# define ECHOKE 0004000 /* Visual erase for KILL. */ +# define FLUSHO 0020000 +# define PENDIN 0040000 /* Retype pending input (state). */ +#endif +#define TOSTOP 0100000 /* Send SIGTTOU for background output. */ +#define ITOSTOP TOSTOP +#ifdef __USE_MISC +# define EXTPROC 0200000 +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/termios-struct.h b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-struct.h new file mode 100644 index 0000000000..3bae186f55 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-struct.h @@ -0,0 +1,34 @@ +/* struct termios definition. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/termios-tcflow.h b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-tcflow.h new file mode 100644 index 0000000000..a6a4e5719e --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/termios-tcflow.h @@ -0,0 +1,26 @@ +/* termios local mode definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* tcsetattr uses these */ +#define TCSANOW 0x540e /* Same as TCSETS; change immediately. */ +#define TCSADRAIN 0x540f /* Same as TCSETSW; change when pending output is written. */ +#define TCSAFLUSH 0x5410 /* Same as TCSETSF; flush pending input before changing. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/timerfd.h b/lib/libc/include/mipsel-linux-gnueabi/bits/timerfd.h new file mode 100644 index 0000000000..871792717b --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/timerfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_TIMERFD_H +# error "Never use directly; include instead." +#endif + +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 02000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 00000200 +#define TFD_NONBLOCK TFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/types/stack_t.h b/lib/libc/include/mipsel-linux-gnueabi/bits/types/stack_t.h new file mode 100644 index 0000000000..005479e51a --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/types/stack_t.h @@ -0,0 +1,33 @@ +/* Define stack_t. MIPS Linux version. + Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef __stack_t_defined +#define __stack_t_defined 1 + +#define __need_size_t +#include + +/* Structure describing a signal stack. */ +typedef struct + { + void *ss_sp; + size_t ss_size; + int ss_flags; + } stack_t; + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_msqid_ds.h b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..c7dcdf23d9 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_msqid_ds.h @@ -0,0 +1,62 @@ +/* Linux/MIPS implementation of the SysV message struct msqid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm msg_perm; /* structure describing operation permission */ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ + __time_t msg_stime; /* time of last msgsnd command */ + unsigned long int __msg_stime_high; + __time_t msg_rtime; /* time of last msgsnd command */ + unsigned long int __msg_rtime_high; + __time_t msg_ctime; /* time of last change */ + unsigned long int __msg_ctime_high; +# else + unsigned long int __msg_stime_high; + __time_t msg_stime; /* time of last msgsnd command */ + unsigned long int __msg_rtime_high; + __time_t msg_rtime; /* time of last msgsnd command */ + unsigned long int __msg_ctime_high; + __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ +# endif + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_semid_ds.h b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000..c1961e1bb1 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_semid_ds.h @@ -0,0 +1,36 @@ +/* MIPS implementation of the semaphore struct semid_ds + 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 + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __sem_otime_high; + __syscall_ulong_t __sem_ctime_high; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_shmid_ds.h b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..2e8525c1a5 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/bits/types/struct_shmid_ds.h @@ -0,0 +1,53 @@ +/* Linux/MIPS implementation of the shared memory struct shmid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ +# if __TIMESIZE == 32 + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ +# else + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ +# endif + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ +# if __TIMESIZE == 32 + unsigned short int __shm_atime_high; + unsigned short int __shm_dtime_high; + unsigned short int __shm_ctime_high; + unsigned short int __glibc_reserved4; +# else + __syscall_ulong_t __glibc_reserved5; + __syscall_ulong_t __glibc_reserved6; +# endif +#endif + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabi/ieee754.h b/lib/libc/include/mipsel-linux-gnueabi/ieee754.h new file mode 100644 index 0000000000..f3e3977ca3 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabi/ieee754.h @@ -0,0 +1,326 @@ +/* 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 + 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 + . */ + +#ifndef _IEEE754_H +#define _IEEE754_H 1 + +#include + +#include + +#ifndef __LDBL_MANT_DIG__ +# include +# define __LDBL_MANT_DIG__ LDBL_MANT_DIG +#endif + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + +#if __LDBL_MANT_DIG__ == 113 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 quad-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:16; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:16; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:15; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:15; + unsigned int quiet_nan:1; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ + +#elif __LDBL_MANT_DIG__ == 64 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee; + + /* This is for NaNs in the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int one:1; + unsigned int quiet_nan:1; + unsigned int mantissa0:30; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff + +#elif __LDBL_MANT_DIG__ == 53 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + +#endif /* __LDBL_MANT_DIG__ == 53 */ + +__END_DECLS + +#endif /* ieee754.h */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/dlfcn.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/dlfcn.h new file mode 100644 index 0000000000..733090d634 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/dlfcn.h @@ -0,0 +1,64 @@ +/* System dependent definitions for run-time dynamic loading. + 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 + 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 + . */ + +#ifndef _DLFCN_H +# error "Never use directly; include instead." +#endif + +/* The MODE argument to `dlopen' contains one of the following: */ +#define RTLD_LAZY 0x0001 /* Lazy function call binding. */ +#define RTLD_NOW 0x0002 /* Immediate function call binding. */ +#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ +#define RTLD_NOLOAD 0x00008 /* Do not load the object. */ +#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */ + +/* If the following bit is set in the MODE argument to `dlopen', + the symbols of the loaded object and its dependencies are made + visible as if the object were linked directly into the program. */ +#define RTLD_GLOBAL 0x0004 + +/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. + The implementation does this by default and so we can define the + value to zero. */ +#define RTLD_LOCAL 0 + +/* Do not delete object when closed. */ +#define RTLD_NODELETE 0x01000 + +#ifdef __USE_GNU +/* To support profiling of shared objects it is a good idea to call + the function found using `dlsym' using the following macro since + these calls do not use the PLT. But this would mean the dynamic + loader has no chance to find out when the function is called. The + macro applies the necessary magic so that profiling is possible. + Rewrite + foo = (*fctp) (arg1, arg2); + into + foo = DL_CALL_FCT (fctp, (arg1, arg2)); +*/ +# define DL_CALL_FCT(fctp, args) \ + (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args) + +__BEGIN_DECLS + +/* This function calls the profiling functions. */ +extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW; + +__END_DECLS + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/errno.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/errno.h new file mode 100644 index 0000000000..0362f92048 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/errno.h @@ -0,0 +1,52 @@ +/* Error constants. MIPS/Linux specific version. + 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 + 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 + . */ + +#ifndef _BITS_ERRNO_H + +#if !defined _ERRNO_H +# error "Never include directly; use instead." +#endif + +# include + +/* Older Linux headers do not define these constants. */ +# ifndef ENOTSUP +# define ENOTSUP EOPNOTSUPP +# endif + +# ifndef ECANCELED +# define ECANCELED 158 +# endif + +# ifndef EOWNERDEAD +# define EOWNERDEAD 165 +# endif + +# ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 166 +# endif + +# ifndef ERFKILL +# define ERFKILL 167 +# endif + +# ifndef EHWPOISON +# define EHWPOISON 168 +# endif + +#endif /* bits/errno.h. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/eventfd.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/eventfd.h new file mode 100644 index 0000000000..a0f8f94d0c --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/eventfd.h @@ -0,0 +1,31 @@ +/* Copyright (C) 2007-2021 Free Software 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 + . */ + +#ifndef _SYS_EVENTFD_H +# error "Never use directly; include instead." +#endif + +/* Flags for eventfd. */ +enum + { + EFD_SEMAPHORE = 00000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE + EFD_CLOEXEC = 02000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 00000200 +#define EFD_NONBLOCK EFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/inotify.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/inotify.h new file mode 100644 index 0000000000..f72c8dc639 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/inotify.h @@ -0,0 +1,29 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_INOTIFY_H +# error "Never use directly; include instead." +#endif + +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 02000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 00000200 +#define IN_NONBLOCK IN_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/ioctl-types.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/ioctl-types.h new file mode 100644 index 0000000000..84081f4bfd --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/ioctl-types.h @@ -0,0 +1,75 @@ +/* Structure types for pre-termios terminal ioctls. Linux/MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Get definition of constants for use with `ioctl'. */ +#include + +struct winsize + { + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; + +#define NCC 8 +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + char c_line; /* line discipline */ + /* Yes, this is really NCCS. */ + unsigned char c_cc[32 /* NCCS */]; /* control characters */ + }; + +/* modem lines */ +#define TIOCM_LE 0x001 /* line enable */ +#define TIOCM_DTR 0x002 /* data terminal ready */ +#define TIOCM_RTS 0x004 /* request to send */ +#define TIOCM_ST 0x010 /* secondary transmit */ +#define TIOCM_SR 0x020 /* secondary receive */ +#define TIOCM_CTS 0x040 /* clear to send */ +#define TIOCM_CAR 0x100 /* carrier detect */ +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RNG 0x200 /* ring */ +#define TIOCM_RI TIOCM_RNG +#define TIOCM_DSR 0x400 /* data set ready */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Mobitex module */ +#define N_R3964 9 /* Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Profibus */ +#define N_IRDA 11 /* Linux IR */ +#define N_SMSBLOCK 12 /* SMS block mode */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/ipctypes.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/ipctypes.h new file mode 100644 index 0000000000..aa6d3772af --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/ipctypes.h @@ -0,0 +1,31 @@ +/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS 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 + 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 + . */ + +/* + * Never include directly. + */ + +#ifndef _BITS_IPCTYPES_H +#define _BITS_IPCTYPES_H 1 + +#include + +typedef __SLONG32_TYPE __ipc_pid_t; + + +#endif /* bits/ipctypes.h */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/mman.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/mman.h new file mode 100644 index 0000000000..726689ddec --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/mman.h @@ -0,0 +1,48 @@ +/* Definitions for POSIX memory map interface. Linux/MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_NORESERVE 0x0400 /* don't check for reservations */ +# define MAP_GROWSDOWN 0x1000 /* stack-like segment */ +# define MAP_DENYWRITE 0x2000 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x4000 /* mark it as an executable */ +# define MAP_LOCKED 0x8000 /* pages are locked */ +# define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ +# define MAP_NONBLOCK 0x20000 /* do not block on IO */ +# define MAP_STACK 0x40000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */ +# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap + underlying mapping. */ +#endif + +#define __MAP_ANONYMOUS 0x0800 + +/* Include generic Linux declarations. */ +#include + +#ifdef __USE_MISC +# define MAP_RENAME MAP_ANONYMOUS +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/poll.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/poll.h new file mode 100644 index 0000000000..fd12b70920 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/poll.h @@ -0,0 +1,49 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* These are extensions for Linux. */ +# define POLLMSG 0x400 +# define POLLREMOVE 0x1000 +# define POLLRDHUP 0x2000 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/pthread_stack_min.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/pthread_stack_min.h new file mode 100644 index 0000000000..1c02866a70 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. MIPS Linux version. + Copyright (C) 2021 Free Software 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 + . */ + +/* Minimum size for a thread. At least two pages with 64k pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/pthreadtypes-arch.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/pthreadtypes-arch.h new file mode 100644 index 0000000000..b6894a757e --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/pthreadtypes-arch.h @@ -0,0 +1,44 @@ +/* Machine-specific pthread type layouts. MIPS version. + 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 + 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 + . */ + +#ifndef _BITS_PTHREADTYPES_ARCH_H +#define _BITS_PTHREADTYPES_ARCH_H 1 + +#include + +#if _MIPS_SIM == _ABI64 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 +#else +# define __SIZEOF_PTHREAD_ATTR_T 36 +# define __SIZEOF_PTHREAD_MUTEX_T 24 +# define __SIZEOF_PTHREAD_RWLOCK_T 32 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +#endif +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#define __LOCK_ALIGNMENT +#define __ONCE_ALIGNMENT + +#endif /* bits/pthreadtypes.h */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/resource.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/resource.h new file mode 100644 index 0000000000..743dc1b9ad --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/resource.h @@ -0,0 +1,231 @@ +/* Bit values & structures for resource limits. Linux/MIPS version. + Copyright (C) 1994-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + __RLIMIT_RSS = 7, +#define RLIMIT_RSS __RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 5, + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE __RLIMIT_OFILE + + /* Address space limit (?) */ + RLIMIT_AS = 6, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + __RLIMIT_NPROC = 8, +#define RLIMIT_NPROC __RLIMIT_NPROC + + /* Locked-in-memory address space. */ + __RLIMIT_MEMLOCK = 9, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + /* Maximum CPU time in microseconds that a process scheduled under a real-time + scheduling policy may consume without making a blocking system + call before being forcibly descheduled. */ + __RLIMIT_RTTIME = 15, +#define RLIMIT_RTTIME __RLIMIT_RTTIME + + __RLIMIT_NLIMITS = 16, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#if _MIPS_SIM == _ABI64 +/* The N64 syscall uses this value. */ +# define RLIM_INFINITY 0xffffffffffffffffUL +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffUL +# endif +#else +/* The O32 and N32 syscalls use 0x7fffffff. */ +# ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +# else +# define RLIM_INFINITY 0xffffffffffffffffULL +# endif +# ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffULL +# endif +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + +#ifdef __USE_GNU + , + /* The calling thread. */ + RUSAGE_THREAD = 1 +# define RUSAGE_THREAD RUSAGE_THREAD + /* Name for the same functionality on Solaris. */ +# define RUSAGE_LWP RUSAGE_THREAD +#endif +}; + +#include +#include + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; + + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Modify and return resource limits of a process atomically. */ +# ifndef __USE_FILE_OFFSET64 +extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (prlimit, (__pid_t __pid, + enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit), prlimit64); +# else +# define prlimit prlimit64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit64 *__new_limit, + struct rlimit64 *__old_limit) __THROW; +# endif +#endif + +__END_DECLS \ No newline at end of file diff --git a/lib/libc/include/mips64-linux-gnuabi64/bits/wordsize.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/semaphore.h similarity index 72% rename from lib/libc/include/mips64-linux-gnuabi64/bits/wordsize.h rename to lib/libc/include/mipsel-linux-gnueabihf/bits/semaphore.h index 9e405e4e4e..73abfb8078 100644 --- a/lib/libc/include/mips64-linux-gnuabi64/bits/wordsize.h +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/semaphore.h @@ -15,17 +15,22 @@ License along with the GNU C Library. If not, see . */ -#include - -#define __WORDSIZE _MIPS_SZPTR - -#if _MIPS_SIM == _ABI64 -# define __WORDSIZE_TIME64_COMPAT32 1 -#else -# define __WORDSIZE_TIME64_COMPAT32 0 +#ifndef _SEMAPHORE_H +# error "Never use directly; include instead." #endif -#if __WORDSIZE == 32 -#define __WORDSIZE32_SIZE_ULONG 0 -#define __WORDSIZE32_PTRDIFF_LONG 0 -#endif \ No newline at end of file +#if _MIPS_SIM == _ABI64 +# define __SIZEOF_SEM_T 32 +#else +# define __SIZEOF_SEM_T 16 +#endif + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + + +typedef union +{ + char __size[__SIZEOF_SEM_T]; + long int __align; +} sem_t; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/shmlba.h new file mode 100644 index 0000000000..357defb2ba --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/shmlba.h @@ -0,0 +1,24 @@ +/* Define SHMLBA. MIPS version. + 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 + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never use directly; include instead." +#endif + +/* Segment low boundary address multiple. */ +#define SHMLBA 0x40000 \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/sigaction.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/sigaction.h new file mode 100644 index 0000000000..f968c4d10d --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/sigaction.h @@ -0,0 +1,94 @@ +/* The proper definitions for Linux/MIPS's sigaction. + Copyright (C) 1993-2021 Free Software 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 + . */ + +#ifndef _BITS_SIGACTION_H +#define _BITS_SIGACTION_H 1 + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Special flags. */ + int sa_flags; + + /* Signal handler. */ +#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* The ABI says here are two unused ints following. */ + /* Restore handler. */ + void (*sa_restorer) (void); + +#if _MIPS_SZPTR < 64 + int sa_resv[1]; +#endif + }; + +/* Bits in `sa_flags'. */ +/* Please note that some Linux kernels versions use different values for these + flags which is a bug in those kernel versions. */ +#define SA_NOCLDSTOP 0x00000001 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x00010000 /* Don't create zombie on child death. */ +#define SA_SIGINFO 0x00000008 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC +# define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */ +#endif +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */ +# define SA_RESTART 0x10000000 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x40000000 /* Don't automatically block the signal when + its handler is being executed. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historical no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_NOP 0 /* 0 is unused to catch errors */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ +#ifdef __USE_MISC +# define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: + set only the low 32 bit of the sigset. */ +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/sigcontext.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/sigcontext.h new file mode 100644 index 0000000000..cdf767d48a --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/sigcontext.h @@ -0,0 +1,82 @@ +/* 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 + 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 + . */ + +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never use directly; include instead." +#endif + +#include + +#if _MIPS_SIM == _ABIO32 + +/* Certain unused fields were replaced with new ones in 2.6.12-rc4. + The changes were as follows: + + sc_cause -> sc_hi1 + sc_badvaddr -> sc_lo1 + sc_sigset[0] -> sc_hi2 + sc_sigset[1] -> sc_lo2 + sc_sigset[2] -> sc_hi3 + sc_sigset[3] -> sc_lo3 + + sc_regmask, sc_ownedfp and sc_fpc_eir are not used. */ +struct sigcontext { + unsigned int sc_regmask; + unsigned int sc_status; + __extension__ unsigned long long sc_pc; + __extension__ unsigned long long sc_regs[32]; + __extension__ unsigned long long sc_fpregs[32]; + unsigned int sc_ownedfp; + unsigned int sc_fpc_csr; + unsigned int sc_fpc_eir; + unsigned int sc_used_math; + unsigned int sc_dsp; + __extension__ unsigned long long sc_mdhi; + __extension__ unsigned long long sc_mdlo; + unsigned long sc_hi1; + unsigned long sc_lo1; + unsigned long sc_hi2; + unsigned long sc_lo2; + unsigned long sc_hi3; + unsigned long sc_lo3; +}; + +#else + +/* This structure changed in 2.6.12-rc4 when DSP support was added. */ +struct sigcontext { + __extension__ unsigned long long sc_regs[32]; + __extension__ unsigned long long sc_fpregs[32]; + __extension__ unsigned long long sc_mdhi; + __extension__ unsigned long long sc_hi1; + __extension__ unsigned long long sc_hi2; + __extension__ unsigned long long sc_hi3; + __extension__ unsigned long long sc_mdlo; + __extension__ unsigned long long sc_lo1; + __extension__ unsigned long long sc_lo2; + __extension__ unsigned long long sc_lo3; + __extension__ unsigned long long sc_pc; + unsigned int sc_fpc_csr; + unsigned int sc_used_math; + unsigned int sc_dsp; + unsigned int sc_reserved; +}; + +#endif /* _MIPS_SIM != _ABIO32 */ +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/siginfo-arch.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/siginfo-arch.h new file mode 100644 index 0000000000..d639ba2076 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/siginfo-arch.h @@ -0,0 +1,13 @@ +/* Architecture-specific adjustments to siginfo_t. MIPS version. */ +#ifndef _BITS_SIGINFO_ARCH_H +#define _BITS_SIGINFO_ARCH_H 1 + +/* MIPS has the si_code and si_errno fields in the opposite order from + all other architectures. */ +#define __SI_ERRNO_THEN_CODE 0 + +/* MIPS also has different values for SI_ASYNCIO, SI_MESGQ, and SI_TIMER + than all other architectures. */ +#define __SI_ASYNCIO_AFTER_SIGIO 0 + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/signalfd.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/signalfd.h new file mode 100644 index 0000000000..10b69b2df4 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/signalfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2007-2021 Free Software 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 + . */ + +#ifndef _SYS_SIGNALFD_H +# error "Never use directly; include instead." +#endif + +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 02000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 00000200 +#define SFD_NONBLOCK SFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/signum-arch.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/signum-arch.h new file mode 100644 index 0000000000..a217ddd443 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/signum-arch.h @@ -0,0 +1,65 @@ +/* Signal number definitions. Linux/MIPS version. + 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 + . */ + +#ifndef _BITS_SIGNUM_H +#define _BITS_SIGNUM_H 1 + +#ifndef _SIGNAL_H +#error "Never include directly; use instead." +#endif + +/* Adjustments and additions to the signal number constants for + Linux/MIPS. */ + +#define SIGEMT 7 /* Emulator trap. */ +#define SIGPWR 19 /* Power failure imminent. */ + +/* Historical signals specified by POSIX. */ +#define SIGBUS 10 /* Bus error. */ +#define SIGSYS 12 /* Bad system call. */ + +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ +#define SIGURG 21 /* Urgent data is available at a socket. */ +#define SIGSTOP 23 /* Stop, unblockable. */ +#define SIGTSTP 24 /* Keyboard stop. */ +#define SIGCONT 25 /* Continue. */ +#define SIGCHLD 18 /* Child terminated or stopped. */ +#define SIGTTIN 26 /* Background read from control terminal. */ +#define SIGTTOU 27 /* Background write to control terminal. */ +#define SIGPOLL 22 /* Pollable event occurred (System V). */ +#define SIGXCPU 30 /* CPU time limit exceeded. */ +#define SIGVTALRM 28 /* Virtual timer expired. */ +#define SIGPROF 29 /* Profiling timer expired. */ +#define SIGXFSZ 31 /* File size limit exceeded. */ +#define SIGUSR1 16 /* User-defined signal 1. */ +#define SIGUSR2 17 /* User-defined signal 2. */ + +/* Nonstandard signals found in all modern POSIX systems + (including both BSD and Linux). */ +#define SIGWINCH 20 /* 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. */ +#define SIGCLD SIGCHLD /* Old System V name */ + +/* By default no real-time signals are supported. */ +#define __SIGRTMIN 32 +#define __SIGRTMAX 127 + +#endif /* included. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/socket-constants.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/socket-constants.h new file mode 100644 index 0000000000..3e95d151ca --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/socket-constants.h @@ -0,0 +1,70 @@ +/* Socket constants which vary among Linux architectures. Version for MIPS. + 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 + 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 + . */ + +#ifndef _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +#define SOL_SOCKET 65535 +#define SO_ACCEPTCONN 4105 +#define SO_BROADCAST 32 +#define SO_DONTROUTE 16 +#define SO_ERROR 4103 +#define SO_KEEPALIVE 8 +#define SO_LINGER 128 +#define SO_OOBINLINE 256 +#define SO_RCVBUF 4098 +#define SO_RCVLOWAT 4100 +#define SO_REUSEADDR 4 +#define SO_SNDBUF 4097 +#define SO_SNDLOWAT 4099 +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 4102 +# define SO_SNDTIMEO 4101 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 4102 +# define SO_SNDTIMEO_OLD 4101 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/socket_type.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/socket_type.h new file mode 100644 index 0000000000..f66bd0ea5f --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/socket_type.h @@ -0,0 +1,55 @@ +/* Define enum __socket_type for Linux/MIPS. + 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 + . */ + +#ifndef _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_STREAM = 2, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_DCCP = 6, +#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */ + SOCK_PACKET = 10, /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ + + SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 00000200 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/statfs.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/statfs.h new file mode 100644 index 0000000000..0e18718b24 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/statfs.h @@ -0,0 +1,73 @@ +/* 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 + 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 + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include /* for __fsid_t and __fsblkcnt_t*/ + +struct statfs + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ +#ifndef __USE_FILE_OFFSET64 + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_files; + __fsblkcnt_t f_ffree; + __fsblkcnt_t f_bavail; +#else + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; +#endif + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_flags; + long int f_spare[5]; + }; + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + long int f_type; +#define f_fstyp f_type + long int f_bsize; + long int f_frsize; /* Fragment size - unsupported */ + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_files; + __fsblkcnt64_t f_ffree; + __fsblkcnt64_t f_bavail; + + /* Linux specials */ + __fsid_t f_fsid; + long int f_namelen; + long int f_flags; + long int f_spare[5]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/struct_mutex.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/struct_mutex.h new file mode 100644 index 0000000000..8ddb89ce24 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/struct_mutex.h @@ -0,0 +1,56 @@ +/* MIPS internal mutex struct definitions. + 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 + 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 + . */ + +#ifndef _THREAD_MUTEX_INTERNAL_H +#define _THREAD_MUTEX_INTERNAL_H 1 + +struct __pthread_mutex_s +{ + int __lock; + unsigned int __count; + int __owner; +#if _MIPS_SIM == _ABI64 + unsigned int __nusers; +#endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; +#if _MIPS_SIM == _ABI64 + int __spins; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else + unsigned int __nusers; + __extension__ union + { + int __spins; + __pthread_slist_t __list; + }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif +}; + +#if _MIPS_SIM == _ABI64 +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, 0, __kind, 0, { 0, 0 } +#else +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, __kind, 0, { 0 } +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_cc.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_cc.h new file mode 100644 index 0000000000..8e67783a9e --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_cc.h @@ -0,0 +1,43 @@ +/* termios c_cc symbolic constant definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_cc characters */ +#define VINTR 0 /* Interrupt character [ISIG]. */ +#define VQUIT 1 /* Quit character [ISIG]. */ +#define VERASE 2 /* Erase character [ICANON]. */ +#define VKILL 3 /* Kill-line character [ICANON]. */ +#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */ +#define VEOL2 6 /* Second EOL character [ICANON]. */ +#define VSWTC 7 +#define VSWTCH VSWTC +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ + /* VDSUSP is not supported on Linux. */ +/* #define VDSUSP 11 / * Delayed suspend character [ISIG]. */ +#define VREPRINT 12 /* Reprint-line character [ICANON]. */ +#define VDISCARD 13 /* Discard character [IEXTEN]. */ +#define VWERASE 14 /* Word-erase character [ICANON]. */ +#define VLNEXT 15 /* Literal-next character [IEXTEN]. */ +#define VEOF 16 /* End-of-file character [ICANON]. */ +#define VEOL 17 /* End-of-line character [ICANON]. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_lflag.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_lflag.h new file mode 100644 index 0000000000..6ef207b1a2 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-c_lflag.h @@ -0,0 +1,46 @@ +/* termios local mode definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_lflag bits */ +#define ISIG 0000001 /* Enable signals. */ +#define ICANON 0000002 /* Do erase and kill processing. */ +#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# define XCASE 0000004 +#endif +#define ECHO 0000010 /* Enable echo. */ +#define ECHOE 0000020 /* Visual erase for ERASE. */ +#define ECHOK 0000040 /* Echo NL after KILL. */ +#define ECHONL 0000100 /* Echo NL even if ECHO is off. */ +#define NOFLSH 0000200 /* Disable flush after interrupt. */ +#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */ +#ifdef __USE_MISC +# define ECHOCTL 0001000 /* Echo control characters as ^X. */ +# define ECHOPRT 0002000 /* Hardcopy visual erase. */ +# define ECHOKE 0004000 /* Visual erase for KILL. */ +# define FLUSHO 0020000 +# define PENDIN 0040000 /* Retype pending input (state). */ +#endif +#define TOSTOP 0100000 /* Send SIGTTOU for background output. */ +#define ITOSTOP TOSTOP +#ifdef __USE_MISC +# define EXTPROC 0200000 +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-struct.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-struct.h new file mode 100644 index 0000000000..3bae186f55 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-struct.h @@ -0,0 +1,34 @@ +/* struct termios definition. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0 + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-tcflow.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-tcflow.h new file mode 100644 index 0000000000..a6a4e5719e --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/termios-tcflow.h @@ -0,0 +1,26 @@ +/* termios local mode definitions. Linux/mips version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* tcsetattr uses these */ +#define TCSANOW 0x540e /* Same as TCSETS; change immediately. */ +#define TCSADRAIN 0x540f /* Same as TCSETSW; change when pending output is written. */ +#define TCSAFLUSH 0x5410 /* Same as TCSETSF; flush pending input before changing. */ \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/timerfd.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/timerfd.h new file mode 100644 index 0000000000..871792717b --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/timerfd.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2008-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_TIMERFD_H +# error "Never use directly; include instead." +#endif + +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 02000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 00000200 +#define TFD_NONBLOCK TFD_NONBLOCK + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/types/stack_t.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/stack_t.h new file mode 100644 index 0000000000..005479e51a --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/stack_t.h @@ -0,0 +1,33 @@ +/* Define stack_t. MIPS Linux version. + Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef __stack_t_defined +#define __stack_t_defined 1 + +#define __need_size_t +#include + +/* Structure describing a signal stack. */ +typedef struct + { + void *ss_sp; + size_t ss_size; + int ss_flags; + } stack_t; + +#endif \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_msqid_ds.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..c7dcdf23d9 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_msqid_ds.h @@ -0,0 +1,62 @@ +/* Linux/MIPS implementation of the SysV message struct msqid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm msg_perm; /* structure describing operation permission */ +# if __TIMESIZE == 32 +# ifdef __MIPSEL__ + __time_t msg_stime; /* time of last msgsnd command */ + unsigned long int __msg_stime_high; + __time_t msg_rtime; /* time of last msgsnd command */ + unsigned long int __msg_rtime_high; + __time_t msg_ctime; /* time of last change */ + unsigned long int __msg_ctime_high; +# else + unsigned long int __msg_stime_high; + __time_t msg_stime; /* time of last msgsnd command */ + unsigned long int __msg_rtime_high; + __time_t msg_rtime; /* time of last msgsnd command */ + unsigned long int __msg_ctime_high; + __time_t msg_ctime; /* time of last change */ +# endif +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ +# endif + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_semid_ds.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000..c1961e1bb1 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_semid_ds.h @@ -0,0 +1,36 @@ +/* MIPS implementation of the semaphore struct semid_ds + 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 + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __sem_otime_high; + __syscall_ulong_t __sem_ctime_high; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_shmid_ds.h b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..2e8525c1a5 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/bits/types/struct_shmid_ds.h @@ -0,0 +1,53 @@ +/* Linux/MIPS implementation of the shared memory struct shmid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ +# if __TIMESIZE == 32 + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ +# else + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ +# endif + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ +# if __TIMESIZE == 32 + unsigned short int __shm_atime_high; + unsigned short int __shm_dtime_high; + unsigned short int __shm_ctime_high; + unsigned short int __glibc_reserved4; +# else + __syscall_ulong_t __glibc_reserved5; + __syscall_ulong_t __glibc_reserved6; +# endif +#endif + }; \ No newline at end of file diff --git a/lib/libc/include/mipsel-linux-gnueabihf/ieee754.h b/lib/libc/include/mipsel-linux-gnueabihf/ieee754.h new file mode 100644 index 0000000000..f3e3977ca3 --- /dev/null +++ b/lib/libc/include/mipsel-linux-gnueabihf/ieee754.h @@ -0,0 +1,326 @@ +/* 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 + 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 + . */ + +#ifndef _IEEE754_H +#define _IEEE754_H 1 + +#include + +#include + +#ifndef __LDBL_MANT_DIG__ +# include +# define __LDBL_MANT_DIG__ LDBL_MANT_DIG +#endif + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + +#if __LDBL_MANT_DIG__ == 113 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 quad-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:16; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:16; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:15; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:15; + unsigned int quiet_nan:1; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ + +#elif __LDBL_MANT_DIG__ == 64 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee; + + /* This is for NaNs in the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty:16; + unsigned int one:1; + unsigned int quiet_nan:1; + unsigned int mantissa0:30; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff + +#elif __LDBL_MANT_DIG__ == 53 + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + +#endif /* __LDBL_MANT_DIG__ == 53 */ + +__END_DECLS + +#endif /* ieee754.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h deleted file mode 100644 index 5416e4d6cf..0000000000 --- a/lib/libc/include/powerpc-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2021 Free Software 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; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages for systems with 64k - pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/endianness.h b/lib/libc/include/powerpc-linux-gnueabi/bits/endianness.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/endianness.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/endianness.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/environments.h b/lib/libc/include/powerpc-linux-gnueabi/bits/environments.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/environments.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/environments.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fcntl.h b/lib/libc/include/powerpc-linux-gnueabi/bits/fcntl.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/fcntl.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/fcntl.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fenv.h b/lib/libc/include/powerpc-linux-gnueabi/bits/fenv.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/fenv.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/fenv.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/floatn.h b/lib/libc/include/powerpc-linux-gnueabi/bits/floatn.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/floatn.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/floatn.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h b/lib/libc/include/powerpc-linux-gnueabi/bits/fp-fast.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/fp-fast.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/fp-fast.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/hwcap.h b/lib/libc/include/powerpc-linux-gnueabi/bits/hwcap.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/hwcap.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/hwcap.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h b/lib/libc/include/powerpc-linux-gnueabi/bits/ioctl-types.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/ioctl-types.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/ioctl-types.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h b/lib/libc/include/powerpc-linux-gnueabi/bits/ipc-perm.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/ipc-perm.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/ipc-perm.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h b/lib/libc/include/powerpc-linux-gnueabi/bits/iscanonical.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/iscanonical.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/iscanonical.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/link.h b/lib/libc/include/powerpc-linux-gnueabi/bits/link.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/link.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/link.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/long-double.h b/lib/libc/include/powerpc-linux-gnueabi/bits/long-double.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/long-double.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/long-double.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/mman.h b/lib/libc/include/powerpc-linux-gnueabi/bits/mman.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/mman.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/mman.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/procfs.h b/lib/libc/include/powerpc-linux-gnueabi/bits/procfs.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/procfs.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/procfs.h diff --git a/lib/libc/include/powerpc-linux-gnueabi/bits/pthread_stack_min.h b/lib/libc/include/powerpc-linux-gnueabi/bits/pthread_stack_min.h new file mode 100644 index 0000000000..c8caed37b2 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/pthread_stack_min.h @@ -0,0 +1,21 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/PPC version. + Copyright (C) 2021 Free Software 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; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/setjmp.h b/lib/libc/include/powerpc-linux-gnueabi/bits/setjmp.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/setjmp.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/setjmp.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/sigstack.h b/lib/libc/include/powerpc-linux-gnueabi/bits/sigstack.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/sigstack.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/sigstack.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc-linux-gnueabi/bits/socket-constants.h similarity index 57% rename from lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/socket-constants.h index 64f96f535c..a6223eff27 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 10 #define SO_RCVBUF 8 #define SO_RCVLOWAT 16 -#define SO_RCVTIMEO 18 #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_SNDLOWAT 17 -#define SO_SNDTIMEO 19 -#define SO_TYPE 3 \ No newline at end of file +#define SO_TYPE 3 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 18 +# define SO_SNDTIMEO 19 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 18 +# define SO_SNDTIMEO_OLD 19 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h b/lib/libc/include/powerpc-linux-gnueabi/bits/struct_mutex.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/struct_mutex.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/powerpc-linux-gnueabi/bits/struct_rwlock.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/struct_rwlock.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/struct_rwlock.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h b/lib/libc/include/powerpc-linux-gnueabi/bits/struct_stat.h similarity index 94% rename from lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/struct_stat.h index 805594defd..3faed3a29b 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/struct_stat.h @@ -26,74 +26,36 @@ #include #if __WORDSIZE == 32 - struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 unsigned short int __pad1; __ino_t st_ino; /* File serial number. */ -# else +# else __ino64_t st_ino; /* File serial number. */ -# endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -# else +# else __off64_t st_size; /* Size of file, in bytes. */ -# endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - - -# ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -117,6 +79,50 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ + }; + +# ifdef __USE_LARGEFILE64 +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ }; # endif /* __USE_LARGEFILE64 */ diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-baud.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-baud.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-baud.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_cc.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-c_cc.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_cc.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_cflag.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-c_cflag.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_cflag.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_iflag.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-c_iflag.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_iflag.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_lflag.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-c_lflag.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_lflag.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_oflag.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-c_oflag.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-c_oflag.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h b/lib/libc/include/powerpc-linux-gnueabi/bits/termios-misc.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/termios-misc.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/termios-misc.h diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_msqid_ds.h similarity index 93% rename from lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_msqid_ds.h index 65856a4231..52cc930886 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_semid_ds.h similarity index 93% rename from lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_semid_ds.h index df168a5b57..d70967d6e0 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_shmid_ds.h similarity index 94% rename from lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_shmid_ds.h index 82e25d77a9..6a47b1c39f 100644 --- a/lib/libc/include/powerpc-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc-linux-gnueabi/bits/types/struct_shmid_ds.h @@ -23,8 +23,11 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __shm_atime_high; __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_dtime_high; @@ -32,15 +35,16 @@ struct shmid_ds unsigned long int __shm_ctime_high; __time_t shm_ctime; /* time of last change by shmctl() */ unsigned long int __glibc_reserved4; -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif size_t shm_segsz; /* size of segment in bytes */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnu/bits/wordsize.h b/lib/libc/include/powerpc-linux-gnueabi/bits/wordsize.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/bits/wordsize.h rename to lib/libc/include/powerpc-linux-gnueabi/bits/wordsize.h diff --git a/lib/libc/include/powerpc-linux-gnu/fpu_control.h b/lib/libc/include/powerpc-linux-gnueabi/fpu_control.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/fpu_control.h rename to lib/libc/include/powerpc-linux-gnueabi/fpu_control.h diff --git a/lib/libc/include/powerpc-linux-gnu/gnu/lib-names-32.h b/lib/libc/include/powerpc-linux-gnueabi/gnu/lib-names-32.h similarity index 95% rename from lib/libc/include/powerpc-linux-gnu/gnu/lib-names-32.h rename to lib/libc/include/powerpc-linux-gnueabi/gnu/lib-names-32.h index f4db4285af..7dfe5a7147 100644 --- a/lib/libc/include/powerpc-linux-gnu/gnu/lib-names-32.h +++ b/lib/libc/include/powerpc-linux-gnueabi/gnu/lib-names-32.h @@ -7,6 +7,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/powerpc-linux-gnu/gnu/lib-names.h b/lib/libc/include/powerpc-linux-gnueabi/gnu/lib-names.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/gnu/lib-names.h rename to lib/libc/include/powerpc-linux-gnueabi/gnu/lib-names.h diff --git a/lib/libc/include/powerpc-linux-gnu/gnu/stubs.h b/lib/libc/include/powerpc-linux-gnueabi/gnu/stubs.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/gnu/stubs.h rename to lib/libc/include/powerpc-linux-gnueabi/gnu/stubs.h diff --git a/lib/libc/include/powerpc-linux-gnu/ieee754.h b/lib/libc/include/powerpc-linux-gnueabi/ieee754.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/ieee754.h rename to lib/libc/include/powerpc-linux-gnueabi/ieee754.h diff --git a/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc-linux-gnueabi/sys/ptrace.h similarity index 95% rename from lib/libc/include/powerpc-linux-gnu/sys/ptrace.h rename to lib/libc/include/powerpc-linux-gnueabi/sys/ptrace.h index 5c5d5addee..a0134d5dfe 100644 --- a/lib/libc/include/powerpc-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc-linux-gnueabi/sys/ptrace.h @@ -70,6 +70,8 @@ __BEGIN_DECLS # undef PTRACE_SYSCALL_INFO_ENTRY # undef PTRACE_SYSCALL_INFO_EXIT # undef PTRACE_SYSCALL_INFO_SECCOMP +# undef PTRACE_SYSEMU +# undef PTRACE_SYSEMU_SINGLESTEP # undef PTRACE_TRACEME #endif @@ -188,6 +190,14 @@ enum __ptrace_request PTRACE_SETVSRREGS = 28, #define PT_SETVSRREGS PTRACE_SETVSRREGS + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 29, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 30, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + /* Execute process until next taken branch. */ PTRACE_SINGLEBLOCK = 256, #define PT_STEPBLOCK PTRACE_SINGLEBLOCK diff --git a/lib/libc/include/powerpc-linux-gnu/sys/ucontext.h b/lib/libc/include/powerpc-linux-gnueabi/sys/ucontext.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/sys/ucontext.h rename to lib/libc/include/powerpc-linux-gnueabi/sys/ucontext.h diff --git a/lib/libc/include/powerpc-linux-gnu/sys/user.h b/lib/libc/include/powerpc-linux-gnueabi/sys/user.h similarity index 100% rename from lib/libc/include/powerpc-linux-gnu/sys/user.h rename to lib/libc/include/powerpc-linux-gnueabi/sys/user.h diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/endianness.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/endianness.h new file mode 100644 index 0000000000..91892fa161 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/endianness.h @@ -0,0 +1,16 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* PowerPC has selectable endianness. */ +#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN +# define __BYTE_ORDER __BIG_ENDIAN +#endif +#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/environments.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/environments.h new file mode 100644 index 0000000000..81b109e9c7 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/environments.h @@ -0,0 +1,96 @@ +/* Copyright (C) 1999-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* Environments with 32-bit wide pointers are optionally provided. + Therefore following macros aren't defined: + # undef _POSIX_V7_ILP32_OFF32 + # undef _POSIX_V7_ILP32_OFFBIG + # undef _POSIX_V6_ILP32_OFF32 + # undef _POSIX_V6_ILP32_OFFBIG + # undef _XBS5_ILP32_OFF32 + # undef _XBS5_ILP32_OFFBIG + and users need to check at runtime. */ + +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* By default we have 32-bit wide `int', `long int', pointers and `off_t' + and all platforms support LFS. */ +# define _POSIX_V7_ILP32_OFF32 1 +# define _POSIX_V7_ILP32_OFFBIG 1 +# define _POSIX_V6_ILP32_OFF32 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFF32 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We optionally provide an environment with the above size but an 64-bit + side `off_t'. Therefore we don't define _POSIX_V7_ILP32_OFFBIG. */ + +/* Environments with 64-bit wide pointers can be provided, + so these macros aren't defined: + # undef _POSIX_V7_LP64_OFF64 + # undef _POSIX_V7_LPBIG_OFFBIG + # undef _POSIX_V6_LP64_OFF64 + # undef _POSIX_V6_LPBIG_OFFBIG + # undef _XBS5_LP64_OFF64 + # undef _XBS5_LPBIG_OFFBIG + and sysconf tests for it at runtime. */ + +#endif /* __WORDSIZE == 32 */ + +#define __ILP32_OFF32_CFLAGS "-m32" +#define __ILP32_OFFBIG_CFLAGS "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +#define __ILP32_OFF32_LDFLAGS "-m32" +#define __ILP32_OFFBIG_LDFLAGS "-m32" +#define __LP64_OFF64_CFLAGS "-m64" +#define __LP64_OFF64_LDFLAGS "-m64" \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/fcntl.h new file mode 100644 index 0000000000..abb1bd7083 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/fcntl.h @@ -0,0 +1,62 @@ +/* O_*, F_*, FD_* bit values for Linux/PowerPC. + 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 + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include + +#define __O_DIRECTORY 040000 /* Must be a directory. */ +#define __O_NOFOLLOW 0100000 /* Do not follow links. */ +#define __O_DIRECT 0400000 /* Direct disk access. */ + +#if __WORDSIZE == 64 +/* Not necessary, files are always with 64bit off_t. */ +# define __O_LARGEFILE 0 +#else +# define __O_LARGEFILE 0200000 +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/fenv.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/fenv.h new file mode 100644 index 0000000000..a1e1b6ba4b --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/fenv.h @@ -0,0 +1,180 @@ +/* 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 + 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 + . */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + + +/* Define bits representing the exception. We use the bit positions of + the appropriate bits in the FPSCR... */ +enum + { + FE_INEXACT = +#define FE_INEXACT (1 << (31 - 6)) + FE_INEXACT, + FE_DIVBYZERO = +#define FE_DIVBYZERO (1 << (31 - 5)) + FE_DIVBYZERO, + FE_UNDERFLOW = +#define FE_UNDERFLOW (1 << (31 - 4)) + FE_UNDERFLOW, + FE_OVERFLOW = +#define FE_OVERFLOW (1 << (31 - 3)) + FE_OVERFLOW, + + /* ... except for FE_INVALID, for which we use bit 31. FE_INVALID + actually corresponds to bits 7 through 12 and 21 through 23 + in the FPSCR, but we can't use that because the current draft + says that it must be a power of 2. Instead we use bit 2 which + is the summary bit for all the FE_INVALID exceptions, which + kind of makes sense. */ + FE_INVALID = +#define FE_INVALID (1 << (31 - 2)) + FE_INVALID, + +#ifdef __USE_GNU + /* Breakdown of the FE_INVALID bits. Setting FE_INVALID on an + input to a routine is equivalent to setting all of these bits; + FE_INVALID will be set on output from a routine iff one of + these bits is set. Note, though, that you can't disable or + enable these exceptions individually. */ + + /* Operation with a sNaN. */ + FE_INVALID_SNAN = +# define FE_INVALID_SNAN (1 << (31 - 7)) + FE_INVALID_SNAN, + + /* Inf - Inf */ + FE_INVALID_ISI = +# define FE_INVALID_ISI (1 << (31 - 8)) + FE_INVALID_ISI, + + /* Inf / Inf */ + FE_INVALID_IDI = +# define FE_INVALID_IDI (1 << (31 - 9)) + FE_INVALID_IDI, + + /* 0 / 0 */ + FE_INVALID_ZDZ = +# define FE_INVALID_ZDZ (1 << (31 - 10)) + FE_INVALID_ZDZ, + + /* Inf * 0 */ + FE_INVALID_IMZ = +# define FE_INVALID_IMZ (1 << (31 - 11)) + FE_INVALID_IMZ, + + /* Comparison with a NaN. */ + FE_INVALID_COMPARE = +# define FE_INVALID_COMPARE (1 << (31 - 12)) + FE_INVALID_COMPARE, + + /* Invalid operation flag for software (not set by hardware). */ + /* Note that some chips don't have this implemented, presumably + because no-one expected anyone to write software for them %-). */ + FE_INVALID_SOFTWARE = +# define FE_INVALID_SOFTWARE (1 << (31 - 21)) + FE_INVALID_SOFTWARE, + + /* Square root of negative number (including -Inf). */ + /* Note that some chips don't have this implemented. */ + FE_INVALID_SQRT = +# define FE_INVALID_SQRT (1 << (31 - 22)) + FE_INVALID_SQRT, + + /* Conversion-to-integer of a NaN or a number too large or too small. */ + FE_INVALID_INTEGER_CONVERSION = +# define FE_INVALID_INTEGER_CONVERSION (1 << (31 - 23)) + FE_INVALID_INTEGER_CONVERSION + +# define FE_ALL_INVALID \ + (FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \ + | FE_INVALID_IMZ | FE_INVALID_COMPARE | FE_INVALID_SOFTWARE \ + | FE_INVALID_SQRT | FE_INVALID_INTEGER_CONVERSION) +#endif + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* PowerPC chips support all of the four defined rounding modes. We + use the bit pattern in the FPSCR as the values for the + appropriate macros. */ +enum + { + FE_TONEAREST = +#define FE_TONEAREST 0 + FE_TONEAREST, + FE_TOWARDZERO = +#define FE_TOWARDZERO 1 + FE_TOWARDZERO, + FE_UPWARD = +#define FE_UPWARD 2 + FE_UPWARD, + FE_DOWNWARD = +#define FE_DOWNWARD 3 + FE_DOWNWARD + }; + +/* Type representing exception flags. */ +typedef unsigned int fexcept_t; + +/* Type representing floating-point environment. We leave it as 'double' + for efficiency reasons (rather than writing it to a 32-bit integer). */ +typedef double fenv_t; + +/* If the default argument is used we use this value. */ +extern const fenv_t __fe_dfl_env; +#define FE_DFL_ENV (&__fe_dfl_env) + +#ifdef __USE_GNU +/* Floating-point environment where all exceptions are enabled. Note that + this is not sufficient to give you SIGFPE. */ +extern const fenv_t __fe_enabled_env; +# define FE_ENABLED_ENV (&__fe_enabled_env) + +/* Floating-point environment with (processor-dependent) non-IEEE floating + point. */ +extern const fenv_t __fe_nonieee_env; +# define FE_NONIEEE_ENV (&__fe_nonieee_env) + +/* Floating-point environment with all exceptions enabled. Note that + just evaluating this value does not change the processor exception mode. + Passing this mask to fesetenv will result in a prctl syscall to change + the MSR FE0/FE1 bits to "Precise Mode". On some processors this will + result in slower floating point execution. This will last until an + fenv or exception mask is installed that disables all FP exceptions. */ +# define FE_NOMASK_ENV FE_ENABLED_ENV + +/* Floating-point environment with all exceptions disabled. Note that + just evaluating this value does not change the processor exception mode. + Passing this mask to fesetenv will result in a prctl syscall to change + the MSR FE0/FE1 bits to "Ignore Exceptions Mode". On most processors + this allows the fastest possible floating point execution.*/ +# define FE_MASK_ENV FE_DFL_ENV + +#endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X) +/* Type representing floating-point control modes. */ +typedef double femode_t; + +/* Default floating-point control modes. */ +extern const femode_t __fe_dfl_mode; +# define FE_DFL_MODE (&__fe_dfl_mode) +#endif \ No newline at end of file diff --git a/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/floatn.h similarity index 53% rename from lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h rename to lib/libc/include/powerpc-linux-gnueabihf/bits/floatn.h index c05a5e55e0..cb7f2fe5bc 100644 --- a/lib/libc/include/mips64el-linux-gnuabi64/bits/floatn.h +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/floatn.h @@ -1,4 +1,4 @@ -/* Macros to control TS 18661-3 glibc features on MIPS platforms. +/* Macros to control TS 18661-3 glibc features on powerpc. Copyright (C) 2017-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -23,21 +23,23 @@ #include /* Defined to 1 if the current compiler invocation provides a - floating-point type with the IEEE 754 binary128 format, and this - glibc includes corresponding *f128 interfaces for it. */ -#ifndef __NO_LONG_DOUBLE_MATH + floating-point type with the IEEE 754 binary128 format, and this glibc + includes corresponding *f128 interfaces for it. */ +#if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \ + && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH # define __HAVE_FLOAT128 1 #else -/* glibc does not support _Float128 for platforms where long double is - normally binary128 when building with long double as binary64. - GCC's default for supported scalar modes does not support it either - in that case. */ # define __HAVE_FLOAT128 0 #endif /* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct - from the default float, double and long double types in this glibc. */ -#define __HAVE_DISTINCT_FLOAT128 0 + from the default float, double and long double types in this glibc, i.e. + calls to the binary128 functions go to *f128 symbols instead of *l. */ +#if __HAVE_FLOAT128 +# define __HAVE_DISTINCT_FLOAT128 1 +#else +# define __HAVE_DISTINCT_FLOAT128 0 +#endif /* Defined to 1 if the current compiler invocation provides a floating-point type with the right format for _Float64x, and this @@ -48,7 +50,7 @@ of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has the format of _Float128, which must be different from that of long double. */ -#define __HAVE_FLOAT64X_LONG_DOUBLE __HAVE_FLOAT128 +#define __HAVE_FLOAT64X_LONG_DOUBLE 0 #ifndef __ASSEMBLER__ @@ -56,8 +58,12 @@ types, if __HAVE_FLOAT128 is 1. */ # if __HAVE_FLOAT128 # if !__GNUC_PREREQ (7, 0) || defined __cplusplus -/* The literal suffix f128 exists only since GCC 7.0. */ -# define __f128(x) x##l +/* The literal suffix (f128) exist for powerpc only since GCC 7.0. */ +# if __LDBL_MANT_DIG__ == 113 +# define __f128(x) x##l +# else +# define __f128(x) x##q +# endif # else # define __f128(x) x##f128 # endif @@ -65,8 +71,16 @@ /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ # if __HAVE_FLOAT128 -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus +# if __LDBL_MANT_DIG__ == 113 && defined __cplusplus +typedef long double _Float128; # define __CFLOAT128 _Complex long double +# elif !__GNUC_PREREQ (7, 0) || defined __cplusplus +/* The type _Float128 exist for powerpc only since GCC 7.0. */ +typedef __float128 _Float128; +/* Add a typedef for older GCC and C++ compilers which don't natively support + _Complex _Float128. */ +typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__))); +# define __CFLOAT128 __cfloat128 # else # define __CFLOAT128 _Complex _Float128 # endif @@ -74,18 +88,29 @@ /* The remaining of this file provides support for older compilers. */ # if __HAVE_FLOAT128 - -/* The type _Float128 exists only since GCC 7.0. */ -# if !__GNUC_PREREQ (7, 0) || defined __cplusplus -typedef long double _Float128; +/* Builtin __builtin_huge_valf128 doesn't exist before GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) # endif -/* Various built-in functions do not exist before GCC 7.0. */ +/* The following builtins (suffixed with 'q') are available in GCC >= 6.2, + which is the minimum version required for float128 support on powerpc64le. + Since GCC 7.0 the builtins suffixed with f128 are also available, then + there is no need to redefined them. */ # if !__GNUC_PREREQ (7, 0) -# define __builtin_huge_valf128() (__builtin_huge_vall ()) -# define __builtin_inff128() (__builtin_infl ()) -# define __builtin_nanf128(x) (__builtin_nanl (x)) -# define __builtin_nansf128(x) (__builtin_nansl (x)) +# define __builtin_copysignf128 __builtin_copysignq +# define __builtin_fabsf128 __builtin_fabsq +# define __builtin_inff128 __builtin_infq +# define __builtin_nanf128 __builtin_nanq +# define __builtin_nansf128 __builtin_nansq +# endif + +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 # endif # endif diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/fp-fast.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/fp-fast.h new file mode 100644 index 0000000000..e10d37d400 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/fp-fast.h @@ -0,0 +1,39 @@ +/* Define FP_FAST_* macros. PowerPC version. + 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 + 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 + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#ifdef __USE_ISOC99 + +/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l} + builtins are supported. */ +# if (!defined _SOFT_FLOAT && !defined __NO_FPRS__) || defined __FP_FAST_FMA +# define FP_FAST_FMA 1 +# endif + +# if (!defined _SOFT_FLOAT && !defined __NO_FPRS__) || defined __FP_FAST_FMAF +# define FP_FAST_FMAF 1 +# endif + +# ifdef __FP_FAST_FMAL +# define FP_FAST_FMAL 1 +# endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/hwcap.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/hwcap.h new file mode 100644 index 0000000000..9858baf991 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/hwcap.h @@ -0,0 +1,78 @@ +/* Defines for bits in AT_HWCAP and AT_HWCAP2. + 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 + 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 + . */ + +#if !defined(_SYS_AUXV_H) && !defined(_SYSDEPS_SYSDEP_H) +# error "Never include directly; use instead." +#endif + +/* The bit numbers must match those in the kernel's asm/cputable.h. */ + +/* Feature definitions in AT_HWCAP. */ +#define PPC_FEATURE_32 0x80000000 /* 32-bit mode. */ +#define PPC_FEATURE_64 0x40000000 /* 64-bit mode. */ +#define PPC_FEATURE_601_INSTR 0x20000000 /* 601 chip, Old POWER ISA. */ +#define PPC_FEATURE_HAS_ALTIVEC 0x10000000 /* SIMD/Vector Unit. */ +#define PPC_FEATURE_HAS_FPU 0x08000000 /* Floating Point Unit. */ +#define PPC_FEATURE_HAS_MMU 0x04000000 /* Memory Management Unit. */ +#define PPC_FEATURE_HAS_4xxMAC 0x02000000 /* 4xx Multiply Accumulator. */ +#define PPC_FEATURE_UNIFIED_CACHE 0x01000000 /* Unified I/D cache. */ +#define PPC_FEATURE_HAS_SPE 0x00800000 /* Signal Processing ext. */ +#define PPC_FEATURE_HAS_EFP_SINGLE 0x00400000 /* SPE Float. */ +#define PPC_FEATURE_HAS_EFP_DOUBLE 0x00200000 /* SPE Double. */ +#define PPC_FEATURE_NO_TB 0x00100000 /* 601/403gx have no timebase */ +#define PPC_FEATURE_POWER4 0x00080000 /* POWER4 ISA 2.00 */ +#define PPC_FEATURE_POWER5 0x00040000 /* POWER5 ISA 2.02 */ +#define PPC_FEATURE_POWER5_PLUS 0x00020000 /* POWER5+ ISA 2.03 */ +#define PPC_FEATURE_CELL_BE 0x00010000 /* CELL Broadband Engine */ +#define PPC_FEATURE_BOOKE 0x00008000 /* ISA Category Embedded */ +#define PPC_FEATURE_SMT 0x00004000 /* Simultaneous + Multi-Threading */ +#define PPC_FEATURE_ICACHE_SNOOP 0x00002000 +#define PPC_FEATURE_ARCH_2_05 0x00001000 /* ISA 2.05 */ +#define PPC_FEATURE_PA6T 0x00000800 /* PA Semi 6T Core */ +#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal FP Unit */ +#define PPC_FEATURE_POWER6_EXT 0x00000200 /* P6 + mffgpr/mftgpr */ +#define PPC_FEATURE_ARCH_2_06 0x00000100 /* ISA 2.06 */ +#define PPC_FEATURE_HAS_VSX 0x00000080 /* P7 Vector Extension. */ +#define PPC_FEATURE_PSERIES_PERFMON_COMPAT 0x00000040 +/* Reserved by the kernel. 0x00000004 Do not use. */ +#define PPC_FEATURE_TRUE_LE 0x00000002 +#define PPC_FEATURE_PPC_LE 0x00000001 + +/* Feature definitions in AT_HWCAP2. */ +#define PPC_FEATURE2_ARCH_2_07 0x80000000 /* ISA 2.07 */ +#define PPC_FEATURE2_HAS_HTM 0x40000000 /* Hardware Transactional + Memory */ +#define PPC_FEATURE2_HAS_DSCR 0x20000000 /* Data Stream Control + Register */ +#define PPC_FEATURE2_HAS_EBB 0x10000000 /* Event Base Branching */ +#define PPC_FEATURE2_HAS_ISEL 0x08000000 /* Integer Select */ +#define PPC_FEATURE2_HAS_TAR 0x04000000 /* Target Address Register */ +#define PPC_FEATURE2_HAS_VEC_CRYPTO 0x02000000 /* Target supports vector + instruction. */ +#define PPC_FEATURE2_HTM_NOSC 0x01000000 /* Kernel aborts transaction + when a syscall is made. */ +#define PPC_FEATURE2_ARCH_3_00 0x00800000 /* ISA 3.0 */ +#define PPC_FEATURE2_HAS_IEEE128 0x00400000 /* VSX IEEE Binary Float + 128-bit */ +#define PPC_FEATURE2_DARN 0x00200000 /* darn instruction. */ +#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall. */ +#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended + state. */ +#define PPC_FEATURE2_ARCH_3_1 0x00040000 /* ISA 3.1. */ +#define PPC_FEATURE2_MMA 0x00020000 /* Matrix-Multiply Assist. */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/ioctl-types.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/ioctl-types.h new file mode 100644 index 0000000000..919610e5ca --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/ioctl-types.h @@ -0,0 +1,77 @@ +/* Structure types for pre-termios terminal ioctls. Linux/powerpc version. + Copyright (C) 2014-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Get definition of constants for use with `ioctl'. */ +#include + + +struct winsize + { + unsigned short int ws_row; + unsigned short int ws_col; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; + }; + +#define NCC 10 +struct termio + { + unsigned short int c_iflag; /* input mode flags */ + unsigned short int c_oflag; /* output mode flags */ + unsigned short int c_cflag; /* control mode flags */ + unsigned short int c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Mobitex module */ +#define N_R3964 9 /* Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Profibus */ +#define N_IRDA 11 /* Linux IR */ +#define N_SMSBLOCK 12 /* SMS block mode */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 /* synchronous PPP */ +#define N_HCI 15 /* Bluetooth HCI UART */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/ipc-perm.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/ipc-perm.h new file mode 100644 index 0000000000..ff13f53218 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/ipc-perm.h @@ -0,0 +1,36 @@ +/* struct ipc_perm definition. Linux/powerpc version. + 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 + . */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ + __uint32_t __seq; /* Sequence number. */ + __uint32_t __pad1; + __uint64_t __glibc_reserved1; + __uint64_t __glibc_reserved2; + }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/iscanonical.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/iscanonical.h new file mode 100644 index 0000000000..288b2f2d8a --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/iscanonical.h @@ -0,0 +1,58 @@ +/* Define iscanonical macro. ldbl-128ibm version. + 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 + 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 + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#if defined (__NO_LONG_DOUBLE_MATH) || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# define iscanonical(x) ((void) (__typeof (x)) (x), 1) +#else +extern int __iscanonicall (long double __x) + __THROW __attribute__ ((__const__)); +# define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1) +# define __iscanonical(x) ((void) (__typeof (x)) (x), 1) +# if __HAVE_DISTINCT_FLOAT128 +# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1) +# endif + +/* Return nonzero value if X is canonical. In IEEE interchange binary + formats, all values are canonical, but the argument must still be + converted to its semantic type for any exceptions arising from the + conversion, before being discarded; in IBM long double, there are + encodings that are not consistently handled as corresponding to any + particular value of the type, and we return 0 for those. */ +# ifndef __cplusplus +# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) +# else +/* In C++ mode, __MATH_TG cannot be used, because it relies on + __builtin_types_compatible_p, which is a C-only builtin. On the + other hand, overloading provides the means to distinguish between + the floating-point types. The overloading resolution will match + the correct parameter (regardless of type qualifiers (i.e.: const + and volatile)). */ +extern "C++" { +inline int iscanonical (float __val) { return __iscanonicalf (__val); } +inline int iscanonical (double __val) { return __iscanonical (__val); } +inline int iscanonical (long double __val) { return __iscanonicall (__val); } +# if __HAVE_DISTINCT_FLOAT128 +inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } +# endif +} +# endif /* __cplusplus */ +#endif /* __NO_LONG_DOUBLE_MATH */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/link.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/link.h new file mode 100644 index 0000000000..fc234f741e --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/link.h @@ -0,0 +1,156 @@ +/* Machine-specific declarations for dynamic linker interface. PowerPC version + Copyright (C) 2004-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _LINK_H +# error "Never include directly; use instead." +#endif + + +#if __ELF_NATIVE_CLASS == 32 + +/* Registers for entry into PLT on PPC32. */ +typedef struct La_ppc32_regs +{ + uint32_t lr_reg[8]; + double lr_fp[8]; + uint32_t lr_vreg[12][4]; + uint32_t lr_r1; + uint32_t lr_lr; +} La_ppc32_regs; + +/* Return values for calls from PLT on PPC32. */ +typedef struct La_ppc32_retval +{ + uint32_t lrv_r3; + uint32_t lrv_r4; + double lrv_fp[8]; + uint32_t lrv_v2[4]; +} La_ppc32_retval; + + +__BEGIN_DECLS + +extern Elf32_Addr la_ppc32_gnu_pltenter (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_ppc32_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_ppc32_gnu_pltexit (Elf32_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_ppc32_regs *__inregs, + La_ppc32_retval *__outregs, + const char *__symname); + +__END_DECLS + +#elif __ELF_NATIVE_CLASS == 64 +# if _CALL_ELF != 2 + +/* Registers for entry into PLT on PPC64. */ +typedef struct La_ppc64_regs +{ + uint64_t lr_reg[8]; + double lr_fp[13]; + uint32_t __padding; + uint32_t lr_vrsave; + uint32_t lr_vreg[12][4]; + uint64_t lr_r1; + uint64_t lr_lr; +} La_ppc64_regs; + +/* Return values for calls from PLT on PPC64. */ +typedef struct La_ppc64_retval +{ + uint64_t lrv_r3; + uint64_t lrv_r4; + double lrv_fp[4]; /* f1-f4, float - complex long double. */ + uint32_t lrv_v2[4]; /* v2. */ +} La_ppc64_retval; + + +__BEGIN_DECLS + +extern Elf64_Addr la_ppc64_gnu_pltenter (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_ppc64_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_ppc64_gnu_pltexit (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_ppc64_regs *__inregs, + La_ppc64_retval *__outregs, + const char *__symname); + +__END_DECLS + +# else + +/* Registers for entry into PLT on PPC64 in the ELFv2 ABI. */ +typedef struct La_ppc64v2_regs +{ + uint64_t lr_reg[8]; + double lr_fp[13]; + uint32_t __padding; + uint32_t lr_vrsave; + uint32_t lr_vreg[12][4] __attribute__ ((aligned (16))); + uint64_t lr_r1; + uint64_t lr_lr; +} La_ppc64v2_regs; + +/* Return values for calls from PLT on PPC64 in the ELFv2 ABI. */ +typedef struct La_ppc64v2_retval +{ + uint64_t lrv_r3; + uint64_t lrv_r4; + double lrv_fp[10]; + uint32_t lrv_vreg[8][4] __attribute__ ((aligned (16))); +} La_ppc64v2_retval; + + +__BEGIN_DECLS + +extern Elf64_Addr la_ppc64v2_gnu_pltenter (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + La_ppc64v2_regs *__regs, + unsigned int *__flags, + const char *__symname, + long int *__framesizep); +extern unsigned int la_ppc64v2_gnu_pltexit (Elf64_Sym *__sym, + unsigned int __ndx, + uintptr_t *__refcook, + uintptr_t *__defcook, + const La_ppc64v2_regs *__inregs, + La_ppc64v2_retval *__outregs, + const char *__symname); + +__END_DECLS + +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/long-double.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/long-double.h new file mode 100644 index 0000000000..e3ec00d82b --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/long-double.h @@ -0,0 +1,25 @@ +/* Properties of long double type. ldbl-opt version. + 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 + modify it under the terms of the GNU Lesser General Public + License 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 + . */ + +#ifndef __NO_LONG_DOUBLE_MATH +# define __LONG_DOUBLE_MATH_OPTIONAL 1 +# ifndef __LONG_DOUBLE_128__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif +#endif +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/mman.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/mman.h new file mode 100644 index 0000000000..c920654b28 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/mman.h @@ -0,0 +1,53 @@ +/* Definitions for POSIX memory map interface. Linux/PowerPC version. + 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 + 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 + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + +#define PROT_SAO 0x10 /* Strong Access Ordering. */ + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x00800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x00080 /* Lock the mapping. */ +# define MAP_NORESERVE 0x00040 /* Don't check for reservations. */ +# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_STACK 0x20000 /* Allocation is for a stack. */ +# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */ +# define MAP_SYNC 0x80000 /* Perform synchronous page + faults for the mapping. */ +# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap + underlying mapping. */ +#endif + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 0x4000 /* Lock all additions to address + space. */ +#define MCL_ONFAULT 0x8000 /* Lock all pages that are + faulted in. */ + +/* Include generic Linux declarations. */ +#include \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/procfs.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/procfs.h new file mode 100644 index 0000000000..eabe87ff35 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/procfs.h @@ -0,0 +1,49 @@ +/* Types for registers for sys/procfs.h. PowerPC version. + 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 + 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 + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#include +#include + +/* These definitions are normally provided by ucontext.h via + asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define + them here. */ +#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H +#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ +#define ELF_NFPREG 33 /* includes fpscr */ +#if __WORDSIZE == 32 +# define ELF_NVRREG 33 /* includes vscr */ +#else +# define ELF_NVRREG 34 /* includes vscr */ +#endif + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +/* Altivec registers */ +typedef struct { + unsigned int u[4]; +} __attribute__ ((__aligned__ (16))) elf_vrreg_t; +typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/pthread_stack_min.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/pthread_stack_min.h new file mode 100644 index 0000000000..c8caed37b2 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/pthread_stack_min.h @@ -0,0 +1,21 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/PPC version. + Copyright (C) 2021 Free Software 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; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/setjmp.h new file mode 100644 index 0000000000..47eec4fe73 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/setjmp.h @@ -0,0 +1,50 @@ +/* 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 + 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 + . */ + +/* Define the machine-dependent type `jmp_buf'. PowerPC version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +/* The previous bits/setjmp.h had __jmp_buf defined as a structure. + We use an array of 'long int' instead, to make writing the + assembler easier. Naturally, user code should not depend on + either representation. */ + +#include + +/* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI + the vrsave must be at byte 248 & v20 at byte 256. So we must pad this + correctly on 32 bit. It also insists that vecregs are only gauranteed + 4 byte alignment so we need to use vperm in the setjmp/longjmp routines. + We have to version the code because members like int __mask_was_saved + in the jmp_buf will move as jmp_buf is now larger than 248 bytes. We + cannot keep the altivec jmp_buf backward compatible with the jmp_buf. */ +#ifndef _ASM +# if __WORDSIZE == 64 +typedef long int __jmp_buf[64] __attribute__ ((__aligned__ (16))); +# else +/* The alignment is not essential, i.e.the buffer can be copied to a 4 byte + aligned buffer as per the ABI it is just added for performance reasons. */ +typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16))); +# endif +#endif + +#endif /* bits/setjmp.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/sigstack.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/sigstack.h new file mode 100644 index 0000000000..f2371950e2 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/sigstack.h @@ -0,0 +1,32 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _BITS_SIGSTACK_H +#define _BITS_SIGSTACK_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never include this file directly. Use instead" +#endif + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 4096 + +/* System default stack size. */ +#define SIGSTKSZ 16384 + +#endif /* bits/sigstack.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/socket-constants.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/socket-constants.h new file mode 100644 index 0000000000..a6223eff27 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/socket-constants.h @@ -0,0 +1,70 @@ +/* Socket constants which vary among Linux architectures. Version for POWER. + 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 + 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 + . */ + +#ifndef _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +#define SOL_SOCKET 1 +#define SO_ACCEPTCONN 30 +#define SO_BROADCAST 6 +#define SO_DONTROUTE 5 +#define SO_ERROR 4 +#define SO_KEEPALIVE 9 +#define SO_LINGER 13 +#define SO_OOBINLINE 10 +#define SO_RCVBUF 8 +#define SO_RCVLOWAT 16 +#define SO_REUSEADDR 2 +#define SO_SNDBUF 7 +#define SO_SNDLOWAT 17 +#define SO_TYPE 3 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 18 +# define SO_SNDTIMEO 19 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 18 +# define SO_SNDTIMEO_OLD 19 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_mutex.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_mutex.h new file mode 100644 index 0000000000..708b22e85a --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_mutex.h @@ -0,0 +1,63 @@ +/* PowerPC internal mutex struct definitions. + 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 + 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 + . */ + +#ifndef _THREAD_MUTEX_INTERNAL_H +#define _THREAD_MUTEX_INTERNAL_H 1 + +struct __pthread_mutex_s +{ + int __lock; + unsigned int __count; + int __owner; +#if __WORDSIZE == 64 + unsigned int __nusers; +#endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; +#if __WORDSIZE == 64 + short __spins; + short __elision; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else + unsigned int __nusers; + __extension__ union + { + struct + { + short __espins; + short __elision; +# define __spins __elision_data.__espins +# define __elision __elision_data.__elision + } __elision_data; + __pthread_slist_t __list; + }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif +}; + +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, 0, __kind, 0, 0, { 0, 0 } +#else +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, __kind, 0, { { 0, 0 } } +#endif + +#endif \ No newline at end of file diff --git a/lib/libc/include/mips-linux-gnu/bits/struct_rwlock.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_rwlock.h similarity index 69% rename from lib/libc/include/mips-linux-gnu/bits/struct_rwlock.h rename to lib/libc/include/powerpc-linux-gnueabihf/bits/struct_rwlock.h index 6355f539b9..5d5bc3f894 100644 --- a/lib/libc/include/mips-linux-gnu/bits/struct_rwlock.h +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_rwlock.h @@ -1,5 +1,6 @@ -/* MIPS internal rwlock struct definitions. +/* PowerPC internal rwlock struct definitions. Copyright (C) 2019-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,45 +28,34 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; -#if _MIPS_SIM == _ABI64 +#if __WORDSIZE == 64 int __cur_writer; int __shared; - unsigned long int __pad1; + unsigned char __rwelision; + unsigned char __pad1[7]; unsigned long int __pad2; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; -# else -# if __BYTE_ORDER == __BIG_ENDIAN - unsigned char __pad1; +# define __PTHREAD_RWLOCK_ELISION_EXTRA 0, {0, 0, 0, 0, 0, 0, 0 } +#else + unsigned char __rwelision; unsigned char __pad2; unsigned char __shared; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned char __flags; -# 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 }; -#if _MIPS_SIM == _ABI64 +#if __WORDSIZE == 64 # define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags + 0, 0, 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, __flags #else -# if __BYTE_ORDER == __BIG_ENDIAN -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 -# else -# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ - 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 -# endif +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __PTHREAD_RWLOCK_ELISION_EXTRA, 0, 0, __flags, 0 #endif #endif \ No newline at end of file diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_stat.h similarity index 79% rename from lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h rename to lib/libc/include/powerpc-linux-gnueabihf/bits/struct_stat.h index 61781bd902..3faed3a29b 100644 --- a/lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/bits/stat.h +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/struct_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1992-2020 Free Software Foundation, Inc. +/* Definition for struct stat. + Copyright (C) 2020-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -12,104 +13,49 @@ 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 + License along with the GNU C Library. If not, see . */ #if !defined _SYS_STAT_H && !defined _FCNTL_H -# error "Never include directly; use instead." +# error "Never include directly; use instead." #endif -#ifndef _BITS_STAT_H -#define _BITS_STAT_H 1 +#ifndef _BITS_STRUCT_STAT_H +#define _BITS_STRUCT_STAT_H 1 #include -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 #if __WORDSIZE == 32 -# define _STAT_VER _STAT_VER_LINUX -#else -# define _STAT_VER _STAT_VER_KERNEL -#endif - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -#if __WORDSIZE == 32 - struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 unsigned short int __pad1; __ino_t st_ino; /* File serial number. */ -# else +# else __ino64_t st_ino; /* File serial number. */ -# endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -# else +# else __off64_t st_size; /* Size of file, in bytes. */ -# endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - - -# ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -133,6 +79,50 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ + }; + +# ifdef __USE_LARGEFILE64 +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ }; # endif /* __USE_LARGEFILE64 */ @@ -232,44 +222,10 @@ struct stat64 # endif /* __USE_LARGEFILE64 */ #endif - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV /* Nanosecond resolution time values are supported. */ #define _STATBUF_ST_NSEC -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ - -#ifdef __USE_ATFILE -# define UTIME_NOW ((1l << 30) - 1l) -# define UTIME_OMIT ((1l << 30) - 2l) -#endif - -#endif /* bits/stat.h */ +#endif /* _BITS_STRUCT_STAT_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-baud.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-baud.h new file mode 100644 index 0000000000..4ee2f824bf --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-baud.h @@ -0,0 +1,45 @@ +/* termios baud rate selection definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#ifdef __USE_MISC +# define CBAUD 0000377 +# define CBAUDEX 0000020 +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 +#define __MAX_BAUD B4000000 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cc.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cc.h new file mode 100644 index 0000000000..32283b153f --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cc.h @@ -0,0 +1,41 @@ +/* termios c_cc symbolic constant definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VMIN 5 +#define VEOL 6 +#define VTIME 7 +#define VEOL2 8 +#define VSWTC 9 + +#define VWERASE 10 +#define VREPRINT 11 +#define VSUSP 12 +#define VSTART 13 +#define VSTOP 14 +#define VLNEXT 15 +#define VDISCARD 16 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cflag.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cflag.h new file mode 100644 index 0000000000..01c2a123b5 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_cflag.h @@ -0,0 +1,35 @@ +/* termios control mode definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#define CSIZE 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 + +#define CSTOPB 00002000 +#define CREAD 00004000 +#define PARENB 00010000 +#define PARODD 00020000 +#define HUPCL 00040000 + +#define CLOCAL 00100000 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_iflag.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_iflag.h new file mode 100644 index 0000000000..4df494e6dc --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_iflag.h @@ -0,0 +1,38 @@ +/* termios input mode definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#define IXANY 0004000 +#define IUCLC 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_lflag.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_lflag.h new file mode 100644 index 0000000000..ee2291cc56 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_lflag.h @@ -0,0 +1,45 @@ +/* termios local mode definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# define XCASE 0x00004000 +#endif +#define ECHO 0x00000008 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define NOFLSH 0x80000000 +#define TOSTOP 0x00400000 +#ifdef __USE_MISC +# define ECHOCTL 0x00000040 +# define ECHOPRT 0x00000020 +# define ECHOKE 0x00000001 +# define FLUSHO 0x00800000 +# define PENDIN 0x20000000 +#endif +#define IEXTEN 0x00000400 +#ifdef __USE_MISC +# define EXTPROC 0x10000000 +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_oflag.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_oflag.h new file mode 100644 index 0000000000..a875d23d4f --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-c_oflag.h @@ -0,0 +1,65 @@ +/* termios output mode definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +/* c_oflag bits */ +#define OPOST 0000001 +#define ONLCR 0000002 +#define OLCUC 0000004 + +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 + +#define OFILL 00000100 +#define OFDEL 00000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 00001400 +# define NL0 00000000 +# define NL1 00000400 +# if defined __USE_MISC +# define NL2 00001000 +# define NL3 00001400 +# endif +# define TABDLY 00006000 +# define TAB0 00000000 +# define TAB1 00002000 +# define TAB2 00004000 +# define TAB3 00006000 +# define CRDLY 00030000 +# define CR0 00000000 +# define CR1 00010000 +# define CR2 00020000 +# define CR3 00030000 +# define FFDLY 00040000 +# define FF0 00000000 +# define FF1 00040000 +# define BSDLY 00100000 +# define BS0 00000000 +# define BS1 00100000 +#endif +#define VTDLY 00200000 +#define VT0 00000000 +#define VT1 00200000 + +#ifdef __USE_MISC +# define XTABS 00006000 +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-misc.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-misc.h new file mode 100644 index 0000000000..dc3fb15aa7 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/termios-misc.h @@ -0,0 +1,72 @@ +/* termios baud platform specific definitions. Linux/powerpc version. + 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 + 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 + . */ + +#ifndef _TERMIOS_H +# error "Never include directly; use instead." +#endif + +#ifdef __USE_MISC + +struct sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + short sg_flags; +}; + +struct tchars { + char t_intrc; + char t_quitc; + char t_startc; + char t_stopc; + char t_eofc; + char t_brkc; +}; + +struct ltchars { + char t_suspc; + char t_dsuspc; + char t_rprntc; + char t_flushc; + char t_werasc; + char t_lnextc; +}; + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +/* c_cc characters */ +#define _VINTR 0 +#define _VQUIT 1 +#define _VERASE 2 +#define _VKILL 3 +#define _VEOF 4 +#define _VMIN 5 +#define _VEOL 6 +#define _VTIME 7 +#define _VEOL2 8 +#define _VSWTC 9 + +#endif /* __USE_MISC */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_msqid_ds.h new file mode 100644 index 0000000000..52cc930886 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_msqid_ds.h @@ -0,0 +1,53 @@ +/* Linux/PowerPC implementation of the SysV message struct msqid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm msg_perm; /* structure describing operation permission */ +# if __TIMESIZE == 32 + unsigned long int __msg_stime_high; + __time_t msg_stime; /* time of last msgsnd command */ + unsigned long int __msg_rtime_high; + __time_t msg_rtime; /* time of last msgsnd command */ + unsigned long int __msg_ctime_high; + __time_t msg_ctime; /* time of last change */ +# else + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgsnd command */ + __time_t msg_ctime; /* time of last change */ +# endif + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_semid_ds.h new file mode 100644 index 0000000000..d70967d6e0 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_semid_ds.h @@ -0,0 +1,43 @@ +/* PowerPC implementation of the semaphore struct semid_ds. + 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 + . */ + +#ifndef _SYS_SEM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm sem_perm; /* operation permission struct */ +# if __TIMESIZE == 32 + __syscall_ulong_t __sem_otime_high; + __time_t sem_otime; /* last semop() time */ + __syscall_ulong_t __sem_ctime_high; + __time_t sem_ctime; /* last time changed by semctl() */ +# else + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ +# endif + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; +#endif +}; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_shmid_ds.h new file mode 100644 index 0000000000..6a47b1c39f --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/types/struct_shmid_ds.h @@ -0,0 +1,50 @@ +/* Linux/PowerPC implementation of the shared memory struct shmid_ds. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_SHM_H +# error "Never include directly; use instead." +#endif + +/* Data structure describing a shared memory segment. */ +struct shmid_ds + { +#ifdef __USE_TIME_BITS64 +# include +#else + struct ipc_perm shm_perm; /* operation permission struct */ +# if __TIMESIZE == 32 + unsigned long int __shm_atime_high; + __time_t shm_atime; /* time of last shmat() */ + unsigned long int __shm_dtime_high; + __time_t shm_dtime; /* time of last shmdt() */ + unsigned long int __shm_ctime_high; + __time_t shm_ctime; /* time of last change by shmctl() */ + unsigned long int __glibc_reserved4; +# else + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ +# endif + size_t shm_segsz; /* size of segment in bytes */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ + __syscall_ulong_t __glibc_reserved5; + __syscall_ulong_t __glibc_reserved6; +#endif + }; \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/powerpc-linux-gnueabihf/bits/wordsize.h new file mode 100644 index 0000000000..37836f9d4e --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/bits/wordsize.h @@ -0,0 +1,11 @@ +/* Determine the wordsize from the preprocessor defines. */ + +#if defined __powerpc64__ +# define __WORDSIZE 64 +# define __WORDSIZE_TIME64_COMPAT32 1 +#else +# define __WORDSIZE 32 +# define __WORDSIZE_TIME64_COMPAT32 0 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/fpu_control.h b/lib/libc/include/powerpc-linux-gnueabihf/fpu_control.h new file mode 100644 index 0000000000..7f66352f1a --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/fpu_control.h @@ -0,0 +1,114 @@ +/* FPU control word definitions. PowerPC version. + 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 + 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 + . */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +#if defined __SPE__ || (defined __NO_FPRS__ && !defined _SOFT_FLOAT) +# error "SPE/e500 is no longer supported" +#endif + +#ifdef _SOFT_FLOAT + +# define _FPU_RESERVED 0xffffffff +# define _FPU_DEFAULT 0x00000000 /* Default value. */ +typedef unsigned int fpu_control_t; +# define _FPU_GETCW(cw) (cw) = 0 +# define _FPU_SETCW(cw) (void) (cw) +extern fpu_control_t __fpu_control; + +#else /* PowerPC 6xx floating-point. */ + +/* rounding control */ +# define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */ +# define _FPU_RC_DOWN 0x03 +# define _FPU_RC_UP 0x02 +# define _FPU_RC_ZERO 0x01 + +# define _FPU_MASK_RC (_FPU_RC_NEAREST|_FPU_RC_DOWN|_FPU_RC_UP|_FPU_RC_ZERO) + +# define _FPU_MASK_NI 0x04 /* non-ieee mode */ + +/* masking of interrupts */ +# define _FPU_MASK_ZM 0x10 /* zero divide */ +# define _FPU_MASK_OM 0x40 /* overflow */ +# define _FPU_MASK_UM 0x20 /* underflow */ +# define _FPU_MASK_XM 0x08 /* inexact */ +# define _FPU_MASK_IM 0x80 /* invalid operation */ + +# define _FPU_RESERVED 0xffffff00 /* These bits are reserved are not changed. */ + +/* The fdlibm code requires no interrupts for exceptions. */ +# define _FPU_DEFAULT 0x00000000 /* Default value. */ + +/* IEEE: same as above, but (some) exceptions; + we leave the 'inexact' exception off. + */ +# define _FPU_IEEE 0x000000f0 + +/* Type of the control word. */ +typedef unsigned int fpu_control_t; + +/* Macros for accessing the hardware control word. */ +# define _FPU_GETCW(cw) \ + ({union { double __d; unsigned long long __ll; } __u; \ + __asm__ __volatile__("mffs %0" : "=f" (__u.__d)); \ + (cw) = (fpu_control_t) __u.__ll; \ + (fpu_control_t) __u.__ll; \ + }) + +# define _FPU_GET_RC_ISA300() \ + ({union { double __d; unsigned long long __ll; } __u; \ + __asm__ __volatile__( \ + ".machine push; .machine \"power9\"; mffsl %0; .machine pop" \ + : "=f" (__u.__d)); \ + (fpu_control_t) (__u.__ll & _FPU_MASK_RC); \ + }) + +# ifdef _ARCH_PWR9 +# define _FPU_GET_RC() _FPU_GET_RC_ISA300() +# elif defined __BUILTIN_CPU_SUPPORTS__ +# define _FPU_GET_RC() \ + ({fpu_control_t __rc; \ + __rc = __glibc_likely (__builtin_cpu_supports ("arch_3_00")) \ + ? _FPU_GET_RC_ISA300 () \ + : _FPU_GETCW (__rc) & _FPU_MASK_RC; \ + __rc; \ + }) +# else +# define _FPU_GET_RC() \ + ({fpu_control_t __rc = _FPU_GETCW (__rc) & _FPU_MASK_RC; \ + __rc; \ + }) +# endif + +# define _FPU_SETCW(cw) \ + { union { double __d; unsigned long long __ll; } __u; \ + register double __fr; \ + __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */ \ + __u.__ll |= (cw) & 0xffffffffLL; \ + __fr = __u.__d; \ + __asm__ __volatile__("mtfsf 255,%0" : : "f" (__fr)); \ + } + +/* Default control word set at startup. */ +extern fpu_control_t __fpu_control; + +#endif /* PowerPC 6xx floating-point. */ + +#endif /* _FPU_CONTROL_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names-32.h b/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names-32.h new file mode 100644 index 0000000000..7dfe5a7147 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names-32.h @@ -0,0 +1,29 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_SO "ld.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names.h b/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names.h new file mode 100644 index 0000000000..a6fbab8035 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/gnu/lib-names.h @@ -0,0 +1,19 @@ +/* This file is automatically generated. + It defines macros to allow user program to find the shared + library files which come as part of GNU libc. */ +#ifndef __GNU_LIB_NAMES_H +#define __GNU_LIB_NAMES_H 1 + +#include + +#if __WORDSIZE == 32 +# include +#endif +#if __WORDSIZE == 64 && _CALL_ELF != 2 +# include +#endif +#if __WORDSIZE == 64 && _CALL_ELF == 2 +# include +#endif + +#endif /* gnu/lib-names.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/gnu/stubs.h b/lib/libc/include/powerpc-linux-gnueabihf/gnu/stubs.h new file mode 100644 index 0000000000..d130565a35 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/gnu/stubs.h @@ -0,0 +1,15 @@ +/* This file is automatically generated. + This file selects the right generated file of `__stub_FUNCTION' macros + based on the architecture being compiled for. */ + +#include + +#if __WORDSIZE == 32 +# include +#endif +#if __WORDSIZE == 64 && _CALL_ELF != 2 +# include +#endif +#if __WORDSIZE == 64 && _CALL_ELF == 2 +# include +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/ieee754.h b/lib/libc/include/powerpc-linux-gnueabihf/ieee754.h new file mode 100644 index 0000000000..78bbb343c4 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/ieee754.h @@ -0,0 +1,197 @@ +/* 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 + 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 + . */ + +#ifndef _IEEE754_H +#define _IEEE754_H 1 + +#include + +#include +#include + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + + +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +/* long double is IEEE 128 bit */ +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 quad-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:16; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:16; + unsigned int exponent:15; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:15; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:15; + unsigned int mantissa1:32; + unsigned int mantissa2:32; + unsigned int mantissa3:32; +#else + /* Together these comprise the mantissa. */ + unsigned int mantissa3:32; + unsigned int mantissa2:32; + unsigned int mantissa1:32; + unsigned int mantissa0:15; + unsigned int quiet_nan:1; + unsigned int exponent:15; + unsigned int negative:1; +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ +#endif + + +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 || __GNUC_PREREQ (7, 0) +/* IBM extended format for long double. + + Each long double is made up of two IEEE doubles. The value of the + long double is the sum of the values of the two parts. The most + significant part is required to be the value of the long double + rounded to the nearest double, as specified by IEEE. For Inf + values, the least significant part is required to be one of +0.0 or + -0.0. No other requirements are made; so, for example, 1.0 may be + represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a + NaN is don't-care. */ +union ibm_extended_long_double + { +# if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && __GNUC_PREREQ (7, 0) + __ibm128 ld; +# else + long double ld; +# endif + union ieee754_double d[2]; + }; +#endif + +__END_DECLS + +#endif /* ieee754.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/sys/ptrace.h b/lib/libc/include/powerpc-linux-gnueabihf/sys/ptrace.h new file mode 100644 index 0000000000..a0134d5dfe --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/sys/ptrace.h @@ -0,0 +1,272 @@ +/* `ptrace' debugger support interface. Linux/PowerPC version. + 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 + 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 + . */ + +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H 1 + +#include +#include + +__BEGIN_DECLS + +#if defined _LINUX_PTRACE_H || defined _ASM_POWERPC_PTRACE_H +/* Do not let Linux headers macros interfere with enum __ptrace_request. */ +# undef PTRACE_ATTACH +# undef PTRACE_CONT +# undef PTRACE_DETACH +# undef PTRACE_GET_DEBUGREG +# undef PTRACE_GETEVENTMSG +# undef PTRACE_GETEVRREGS +# undef PTRACE_GETFPREGS +# undef PTRACE_GETREGS +# undef PTRACE_GETREGS64 +# undef PTRACE_GETREGSET +# undef PTRACE_GETSIGINFO +# undef PTRACE_GETSIGMASK +# undef PTRACE_GET_SYSCALL_INFO +# undef PTRACE_GETVRREGS +# undef PTRACE_GETVSRREGS +# undef PTRACE_INTERRUPT +# undef PTRACE_KILL +# undef PTRACE_LISTEN +# undef PTRACE_PEEKDATA +# undef PTRACE_PEEKSIGINFO +# undef PTRACE_PEEKTEXT +# undef PTRACE_POKEDATA +# undef PTRACE_POKETEXT +# undef PTRACE_SECCOMP_GET_FILTER +# undef PTRACE_SECCOMP_GET_METADATA +# undef PTRACE_SEIZE +# undef PTRACE_SET_DEBUGREG +# undef PTRACE_SETEVRREGS +# undef PTRACE_SETFPREGS +# undef PTRACE_SETOPTIONS +# undef PTRACE_SETREGS +# undef PTRACE_SETREGS64 +# undef PTRACE_SETREGSET +# undef PTRACE_SETSIGINFO +# undef PTRACE_SETSIGMASK +# undef PTRACE_SETVRREGS +# undef PTRACE_SETVSRREGS +# undef PTRACE_SINGLEBLOCK +# undef PTRACE_SINGLESTEP +# undef PTRACE_SYSCALL +# undef PTRACE_SYSCALL_INFO_NONE +# undef PTRACE_SYSCALL_INFO_ENTRY +# undef PTRACE_SYSCALL_INFO_EXIT +# undef PTRACE_SYSCALL_INFO_SECCOMP +# undef PTRACE_SYSEMU +# undef PTRACE_SYSEMU_SINGLESTEP +# undef PTRACE_TRACEME +#endif + +/* Type of the REQUEST argument to `ptrace.' */ +enum __ptrace_request +{ + /* Indicate that the process making this request should be traced. + All signals received by this process can be intercepted by its + parent, and its parent can use the other `ptrace' requests. */ + PTRACE_TRACEME = 0, +#define PT_TRACE_ME PTRACE_TRACEME + + /* Return the word in the process's text space at address ADDR. */ + PTRACE_PEEKTEXT = 1, +#define PT_READ_I PTRACE_PEEKTEXT + + /* Return the word in the process's data space at address ADDR. */ + PTRACE_PEEKDATA = 2, +#define PT_READ_D PTRACE_PEEKDATA + + /* Return the word in the process's user area at offset ADDR. */ + PTRACE_PEEKUSER = 3, +#define PT_READ_U PTRACE_PEEKUSER + + /* Write the word DATA into the process's text space at address ADDR. */ + PTRACE_POKETEXT = 4, +#define PT_WRITE_I PTRACE_POKETEXT + + /* Write the word DATA into the process's data space at address ADDR. */ + PTRACE_POKEDATA = 5, +#define PT_WRITE_D PTRACE_POKEDATA + + /* Write the word DATA into the process's user area at offset ADDR. */ + PTRACE_POKEUSER = 6, +#define PT_WRITE_U PTRACE_POKEUSER + + /* Continue the process. */ + PTRACE_CONT = 7, +#define PT_CONTINUE PTRACE_CONT + + /* Kill the process. */ + PTRACE_KILL = 8, +#define PT_KILL PTRACE_KILL + + /* Single step the process. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + + /* Get all general purpose registers used by a process. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a process. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a process. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a process. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + + /* Attach to a process that is already running. */ + PTRACE_ATTACH = 16, +#define PT_ATTACH PTRACE_ATTACH + + /* Detach from a process attached to with PTRACE_ATTACH. */ + PTRACE_DETACH = 17, +#define PT_DETACH PTRACE_DETACH + + /* Get all altivec registers used by a process. */ + PTRACE_GETVRREGS = 18, +#define PT_GETVRREGS PTRACE_GETVRREGS + + /* Set all altivec registers used by a process. */ + PTRACE_SETVRREGS = 19, +#define PT_SETVRREGS PTRACE_SETVRREGS + + /* Get all SPE registers used by a process. */ + PTRACE_GETEVRREGS = 20, +#define PT_GETEVRREGS PTRACE_GETEVRREGS + + /* Set all SPE registers used by a process. */ + PTRACE_SETEVRREGS = 21, +#define PT_SETEVRREGS PTRACE_SETEVRREGS + + /* Same as PTRACE_GETREGS except a 32-bit process will obtain + the full 64-bit registers. Implemented by 64-bit kernels only. */ + PTRACE_GETREGS64 = 22, +#define PT_GETREGS64 PTRACE_GETREGS64 + + /* Same as PTRACE_SETREGS except a 32-bit process will set + the full 64-bit registers. Implemented by 64-bit kernels only. */ + PTRACE_SETREGS64 = 23, +#define PT_SETREGS64 PTRACE_SETREGS64 + + /* Continue and stop at the next entry to or return from syscall. */ + PTRACE_SYSCALL = 24, +#define PT_SYSCALL PTRACE_SYSCALL + + /* Get a debug register of a process. */ + PTRACE_GET_DEBUGREG = 25, +#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG + + /* Set a debug register of a process. */ + PTRACE_SET_DEBUGREG = 26, +#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG + + /* Get the first 32 VSX registers of a process. */ + PTRACE_GETVSRREGS = 27, +#define PT_GETVSRREGS PTRACE_GETVSRREGS + + /* Set the first 32 VSX registers of a process. */ + PTRACE_SETVSRREGS = 28, +#define PT_SETVSRREGS PTRACE_SETVSRREGS + + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 29, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 30, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + + /* Execute process until next taken branch. */ + PTRACE_SINGLEBLOCK = 256, +#define PT_STEPBLOCK PTRACE_SINGLEBLOCK + + /* Set ptrace filter options. */ + PTRACE_SETOPTIONS = 0x4200, +#define PT_SETOPTIONS PTRACE_SETOPTIONS + + /* Get last ptrace message. */ + PTRACE_GETEVENTMSG = 0x4201, +#define PT_GETEVENTMSG PTRACE_GETEVENTMSG + + /* Get siginfo for process. */ + PTRACE_GETSIGINFO = 0x4202, +#define PT_GETSIGINFO PTRACE_GETSIGINFO + + /* Set new siginfo for process. */ + PTRACE_SETSIGINFO = 0x4203, +#define PT_SETSIGINFO PTRACE_SETSIGINFO + + /* Get register content. */ + PTRACE_GETREGSET = 0x4204, +#define PTRACE_GETREGSET PTRACE_GETREGSET + + /* Set register content. */ + PTRACE_SETREGSET = 0x4205, +#define PTRACE_SETREGSET PTRACE_SETREGSET + + /* Like PTRACE_ATTACH, but do not force tracee to trap and do not affect + signal or group stop state. */ + PTRACE_SEIZE = 0x4206, +#define PTRACE_SEIZE PTRACE_SEIZE + + /* Trap seized tracee. */ + PTRACE_INTERRUPT = 0x4207, +#define PTRACE_INTERRUPT PTRACE_INTERRUPT + + /* Wait for next group event. */ + PTRACE_LISTEN = 0x4208, +#define PTRACE_LISTEN PTRACE_LISTEN + + /* Retrieve siginfo_t structures without removing signals from a queue. */ + PTRACE_PEEKSIGINFO = 0x4209, +#define PTRACE_PEEKSIGINFO PTRACE_PEEKSIGINFO + + /* Get the mask of blocked signals. */ + PTRACE_GETSIGMASK = 0x420a, +#define PTRACE_GETSIGMASK PTRACE_GETSIGMASK + + /* Change the mask of blocked signals. */ + PTRACE_SETSIGMASK = 0x420b, +#define PTRACE_SETSIGMASK PTRACE_SETSIGMASK + + /* Get seccomp BPF filters. */ + PTRACE_SECCOMP_GET_FILTER = 0x420c, +#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER + + /* Get seccomp BPF filter metadata. */ + PTRACE_SECCOMP_GET_METADATA = 0x420d, +#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA + + /* Get information about system call. */ + PTRACE_GET_SYSCALL_INFO = 0x420e +#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO +}; + + +#include + +__END_DECLS + +#endif /* _SYS_PTRACE_H */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/powerpc-linux-gnueabihf/sys/ucontext.h new file mode 100644 index 0000000000..a48adedb95 --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/sys/ucontext.h @@ -0,0 +1,200 @@ +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +struct __ctx(pt_regs); + +#if __WORDSIZE == 32 + +/* Number of general registers. */ +# define __NGREG 48 +# ifdef __USE_MISC +# define NGREG __NGREG +# endif + +/* Container for all general registers. */ +typedef unsigned long gregset_t[__NGREG]; + +/* Container for floating-point registers and status */ +typedef struct _libc_fpstate +{ + double __ctx(fpregs)[32]; + double __ctx(fpscr); + unsigned int _pad[2]; +} fpregset_t; + +/* Container for Altivec/VMX registers and status. + Needs to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int __ctx(vrregs)[32][4]; + unsigned int __ctx(vrsave); + unsigned int _pad[2]; + unsigned int __ctx(vscr); +} vrregset_t; + +/* Context to describe whole processor state. */ +typedef struct +{ + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + vrregset_t __ctx(vrregs) __attribute__((__aligned__(16))); +} mcontext_t; + +#else + +/* For 64-bit kernels with Altivec support, a machine context is exactly + * a sigcontext. For older kernel (without Altivec) the sigcontext matches + * the mcontext upto but not including the v_regs field. For kernels that + * don't set AT_HWCAP or return AT_HWCAP without PPC_FEATURE_HAS_ALTIVEC the + * v_regs field may not exist and should not be referenced. The v_regs field + * can be referenced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC + * is set in AT_HWCAP. */ + +/* Number of general registers. */ +# define __NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */ +# define __NFPREG 33 /* includes fp0-fp31 &fpscr. */ +# define __NVRREG 34 /* includes v0-v31, vscr, & vrsave in + split vectors */ +# ifdef __USE_MISC +# define NGREG __NGREG +# define NFPREG __NFPREG +# define NVRREG __NVRREG +# endif + +typedef unsigned long gregset_t[__NGREG]; +typedef double fpregset_t[__NFPREG]; + +/* Container for Altivec/VMX Vector Status and Control Register. Only 32-bits + but can only be copied to/from a 128-bit vector register. So we allocated + a whole quadword speedup save/restore. */ +typedef struct _libc_vscr +{ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned int __pad[3]; + unsigned int __ctx(vscr_word); +#else + unsigned int __ctx(vscr_word); + unsigned int __pad[3]; +#endif +} vscr_t; + +/* Container for Altivec/VMX registers and status. + Must to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int __ctx(vrregs)[32][4]; + vscr_t __ctx(vscr); + unsigned int __ctx(vrsave); + unsigned int __pad[3]; +} vrregset_t __attribute__((__aligned__(16))); + +typedef struct { + unsigned long __glibc_reserved[4]; + int __ctx(signal); + int __pad0; + unsigned long __ctx(handler); + unsigned long __ctx(oldmask); + struct __ctx(pt_regs) *__ctx(regs); + gregset_t __ctx(gp_regs); + fpregset_t __ctx(fp_regs); +/* + * To maintain compatibility with current implementations the sigcontext is + * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) + * followed by an unstructured (vmx_reserve) field of 69 doublewords. This + * allows the array of vector registers to be quadword aligned independent of + * the alignment of the containing sigcontext or ucontext. It is the + * responsibility of the code setting the sigcontext to set this pointer to + * either NULL (if this processor does not support the VMX feature) or the + * address of the first quadword within the allocated (vmx_reserve) area. + * + * The pointer (v_regs) of vector type (elf_vrreg_t) is essentially + * an array of 34 quadword entries. The entries with + * indexes 0-31 contain the corresponding vector registers. The entry with + * index 32 contains the vscr as the last word (offset 12) within the + * quadword. This allows the vscr to be stored as either a quadword (since + * it must be copied via a vector register to/from storage) or as a word. + * The entry with index 33 contains the vrsave as the first word (offset 0) + * within the quadword. + */ + vrregset_t *__ctx(v_regs); + long __ctx(vmx_reserve)[__NVRREG+__NVRREG+1]; +} mcontext_t; + +#endif + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; +#if __WORDSIZE == 32 + /* + * These fields are set up this way to maximize source and + * binary compatibility with code written for the old + * ucontext_t definition, which didn't include space for the + * registers. + * + * Different versions of the kernel have stored the registers on + * signal delivery at different offsets from the ucontext struct. + * Programs should thus use the uc_mcontext.uc_regs pointer to + * find where the registers are actually stored. The registers + * will be stored within the ucontext_t struct but not necessarily + * at a fixed address. As a side-effect, this lets us achieve + * 16-byte alignment for the register storage space if the + * Altivec registers are to be saved, without requiring 16-byte + * alignment on the whole ucontext_t. + * + * The uc_mcontext.regs field is included for source compatibility + * with programs written against the older ucontext_t definition, + * and its name should therefore not change. The uc_pad field + * is for binary compatibility with programs compiled against the + * old ucontext_t; it ensures that uc_mcontext.regs and uc_sigmask + * are at the same offset as previously. + */ + int __glibc_reserved1[7]; + union __ctx(uc_regs_ptr) { + struct __ctx(pt_regs) *__ctx(regs); + mcontext_t *__ctx(uc_regs); + } uc_mcontext; + sigset_t uc_sigmask; + /* last for extensibility */ + char __ctx(uc_reg_space)[sizeof (mcontext_t) + 12]; +#else /* 64-bit */ + sigset_t uc_sigmask; + mcontext_t uc_mcontext; /* last for extensibility */ +#endif + } ucontext_t; + +#undef __ctx + +#endif /* sys/ucontext.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-linux-gnueabihf/sys/user.h b/lib/libc/include/powerpc-linux-gnueabihf/sys/user.h new file mode 100644 index 0000000000..c18c39983b --- /dev/null +++ b/lib/libc/include/powerpc-linux-gnueabihf/sys/user.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1998-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 + . */ + +#ifndef _SYS_USER_H + +#define _SYS_USER_H 1 +#include +#include + +#include + +struct user { + struct pt_regs regs; /* entire machine state */ + size_t u_tsize; /* text size (pages) */ + size_t u_dsize; /* data size (pages) */ + size_t u_ssize; /* stack size (pages) */ + unsigned long start_code; /* text starting address */ + unsigned long start_data; /* data starting address */ + unsigned long start_stack; /* stack starting address */ + long int signal; /* signal causing core dump */ + struct regs * u_ar0; /* help gdb find registers */ + unsigned long magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#endif /* sys/user.h */ \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h deleted file mode 100644 index 5416e4d6cf..0000000000 --- a/lib/libc/include/powerpc64-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2021 Free Software 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; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages for systems with 64k - pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/powerpc64-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..c8caed37b2 --- /dev/null +++ b/lib/libc/include/powerpc64-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,21 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/PPC version. + Copyright (C) 2021 Free Software 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; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h index 64f96f535c..a6223eff27 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 10 #define SO_RCVBUF 8 #define SO_RCVLOWAT 16 -#define SO_RCVTIMEO 18 #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_SNDLOWAT 17 -#define SO_SNDTIMEO 19 -#define SO_TYPE 3 \ No newline at end of file +#define SO_TYPE 3 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 18 +# define SO_SNDTIMEO 19 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 18 +# define SO_SNDTIMEO_OLD 19 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h b/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h index 805594defd..3faed3a29b 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/struct_stat.h @@ -26,74 +26,36 @@ #include #if __WORDSIZE == 32 - struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 unsigned short int __pad1; __ino_t st_ino; /* File serial number. */ -# else +# else __ino64_t st_ino; /* File serial number. */ -# endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -# else +# else __off64_t st_size; /* Size of file, in bytes. */ -# endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - - -# ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -117,6 +79,50 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ + }; + +# ifdef __USE_LARGEFILE64 +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ }; # endif /* __USE_LARGEFILE64 */ diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h index 65856a4231..52cc930886 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h index df168a5b57..d70967d6e0 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h index 82e25d77a9..6a47b1c39f 100644 --- a/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc64-linux-gnu/bits/types/struct_shmid_ds.h @@ -23,8 +23,11 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __shm_atime_high; __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_dtime_high; @@ -32,15 +35,16 @@ struct shmid_ds unsigned long int __shm_ctime_high; __time_t shm_ctime; /* time of last change by shmctl() */ unsigned long int __glibc_reserved4; -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif size_t shm_segsz; /* size of segment in bytes */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64-linux-gnu/gnu/lib-names-64-v1.h b/lib/libc/include/powerpc64-linux-gnu/gnu/lib-names-64-v1.h index 22c0732548..d6398763ed 100644 --- a/lib/libc/include/powerpc64-linux-gnu/gnu/lib-names-64-v1.h +++ b/lib/libc/include/powerpc64-linux-gnu/gnu/lib-names-64-v1.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h index 5c5d5addee..a0134d5dfe 100644 --- a/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc64-linux-gnu/sys/ptrace.h @@ -70,6 +70,8 @@ __BEGIN_DECLS # undef PTRACE_SYSCALL_INFO_ENTRY # undef PTRACE_SYSCALL_INFO_EXIT # undef PTRACE_SYSCALL_INFO_SECCOMP +# undef PTRACE_SYSEMU +# undef PTRACE_SYSEMU_SINGLESTEP # undef PTRACE_TRACEME #endif @@ -188,6 +190,14 @@ enum __ptrace_request PTRACE_SETVSRREGS = 28, #define PT_SETVSRREGS PTRACE_SETVSRREGS + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 29, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 30, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + /* Execute process until next taken branch. */ PTRACE_SINGLEBLOCK = 256, #define PT_STEPBLOCK PTRACE_SINGLEBLOCK diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h b/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h deleted file mode 100644 index 5416e4d6cf..0000000000 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux/PPC version. - Copyright (C) 1993-2021 Free Software 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; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. At least two pages for systems with 64k - pages. */ -#define PTHREAD_STACK_MIN 131072 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/powerpc64le-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..c8caed37b2 --- /dev/null +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,21 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/PPC version. + Copyright (C) 2021 Free Software 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; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. At least two pages for systems with 64k + pages. */ +#define PTHREAD_STACK_MIN 131072 \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h b/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h index 64f96f535c..a6223eff27 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 10 #define SO_RCVBUF 8 #define SO_RCVLOWAT 16 -#define SO_RCVTIMEO 18 #define SO_REUSEADDR 2 #define SO_SNDBUF 7 #define SO_SNDLOWAT 17 -#define SO_SNDTIMEO 19 -#define SO_TYPE 3 \ No newline at end of file +#define SO_TYPE 3 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 18 +# define SO_SNDTIMEO 19 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 35 +# define SO_TIMESTAMPING 37 +#else +# define SO_RCVTIMEO_OLD 18 +# define SO_SNDTIMEO_OLD 19 +# define SO_RCVTIMEO_NEW 66 +# define SO_SNDTIMEO_NEW 67 + +# define SO_TIMESTAMP_OLD 29 +# define SO_TIMESTAMPNS_OLD 35 +# define SO_TIMESTAMPING_OLD 37 +# define SO_TIMESTAMP_NEW 63 +# define SO_TIMESTAMPNS_NEW 64 +# define SO_TIMESTAMPING_NEW 65 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h index 805594defd..3faed3a29b 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/struct_stat.h @@ -26,74 +26,36 @@ #include #if __WORDSIZE == 32 - struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 unsigned short int __pad1; __ino_t st_ino; /* File serial number. */ -# else +# else __ino64_t st_ino; /* File serial number. */ -# endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned short int __pad2; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -# else +# else __off64_t st_size; /* Size of file, in bytes. */ -# endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - }; - - -# ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - __ino64_t st_ino; /* File serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# endif # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -117,6 +79,50 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ + }; + +# ifdef __USE_LARGEFILE64 +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# endif /* __USE_TIME_BITS64 */ }; # endif /* __USE_LARGEFILE64 */ diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h index 65856a4231..52cc930886 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h index df168a5b57..d70967d6e0 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h index 82e25d77a9..6a47b1c39f 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/powerpc64le-linux-gnu/bits/types/struct_shmid_ds.h @@ -23,8 +23,11 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __shm_atime_high; __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_dtime_high; @@ -32,15 +35,16 @@ struct shmid_ds unsigned long int __shm_ctime_high; __time_t shm_ctime; /* time of last change by shmctl() */ unsigned long int __glibc_reserved4; -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif size_t shm_segsz; /* size of segment in bytes */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/powerpc64le-linux-gnu/gnu/lib-names-64-v2.h b/lib/libc/include/powerpc64le-linux-gnu/gnu/lib-names-64-v2.h index b8e68b6c89..bcfc823b19 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/gnu/lib-names-64-v2.h +++ b/lib/libc/include/powerpc64le-linux-gnu/gnu/lib-names-64-v2.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h b/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h index 5c5d5addee..a0134d5dfe 100644 --- a/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/powerpc64le-linux-gnu/sys/ptrace.h @@ -70,6 +70,8 @@ __BEGIN_DECLS # undef PTRACE_SYSCALL_INFO_ENTRY # undef PTRACE_SYSCALL_INFO_EXIT # undef PTRACE_SYSCALL_INFO_SECCOMP +# undef PTRACE_SYSEMU +# undef PTRACE_SYSEMU_SINGLESTEP # undef PTRACE_TRACEME #endif @@ -188,6 +190,14 @@ enum __ptrace_request PTRACE_SETVSRREGS = 28, #define PT_SETVSRREGS PTRACE_SETVSRREGS + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 29, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 30, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + /* Execute process until next taken branch. */ PTRACE_SINGLEBLOCK = 256, #define PT_STEPBLOCK PTRACE_SINGLEBLOCK diff --git a/lib/libc/include/riscv64-linux-gnu/bits/statfs.h b/lib/libc/include/riscv64-linux-gnu/bits/statfs.h deleted file mode 100644 index 94a6e610fb..0000000000 --- a/lib/libc/include/riscv64-linux-gnu/bits/statfs.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#ifndef _SYS_STATFS_H -# error "Never include directly; use instead." -#endif - -#include -#include -#include - -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - -#if defined __USE_FILE_OFFSET64 -# define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name -#elif __BYTE_ORDER == __LITTLE_ENDIAN -# define __field64(type, type64, name) \ - type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad -#else -# define __field64(type, type64, name) \ - int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name -#endif - -struct statfs - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); - __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); - __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; - -#undef __field64 - -#ifdef __USE_LARGEFILE64 -struct statfs64 - { - __SWORD_TYPE f_type; - __SWORD_TYPE f_bsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsid_t f_fsid; - __SWORD_TYPE f_namelen; - __SWORD_TYPE f_frsize; - __SWORD_TYPE f_flags; - __SWORD_TYPE f_spare[4]; - }; -#endif - -/* Tell code we have these members. */ -#define _STATFS_F_NAMELEN -#define _STATFS_F_FRSIZE -#define _STATFS_F_FLAGS \ No newline at end of file diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h index c157deb8cf..e8d3a8e796 100644 --- a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h +++ b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h new file mode 100644 index 0000000000..88de20ca0a --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/gnu/lib-names-lp64d.h @@ -0,0 +1,30 @@ +/* This file is automatically generated. */ +#ifndef __GNU_LIB_NAMES_H +# error "Never use directly; include instead." +#endif + +#define LD_LINUX_RISCV64_LP64D_SO "ld-linux-riscv64-lp64d.so.1" +#define LD_SO "ld-linux-riscv64-lp64d.so.1" +#define LIBANL_SO "libanl.so.1" +#define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" +#define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" +#define LIBC_SO "libc.so.6" +#define LIBDL_SO "libdl.so.2" +#define LIBGCC_S_SO "libgcc_s.so.1" +#define LIBMVEC_SO "libmvec.so.1" +#define LIBM_SO "libm.so.6" +#define LIBNSL_SO "libnsl.so.1" +#define LIBNSS_COMPAT_SO "libnss_compat.so.2" +#define LIBNSS_DB_SO "libnss_db.so.2" +#define LIBNSS_DNS_SO "libnss_dns.so.2" +#define LIBNSS_FILES_SO "libnss_files.so.2" +#define LIBNSS_HESIOD_SO "libnss_hesiod.so.2" +#define LIBNSS_LDAP_SO "libnss_ldap.so.2" +#define LIBNSS_TEST1_SO "libnss_test1.so.2" +#define LIBNSS_TEST2_SO "libnss_test2.so.2" +#define LIBPTHREAD_SO "libpthread.so.0" +#define LIBRESOLV_SO "libresolv.so.2" +#define LIBRT_SO "librt.so.1" +#define LIBTHREAD_DB_SO "libthread_db.so.1" +#define LIBUTIL_SO "libutil.so.1" diff --git a/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h new file mode 100644 index 0000000000..4d4c0d146a --- /dev/null +++ b/lib/libc/include/riscv64-linux-gnu/gnu/stubs-lp64d.h @@ -0,0 +1,24 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub___compat_create_module +#define __stub___compat_get_kernel_syms +#define __stub___compat_query_module +#define __stub___compat_uselib +#define __stub_chflags +#define __stub_fchflags +#define __stub_fedisableexcept +#define __stub_feenableexcept +#define __stub_fegetexcept +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/lib/libc/include/s390x-linux-gnu/bits/hwcap.h b/lib/libc/include/s390x-linux-gnu/bits/hwcap.h index 5031d2e6a7..a60cd60094 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/hwcap.h +++ b/lib/libc/include/s390x-linux-gnu/bits/hwcap.h @@ -45,4 +45,6 @@ #define HWCAP_S390_VXRS_EXT2 32768 #define HWCAP_S390_VXRS_PDE 65536 #define HWCAP_S390_SORT 131072 -#define HWCAP_S390_DFLT 262144 \ No newline at end of file +#define HWCAP_S390_DFLT 262144 +#define HWCAP_S390_VXRS_PDE2 524288 +#define HWCAP_S390_NNPA 1048576 \ No newline at end of file diff --git a/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h b/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h index 47bee1f317..c925f4cc77 100644 --- a/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/s390x-linux-gnu/bits/struct_stat.h @@ -65,32 +65,35 @@ struct stat #else struct stat { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -# else +# else __ino_t __st_ino; /* 32bit file serial number. */ -# endif +# endif __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ __dev_t st_rdev; /* Device number, if device. */ unsigned int __pad2; -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -# else +# else __off64_t st_size; /* Size of file, in bytes. */ -# endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -# else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# endif -# ifdef __USE_XOPEN2K8 +# endif +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -100,25 +103,26 @@ struct stat struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif -# ifndef __USE_FILE_OFFSET64 +# endif +# ifndef __USE_FILE_OFFSET64 unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -# else +# else __ino64_t st_ino; /* File serial number. */ +# endif # endif }; -#endif +# endif #ifdef __USE_LARGEFILE64 # if __WORDSIZE == 64 @@ -162,6 +166,9 @@ struct stat64 # else struct stat64 { +# ifdef __USE_TIME_BITS64 +# include +# else __dev_t st_dev; /* Device. */ unsigned int __pad1; @@ -176,7 +183,7 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -# ifdef __USE_XOPEN2K8 +# ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used whenever possible but the Unix namespace rules do not allow the @@ -186,18 +193,19 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# else +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else __time_t st_atime; /* Time of last access. */ unsigned long int st_atimensec; /* Nscecs of last access. */ __time_t st_mtime; /* Time of last modification. */ unsigned long int st_mtimensec; /* Nsecs of last modification. */ __time_t st_ctime; /* Time of last status change. */ unsigned long int st_ctimensec; /* Nsecs of last status change. */ -# endif +# endif __ino64_t st_ino; /* File serial number. */ +# endif }; # endif #endif diff --git a/lib/libc/include/s390x-linux-gnu/gnu/lib-names-64.h b/lib/libc/include/s390x-linux-gnu/gnu/lib-names-64.h index 1f26b2ab53..d232144282 100644 --- a/lib/libc/include/s390x-linux-gnu/gnu/lib-names-64.h +++ b/lib/libc/include/s390x-linux-gnu/gnu/lib-names-64.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/s390x-linux-gnu/sys/ptrace.h b/lib/libc/include/s390x-linux-gnu/sys/ptrace.h index fc62cf8756..5c793731c2 100644 --- a/lib/libc/include/s390x-linux-gnu/sys/ptrace.h +++ b/lib/libc/include/s390x-linux-gnu/sys/ptrace.h @@ -39,6 +39,8 @@ __BEGIN_DECLS # undef PTRACE_ATTACH # undef PTRACE_DETACH # undef PTRACE_SYSCALL +# undef PTRACE_SYSEMU +# undef PTRACE_SYSEMU_SINGLESTEP # undef PTRACE_SETOPTIONS # undef PTRACE_GETEVENTMSG # undef PTRACE_GETSIGINFO @@ -146,6 +148,14 @@ enum __ptrace_request PTRACE_SYSCALL = 24, #define PT_SYSCALL PTRACE_SYSCALL + /* Continue and stop at the next syscall, it will not be executed. */ + PTRACE_SYSEMU = 31, +#define PT_SYSEMU PTRACE_SYSEMU + + /* Single step the process, the next syscall will not be executed. */ + PTRACE_SYSEMU_SINGLESTEP = 32, +#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP + /* Set ptrace filter options. */ PTRACE_SETOPTIONS = 0x4200, #define PT_SETOPTIONS PTRACE_SETOPTIONS diff --git a/lib/libc/include/sparc-linux-gnu/bits/local_lim.h b/lib/libc/include/sparc-linux-gnu/bits/local_lim.h deleted file mode 100644 index 0a1bc361e6..0000000000 --- a/lib/libc/include/sparc-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux/SPARC version. - Copyright (C) 1993-2021 Free Software 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. We are free to choose a reasonable value. */ -#define PTHREAD_STACK_MIN 24576 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/sparc-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..220f9fcec3 --- /dev/null +++ b/lib/libc/include/sparc-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/SPARC version. + Copyright (C) 2021 Free Software 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 24576 \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h b/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h index 6d45cf834d..177bd23494 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/sparc-linux-gnu/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 2048 -#define SO_RCVTIMEO 8192 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4096 -#define SO_SNDTIMEO 16384 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 8192 +# define SO_SNDTIMEO 16384 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 33 +# define SO_TIMESTAMPING 35 +#else +# define SO_RCVTIMEO_OLD 8192 +# define SO_SNDTIMEO_OLD 16384 +# define SO_RCVTIMEO_NEW 68 +# define SO_SNDTIMEO_NEW 69 + +# define SO_TIMESTAMP_OLD 0x001d +# define SO_TIMESTAMPNS_OLD 0x0021 +# define SO_TIMESTAMPING_OLD 0x0023 +# define SO_TIMESTAMP_NEW 0x0046 +# define SO_TIMESTAMPNS_NEW 0x0042 +# define SO_TIMESTAMPING_NEW 0x0043 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h index 50be147d4c..d56c69e62f 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h index 0de6f97086..1eebddfb15 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h index 742891265a..25d101b362 100644 --- a/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/sparc-linux-gnu/bits/types/struct_shmid_ds.h @@ -23,23 +23,27 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __shm_atime_high; __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_dtime_high; __time_t shm_dtime; /* time of last shmdt() */ unsigned long int __shm_ctime_high; __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif size_t shm_segsz; /* size of segment in bytes */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/sparc-linux-gnu/gnu/lib-names-64.h b/lib/libc/include/sparc-linux-gnu/gnu/lib-names-64.h index 0f86fee604..c76c33569f 100644 --- a/lib/libc/include/sparc-linux-gnu/gnu/lib-names-64.h +++ b/lib/libc/include/sparc-linux-gnu/gnu/lib-names-64.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h b/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h deleted file mode 100644 index 0a1bc361e6..0000000000 --- a/lib/libc/include/sparcv9-linux-gnu/bits/local_lim.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Minimum guaranteed maximum values for system limits. Linux/SPARC version. - Copyright (C) 1993-2021 Free Software 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, see . */ - -/* The kernel header pollutes the namespace with the NR_OPEN symbol - and defines LINK_MAX although filesystems have different maxima. A - similar thing is true for OPEN_MAX: the limit can be changed at - runtime and therefore the macro must not be defined. Remove this - after including the header if necessary. */ -#ifndef NR_OPEN -# define __undef_NR_OPEN -#endif -#ifndef LINK_MAX -# define __undef_LINK_MAX -#endif -#ifndef OPEN_MAX -# define __undef_OPEN_MAX -#endif -#ifndef ARG_MAX -# define __undef_ARG_MAX -#endif - -/* The kernel sources contain a file with all the needed information. */ -#include - -/* Have to remove NR_OPEN? */ -#ifdef __undef_NR_OPEN -# undef NR_OPEN -# undef __undef_NR_OPEN -#endif -/* Have to remove LINK_MAX? */ -#ifdef __undef_LINK_MAX -# undef LINK_MAX -# undef __undef_LINK_MAX -#endif -/* Have to remove OPEN_MAX? */ -#ifdef __undef_OPEN_MAX -# undef OPEN_MAX -# undef __undef_OPEN_MAX -#endif -/* Have to remove ARG_MAX? */ -#ifdef __undef_ARG_MAX -# undef ARG_MAX -# undef __undef_ARG_MAX -#endif - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 -/* This is the value this implementation supports. */ -#define PTHREAD_KEYS_MAX 1024 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 -/* Number of iterations this implementation does. */ -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 -/* We have no predefined limit on the number of threads. */ -#undef PTHREAD_THREADS_MAX - -/* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -#define AIO_PRIO_DELTA_MAX 20 - -/* Minimum size for a thread. We are free to choose a reasonable value. */ -#define PTHREAD_STACK_MIN 24576 - -/* Maximum number of timer expiration overruns. */ -#define DELAYTIMER_MAX 2147483647 - -/* Maximum tty name length. */ -#define TTY_NAME_MAX 32 - -/* Maximum login name length. This is arbitrary. */ -#define LOGIN_NAME_MAX 256 - -/* Maximum host name length. */ -#define HOST_NAME_MAX 64 - -/* Maximum message queue priority level. */ -#define MQ_PRIO_MAX 32768 - -/* Maximum value the semaphore can have. */ -#define SEM_VALUE_MAX (2147483647) \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/pthread_stack_min.h b/lib/libc/include/sparcv9-linux-gnu/bits/pthread_stack_min.h new file mode 100644 index 0000000000..220f9fcec3 --- /dev/null +++ b/lib/libc/include/sparcv9-linux-gnu/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/SPARC version. + Copyright (C) 2021 Free Software 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 24576 \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h b/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h index 6d45cf834d..177bd23494 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/socket-constants.h @@ -30,9 +30,41 @@ #define SO_OOBINLINE 256 #define SO_RCVBUF 4098 #define SO_RCVLOWAT 2048 -#define SO_RCVTIMEO 8192 #define SO_REUSEADDR 4 #define SO_SNDBUF 4097 #define SO_SNDLOWAT 4096 -#define SO_SNDTIMEO 16384 -#define SO_TYPE 4104 \ No newline at end of file +#define SO_TYPE 4104 + +#if __TIMESIZE == 64 +# define SO_RCVTIMEO 8192 +# define SO_SNDTIMEO 16384 +# define SO_TIMESTAMP 29 +# define SO_TIMESTAMPNS 33 +# define SO_TIMESTAMPING 35 +#else +# define SO_RCVTIMEO_OLD 8192 +# define SO_SNDTIMEO_OLD 16384 +# define SO_RCVTIMEO_NEW 68 +# define SO_SNDTIMEO_NEW 69 + +# define SO_TIMESTAMP_OLD 0x001d +# define SO_TIMESTAMPNS_OLD 0x0021 +# define SO_TIMESTAMPING_OLD 0x0023 +# define SO_TIMESTAMP_NEW 0x0046 +# define SO_TIMESTAMPNS_NEW 0x0042 +# define SO_TIMESTAMPING_NEW 0x0043 + +# ifdef __USE_TIME_BITS64 +# define SO_RCVTIMEO SO_RCVTIMEO_NEW +# define SO_SNDTIMEO SO_SNDTIMEO_NEW +# define SO_TIMESTAMP SO_TIMESTAMP_NEW +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_NEW +# define SO_TIMESTAMPING SO_TIMESTAMPING_NEW +# else +# define SO_RCVTIMEO SO_RCVTIMEO_OLD +# define SO_SNDTIMEO SO_SNDTIMEO_OLD +# define SO_TIMESTAMP SO_TIMESTAMP_OLD +# define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD +# define SO_TIMESTAMPING SO_TIMESTAMPING_OLD +# endif +#endif \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h index 50be147d4c..d56c69e62f 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_msqid_ds.h @@ -20,23 +20,28 @@ # error "Never use directly; include instead." #endif +#include + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ struct msqid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm msg_perm; /* structure describing operation permission */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __msg_stime_high; __time_t msg_stime; /* time of last msgsnd command */ unsigned long int __msg_rtime_high; __time_t msg_rtime; /* time of last msgsnd command */ unsigned long int __msg_ctime_high; __time_t msg_ctime; /* time of last change */ -#else +# else __time_t msg_stime; /* time of last msgsnd command */ __time_t msg_rtime; /* time of last msgsnd command */ __time_t msg_ctime; /* time of last change */ -#endif +# endif __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ @@ -44,4 +49,5 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ __syscall_ulong_t __glibc_reserved4; __syscall_ulong_t __glibc_reserved5; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h index 0de6f97086..1eebddfb15 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_semid_ds.h @@ -23,17 +23,21 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 __syscall_ulong_t __sem_otime_high; __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_ctime_high; __time_t sem_ctime; /* last time changed by semctl() */ -#else +# else __time_t sem_otime; /* last semop() time */ __time_t sem_ctime; /* last time changed by semctl() */ -#endif +# endif __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h index 742891265a..25d101b362 100644 --- a/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h +++ b/lib/libc/include/sparcv9-linux-gnu/bits/types/struct_shmid_ds.h @@ -23,23 +23,27 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm shm_perm; /* operation permission struct */ -#if __TIMESIZE == 32 +# if __TIMESIZE == 32 unsigned long int __shm_atime_high; __time_t shm_atime; /* time of last shmat() */ unsigned long int __shm_dtime_high; __time_t shm_dtime; /* time of last shmdt() */ unsigned long int __shm_ctime_high; __time_t shm_ctime; /* time of last change by shmctl() */ -#else +# else __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ -#endif +# endif size_t shm_segsz; /* size of segment in bytes */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ __syscall_ulong_t __glibc_reserved5; __syscall_ulong_t __glibc_reserved6; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h b/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h index 4a34470345..b3674c73c4 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/struct_stat.h @@ -25,103 +25,45 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad1; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif -#ifndef __x86_64__ +# endif +# ifndef __x86_64__ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ -#else +# else __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ -#endif +# endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ -#ifdef __x86_64__ +# ifdef __x86_64__ int __pad0; -#endif +# endif __dev_t st_rdev; /* Device number, if device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad2; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -#else -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ # endif -#endif - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 has the same shape as stat for x86-64. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ -# ifdef __x86_64__ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# else - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -132,6 +74,9 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec # else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ @@ -143,8 +88,71 @@ struct stat64 # ifdef __x86_64__ __syscall_slong_t __glibc_reserved[3]; # else - __ino64_t st_ino; /* File serial number. */ +# ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif # endif +#endif /* __USE_TIME_BITS64 */ + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 has the same shape as stat for x86-64. */ +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ +# ifdef __x86_64__ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +# else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +# endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +# ifdef __x86_64__ + int __pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +# else + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ +# endif +# ifdef __x86_64__ + __syscall_slong_t __glibc_reserved[3]; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h b/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h index 76ea9f63dc..6713836d1e 100644 --- a/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h +++ b/lib/libc/include/x86_64-linux-gnu/bits/types/struct_semid_ds.h @@ -23,6 +23,9 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; @@ -31,4 +34,5 @@ struct semid_ds __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/x86_64-linux-gnu/gnu/lib-names-64.h b/lib/libc/include/x86_64-linux-gnu/gnu/lib-names-64.h index 03d0df5edf..5c25d27fe6 100644 --- a/lib/libc/include/x86_64-linux-gnu/gnu/lib-names-64.h +++ b/lib/libc/include/x86_64-linux-gnu/gnu/lib-names-64.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h b/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h index 4a34470345..b3674c73c4 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/struct_stat.h @@ -25,103 +25,45 @@ struct stat { +#ifdef __USE_TIME_BITS64 +# include +#else __dev_t st_dev; /* Device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad1; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __ino_t st_ino; /* File serial number. */ -#else +# else __ino_t __st_ino; /* 32bit file serial number. */ -#endif -#ifndef __x86_64__ +# endif +# ifndef __x86_64__ __mode_t st_mode; /* File mode. */ __nlink_t st_nlink; /* Link count. */ -#else +# else __nlink_t st_nlink; /* Link count. */ __mode_t st_mode; /* File mode. */ -#endif +# endif __uid_t st_uid; /* User ID of the file's owner. */ __gid_t st_gid; /* Group ID of the file's group.*/ -#ifdef __x86_64__ +# ifdef __x86_64__ int __pad0; -#endif +# endif __dev_t st_rdev; /* Device number, if device. */ -#ifndef __x86_64__ +# ifndef __x86_64__ unsigned short int __pad2; -#endif -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# endif +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __off_t st_size; /* Size of file, in bytes. */ -#else +# else __off64_t st_size; /* Size of file, in bytes. */ -#endif +# endif __blksize_t st_blksize; /* Optimal block size for I/O. */ -#if defined __x86_64__ || !defined __USE_FILE_OFFSET64 +# if defined __x86_64__ || !defined __USE_FILE_OFFSET64 __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else +# else __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_XOPEN2K8 - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifdef __x86_64__ - __syscall_slong_t __glibc_reserved[3]; -#else -# ifndef __USE_FILE_OFFSET64 - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; -# else - __ino64_t st_ino; /* File serial number. */ # endif -#endif - }; - -#ifdef __USE_LARGEFILE64 -/* Note stat64 has the same shape as stat for x86-64. */ -struct stat64 - { - __dev_t st_dev; /* Device. */ -# ifdef __x86_64__ - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -# else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -# endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ -# ifdef __x86_64__ - int __pad0; - __dev_t st_rdev; /* Device number, if device. */ - __off_t st_size; /* Size of file, in bytes. */ -# else - __dev_t st_rdev; /* Device number, if device. */ - unsigned int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ -# endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ # ifdef __USE_XOPEN2K8 /* Nanosecond resolution timestamps are stored in a format equivalent to 'struct timespec'. This is the type used @@ -132,6 +74,9 @@ struct stat64 struct timespec st_atim; /* Time of last access. */ struct timespec st_mtim; /* Time of last modification. */ struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec # else __time_t st_atime; /* Time of last access. */ __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ @@ -143,8 +88,71 @@ struct stat64 # ifdef __x86_64__ __syscall_slong_t __glibc_reserved[3]; # else - __ino64_t st_ino; /* File serial number. */ +# ifndef __USE_FILE_OFFSET64 + unsigned long int __glibc_reserved4; + unsigned long int __glibc_reserved5; +# else + __ino64_t st_ino; /* File serial number. */ +# endif # endif +#endif /* __USE_TIME_BITS64 */ + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 has the same shape as stat for x86-64. */ +struct stat64 + { +# ifdef __USE_TIME_BITS64 +# include +# else + __dev_t st_dev; /* Device. */ +# ifdef __x86_64__ + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +# else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +# endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ +# ifdef __x86_64__ + int __pad0; + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +# else + __dev_t st_rdev; /* Device number, if device. */ + unsigned int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ +# endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +# ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# else + __time_t st_atime; /* Time of last access. */ + __syscall_ulong_t st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + __syscall_ulong_t st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + __syscall_ulong_t st_ctimensec; /* Nsecs of last status change. */ +# endif +# ifdef __x86_64__ + __syscall_slong_t __glibc_reserved[3]; +# else + __ino64_t st_ino; /* File serial number. */ +# endif +# endif /* __USE_TIME_BITS64 */ }; #endif diff --git a/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h b/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h index 76ea9f63dc..6713836d1e 100644 --- a/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h +++ b/lib/libc/include/x86_64-linux-gnux32/bits/types/struct_semid_ds.h @@ -23,6 +23,9 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { +#ifdef __USE_TIME_BITS64 +# include +#else struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ __syscall_ulong_t __sem_otime_high; @@ -31,4 +34,5 @@ struct semid_ds __syscall_ulong_t sem_nsems; /* number of semaphores in set */ __syscall_ulong_t __glibc_reserved3; __syscall_ulong_t __glibc_reserved4; +#endif }; \ No newline at end of file diff --git a/lib/libc/include/x86_64-linux-gnux32/gnu/lib-names-x32.h b/lib/libc/include/x86_64-linux-gnux32/gnu/lib-names-x32.h index cdc4ac90f9..95b469a00c 100644 --- a/lib/libc/include/x86_64-linux-gnux32/gnu/lib-names-x32.h +++ b/lib/libc/include/x86_64-linux-gnux32/gnu/lib-names-x32.h @@ -8,6 +8,7 @@ #define LIBANL_SO "libanl.so.1" #define LIBBROKENLOCALE_SO "libBrokenLocale.so.1" #define LIBCRYPT_SO "libcrypt.so.1" +#define LIBC_MALLOC_DEBUG_SO "libc_malloc_debug.so.0" #define LIBC_SO "libc.so.6" #define LIBDL_SO "libdl.so.2" #define LIBGCC_S_SO "libgcc_s.so.1" diff --git a/lib/std/target.zig b/lib/std/target.zig index c6ee53157d..ca1f668ca4 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -329,9 +329,9 @@ pub const Target = struct { .linux = .{ .range = .{ .min = .{ .major = 3, .minor = 16 }, - .max = .{ .major = 5, .minor = 5, .patch = 5 }, + .max = .{ .major = 5, .minor = 10, .patch = 81 }, }, - .glibc = .{ .major = 2, .minor = 17 }, + .glibc = .{ .major = 2, .minor = 19 }, }, }, diff --git a/src/Compilation.zig b/src/Compilation.zig index d58394de65..b3c2608c05 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1586,9 +1586,23 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { // If we need to build glibc for the target, add work items for it. // We go through the work queue so that building can be done in parallel. if (comp.wantBuildGLibCFromSource()) { - try comp.addBuildingGLibCJobs(); + if (!target_util.canBuildLibC(comp.getTarget())) return error.LibCUnavailable; + + if (glibc.needsCrtiCrtn(comp.getTarget())) { + try comp.work_queue.write(&[_]Job{ + .{ .glibc_crt_file = .crti_o }, + .{ .glibc_crt_file = .crtn_o }, + }); + } + try comp.work_queue.write(&[_]Job{ + .{ .glibc_crt_file = .scrt1_o }, + .{ .glibc_crt_file = .libc_nonshared_a }, + .{ .glibc_shared_objects = {} }, + }); } if (comp.wantBuildMuslFromSource()) { + if (!target_util.canBuildLibC(comp.getTarget())) return error.LibCUnavailable; + try comp.work_queue.ensureUnusedCapacity(6); if (musl.needsCrtiCrtn(comp.getTarget())) { comp.work_queue.writeAssumeCapacity(&[_]Job{ @@ -1607,6 +1621,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }); } if (comp.wantBuildWasiLibcFromSource()) { + if (!target_util.canBuildLibC(comp.getTarget())) return error.LibCUnavailable; + const wasi_emulated_libs = comp.bin_file.options.wasi_emulated_libs; try comp.work_queue.ensureUnusedCapacity(wasi_emulated_libs.len + 2); // worst-case we need all components for (wasi_emulated_libs) |crt_file| { @@ -1620,6 +1636,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }); } if (comp.wantBuildMinGWFromSource()) { + if (!target_util.canBuildLibC(comp.getTarget())) return error.LibCUnavailable; + const static_lib_jobs = [_]Job{ .{ .mingw_crt_file = .mingw32_lib }, .{ .mingw_crt_file = .msvcrt_os_lib }, @@ -3397,6 +3415,14 @@ pub fn addCCArgs( try argv.append(libunwind_include_path); } + if (comp.bin_file.options.link_libc and target.isGnuLibC()) { + const target_version = target.os.version_range.linux.glibc; + const glibc_minor_define = try std.fmt.allocPrint(arena, "-D__GLIBC_MINOR__={d}", .{ + target_version.minor, + }); + try argv.append(glibc_minor_define); + } + const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target); try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); @@ -4038,16 +4064,6 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: Allocator, basename: []const return full_path; } -fn addBuildingGLibCJobs(comp: *Compilation) !void { - try comp.work_queue.write(&[_]Job{ - .{ .glibc_crt_file = .crti_o }, - .{ .glibc_crt_file = .crtn_o }, - .{ .glibc_crt_file = .scrt1_o }, - .{ .glibc_crt_file = .libc_nonshared_a }, - .{ .glibc_shared_objects = {} }, - }); -} - fn wantBuildLibCFromSource(comp: Compilation) bool { const is_exe_or_dyn_lib = switch (comp.bin_file.options.output_mode) { .Obj => false, diff --git a/src/glibc.zig b/src/glibc.zig index bd5372c2d2..e9c0651fdc 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -269,59 +269,47 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { return comp.build_crt_file("Scrt1", .Obj, &[_]Compilation.CSourceFile{ start_os, abi_note_o }); }, .libc_nonshared_a => { - const deps = [_][]const u8{ - lib_libc_glibc ++ "stdlib" ++ path.sep_str ++ "atexit.c", - lib_libc_glibc ++ "stdlib" ++ path.sep_str ++ "at_quick_exit.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "stat.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstat.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "lstat.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "stat64.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstat64.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "lstat64.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c", - lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknodat.c", - lib_libc_glibc ++ "nptl" ++ path.sep_str ++ "pthread_atfork.c", - lib_libc_glibc ++ "debug" ++ path.sep_str ++ "stack_chk_fail_local.c", + const target = comp.getTarget(); + const s = path.sep_str; + const linux_prefix = lib_libc_glibc ++ + "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s; + const Flavor = enum { nonshared, shared }; + const Dep = struct { + path: []const u8, + flavor: Flavor = .shared, + }; + const deps = [_]Dep{ + .{ + .path = lib_libc_glibc ++ "stdlib" ++ s ++ "atexit.c", + .flavor = .nonshared, + }, + .{ + .path = lib_libc_glibc ++ "stdlib" ++ s ++ "at_quick_exit.c", + .flavor = .nonshared, + }, + .{ + .path = lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread" ++ s ++ "pthread_atfork.c", + .flavor = .nonshared, + }, + .{ + .path = lib_libc_glibc ++ "debug" ++ s ++ "stack_chk_fail_local.c", + .flavor = .nonshared, + }, + .{ .path = lib_libc_glibc ++ "csu" ++ s ++ "errno.c" }, + .{ .path = linux_prefix ++ "stat.c" }, + .{ .path = linux_prefix ++ "fstat.c" }, + .{ .path = linux_prefix ++ "lstat.c" }, + .{ .path = linux_prefix ++ "stat64.c" }, + .{ .path = linux_prefix ++ "fstat64.c" }, + .{ .path = linux_prefix ++ "lstat64.c" }, + .{ .path = linux_prefix ++ "fstatat.c" }, + .{ .path = linux_prefix ++ "fstatat64.c" }, + .{ .path = linux_prefix ++ "mknodat.c" }, + .{ .path = lib_libc_glibc ++ "io" ++ s ++ "mknod.c" }, + .{ .path = linux_prefix ++ "stat_t64_cp.c" }, }; - var c_source_files: [deps.len + 1]Compilation.CSourceFile = undefined; - - c_source_files[0] = blk: { - var args = std.ArrayList([]const u8).init(arena); - try args.appendSlice(&[_][]const u8{ - "-std=gnu11", - "-fgnu89-inline", - "-fmerge-all-constants", - "-fno-stack-protector", - "-fmath-errno", - "-fno-stack-protector", - "-I", - try lib_path(comp, arena, lib_libc_glibc ++ "csu"), - }); - try add_include_dirs(comp, arena, &args); - try args.appendSlice(&[_][]const u8{ - "-DSTACK_PROTECTOR_LEVEL=0", - "-fPIC", - "-fno-stack-protector", - "-ftls-model=initial-exec", - "-D_LIBC_REENTRANT", - "-include", - try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), - "-DMODULE_NAME=libc", - "-Wno-nonportable-include-path", - "-include", - try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), - "-DPIC", - "-DLIBC_NONSHARED=1", - "-DTOP_NAMESPACE=glibc", - }); - break :blk .{ - .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "elf-init.c"), - .extra_flags = args.items, - }; - }; + var c_source_files: [deps.len]Compilation.CSourceFile = undefined; for (deps) |dep, i| { var args = std.ArrayList([]const u8).init(arena); @@ -329,12 +317,30 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { "-std=gnu11", "-fgnu89-inline", "-fmerge-all-constants", + // glibc sets this flag but clang does not support it. + // "-frounding-math", "-fno-stack-protector", + "-fno-common", "-fmath-errno", "-ftls-model=initial-exec", "-Wno-ignored-attributes", }); try add_include_dirs(comp, arena, &args); + + if (target.cpu.arch == .i386) { + // This prevents i386/sysdep.h from trying to do some + // silly and unnecessary inline asm hack that uses weird + // syntax that clang does not support. + try args.append("-DCAN_USE_REGISTER_ASM_EBP"); + } + + const shared_def = switch (dep.flavor) { + .nonshared => "-DLIBC_NONSHARED=1", + // glibc passes `-DSHARED` for these. However, empirically if + // we do that here we will see undefined symbols such as `__GI_memcpy`. + // So we pass the same thing as for nonshared. + .shared => "-DLIBC_NONSHARED=1", + }; try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", @@ -344,11 +350,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", - "-DLIBC_NONSHARED=1", + shared_def, "-DTOP_NAMESPACE=glibc", }); - c_source_files[i + 1] = .{ - .src_path = try lib_path(comp, arena, dep), + c_source_files[i] = .{ + .src_path = try lib_path(comp, arena, dep.path), .extra_flags = args.items, }; } @@ -1093,3 +1099,11 @@ fn buildSharedLib( try sub_compilation.updateSubCompilation(); } + +// Return true if glibc has crti/crtn sources for that architecture. +pub fn needsCrtiCrtn(target: std.Target) bool { + return switch (target.cpu.arch) { + .riscv32, .riscv64 => false, + else => true, + }; +} diff --git a/src/main.zig b/src/main.zig index 57342702ee..e3221ecc67 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2495,8 +2495,28 @@ fn buildOutputType( .debug_compile_errors = debug_compile_errors, .enable_link_snapshots = enable_link_snapshots, .native_darwin_sdk = native_darwin_sdk, - }) catch |err| { - fatal("unable to create compilation: {s}", .{@errorName(err)}); + }) catch |err| switch (err) { + error.LibCUnavailable => { + const target = target_info.target; + const triple_name = try target.zigTriple(arena); + std.log.err("unable to find or provide libc for target '{s}'", .{triple_name}); + + for (target_util.available_libcs) |t| { + if (t.arch == target.cpu.arch and t.os == target.os.tag) { + if (t.os_ver) |os_ver| { + std.log.info("zig can provide libc for related target {s}-{s}.{d}-{s}", .{ + @tagName(t.arch), @tagName(t.os), os_ver.major, @tagName(t.abi), + }); + } else { + std.log.info("zig can provide libc for related target {s}-{s}-{s}", .{ + @tagName(t.arch), @tagName(t.os), @tagName(t.abi), + }); + } + } + } + process.exit(1); + }, + else => fatal("unable to create compilation: {s}", .{@errorName(err)}), }; var comp_destroyed = false; defer if (!comp_destroyed) comp.destroy(); diff --git a/src/target.zig b/src/target.zig index 5b2f6f5978..8a95e756bf 100644 --- a/src/target.zig +++ b/src/target.zig @@ -44,15 +44,18 @@ pub const available_libcs = [_]ArchOsAbi{ .{ .arch = .mips64, .os = .linux, .abi = .gnuabi64 }, .{ .arch = .mips64, .os = .linux, .abi = .gnuabin32 }, .{ .arch = .mips64, .os = .linux, .abi = .musl }, - .{ .arch = .mipsel, .os = .linux, .abi = .gnu }, + .{ .arch = .mipsel, .os = .linux, .abi = .gnueabi }, + .{ .arch = .mipsel, .os = .linux, .abi = .gnueabihf }, .{ .arch = .mipsel, .os = .linux, .abi = .musl }, - .{ .arch = .mips, .os = .linux, .abi = .gnu }, + .{ .arch = .mips, .os = .linux, .abi = .gnueabi }, + .{ .arch = .mips, .os = .linux, .abi = .gnueabihf }, .{ .arch = .mips, .os = .linux, .abi = .musl }, .{ .arch = .powerpc64le, .os = .linux, .abi = .gnu }, .{ .arch = .powerpc64le, .os = .linux, .abi = .musl }, .{ .arch = .powerpc64, .os = .linux, .abi = .gnu }, .{ .arch = .powerpc64, .os = .linux, .abi = .musl }, - .{ .arch = .powerpc, .os = .linux, .abi = .gnu }, + .{ .arch = .powerpc, .os = .linux, .abi = .gnueabi }, + .{ .arch = .powerpc, .os = .linux, .abi = .gnueabihf }, .{ .arch = .powerpc, .os = .linux, .abi = .musl }, .{ .arch = .riscv64, .os = .linux, .abi = .gnu }, .{ .arch = .riscv64, .os = .linux, .abi = .musl }, diff --git a/test/standalone.zig b/test/standalone.zig index 4081e5aff3..6df3387018 100644 --- a/test/standalone.zig +++ b/test/standalone.zig @@ -84,5 +84,6 @@ pub fn addCases(cases: *tests.StandaloneContext) void { cases.add("tools/gen_stubs.zig"); cases.add("tools/update_clang_options.zig"); cases.add("tools/update_cpu_features.zig"); + cases.add("tools/update_glibc.zig"); cases.add("tools/update_spirv_features.zig"); } diff --git a/test/tests.zig b/test/tests.zig index 99d84d14a7..f618adc1bf 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -189,7 +189,7 @@ const test_targets = blk: { // .target = .{ // .cpu_arch = .mips, // .os_tag = .linux, - // .abi = .gnu, + // .abi = .gnueabihf, // }, // .link_libc = true, //}, @@ -216,7 +216,7 @@ const test_targets = blk: { // .target = .{ // .cpu_arch = .mipsel, // .os_tag = .linux, - // .abi = .gnu, + // .abi = .gnueabihf, // }, // .link_libc = true, //}, @@ -236,6 +236,15 @@ const test_targets = blk: { }, .link_libc = true, }, + // https://github.com/ziglang/zig/issues/2256 + //TestTarget{ + // .target = .{ + // .cpu_arch = .powerpc, + // .os_tag = .linux, + // .abi = .gnueabihf, + // }, + // .link_libc = true, + //}, TestTarget{ .target = .{ diff --git a/tools/process_headers.zig b/tools/process_headers.zig index fea50b30df..579667a5a6 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -122,12 +122,22 @@ const glibc_targets = [_]LibCTarget{ LibCTarget{ .name = "mipsel-linux-gnu", .arch = MultiArch{ .specific = Arch.mipsel }, - .abi = MultiAbi{ .specific = Abi.gnu }, + .abi = MultiAbi{ .specific = Abi.gnueabihf }, + }, + LibCTarget{ + .name = "mipsel-linux-gnu-soft", + .arch = MultiArch{ .specific = Arch.mipsel }, + .abi = MultiAbi{ .specific = Abi.gnueabi }, }, LibCTarget{ .name = "mips-linux-gnu", .arch = MultiArch{ .specific = Arch.mips }, - .abi = MultiAbi{ .specific = Abi.gnu }, + .abi = MultiAbi{ .specific = Abi.gnueabihf }, + }, + LibCTarget{ + .name = "mips-linux-gnu-soft", + .arch = MultiArch{ .specific = Arch.mips }, + .abi = MultiAbi{ .specific = Abi.gnueabi }, }, LibCTarget{ .name = "powerpc64le-linux-gnu", @@ -142,7 +152,12 @@ const glibc_targets = [_]LibCTarget{ LibCTarget{ .name = "powerpc-linux-gnu", .arch = MultiArch{ .specific = Arch.powerpc }, - .abi = MultiAbi{ .specific = Abi.gnu }, + .abi = MultiAbi{ .specific = Abi.gnueabihf }, + }, + LibCTarget{ + .name = "powerpc-linux-gnu-soft", + .arch = MultiArch{ .specific = Arch.powerpc }, + .abi = MultiAbi{ .specific = Abi.gnueabi }, }, LibCTarget{ .name = "riscv64-linux-gnu-rv64imac-lp64", diff --git a/tools/update_glibc.zig b/tools/update_glibc.zig new file mode 100644 index 0000000000..c15123a6de --- /dev/null +++ b/tools/update_glibc.zig @@ -0,0 +1,144 @@ +//! This script updates the .c, .h, .s, and .S files that make up the start +//! files such as crt1.o. Not to be confused with +//! https://github.com/ziglang/glibc-abi-tool/ which updates the `abilists` +//! file. +//! +//! Example usage: +//! `zig run ../tools/update_glibc.zig -- ~/Downloads/glibc ..` + +const std = @import("std"); +const mem = std.mem; +const log = std.log; +const fs = std.fs; + +const exempt_files = [_][]const u8{ + // This file is maintained by a separate project and does not come from glibc. + "abilists", + + // Generated files. + "include/libc-modules.h", + "include/config.h", + + // These are easier to maintain like this, without updating to the abi-note.c + // that glibc did upstream. + "csu/abi-tag.h", + "csu/abi-note.S", + + // We have patched these files to require fewer includes. + "stdlib/at_quick_exit.c", + "stdlib/atexit.c", + "sysdeps/pthread/pthread_atfork.c", +}; + +pub fn main() !void { + var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); + defer arena_instance.deinit(); + const arena = arena_instance.allocator(); + + const args = try std.process.argsAlloc(arena); + const glibc_src_path = args[1]; + const zig_src_path = args[2]; + + const dest_dir_path = try std.fmt.allocPrint(arena, "{s}/lib/libc/glibc", .{zig_src_path}); + + var dest_dir = fs.cwd().openDir(dest_dir_path, .{ .iterate = true }) catch |err| { + fatal("unable to open destination directory '{s}': {s}", .{ + dest_dir_path, @errorName(err), + }); + }; + defer dest_dir.close(); + + var glibc_src_dir = try fs.cwd().openDir(glibc_src_path, .{}); + defer glibc_src_dir.close(); + + // Copy updated files from upstream. + { + var walker = try dest_dir.walk(arena); + defer walker.deinit(); + + walk: while (try walker.next()) |entry| { + if (entry.kind != .File) continue; + if (mem.startsWith(u8, entry.basename, ".")) continue; + for (exempt_files) |p| { + if (mem.eql(u8, entry.path, p)) continue :walk; + } + + glibc_src_dir.copyFile(entry.path, dest_dir, entry.path, .{}) catch |err| { + log.warn("unable to copy '{s}/{s}' to '{s}/{s}': {s}", .{ + glibc_src_path, entry.path, + dest_dir_path, entry.path, + @errorName(err), + }); + if (err == error.FileNotFound) { + try dest_dir.deleteFile(entry.path); + } + }; + } + } + + // Warn about duplicated files inside glibc/include/* that can be omitted + // because they are already in generic-glibc/*. + + var include_dir = dest_dir.openDir("include", .{ .iterate = true }) catch |err| { + fatal("unable to open directory '{s}/include': {s}", .{ + dest_dir_path, @errorName(err), + }); + }; + defer include_dir.close(); + + const generic_glibc_path = try std.fmt.allocPrint( + arena, + "{s}/lib/libc/include/generic-glibc", + .{zig_src_path}, + ); + var generic_glibc_dir = try fs.cwd().openDir(generic_glibc_path, .{}); + defer generic_glibc_dir.close(); + + var walker = try include_dir.walk(arena); + defer walker.deinit(); + + walk: while (try walker.next()) |entry| { + if (entry.kind != .File) continue; + if (mem.startsWith(u8, entry.basename, ".")) continue; + for (exempt_files) |p| { + if (mem.eql(u8, entry.path, p)) continue :walk; + } + + const max_file_size = 10 * 1024 * 1024; + + const generic_glibc_contents = generic_glibc_dir.readFileAlloc( + arena, + entry.path, + max_file_size, + ) catch |err| switch (err) { + error.FileNotFound => continue, + else => |e| fatal("unable to load '{s}/include/{s}': {s}", .{ + generic_glibc_path, entry.path, @errorName(e), + }), + }; + const glibc_include_contents = include_dir.readFileAlloc( + arena, + entry.path, + max_file_size, + ) catch |err| { + fatal("unable to load '{s}/include/{s}': {s}", .{ + dest_dir_path, entry.path, @errorName(err), + }); + }; + + const whitespace = " \r\n\t"; + const generic_glibc_trimmed = mem.trim(u8, generic_glibc_contents, whitespace); + const glibc_include_trimmed = mem.trim(u8, glibc_include_contents, whitespace); + if (mem.eql(u8, generic_glibc_trimmed, glibc_include_trimmed)) { + log.warn("same contents: '{s}/include/{s}' and '{s}/include/{s}'", .{ + generic_glibc_path, entry.path, + dest_dir_path, entry.path, + }); + } + } +} + +fn fatal(comptime format: []const u8, args: anytype) noreturn { + log.err(format, args); + std.process.exit(1); +}