authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-24 12:28:22+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-24 21:27:00+02:00
log857d8ac650b3154bfd320911f8d8fd0bd7ed9ea7
tree568255e85340287c16fd60baa69d798f3049aa0b
parent87169df9c140435f5651ea98b7f8ffaba56ebaf2

glibc: prune a bunch of dead code


108 files changed, 0 insertions(+), 15591 deletions(-)

lib/libc/glibc/bits/endian.h deleted-13
......@@ -1,13 +0,0 @@
1/* This file should define __BYTE_ORDER as appropriate for the machine
2 in question. See string/endian.h for how to define it.
3
4 If only the stub bits/endian.h applies to a particular configuration,
5 bytesex.h is generated by running a program on the host machine.
6 So if cross-compiling to a machine with a different byte order,
7 the bits/endian.h file for that machine must exist. */
8
9#ifndef _ENDIAN_H
10# error "Never use <bits/endian.h> directly; include <endian.h> instead."
11#endif
12
13#error Machine byte order unknown.
lib/libc/glibc/bits/floatn-common.h deleted-329
......@@ -1,329 +0,0 @@
1/* Macros to control TS 18661-3 glibc features where the same
2 definitions are appropriate for all platforms.
3 Copyright (C) 2017-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _BITS_FLOATN_COMMON_H
21#define _BITS_FLOATN_COMMON_H
22
23#include <features.h>
24#include <bits/long-double.h>
25
26/* This header should be included at the bottom of each bits/floatn.h.
27 It defines the following macros for each _FloatN and _FloatNx type,
28 where the same definitions, or definitions based only on the macros
29 in bits/floatn.h, are appropriate for all glibc configurations. */
30
31/* Defined to 1 if the current compiler invocation provides a
32 floating-point type with the right format for this type, and this
33 glibc includes corresponding *fN or *fNx interfaces for it. */
34#define __HAVE_FLOAT16 0
35#define __HAVE_FLOAT32 1
36#define __HAVE_FLOAT64 1
37#define __HAVE_FLOAT32X 1
38#define __HAVE_FLOAT128X 0
39
40/* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
41 type is the first with its format in the sequence of (the default
42 choices for) float, double, long double, _Float16, _Float32,
43 _Float64, _Float128, _Float32x, _Float64x, _Float128x for this
44 glibc; that is, if functions present once per floating-point format
45 rather than once per type are present for this type.
46
47 All configurations supported by glibc have _Float32 the same format
48 as float, _Float64 and _Float32x the same format as double, the
49 _Float64x the same format as either long double or _Float128. No
50 configurations support _Float128x or, as of GCC 7, have compiler
51 support for a type meeting the requirements for _Float128x. */
52#define __HAVE_DISTINCT_FLOAT16 __HAVE_FLOAT16
53#define __HAVE_DISTINCT_FLOAT32 0
54#define __HAVE_DISTINCT_FLOAT64 0
55#define __HAVE_DISTINCT_FLOAT32X 0
56#define __HAVE_DISTINCT_FLOAT64X 0
57#define __HAVE_DISTINCT_FLOAT128X __HAVE_FLOAT128X
58
59/* Defined to 1 if the corresponding _FloatN type is not binary compatible
60 with the corresponding ISO C type in the current compilation unit as
61 opposed to __HAVE_DISTINCT_FLOATN, which indicates the default types built
62 in glibc. */
63#define __HAVE_FLOAT128_UNLIKE_LDBL (__HAVE_DISTINCT_FLOAT128 \
64 && __LDBL_MANT_DIG__ != 113)
65
66/* Defined to 1 if any _FloatN or _FloatNx types that are not
67 ABI-distinct are however distinct types at the C language level (so
68 for the purposes of __builtin_types_compatible_p and _Generic). */
69#if __GNUC_PREREQ (7, 0) && !defined __cplusplus
70# define __HAVE_FLOATN_NOT_TYPEDEF 1
71#else
72# define __HAVE_FLOATN_NOT_TYPEDEF 0
73#endif
74
75#ifndef __ASSEMBLER__
76
77/* Defined to concatenate the literal suffix to be used with _FloatN
78 or _FloatNx types, if __HAVE_<type> is 1. The corresponding
79 literal suffixes exist since GCC 7, for C only. */
80# if __HAVE_FLOAT16
81# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
82/* No corresponding suffix available for this type. */
83# define __f16(x) ((_Float16) x##f)
84# else
85# define __f16(x) x##f16
86# endif
87# endif
88
89# if __HAVE_FLOAT32
90# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
91# define __f32(x) x##f
92# else
93# define __f32(x) x##f32
94# endif
95# endif
96
97# if __HAVE_FLOAT64
98# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
99# ifdef __NO_LONG_DOUBLE_MATH
100# define __f64(x) x##l
101# else
102# define __f64(x) x
103# endif
104# else
105# define __f64(x) x##f64
106# endif
107# endif
108
109# if __HAVE_FLOAT32X
110# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
111# define __f32x(x) x
112# else
113# define __f32x(x) x##f32x
114# endif
115# endif
116
117# if __HAVE_FLOAT64X
118# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
119# if __HAVE_FLOAT64X_LONG_DOUBLE
120# define __f64x(x) x##l
121# else
122# define __f64x(x) __f128 (x)
123# endif
124# else
125# define __f64x(x) x##f64x
126# endif
127# endif
128
129# if __HAVE_FLOAT128X
130# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
131# error "_Float128X supported but no constant suffix"
132# else
133# define __f128x(x) x##f128x
134# endif
135# endif
136
137/* Defined to a complex type if __HAVE_<type> is 1. */
138# if __HAVE_FLOAT16
139# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
140typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
141# define __CFLOAT16 __cfloat16
142# else
143# define __CFLOAT16 _Complex _Float16
144# endif
145# endif
146
147# if __HAVE_FLOAT32
148# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
149# define __CFLOAT32 _Complex float
150# else
151# define __CFLOAT32 _Complex _Float32
152# endif
153# endif
154
155# if __HAVE_FLOAT64
156# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
157# ifdef __NO_LONG_DOUBLE_MATH
158# define __CFLOAT64 _Complex long double
159# else
160# define __CFLOAT64 _Complex double
161# endif
162# else
163# define __CFLOAT64 _Complex _Float64
164# endif
165# endif
166
167# if __HAVE_FLOAT32X
168# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
169# define __CFLOAT32X _Complex double
170# else
171# define __CFLOAT32X _Complex _Float32x
172# endif
173# endif
174
175# if __HAVE_FLOAT64X
176# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
177# if __HAVE_FLOAT64X_LONG_DOUBLE
178# define __CFLOAT64X _Complex long double
179# else
180# define __CFLOAT64X __CFLOAT128
181# endif
182# else
183# define __CFLOAT64X _Complex _Float64x
184# endif
185# endif
186
187# if __HAVE_FLOAT128X
188# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
189# error "_Float128X supported but no complex type"
190# else
191# define __CFLOAT128X _Complex _Float128x
192# endif
193# endif
194
195/* The remaining of this file provides support for older compilers. */
196# if __HAVE_FLOAT16
197
198# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
199typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
200# endif
201
202# if !__GNUC_PREREQ (7, 0)
203# define __builtin_huge_valf16() ((_Float16) __builtin_huge_val ())
204# define __builtin_inff16() ((_Float16) __builtin_inf ())
205# define __builtin_nanf16(x) ((_Float16) __builtin_nan (x))
206# define __builtin_nansf16(x) ((_Float16) __builtin_nans (x))
207# endif
208
209# endif
210
211# if __HAVE_FLOAT32
212
213# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
214typedef float _Float32;
215# endif
216
217# if !__GNUC_PREREQ (7, 0)
218# define __builtin_huge_valf32() (__builtin_huge_valf ())
219# define __builtin_inff32() (__builtin_inff ())
220# define __builtin_nanf32(x) (__builtin_nanf (x))
221# define __builtin_nansf32(x) (__builtin_nansf (x))
222# endif
223
224# endif
225
226# if __HAVE_FLOAT64
227
228/* If double, long double and _Float64 all have the same set of
229 values, TS 18661-3 requires the usual arithmetic conversions on
230 long double and _Float64 to produce _Float64. For this to be the
231 case when building with a compiler without a distinct _Float64
232 type, _Float64 must be a typedef for long double, not for
233 double. */
234
235# ifdef __NO_LONG_DOUBLE_MATH
236
237# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
238typedef long double _Float64;
239# endif
240
241# if !__GNUC_PREREQ (7, 0)
242# define __builtin_huge_valf64() (__builtin_huge_vall ())
243# define __builtin_inff64() (__builtin_infl ())
244# define __builtin_nanf64(x) (__builtin_nanl (x))
245# define __builtin_nansf64(x) (__builtin_nansl (x))
246# endif
247
248# else
249
250# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
251typedef double _Float64;
252# endif
253
254# if !__GNUC_PREREQ (7, 0)
255# define __builtin_huge_valf64() (__builtin_huge_val ())
256# define __builtin_inff64() (__builtin_inf ())
257# define __builtin_nanf64(x) (__builtin_nan (x))
258# define __builtin_nansf64(x) (__builtin_nans (x))
259# endif
260
261# endif
262
263# endif
264
265# if __HAVE_FLOAT32X
266
267# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
268typedef double _Float32x;
269# endif
270
271# if !__GNUC_PREREQ (7, 0)
272# define __builtin_huge_valf32x() (__builtin_huge_val ())
273# define __builtin_inff32x() (__builtin_inf ())
274# define __builtin_nanf32x(x) (__builtin_nan (x))
275# define __builtin_nansf32x(x) (__builtin_nans (x))
276# endif
277
278# endif
279
280# if __HAVE_FLOAT64X
281
282# if __HAVE_FLOAT64X_LONG_DOUBLE
283
284# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
285typedef long double _Float64x;
286# endif
287
288# if !__GNUC_PREREQ (7, 0)
289# define __builtin_huge_valf64x() (__builtin_huge_vall ())
290# define __builtin_inff64x() (__builtin_infl ())
291# define __builtin_nanf64x(x) (__builtin_nanl (x))
292# define __builtin_nansf64x(x) (__builtin_nansl (x))
293# endif
294
295# else
296
297# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
298typedef _Float128 _Float64x;
299# endif
300
301# if !__GNUC_PREREQ (7, 0)
302# define __builtin_huge_valf64x() (__builtin_huge_valf128 ())
303# define __builtin_inff64x() (__builtin_inff128 ())
304# define __builtin_nanf64x(x) (__builtin_nanf128 (x))
305# define __builtin_nansf64x(x) (__builtin_nansf128 (x))
306# endif
307
308# endif
309
310# endif
311
312# if __HAVE_FLOAT128X
313
314# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
315# error "_Float128x supported but no type"
316# endif
317
318# if !__GNUC_PREREQ (7, 0)
319# define __builtin_huge_valf128x() ((_Float128x) __builtin_huge_val ())
320# define __builtin_inff128x() ((_Float128x) __builtin_inf ())
321# define __builtin_nanf128x(x) ((_Float128x) __builtin_nan (x))
322# define __builtin_nansf128x(x) ((_Float128x) __builtin_nans (x))
323# endif
324
325# endif
326
327#endif /* !__ASSEMBLER__. */
328
329#endif /* _BITS_FLOATN_COMMON_H */
lib/libc/glibc/bits/libc-header-start.h deleted-110
......@@ -1,110 +0,0 @@
1/* Handle feature test macros at the start of a header.
2 Copyright (C) 2016-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* This header is internal to glibc and should not be included outside
20 of glibc headers. Headers including it must define
21 __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first. This header
22 cannot have multiple include guards because ISO C feature test
23 macros depend on the definition of the macro when an affected
24 header is included, not when the first system header is
25 included. */
26
27#ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
28# error "Never include <bits/libc-header-start.h> directly."
29#endif
30
31#undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
32
33#include <features.h>
34
35/* ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__
36 macro. */
37#undef __GLIBC_USE_LIB_EXT2
38#if (defined __USE_GNU \
39 || (defined __STDC_WANT_LIB_EXT2__ && __STDC_WANT_LIB_EXT2__ > 0))
40# define __GLIBC_USE_LIB_EXT2 1
41#else
42# define __GLIBC_USE_LIB_EXT2 0
43#endif
44
45/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
46 macro. Most but not all symbols enabled by that macro in TS
47 18661-1 are enabled unconditionally in C23. In C23, the symbols in
48 Annex F still require a new feature test macro
49 __STDC_WANT_IEC_60559_EXT__ instead (C23 does not define
50 __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
51 18661-1 are not included in C23 (and thus should depend on
52 __STDC_WANT_IEC_60559_BFP_EXT__ even when C23 features are
53 enabled).
54
55 __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
56 18661-1 not included in C23.
57
58 __GLIBC_USE (IEC_60559_BFP_EXT_C23) controls those features from TS
59 18661-1 that are also included in C23 (with no feature test macro
60 required in C23).
61
62 __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
63 that are included in C23 but conditional on
64 __STDC_WANT_IEC_60559_EXT__. (There are currently no features
65 conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
66 18661-1.) */
67#undef __GLIBC_USE_IEC_60559_BFP_EXT
68#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
69# define __GLIBC_USE_IEC_60559_BFP_EXT 1
70#else
71# define __GLIBC_USE_IEC_60559_BFP_EXT 0
72#endif
73#undef __GLIBC_USE_IEC_60559_BFP_EXT_C23
74#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC23)
75# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 1
76#else
77# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 0
78#endif
79#undef __GLIBC_USE_IEC_60559_EXT
80#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
81# define __GLIBC_USE_IEC_60559_EXT 1
82#else
83# define __GLIBC_USE_IEC_60559_EXT 0
84#endif
85
86/* ISO/IEC TS 18661-4:2015 defines the
87 __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
88 functions, the symbols from this TS are enabled unconditionally in
89 C23. */
90#undef __GLIBC_USE_IEC_60559_FUNCS_EXT
91#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
92# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
93#else
94# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
95#endif
96#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C23
97#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC23)
98# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 1
99#else
100# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 0
101#endif
102
103/* ISO/IEC TS 18661-3:2015 defines the
104 __STDC_WANT_IEC_60559_TYPES_EXT__ macro. */
105#undef __GLIBC_USE_IEC_60559_TYPES_EXT
106#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_TYPES_EXT__
107# define __GLIBC_USE_IEC_60559_TYPES_EXT 1
108#else
109# define __GLIBC_USE_IEC_60559_TYPES_EXT 0
110#endif
lib/libc/glibc/bits/pthreadtypes.h deleted-1
......@@ -1 +0,0 @@
1/* No thread support. */
lib/libc/glibc/bits/signum-generic.h deleted-81
......@@ -1,81 +0,0 @@
1/* Signal number constants. Generic template.
2 Copyright (C) 1991-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_SIGNUM_GENERIC_H
20#define _BITS_SIGNUM_GENERIC_H 1
21
22#ifndef _SIGNAL_H
23#error "Never include <bits/signum-generic.h> directly; use <signal.h> instead."
24#endif
25
26/* Fake signal functions. */
27
28#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
29#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
30#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
31
32#ifdef __USE_XOPEN
33# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
34#endif
35
36/* We define here all the signal names listed in POSIX (1003.1-2008);
37 as of 1003.1-2013, no additional signals have been added by POSIX.
38 We also define here signal names that historically exist in every
39 real-world POSIX variant (e.g. SIGWINCH).
40
41 Signals in the 1-15 range are defined with their historical numbers.
42 For other signals, we use the BSD numbers.
43 There are two unallocated signal numbers in the 1-31 range: 7 and 29.
44 Signal number 0 is reserved for use as kill(pid, 0), to test whether
45 a process exists without sending it a signal. */
46
47/* ISO C99 signals. */
48#define SIGINT 2 /* Interactive attention signal. */
49#define SIGILL 4 /* Illegal instruction. */
50#define SIGABRT 6 /* Abnormal termination. */
51#define SIGFPE 8 /* Erroneous arithmetic operation. */
52#define SIGSEGV 11 /* Invalid access to storage. */
53#define SIGTERM 15 /* Termination request. */
54
55/* Historical signals specified by POSIX. */
56#define SIGHUP 1 /* Hangup. */
57#define SIGQUIT 3 /* Quit. */
58#define SIGTRAP 5 /* Trace/breakpoint trap. */
59#define SIGKILL 9 /* Killed. */
60#define SIGPIPE 13 /* Broken pipe. */
61#define SIGALRM 14 /* Alarm clock. */
62
63/* Archaic names for compatibility. */
64#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
65#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */
66#define SIGCLD SIGCHLD /* Old System V name */
67
68/* Not all systems support real-time signals. bits/signum.h indicates
69 that they are supported by overriding __SIGRTMAX to a value greater
70 than __SIGRTMIN. These constants give the kernel-level hard limits,
71 but some real-time signals may be used internally by glibc. Do not
72 use these constants in application code; use SIGRTMIN and SIGRTMAX
73 (defined in signal.h) instead. */
74
75/* Include system specific bits. */
76#include <bits/signum-arch.h>
77
78/* Biggest signal number + 1 (including real-time signals). */
79#define _NSIG (__SIGRTMAX + 1)
80
81#endif /* bits/signum-generic.h. */
lib/libc/glibc/bits/stat.h deleted-103
......@@ -1,103 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#if !defined _SYS_STAT_H && !defined _FCNTL_H
19# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
20#endif
21
22#ifndef _BITS_STAT_H
23#define _BITS_STAT_H 1
24
25/* This structure needs to be defined in accordance with the
26 implementation of __stat, __fstat, and __lstat. */
27
28#include <bits/types.h>
29
30/* Structure describing file characteristics. */
31struct stat
32 {
33 /* These are the members that POSIX.1 requires. */
34
35 __mode_t st_mode; /* File mode. */
36#ifndef __USE_FILE_OFFSET64
37 __ino_t st_ino; /* File serial number. */
38#else
39 __ino64_t st_ino; /* File serial number. */
40#endif
41 __dev_t st_dev; /* Device containing the file. */
42 __nlink_t st_nlink; /* Link count. */
43
44 __uid_t st_uid; /* User ID of the file's owner. */
45 __gid_t st_gid; /* Group ID of the file's group. */
46#ifndef __USE_FILE_OFFSET64
47 __off_t st_size; /* Size of file, in bytes. */
48#else
49 __off64_t st_size; /* Size of file, in bytes. */
50#endif
51
52 __time_t st_atime; /* Time of last access. */
53 __time_t st_mtime; /* Time of last modification. */
54 __time_t st_ctime; /* Time of last status change. */
55
56 /* This should be defined if there is a `st_blksize' member. */
57#undef _STATBUF_ST_BLKSIZE
58 };
59
60/* Encoding of the file mode. These are the standard Unix values,
61 but POSIX.1 does not specify what values should be used. */
62
63#define __S_IFMT 0170000 /* These bits determine file type. */
64
65/* File types. */
66#define __S_IFDIR 0040000 /* Directory. */
67#define __S_IFCHR 0020000 /* Character device. */
68#define __S_IFBLK 0060000 /* Block device. */
69#define __S_IFREG 0100000 /* Regular file. */
70#define __S_IFIFO 0010000 /* FIFO. */
71
72/* POSIX.1b objects. */
73#define __S_TYPEISMQ(buf) 0
74#define __S_TYPEISSEM(buf) 0
75#define __S_TYPEISSHM(buf) 0
76
77/* Protection bits. */
78
79#define __S_ISUID 04000 /* Set user ID on execution. */
80#define __S_ISGID 02000 /* Set group ID on execution. */
81#define __S_IREAD 0400 /* Read by owner. */
82#define __S_IWRITE 0200 /* Write by owner. */
83#define __S_IEXEC 0100 /* Execute by owner. */
84
85#ifdef __USE_LARGEFILE64
86struct stat64
87 {
88 __mode_t st_mode; /* File mode. */
89 __ino64_t st_ino; /* File serial number. */
90 __dev_t st_dev; /* Device. */
91 __nlink_t st_nlink; /* Link count. */
92
93 __uid_t st_uid; /* User ID of the file's owner. */
94 __gid_t st_gid; /* Group ID of the file's group.*/
95 __off64_t st_size; /* Size of file, in bytes. */
96
97 __time_t st_atime; /* Time of last access. */
98 __time_t st_mtime; /* Time of last modification. */
99 __time_t st_ctime; /* Time of last status change. */
100 };
101#endif
102
103#endif /* bits/stat.h */
lib/libc/glibc/bits/stdlib-bsearch.h deleted-50
......@@ -1,50 +0,0 @@
1/* Perform binary search - inline version.
2 Copyright (C) 1991-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19__extern_inline void *
20bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
21 __compar_fn_t __compar)
22{
23 const void *__p;
24 int __comparison;
25
26 while (__nmemb)
27 {
28 __p = (const void *) (((const char *) __base) + ((__nmemb >> 1) * __size));
29 __comparison = (*__compar) (__key, __p);
30 if (__comparison == 0)
31 {
32#if __GNUC_PREREQ(4, 6)
33# pragma GCC diagnostic push
34# pragma GCC diagnostic ignored "-Wcast-qual"
35#endif
36 return (void *) __p;
37#if __GNUC_PREREQ(4, 6)
38# pragma GCC diagnostic pop
39#endif
40 }
41 if (__comparison > 0)
42 {
43 __base = ((const char *) __p) + __size;
44 --__nmemb;
45 }
46 __nmemb >>= 1;
47 }
48
49 return NULL;
50}
lib/libc/glibc/bits/types/struct_sched_param.h deleted-28
......@@ -1,28 +0,0 @@
1/* Sched parameter structure. Generic version.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES_STRUCT_SCHED_PARAM
20#define _BITS_TYPES_STRUCT_SCHED_PARAM 1
21
22/* Data structure to describe a process' schedulability. */
23struct sched_param
24{
25 int sched_priority;
26};
27
28#endif /* bits/types/struct_sched_param.h */
lib/libc/glibc/bits/waitflags.h deleted-34
......@@ -1,34 +0,0 @@
1/* Definitions of flag bits for `waitpid' et al.
2 Copyright (C) 1992-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if !defined _SYS_WAIT_H && !defined _STDLIB_H
20# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
21#endif
22
23
24/* Bits in the third argument to `waitpid'. */
25#define WNOHANG 1 /* Don't block waiting. */
26#define WUNTRACED 2 /* Report status of stopped children. */
27
28/* Bits in the fourth argument to `waitid'. */
29#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
30# define WSTOPPED WUNTRACED /* Report stopped child. */
31# define WCONTINUED 4 /* Report continued child. */
32# define WNOWAIT 8 /* Don't reap, just poll status. */
33# define WEXITED 16 /* Report dead child. */
34#endif
lib/libc/glibc/bits/waitstatus.h deleted-59
......@@ -1,59 +0,0 @@
1/* Definitions of status bits for `wait' et al.
2 Copyright (C) 1992-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#if !defined _SYS_WAIT_H && !defined _STDLIB_H
20# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
21#endif
22
23
24/* Everything extant so far uses these same bits. */
25
26
27/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
28#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
29
30/* If WIFSIGNALED(STATUS), the terminating signal. */
31#define __WTERMSIG(status) ((status) & 0x7f)
32
33/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
34#define __WSTOPSIG(status) __WEXITSTATUS(status)
35
36/* Nonzero if STATUS indicates normal termination. */
37#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
38
39/* Nonzero if STATUS indicates termination by a signal. */
40#define __WIFSIGNALED(status) \
41 (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
42
43/* Nonzero if STATUS indicates the child is stopped. */
44#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
45
46/* Nonzero if STATUS indicates the child continued after a stop. We only
47 define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */
48#ifdef WCONTINUED
49# define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
50#endif
51
52/* Nonzero if STATUS indicates the child dumped core. */
53#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
54
55/* Macros for constructing status values. */
56#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
57#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
58#define __W_CONTINUED 0xffff
59#define __WCOREFLAG 0x80
lib/libc/glibc/csu/errno.c deleted-35
......@@ -1,35 +0,0 @@
1/* Definition of `errno' variable. Canonical version.
2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <errno.h>
20#include <tls.h>
21#include <dl-sysdep.h>
22#undef errno
23
24#if RTLD_PRIVATE_ERRNO
25
26/* Code compiled for rtld refers only to this name. */
27int rtld_errno attribute_hidden;
28
29#else
30
31__thread int errno;
32extern __thread int __libc_errno __attribute__ ((alias ("errno")))
33 attribute_hidden;
34
35#endif
lib/libc/glibc/elf/elf.h deleted-4487
......@@ -1,4487 +0,0 @@
1/* This file defines standard ELF types, structures, and macros.
2 Copyright (C) 1995-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _ELF_H
20#define _ELF_H 1
21
22/* Standard ELF types. */
23
24#include <stdint.h>
25
26/* Type for a 16-bit quantity. */
27typedef uint16_t Elf32_Half;
28typedef uint16_t Elf64_Half;
29
30/* Types for signed and unsigned 32-bit quantities. */
31typedef uint32_t Elf32_Word;
32typedef int32_t Elf32_Sword;
33typedef uint32_t Elf64_Word;
34typedef int32_t Elf64_Sword;
35
36/* Types for signed and unsigned 64-bit quantities. */
37typedef uint64_t Elf32_Xword;
38typedef int64_t Elf32_Sxword;
39typedef uint64_t Elf64_Xword;
40typedef int64_t Elf64_Sxword;
41
42/* Type of addresses. */
43typedef uint32_t Elf32_Addr;
44typedef uint64_t Elf64_Addr;
45
46/* Type of file offsets. */
47typedef uint32_t Elf32_Off;
48typedef uint64_t Elf64_Off;
49
50/* Type for section indices, which are 16-bit quantities. */
51typedef uint16_t Elf32_Section;
52typedef uint16_t Elf64_Section;
53
54/* Type for version symbol information. */
55typedef Elf32_Half Elf32_Versym;
56typedef Elf64_Half Elf64_Versym;
57
58
59/* The ELF file header. This appears at the start of every ELF file. */
60
61#define EI_NIDENT (16)
62
63typedef struct
64{
65 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
66 Elf32_Half e_type; /* Object file type */
67 Elf32_Half e_machine; /* Architecture */
68 Elf32_Word e_version; /* Object file version */
69 Elf32_Addr e_entry; /* Entry point virtual address */
70 Elf32_Off e_phoff; /* Program header table file offset */
71 Elf32_Off e_shoff; /* Section header table file offset */
72 Elf32_Word e_flags; /* Processor-specific flags */
73 Elf32_Half e_ehsize; /* ELF header size in bytes */
74 Elf32_Half e_phentsize; /* Program header table entry size */
75 Elf32_Half e_phnum; /* Program header table entry count */
76 Elf32_Half e_shentsize; /* Section header table entry size */
77 Elf32_Half e_shnum; /* Section header table entry count */
78 Elf32_Half e_shstrndx; /* Section header string table index */
79} Elf32_Ehdr;
80
81typedef struct
82{
83 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
84 Elf64_Half e_type; /* Object file type */
85 Elf64_Half e_machine; /* Architecture */
86 Elf64_Word e_version; /* Object file version */
87 Elf64_Addr e_entry; /* Entry point virtual address */
88 Elf64_Off e_phoff; /* Program header table file offset */
89 Elf64_Off e_shoff; /* Section header table file offset */
90 Elf64_Word e_flags; /* Processor-specific flags */
91 Elf64_Half e_ehsize; /* ELF header size in bytes */
92 Elf64_Half e_phentsize; /* Program header table entry size */
93 Elf64_Half e_phnum; /* Program header table entry count */
94 Elf64_Half e_shentsize; /* Section header table entry size */
95 Elf64_Half e_shnum; /* Section header table entry count */
96 Elf64_Half e_shstrndx; /* Section header string table index */
97} Elf64_Ehdr;
98
99/* Fields in the e_ident array. The EI_* macros are indices into the
100 array. The macros under each EI_* macro are the values the byte
101 may have. */
102
103#define EI_MAG0 0 /* File identification byte 0 index */
104#define ELFMAG0 0x7f /* Magic number byte 0 */
105
106#define EI_MAG1 1 /* File identification byte 1 index */
107#define ELFMAG1 'E' /* Magic number byte 1 */
108
109#define EI_MAG2 2 /* File identification byte 2 index */
110#define ELFMAG2 'L' /* Magic number byte 2 */
111
112#define EI_MAG3 3 /* File identification byte 3 index */
113#define ELFMAG3 'F' /* Magic number byte 3 */
114
115/* Conglomeration of the identification bytes, for easy testing as a word. */
116#define ELFMAG "\177ELF"
117#define SELFMAG 4
118
119#define EI_CLASS 4 /* File class byte index */
120#define ELFCLASSNONE 0 /* Invalid class */
121#define ELFCLASS32 1 /* 32-bit objects */
122#define ELFCLASS64 2 /* 64-bit objects */
123#define ELFCLASSNUM 3
124
125#define EI_DATA 5 /* Data encoding byte index */
126#define ELFDATANONE 0 /* Invalid data encoding */
127#define ELFDATA2LSB 1 /* 2's complement, little endian */
128#define ELFDATA2MSB 2 /* 2's complement, big endian */
129#define ELFDATANUM 3
130
131#define EI_VERSION 6 /* File version byte index */
132 /* Value must be EV_CURRENT */
133
134#define EI_OSABI 7 /* OS ABI identification */
135#define ELFOSABI_NONE 0 /* UNIX System V ABI */
136#define ELFOSABI_SYSV 0 /* Alias. */
137#define ELFOSABI_HPUX 1 /* HP-UX */
138#define ELFOSABI_NETBSD 2 /* NetBSD. */
139#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
140#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */
141#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
142#define ELFOSABI_AIX 7 /* IBM AIX. */
143#define ELFOSABI_IRIX 8 /* SGI Irix. */
144#define ELFOSABI_FREEBSD 9 /* FreeBSD. */
145#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
146#define ELFOSABI_MODESTO 11 /* Novell Modesto. */
147#define ELFOSABI_OPENBSD 12 /* OpenBSD. */
148#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */
149#define ELFOSABI_ARM 97 /* ARM */
150#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
151
152#define EI_ABIVERSION 8 /* ABI version */
153
154#define EI_PAD 9 /* Byte index of padding bytes */
155
156/* Legal values for e_type (object file type). */
157
158#define ET_NONE 0 /* No file type */
159#define ET_REL 1 /* Relocatable file */
160#define ET_EXEC 2 /* Executable file */
161#define ET_DYN 3 /* Shared object file */
162#define ET_CORE 4 /* Core file */
163#define ET_NUM 5 /* Number of defined types */
164#define ET_LOOS 0xfe00 /* OS-specific range start */
165#define ET_HIOS 0xfeff /* OS-specific range end */
166#define ET_LOPROC 0xff00 /* Processor-specific range start */
167#define ET_HIPROC 0xffff /* Processor-specific range end */
168
169/* Legal values for e_machine (architecture). */
170
171#define EM_NONE 0 /* No machine */
172#define EM_M32 1 /* AT&T WE 32100 */
173#define EM_SPARC 2 /* SUN SPARC */
174#define EM_386 3 /* Intel 80386 */
175#define EM_68K 4 /* Motorola m68k family */
176#define EM_88K 5 /* Motorola m88k family */
177#define EM_IAMCU 6 /* Intel MCU */
178#define EM_860 7 /* Intel 80860 */
179#define EM_MIPS 8 /* MIPS R3000 big-endian */
180#define EM_S370 9 /* IBM System/370 */
181#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
182 /* reserved 11-14 */
183#define EM_PARISC 15 /* HPPA */
184 /* reserved 16 */
185#define EM_VPP500 17 /* Fujitsu VPP500 */
186#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
187#define EM_960 19 /* Intel 80960 */
188#define EM_PPC 20 /* PowerPC */
189#define EM_PPC64 21 /* PowerPC 64-bit */
190#define EM_S390 22 /* IBM S390 */
191#define EM_SPU 23 /* IBM SPU/SPC */
192 /* reserved 24-35 */
193#define EM_V800 36 /* NEC V800 series */
194#define EM_FR20 37 /* Fujitsu FR20 */
195#define EM_RH32 38 /* TRW RH-32 */
196#define EM_RCE 39 /* Motorola RCE */
197#define EM_ARM 40 /* ARM */
198#define EM_FAKE_ALPHA 41 /* Digital Alpha */
199#define EM_SH 42 /* Hitachi SH */
200#define EM_SPARCV9 43 /* SPARC v9 64-bit */
201#define EM_TRICORE 44 /* Siemens Tricore */
202#define EM_ARC 45 /* Argonaut RISC Core */
203#define EM_H8_300 46 /* Hitachi H8/300 */
204#define EM_H8_300H 47 /* Hitachi H8/300H */
205#define EM_H8S 48 /* Hitachi H8S */
206#define EM_H8_500 49 /* Hitachi H8/500 */
207#define EM_IA_64 50 /* Intel Merced */
208#define EM_MIPS_X 51 /* Stanford MIPS-X */
209#define EM_COLDFIRE 52 /* Motorola Coldfire */
210#define EM_68HC12 53 /* Motorola M68HC12 */
211#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
212#define EM_PCP 55 /* Siemens PCP */
213#define EM_NCPU 56 /* Sony nCPU embedded RISC */
214#define EM_NDR1 57 /* Denso NDR1 microprocessor */
215#define EM_STARCORE 58 /* Motorola Start*Core processor */
216#define EM_ME16 59 /* Toyota ME16 processor */
217#define EM_ST100 60 /* STMicroelectronic ST100 processor */
218#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam */
219#define EM_X86_64 62 /* AMD x86-64 architecture */
220#define EM_PDSP 63 /* Sony DSP Processor */
221#define EM_PDP10 64 /* Digital PDP-10 */
222#define EM_PDP11 65 /* Digital PDP-11 */
223#define EM_FX66 66 /* Siemens FX66 microcontroller */
224#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
225#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
226#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
227#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
228#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
229#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
230#define EM_SVX 73 /* Silicon Graphics SVx */
231#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
232#define EM_VAX 75 /* Digital VAX */
233#define EM_CRIS 76 /* Axis Communications 32-bit emb.proc */
234#define EM_JAVELIN 77 /* Infineon Technologies 32-bit emb.proc */
235#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
236#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
237#define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc */
238#define EM_HUANY 81 /* Harvard University machine-independent object files */
239#define EM_PRISM 82 /* SiTera Prism */
240#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
241#define EM_FR30 84 /* Fujitsu FR30 */
242#define EM_D10V 85 /* Mitsubishi D10V */
243#define EM_D30V 86 /* Mitsubishi D30V */
244#define EM_V850 87 /* NEC v850 */
245#define EM_M32R 88 /* Mitsubishi M32R */
246#define EM_MN10300 89 /* Matsushita MN10300 */
247#define EM_MN10200 90 /* Matsushita MN10200 */
248#define EM_PJ 91 /* picoJava */
249#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
250#define EM_ARC_COMPACT 93 /* ARC International ARCompact */
251#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
252#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore */
253#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Proc */
254#define EM_NS32K 97 /* National Semi. 32000 */
255#define EM_TPC 98 /* Tenor Network TPC */
256#define EM_SNP1K 99 /* Trebia SNP 1000 */
257#define EM_ST200 100 /* STMicroelectronics ST200 */
258#define EM_IP2K 101 /* Ubicom IP2xxx */
259#define EM_MAX 102 /* MAX processor */
260#define EM_CR 103 /* National Semi. CompactRISC */
261#define EM_F2MC16 104 /* Fujitsu F2MC16 */
262#define EM_MSP430 105 /* Texas Instruments msp430 */
263#define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */
264#define EM_SE_C33 107 /* Seiko Epson S1C33 family */
265#define EM_SEP 108 /* Sharp embedded microprocessor */
266#define EM_ARCA 109 /* Arca RISC */
267#define EM_UNICORE 110 /* PKU-Unity & MPRC Peking Uni. mc series */
268#define EM_EXCESS 111 /* eXcess configurable cpu */
269#define EM_DXP 112 /* Icera Semi. Deep Execution Processor */
270#define EM_ALTERA_NIOS2 113 /* Altera Nios II */
271#define EM_CRX 114 /* National Semi. CompactRISC CRX */
272#define EM_XGATE 115 /* Motorola XGATE */
273#define EM_C166 116 /* Infineon C16x/XC16x */
274#define EM_M16C 117 /* Renesas M16C */
275#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F */
276#define EM_CE 119 /* Freescale Communication Engine RISC */
277#define EM_M32C 120 /* Renesas M32C */
278 /* reserved 121-130 */
279#define EM_TSK3000 131 /* Altium TSK3000 */
280#define EM_RS08 132 /* Freescale RS08 */
281#define EM_SHARC 133 /* Analog Devices SHARC family */
282#define EM_ECOG2 134 /* Cyan Technology eCOG2 */
283#define EM_SCORE7 135 /* Sunplus S+core7 RISC */
284#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP */
285#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III */
286#define EM_LATTICEMICO32 138 /* RISC for Lattice FPGA */
287#define EM_SE_C17 139 /* Seiko Epson C17 */
288#define EM_TI_C6000 140 /* Texas Instruments TMS320C6000 DSP */
289#define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP */
290#define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP */
291#define EM_TI_ARP32 143 /* Texas Instruments App. Specific RISC */
292#define EM_TI_PRU 144 /* Texas Instruments Prog. Realtime Unit */
293 /* reserved 145-159 */
294#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW DSP */
295#define EM_CYPRESS_M8C 161 /* Cypress M8C */
296#define EM_R32C 162 /* Renesas R32C */
297#define EM_TRIMEDIA 163 /* NXP Semi. TriMedia */
298#define EM_QDSP6 164 /* QUALCOMM DSP6 */
299#define EM_8051 165 /* Intel 8051 and variants */
300#define EM_STXP7X 166 /* STMicroelectronics STxP7x */
301#define EM_NDS32 167 /* Andes Tech. compact code emb. RISC */
302#define EM_ECOG1X 168 /* Cyan Technology eCOG1X */
303#define EM_MAXQ30 169 /* Dallas Semi. MAXQ30 mc */
304#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP */
305#define EM_MANIK 171 /* M2000 Reconfigurable RISC */
306#define EM_CRAYNV2 172 /* Cray NV2 vector architecture */
307#define EM_RX 173 /* Renesas RX */
308#define EM_METAG 174 /* Imagination Tech. META */
309#define EM_MCST_ELBRUS 175 /* MCST Elbrus */
310#define EM_ECOG16 176 /* Cyan Technology eCOG16 */
311#define EM_CR16 177 /* National Semi. CompactRISC CR16 */
312#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */
313#define EM_SLE9X 179 /* Infineon Tech. SLE9X */
314#define EM_L10M 180 /* Intel L10M */
315#define EM_K10M 181 /* Intel K10M */
316 /* reserved 182 */
317#define EM_AARCH64 183 /* ARM AARCH64 */
318 /* reserved 184 */
319#define EM_AVR32 185 /* Amtel 32-bit microprocessor */
320#define EM_STM8 186 /* STMicroelectronics STM8 */
321#define EM_TILE64 187 /* Tilera TILE64 */
322#define EM_TILEPRO 188 /* Tilera TILEPro */
323#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
324#define EM_CUDA 190 /* NVIDIA CUDA */
325#define EM_TILEGX 191 /* Tilera TILE-Gx */
326#define EM_CLOUDSHIELD 192 /* CloudShield */
327#define EM_COREA_1ST 193 /* KIPO-KAIST Core-A 1st gen. */
328#define EM_COREA_2ND 194 /* KIPO-KAIST Core-A 2nd gen. */
329#define EM_ARCV2 195 /* Synopsys ARCv2 ISA. */
330#define EM_OPEN8 196 /* Open8 RISC */
331#define EM_RL78 197 /* Renesas RL78 */
332#define EM_VIDEOCORE5 198 /* Broadcom VideoCore V */
333#define EM_78KOR 199 /* Renesas 78KOR */
334#define EM_56800EX 200 /* Freescale 56800EX DSC */
335#define EM_BA1 201 /* Beyond BA1 */
336#define EM_BA2 202 /* Beyond BA2 */
337#define EM_XCORE 203 /* XMOS xCORE */
338#define EM_MCHP_PIC 204 /* Microchip 8-bit PIC(r) */
339#define EM_INTELGT 205 /* Intel Graphics Technology */
340 /* reserved 206-209 */
341#define EM_KM32 210 /* KM211 KM32 */
342#define EM_KMX32 211 /* KM211 KMX32 */
343#define EM_EMX16 212 /* KM211 KMX16 */
344#define EM_EMX8 213 /* KM211 KMX8 */
345#define EM_KVARC 214 /* KM211 KVARC */
346#define EM_CDP 215 /* Paneve CDP */
347#define EM_COGE 216 /* Cognitive Smart Memory Processor */
348#define EM_COOL 217 /* Bluechip CoolEngine */
349#define EM_NORC 218 /* Nanoradio Optimized RISC */
350#define EM_CSR_KALIMBA 219 /* CSR Kalimba */
351#define EM_Z80 220 /* Zilog Z80 */
352#define EM_VISIUM 221 /* Controls and Data Services VISIUMcore */
353#define EM_FT32 222 /* FTDI Chip FT32 */
354#define EM_MOXIE 223 /* Moxie processor */
355#define EM_AMDGPU 224 /* AMD GPU */
356 /* reserved 225-242 */
357#define EM_RISCV 243 /* RISC-V */
358
359#define EM_BPF 247 /* Linux BPF -- in-kernel virtual machine */
360#define EM_CSKY 252 /* C-SKY */
361#define EM_LOONGARCH 258 /* LoongArch */
362
363#define EM_NUM 259
364
365/* Old spellings/synonyms. */
366
367#define EM_ARC_A5 EM_ARC_COMPACT
368
369/* If it is necessary to assign new unofficial EM_* values, please
370 pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
371 chances of collision with official or non-GNU unofficial values. */
372
373#define EM_ALPHA 0x9026
374
375/* Legal values for e_version (version). */
376
377#define EV_NONE 0 /* Invalid ELF version */
378#define EV_CURRENT 1 /* Current version */
379#define EV_NUM 2
380
381/* Section header. */
382
383typedef struct
384{
385 Elf32_Word sh_name; /* Section name (string tbl index) */
386 Elf32_Word sh_type; /* Section type */
387 Elf32_Word sh_flags; /* Section flags */
388 Elf32_Addr sh_addr; /* Section virtual addr at execution */
389 Elf32_Off sh_offset; /* Section file offset */
390 Elf32_Word sh_size; /* Section size in bytes */
391 Elf32_Word sh_link; /* Link to another section */
392 Elf32_Word sh_info; /* Additional section information */
393 Elf32_Word sh_addralign; /* Section alignment */
394 Elf32_Word sh_entsize; /* Entry size if section holds table */
395} Elf32_Shdr;
396
397typedef struct
398{
399 Elf64_Word sh_name; /* Section name (string tbl index) */
400 Elf64_Word sh_type; /* Section type */
401 Elf64_Xword sh_flags; /* Section flags */
402 Elf64_Addr sh_addr; /* Section virtual addr at execution */
403 Elf64_Off sh_offset; /* Section file offset */
404 Elf64_Xword sh_size; /* Section size in bytes */
405 Elf64_Word sh_link; /* Link to another section */
406 Elf64_Word sh_info; /* Additional section information */
407 Elf64_Xword sh_addralign; /* Section alignment */
408 Elf64_Xword sh_entsize; /* Entry size if section holds table */
409} Elf64_Shdr;
410
411/* Special section indices. */
412
413#define SHN_UNDEF 0 /* Undefined section */
414#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
415#define SHN_LOPROC 0xff00 /* Start of processor-specific */
416#define SHN_BEFORE 0xff00 /* Order section before all others
417 (Solaris). */
418#define SHN_AFTER 0xff01 /* Order section after all others
419 (Solaris). */
420#define SHN_HIPROC 0xff1f /* End of processor-specific */
421#define SHN_LOOS 0xff20 /* Start of OS-specific */
422#define SHN_HIOS 0xff3f /* End of OS-specific */
423#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
424#define SHN_COMMON 0xfff2 /* Associated symbol is common */
425#define SHN_XINDEX 0xffff /* Index is in extra table. */
426#define SHN_HIRESERVE 0xffff /* End of reserved indices */
427
428/* Legal values for sh_type (section type). */
429
430#define SHT_NULL 0 /* Section header table entry unused */
431#define SHT_PROGBITS 1 /* Program data */
432#define SHT_SYMTAB 2 /* Symbol table */
433#define SHT_STRTAB 3 /* String table */
434#define SHT_RELA 4 /* Relocation entries with addends */
435#define SHT_HASH 5 /* Symbol hash table */
436#define SHT_DYNAMIC 6 /* Dynamic linking information */
437#define SHT_NOTE 7 /* Notes */
438#define SHT_NOBITS 8 /* Program space with no data (bss) */
439#define SHT_REL 9 /* Relocation entries, no addends */
440#define SHT_SHLIB 10 /* Reserved */
441#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
442#define SHT_INIT_ARRAY 14 /* Array of constructors */
443#define SHT_FINI_ARRAY 15 /* Array of destructors */
444#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
445#define SHT_GROUP 17 /* Section group */
446#define SHT_SYMTAB_SHNDX 18 /* Extended section indices */
447#define SHT_RELR 19 /* RELR relative relocations */
448#define SHT_NUM 20 /* Number of defined types. */
449#define SHT_LOOS 0x60000000 /* Start OS-specific. */
450#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */
451#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
452#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
453#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
454#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
455#define SHT_SUNW_move 0x6ffffffa
456#define SHT_SUNW_COMDAT 0x6ffffffb
457#define SHT_SUNW_syminfo 0x6ffffffc
458#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
459#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
460#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
461#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
462#define SHT_HIOS 0x6fffffff /* End OS-specific type */
463#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
464#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
465#define SHT_LOUSER 0x80000000 /* Start of application-specific */
466#define SHT_HIUSER 0x8fffffff /* End of application-specific */
467
468/* Legal values for sh_flags (section flags). */
469
470#define SHF_WRITE (1 << 0) /* Writable */
471#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
472#define SHF_EXECINSTR (1 << 2) /* Executable */
473#define SHF_MERGE (1 << 4) /* Might be merged */
474#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
475#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
476#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
477#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
478 required */
479#define SHF_GROUP (1 << 9) /* Section is member of a group. */
480#define SHF_TLS (1 << 10) /* Section hold thread-local data. */
481#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
482#define SHF_MASKOS 0x0ff00000 /* OS-specific. */
483#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
484#define SHF_GNU_RETAIN (1 << 21) /* Not to be GCed by linker. */
485#define SHF_ORDERED (1 << 30) /* Special ordering requirement
486 (Solaris). */
487#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless
488 referenced or allocated (Solaris).*/
489
490/* Section compression header. Used when SHF_COMPRESSED is set. */
491
492typedef struct
493{
494 Elf32_Word ch_type; /* Compression format. */
495 Elf32_Word ch_size; /* Uncompressed data size. */
496 Elf32_Word ch_addralign; /* Uncompressed data alignment. */
497} Elf32_Chdr;
498
499typedef struct
500{
501 Elf64_Word ch_type; /* Compression format. */
502 Elf64_Word ch_reserved;
503 Elf64_Xword ch_size; /* Uncompressed data size. */
504 Elf64_Xword ch_addralign; /* Uncompressed data alignment. */
505} Elf64_Chdr;
506
507/* Legal values for ch_type (compression algorithm). */
508#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */
509#define ELFCOMPRESS_ZSTD 2 /* Zstandard algorithm. */
510#define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */
511#define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */
512#define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */
513#define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */
514
515/* Section group handling. */
516#define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
517
518/* Symbol table entry. */
519
520typedef struct
521{
522 Elf32_Word st_name; /* Symbol name (string tbl index) */
523 Elf32_Addr st_value; /* Symbol value */
524 Elf32_Word st_size; /* Symbol size */
525 unsigned char st_info; /* Symbol type and binding */
526 unsigned char st_other; /* Symbol visibility */
527 Elf32_Section st_shndx; /* Section index */
528} Elf32_Sym;
529
530typedef struct
531{
532 Elf64_Word st_name; /* Symbol name (string tbl index) */
533 unsigned char st_info; /* Symbol type and binding */
534 unsigned char st_other; /* Symbol visibility */
535 Elf64_Section st_shndx; /* Section index */
536 Elf64_Addr st_value; /* Symbol value */
537 Elf64_Xword st_size; /* Symbol size */
538} Elf64_Sym;
539
540/* The syminfo section if available contains additional information about
541 every dynamic symbol. */
542
543typedef struct
544{
545 Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
546 Elf32_Half si_flags; /* Per symbol flags */
547} Elf32_Syminfo;
548
549typedef struct
550{
551 Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
552 Elf64_Half si_flags; /* Per symbol flags */
553} Elf64_Syminfo;
554
555/* Possible values for si_boundto. */
556#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
557#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
558#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
559
560/* Possible bitmasks for si_flags. */
561#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
562#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-through symbol for translator */
563#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
564#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
565 loaded */
566/* Syminfo version values. */
567#define SYMINFO_NONE 0
568#define SYMINFO_CURRENT 1
569#define SYMINFO_NUM 2
570
571
572/* How to extract and insert information held in the st_info field. */
573
574#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
575#define ELF32_ST_TYPE(val) ((val) & 0xf)
576#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
577
578/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
579#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
580#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
581#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
582
583/* Legal values for ST_BIND subfield of st_info (symbol binding). */
584
585#define STB_LOCAL 0 /* Local symbol */
586#define STB_GLOBAL 1 /* Global symbol */
587#define STB_WEAK 2 /* Weak symbol */
588#define STB_NUM 3 /* Number of defined types. */
589#define STB_LOOS 10 /* Start of OS-specific */
590#define STB_GNU_UNIQUE 10 /* Unique symbol. */
591#define STB_HIOS 12 /* End of OS-specific */
592#define STB_LOPROC 13 /* Start of processor-specific */
593#define STB_HIPROC 15 /* End of processor-specific */
594
595/* Legal values for ST_TYPE subfield of st_info (symbol type). */
596
597#define STT_NOTYPE 0 /* Symbol type is unspecified */
598#define STT_OBJECT 1 /* Symbol is a data object */
599#define STT_FUNC 2 /* Symbol is a code object */
600#define STT_SECTION 3 /* Symbol associated with a section */
601#define STT_FILE 4 /* Symbol's name is file name */
602#define STT_COMMON 5 /* Symbol is a common data object */
603#define STT_TLS 6 /* Symbol is thread-local data object*/
604#define STT_NUM 7 /* Number of defined types. */
605#define STT_LOOS 10 /* Start of OS-specific */
606#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
607#define STT_HIOS 12 /* End of OS-specific */
608#define STT_LOPROC 13 /* Start of processor-specific */
609#define STT_HIPROC 15 /* End of processor-specific */
610
611
612/* Symbol table indices are found in the hash buckets and chain table
613 of a symbol hash table section. This special index value indicates
614 the end of a chain, meaning no further symbols are found in that bucket. */
615
616#define STN_UNDEF 0 /* End of a chain. */
617
618
619/* How to extract and insert information held in the st_other field. */
620
621#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
622
623/* For ELF64 the definitions are the same. */
624#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
625
626/* Symbol visibility specification encoded in the st_other field. */
627#define STV_DEFAULT 0 /* Default symbol visibility rules */
628#define STV_INTERNAL 1 /* Processor specific hidden class */
629#define STV_HIDDEN 2 /* Sym unavailable in other modules */
630#define STV_PROTECTED 3 /* Not preemptible, not exported */
631
632
633/* Relocation table entry without addend (in section of type SHT_REL). */
634
635typedef struct
636{
637 Elf32_Addr r_offset; /* Address */
638 Elf32_Word r_info; /* Relocation type and symbol index */
639} Elf32_Rel;
640
641/* I have seen two different definitions of the Elf64_Rel and
642 Elf64_Rela structures, so we'll leave them out until Novell (or
643 whoever) gets their act together. */
644/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
645
646typedef struct
647{
648 Elf64_Addr r_offset; /* Address */
649 Elf64_Xword r_info; /* Relocation type and symbol index */
650} Elf64_Rel;
651
652/* Relocation table entry with addend (in section of type SHT_RELA). */
653
654typedef struct
655{
656 Elf32_Addr r_offset; /* Address */
657 Elf32_Word r_info; /* Relocation type and symbol index */
658 Elf32_Sword r_addend; /* Addend */
659} Elf32_Rela;
660
661typedef struct
662{
663 Elf64_Addr r_offset; /* Address */
664 Elf64_Xword r_info; /* Relocation type and symbol index */
665 Elf64_Sxword r_addend; /* Addend */
666} Elf64_Rela;
667
668/* RELR relocation table entry */
669
670typedef Elf32_Word Elf32_Relr;
671typedef Elf64_Xword Elf64_Relr;
672
673/* How to extract and insert information held in the r_info field. */
674
675#define ELF32_R_SYM(val) ((val) >> 8)
676#define ELF32_R_TYPE(val) ((val) & 0xff)
677#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
678
679#define ELF64_R_SYM(i) ((i) >> 32)
680#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
681#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
682
683/* Program segment header. */
684
685typedef struct
686{
687 Elf32_Word p_type; /* Segment type */
688 Elf32_Off p_offset; /* Segment file offset */
689 Elf32_Addr p_vaddr; /* Segment virtual address */
690 Elf32_Addr p_paddr; /* Segment physical address */
691 Elf32_Word p_filesz; /* Segment size in file */
692 Elf32_Word p_memsz; /* Segment size in memory */
693 Elf32_Word p_flags; /* Segment flags */
694 Elf32_Word p_align; /* Segment alignment */
695} Elf32_Phdr;
696
697typedef struct
698{
699 Elf64_Word p_type; /* Segment type */
700 Elf64_Word p_flags; /* Segment flags */
701 Elf64_Off p_offset; /* Segment file offset */
702 Elf64_Addr p_vaddr; /* Segment virtual address */
703 Elf64_Addr p_paddr; /* Segment physical address */
704 Elf64_Xword p_filesz; /* Segment size in file */
705 Elf64_Xword p_memsz; /* Segment size in memory */
706 Elf64_Xword p_align; /* Segment alignment */
707} Elf64_Phdr;
708
709/* Special value for e_phnum. This indicates that the real number of
710 program headers is too large to fit into e_phnum. Instead the real
711 value is in the field sh_info of section 0. */
712
713#define PN_XNUM 0xffff
714
715/* Legal values for p_type (segment type). */
716
717#define PT_NULL 0 /* Program header table entry unused */
718#define PT_LOAD 1 /* Loadable program segment */
719#define PT_DYNAMIC 2 /* Dynamic linking information */
720#define PT_INTERP 3 /* Program interpreter */
721#define PT_NOTE 4 /* Auxiliary information */
722#define PT_SHLIB 5 /* Reserved */
723#define PT_PHDR 6 /* Entry for header table itself */
724#define PT_TLS 7 /* Thread-local storage segment */
725#define PT_NUM 8 /* Number of defined types */
726#define PT_LOOS 0x60000000 /* Start of OS-specific */
727#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
728#define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
729#define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
730#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */
731#define PT_GNU_SFRAME 0x6474e554 /* SFrame segment. */
732#define PT_LOSUNW 0x6ffffffa
733#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
734#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
735#define PT_HISUNW 0x6fffffff
736#define PT_HIOS 0x6fffffff /* End of OS-specific */
737#define PT_LOPROC 0x70000000 /* Start of processor-specific */
738#define PT_HIPROC 0x7fffffff /* End of processor-specific */
739
740/* Legal values for p_flags (segment flags). */
741
742#define PF_X (1 << 0) /* Segment is executable */
743#define PF_W (1 << 1) /* Segment is writable */
744#define PF_R (1 << 2) /* Segment is readable */
745#define PF_MASKOS 0x0ff00000 /* OS-specific */
746#define PF_MASKPROC 0xf0000000 /* Processor-specific */
747
748/* Legal values for note segment descriptor types for core files. */
749
750#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
751#define NT_PRFPREG 2 /* Contains copy of fpregset
752 struct. */
753#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
754#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
755#define NT_PRXREG 4 /* Contains copy of prxregset struct */
756#define NT_TASKSTRUCT 4 /* Contains copy of task structure */
757#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
758#define NT_AUXV 6 /* Contains copy of auxv array */
759#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
760#define NT_ASRS 8 /* Contains copy of asrset struct */
761#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
762#define NT_PSINFO 13 /* Contains copy of psinfo struct */
763#define NT_PRCRED 14 /* Contains copy of prcred struct */
764#define NT_UTSNAME 15 /* Contains copy of utsname struct */
765#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
766#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
767#define NT_PRFPXREG 20 /* Contains copy of fprxregset struct */
768#define NT_SIGINFO 0x53494749 /* Contains copy of siginfo_t,
769 size might increase */
770#define NT_FILE 0x46494c45 /* Contains information about mapped
771 files */
772#define NT_PRXFPREG 0x46e62b7f /* Contains copy of user_fxsr_struct */
773#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
774#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
775#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
776#define NT_PPC_TAR 0x103 /* Target Address Register */
777#define NT_PPC_PPR 0x104 /* Program Priority Register */
778#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
779#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
780#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
781#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
782#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
783#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
784#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
785#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
786#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address
787 Register */
788#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority
789 Register */
790#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control
791 Register */
792#define NT_PPC_PKEY 0x110 /* Memory Protection Keys
793 registers. */
794#define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers. */
795#define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register. */
796#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
797#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
798#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
799#define NT_X86_SHSTK 0x204 /* x86 SHSTK state */
800#define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description. */
801#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves. This was
802 used in now removed s390-32 arch. */
803#define NT_S390_TIMER 0x301 /* s390 timer register */
804#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
805#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
806#define NT_S390_CTRS 0x304 /* s390 control registers */
807#define NT_S390_PREFIX 0x305 /* s390 prefix register */
808#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
809#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
810#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
811#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15
812 upper half. */
813#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31. */
814#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers. */
815#define NT_S390_GS_BC 0x30c /* s390 guarded storage
816 broadcast control block. */
817#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation. */
818#define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data. */
819#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
820#define NT_ARM_TLS 0x401 /* ARM TLS register */
821#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
822#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
823#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
824#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension
825 registers */
826#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication
827 code masks. */
828#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication
829 address keys. */
830#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication
831 generic key. */
832#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* AArch64 tagged address
833 control. */
834#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* AArch64 pointer authentication
835 enabled keys. */
836#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers. */
837#define NT_ARM_ZA 0x40c /* ARM SME ZA registers. */
838#define NT_ARM_ZT 0x40d /* ARM SME ZT registers. */
839#define NT_ARM_FPMR 0x40e /* ARM floating point mode register. */
840#define NT_ARM_POE 0x40f /* ARM POE registers. */
841#define NT_ARM_GCS 0x410 /* ARM GCS state. */
842#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note. */
843#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers. */
844#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode. */
845#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers. */
846#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
847#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
848#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged
849 address control */
850#define NT_RISCV_USER_CFI 0x903 /* RISC-V shadow stack state */
851#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers. */
852#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and
853 status registers. */
854#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD
855 Extension registers. */
856#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced
857 SIMD Extension registers. */
858#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary
859 Translation registers. */
860#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
861#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
862
863/* Legal values for the note segment descriptor types for object files. */
864
865#define NT_VERSION 1 /* Contains a version string. */
866
867
868/* Dynamic section entry. */
869
870typedef struct
871{
872 Elf32_Sword d_tag; /* Dynamic entry type */
873 union
874 {
875 Elf32_Word d_val; /* Integer value */
876 Elf32_Addr d_ptr; /* Address value */
877 } d_un;
878} Elf32_Dyn;
879
880typedef struct
881{
882 Elf64_Sxword d_tag; /* Dynamic entry type */
883 union
884 {
885 Elf64_Xword d_val; /* Integer value */
886 Elf64_Addr d_ptr; /* Address value */
887 } d_un;
888} Elf64_Dyn;
889
890/* Legal values for d_tag (dynamic entry type). */
891
892#define DT_NULL 0 /* Marks end of dynamic section */
893#define DT_NEEDED 1 /* Name of needed library */
894#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
895#define DT_PLTGOT 3 /* Processor defined value */
896#define DT_HASH 4 /* Address of symbol hash table */
897#define DT_STRTAB 5 /* Address of string table */
898#define DT_SYMTAB 6 /* Address of symbol table */
899#define DT_RELA 7 /* Address of Rela relocs */
900#define DT_RELASZ 8 /* Total size of Rela relocs */
901#define DT_RELAENT 9 /* Size of one Rela reloc */
902#define DT_STRSZ 10 /* Size of string table */
903#define DT_SYMENT 11 /* Size of one symbol table entry */
904#define DT_INIT 12 /* Address of init function */
905#define DT_FINI 13 /* Address of termination function */
906#define DT_SONAME 14 /* Name of shared object */
907#define DT_RPATH 15 /* Library search path (deprecated) */
908#define DT_SYMBOLIC 16 /* Start symbol search here */
909#define DT_REL 17 /* Address of Rel relocs */
910#define DT_RELSZ 18 /* Total size of Rel relocs */
911#define DT_RELENT 19 /* Size of one Rel reloc */
912#define DT_PLTREL 20 /* Type of reloc in PLT */
913#define DT_DEBUG 21 /* For debugging; unspecified */
914#define DT_TEXTREL 22 /* Reloc might modify .text */
915#define DT_JMPREL 23 /* Address of PLT relocs */
916#define DT_BIND_NOW 24 /* Process relocations of object */
917#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
918#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
919#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
920#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
921#define DT_RUNPATH 29 /* Library search path */
922#define DT_FLAGS 30 /* Flags for the object being loaded */
923#define DT_ENCODING 32 /* Start of encoded range */
924#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
925#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
926#define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */
927#define DT_RELRSZ 35 /* Total size of RELR relative relocations */
928#define DT_RELR 36 /* Address of RELR relative relocations */
929#define DT_RELRENT 37 /* Size of one RELR relative relocation */
930#define DT_NUM 38 /* Number used */
931#define DT_LOOS 0x6000000d /* Start of OS-specific */
932#define DT_HIOS 0x6ffff000 /* End of OS-specific */
933#define DT_LOPROC 0x70000000 /* Start of processor-specific */
934#define DT_HIPROC 0x7fffffff /* End of processor-specific */
935#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
936
937/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
938 Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
939 approach. */
940#define DT_VALRNGLO 0x6ffffd00
941#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
942#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
943#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
944#define DT_CHECKSUM 0x6ffffdf8
945#define DT_PLTPADSZ 0x6ffffdf9
946#define DT_MOVEENT 0x6ffffdfa
947#define DT_MOVESZ 0x6ffffdfb
948#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
949#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
950 the following DT_* entry. */
951#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
952#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
953#define DT_VALRNGHI 0x6ffffdff
954#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
955#define DT_VALNUM 12
956
957/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
958 Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
959
960 If any adjustment is made to the ELF object after it has been
961 built these entries will need to be adjusted. */
962#define DT_ADDRRNGLO 0x6ffffe00
963#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */
964#define DT_TLSDESC_PLT 0x6ffffef6
965#define DT_TLSDESC_GOT 0x6ffffef7
966#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
967#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
968#define DT_CONFIG 0x6ffffefa /* Configuration information. */
969#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
970#define DT_AUDIT 0x6ffffefc /* Object auditing. */
971#define DT_PLTPAD 0x6ffffefd /* PLT padding. */
972#define DT_MOVETAB 0x6ffffefe /* Move table. */
973#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
974#define DT_ADDRRNGHI 0x6ffffeff
975#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
976#define DT_ADDRNUM 11
977
978/* The versioning entry types. The next are defined as part of the
979 GNU extension. */
980#define DT_VERSYM 0x6ffffff0
981
982#define DT_RELACOUNT 0x6ffffff9
983#define DT_RELCOUNT 0x6ffffffa
984
985/* These were chosen by Sun. */
986#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
987#define DT_VERDEF 0x6ffffffc /* Address of version definition
988 table */
989#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
990#define DT_VERNEED 0x6ffffffe /* Address of table with needed
991 versions */
992#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
993#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
994#define DT_VERSIONTAGNUM 16
995
996/* Sun added these machine-independent extensions in the "processor-specific"
997 range. Be compatible. */
998#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
999#define DT_FILTER 0x7fffffff /* Shared object to get values from */
1000#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
1001#define DT_EXTRANUM 3
1002
1003/* Values of `d_un.d_val' in the DT_FLAGS entry. */
1004#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
1005#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
1006#define DF_TEXTREL 0x00000004 /* Object contains text relocations */
1007#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
1008#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
1009
1010/* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
1011 entry in the dynamic section. */
1012#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
1013#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
1014#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
1015#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
1016#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
1017#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
1018#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
1019#define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
1020#define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
1021#define DF_1_TRANS 0x00000200
1022#define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
1023#define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
1024#define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
1025#define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
1026#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
1027#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
1028#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
1029#define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */
1030#define DF_1_IGNMULDEF 0x00040000
1031#define DF_1_NOKSYMS 0x00080000
1032#define DF_1_NOHDR 0x00100000
1033#define DF_1_EDITED 0x00200000 /* Object is modified after built. */
1034#define DF_1_NORELOC 0x00400000
1035#define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */
1036#define DF_1_GLOBAUDIT 0x01000000 /* Global auditing required. */
1037#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
1038#define DF_1_STUB 0x04000000
1039#define DF_1_PIE 0x08000000
1040#define DF_1_KMOD 0x10000000
1041#define DF_1_WEAKFILTER 0x20000000
1042#define DF_1_NOCOMMON 0x40000000
1043
1044/* Flags for the feature selection in DT_FEATURE_1. */
1045#define DTF_1_PARINIT 0x00000001
1046#define DTF_1_CONFEXP 0x00000002
1047
1048/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
1049#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
1050#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
1051 generally available. */
1052
1053/* Version definition sections. */
1054
1055typedef struct
1056{
1057 Elf32_Half vd_version; /* Version revision */
1058 Elf32_Half vd_flags; /* Version information */
1059 Elf32_Half vd_ndx; /* Version Index */
1060 Elf32_Half vd_cnt; /* Number of associated aux entries */
1061 Elf32_Word vd_hash; /* Version name hash value */
1062 Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
1063 Elf32_Word vd_next; /* Offset in bytes to next verdef
1064 entry */
1065} Elf32_Verdef;
1066
1067typedef struct
1068{
1069 Elf64_Half vd_version; /* Version revision */
1070 Elf64_Half vd_flags; /* Version information */
1071 Elf64_Half vd_ndx; /* Version Index */
1072 Elf64_Half vd_cnt; /* Number of associated aux entries */
1073 Elf64_Word vd_hash; /* Version name hash value */
1074 Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
1075 Elf64_Word vd_next; /* Offset in bytes to next verdef
1076 entry */
1077} Elf64_Verdef;
1078
1079
1080/* Legal values for vd_version (version revision). */
1081#define VER_DEF_NONE 0 /* No version */
1082#define VER_DEF_CURRENT 1 /* Current version */
1083#define VER_DEF_NUM 2 /* Given version number */
1084
1085/* Legal values for vd_flags (version information flags). */
1086#define VER_FLG_BASE 0x1 /* Version definition of file itself */
1087#define VER_FLG_WEAK 0x2 /* Weak version identifier. Also
1088 used by vna_flags below. */
1089
1090/* Versym symbol index values. */
1091#define VER_NDX_LOCAL 0 /* Symbol is local. */
1092#define VER_NDX_GLOBAL 1 /* Symbol is global. */
1093#define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
1094#define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
1095
1096/* Auxiliary version information. */
1097
1098typedef struct
1099{
1100 Elf32_Word vda_name; /* Version or dependency names */
1101 Elf32_Word vda_next; /* Offset in bytes to next verdaux
1102 entry */
1103} Elf32_Verdaux;
1104
1105typedef struct
1106{
1107 Elf64_Word vda_name; /* Version or dependency names */
1108 Elf64_Word vda_next; /* Offset in bytes to next verdaux
1109 entry */
1110} Elf64_Verdaux;
1111
1112
1113/* Version dependency section. */
1114
1115typedef struct
1116{
1117 Elf32_Half vn_version; /* Version of structure */
1118 Elf32_Half vn_cnt; /* Number of associated aux entries */
1119 Elf32_Word vn_file; /* Offset of filename for this
1120 dependency */
1121 Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
1122 Elf32_Word vn_next; /* Offset in bytes to next verneed
1123 entry */
1124} Elf32_Verneed;
1125
1126typedef struct
1127{
1128 Elf64_Half vn_version; /* Version of structure */
1129 Elf64_Half vn_cnt; /* Number of associated aux entries */
1130 Elf64_Word vn_file; /* Offset of filename for this
1131 dependency */
1132 Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
1133 Elf64_Word vn_next; /* Offset in bytes to next verneed
1134 entry */
1135} Elf64_Verneed;
1136
1137
1138/* Legal values for vn_version (version revision). */
1139#define VER_NEED_NONE 0 /* No version */
1140#define VER_NEED_CURRENT 1 /* Current version */
1141#define VER_NEED_NUM 2 /* Given version number */
1142
1143/* Auxiliary needed version information. */
1144
1145typedef struct
1146{
1147 Elf32_Word vna_hash; /* Hash value of dependency name */
1148 Elf32_Half vna_flags; /* Dependency specific information */
1149 Elf32_Half vna_other; /* Unused */
1150 Elf32_Word vna_name; /* Dependency name string offset */
1151 Elf32_Word vna_next; /* Offset in bytes to next vernaux
1152 entry */
1153} Elf32_Vernaux;
1154
1155typedef struct
1156{
1157 Elf64_Word vna_hash; /* Hash value of dependency name */
1158 Elf64_Half vna_flags; /* Dependency specific information */
1159 Elf64_Half vna_other; /* Unused */
1160 Elf64_Word vna_name; /* Dependency name string offset */
1161 Elf64_Word vna_next; /* Offset in bytes to next vernaux
1162 entry */
1163} Elf64_Vernaux;
1164
1165
1166/* Auxiliary vector. */
1167
1168/* This vector is normally only used by the program interpreter. The
1169 usual definition in an ABI supplement uses the name auxv_t. The
1170 vector is not usually defined in a standard <elf.h> file, but it
1171 can't hurt. We rename it to avoid conflicts. The sizes of these
1172 types are an arrangement between the exec server and the program
1173 interpreter, so we don't fully specify them here. */
1174
1175typedef struct
1176{
1177 uint32_t a_type; /* Entry type */
1178 union
1179 {
1180 uint32_t a_val; /* Integer value */
1181 /* We use to have pointer elements added here. We cannot do that,
1182 though, since it does not work when using 32-bit definitions
1183 on 64-bit platforms and vice versa. */
1184 } a_un;
1185} Elf32_auxv_t;
1186
1187typedef struct
1188{
1189 uint64_t a_type; /* Entry type */
1190 union
1191 {
1192 uint64_t a_val; /* Integer value */
1193 /* We use to have pointer elements added here. We cannot do that,
1194 though, since it does not work when using 32-bit definitions
1195 on 64-bit platforms and vice versa. */
1196 } a_un;
1197} Elf64_auxv_t;
1198
1199/* Legal values for a_type (entry type). */
1200
1201#define AT_NULL 0 /* End of vector */
1202#define AT_IGNORE 1 /* Entry should be ignored */
1203#define AT_EXECFD 2 /* File descriptor of program */
1204#define AT_PHDR 3 /* Program headers for program */
1205#define AT_PHENT 4 /* Size of program header entry */
1206#define AT_PHNUM 5 /* Number of program headers */
1207#define AT_PAGESZ 6 /* System page size */
1208#define AT_BASE 7 /* Base address of interpreter */
1209#define AT_FLAGS 8 /* Flags */
1210#define AT_ENTRY 9 /* Entry point of program */
1211#define AT_NOTELF 10 /* Program is not ELF */
1212#define AT_UID 11 /* Real uid */
1213#define AT_EUID 12 /* Effective uid */
1214#define AT_GID 13 /* Real gid */
1215#define AT_EGID 14 /* Effective gid */
1216#define AT_CLKTCK 17 /* Frequency of times() */
1217
1218/* Some more special a_type values describing the hardware. */
1219#define AT_PLATFORM 15 /* String identifying platform. */
1220#define AT_HWCAP 16 /* Machine-dependent hints about
1221 processor capabilities. */
1222
1223/* This entry gives some information about the FPU initialization
1224 performed by the kernel. */
1225#define AT_FPUCW 18 /* Used FPU control word. */
1226
1227/* Cache block sizes. */
1228#define AT_DCACHEBSIZE 19 /* Data cache block size. */
1229#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
1230#define AT_UCACHEBSIZE 21 /* Unified cache block size. */
1231
1232/* A special ignored value for PPC, used by the kernel to control the
1233 interpretation of the AUXV. Must be > 16. */
1234#define AT_IGNOREPPC 22 /* Entry should be ignored. */
1235
1236#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
1237
1238#define AT_BASE_PLATFORM 24 /* String identifying real platforms.*/
1239
1240#define AT_RANDOM 25 /* Address of 16 random bytes. */
1241
1242#define AT_HWCAP2 26 /* More machine-dependent hints about
1243 processor capabilities. */
1244
1245#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size. */
1246#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment. */
1247
1248/* More machine-dependent hints about processor capabilities. */
1249#define AT_HWCAP3 29 /* extension of AT_HWCAP. */
1250#define AT_HWCAP4 30 /* extension of AT_HWCAP. */
1251
1252#define AT_EXECFN 31 /* Filename of executable. */
1253
1254/* Pointer to the global system page used for system calls and other
1255 nice things. */
1256#define AT_SYSINFO 32
1257#define AT_SYSINFO_EHDR 33
1258
1259/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
1260 log2 of line size; mask those to get cache size. */
1261#define AT_L1I_CACHESHAPE 34
1262#define AT_L1D_CACHESHAPE 35
1263#define AT_L2_CACHESHAPE 36
1264#define AT_L3_CACHESHAPE 37
1265
1266/* Shapes of the caches, with more room to describe them.
1267 *GEOMETRY are comprised of cache line size in bytes in the bottom 16 bits
1268 and the cache associativity in the next 16 bits. */
1269#define AT_L1I_CACHESIZE 40
1270#define AT_L1I_CACHEGEOMETRY 41
1271#define AT_L1D_CACHESIZE 42
1272#define AT_L1D_CACHEGEOMETRY 43
1273#define AT_L2_CACHESIZE 44
1274#define AT_L2_CACHEGEOMETRY 45
1275#define AT_L3_CACHESIZE 46
1276#define AT_L3_CACHEGEOMETRY 47
1277
1278#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery */
1279
1280/* Note section contents. Each entry in the note section begins with
1281 a header of a fixed form. */
1282
1283typedef struct
1284{
1285 Elf32_Word n_namesz; /* Length of the note's name. */
1286 Elf32_Word n_descsz; /* Length of the note's descriptor. */
1287 Elf32_Word n_type; /* Type of the note. */
1288} Elf32_Nhdr;
1289
1290typedef struct
1291{
1292 Elf64_Word n_namesz; /* Length of the note's name. */
1293 Elf64_Word n_descsz; /* Length of the note's descriptor. */
1294 Elf64_Word n_type; /* Type of the note. */
1295} Elf64_Nhdr;
1296
1297/* Known names of notes. */
1298
1299/* Solaris entries in the note section have this name. */
1300#define ELF_NOTE_SOLARIS "SUNW Solaris"
1301
1302/* Note entries for GNU systems have this name. */
1303#define ELF_NOTE_GNU "GNU"
1304
1305/* Note entries for freedesktop.org have this name. */
1306#define ELF_NOTE_FDO "FDO"
1307
1308/* Defined types of notes for Solaris. */
1309
1310/* Value of descriptor (one word) is desired pagesize for the binary. */
1311#define ELF_NOTE_PAGESIZE_HINT 1
1312
1313
1314/* Defined note types for GNU systems. */
1315
1316/* ABI information. The descriptor consists of words:
1317 word 0: OS descriptor
1318 word 1: major version of the ABI
1319 word 2: minor version of the ABI
1320 word 3: subminor version of the ABI
1321*/
1322#define NT_GNU_ABI_TAG 1
1323#define ELF_NOTE_ABI NT_GNU_ABI_TAG /* Old name. */
1324
1325/* Known OSes. These values can appear in word 0 of an
1326 NT_GNU_ABI_TAG note section entry. */
1327#define ELF_NOTE_OS_LINUX 0
1328#define ELF_NOTE_OS_GNU 1
1329#define ELF_NOTE_OS_SOLARIS2 2
1330#define ELF_NOTE_OS_FREEBSD 3
1331
1332/* Synthetic hwcap information. The descriptor begins with two words:
1333 word 0: number of entries
1334 word 1: bitmask of enabled entries
1335 Then follow variable-length entries, one byte followed by a
1336 '\0'-terminated hwcap name string. The byte gives the bit
1337 number to test if enabled, (1U << bit) & bitmask. */
1338#define NT_GNU_HWCAP 2
1339
1340/* Build ID bits as generated by ld --build-id.
1341 The descriptor consists of any nonzero number of bytes. */
1342#define NT_GNU_BUILD_ID 3
1343
1344/* Version note generated by GNU gold containing a version string. */
1345#define NT_GNU_GOLD_VERSION 4
1346
1347/* Program property. */
1348#define NT_GNU_PROPERTY_TYPE_0 5
1349
1350/* Packaging metadata as defined on
1351 https://systemd.io/ELF_PACKAGE_METADATA/ */
1352#define NT_FDO_PACKAGING_METADATA 0xcafe1a7e
1353
1354/* dlopen metadata as defined on
1355 https://systemd.io/ELF_DLOPEN_METADATA/ */
1356#define NT_FDO_DLOPEN_METADATA 0x407c0c0a
1357
1358/* Note section name of program property. */
1359#define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
1360
1361/* Values used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0). */
1362
1363/* Stack size. */
1364#define GNU_PROPERTY_STACK_SIZE 1
1365/* No copy relocation on protected data symbol. */
1366#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
1367
1368/* A 4-byte unsigned integer property: A bit is set if it is set in all
1369 relocatable inputs. */
1370#define GNU_PROPERTY_UINT32_AND_LO 0xb0000000
1371#define GNU_PROPERTY_UINT32_AND_HI 0xb0007fff
1372
1373/* A 4-byte unsigned integer property: A bit is set if it is set in any
1374 relocatable inputs. */
1375#define GNU_PROPERTY_UINT32_OR_LO 0xb0008000
1376#define GNU_PROPERTY_UINT32_OR_HI 0xb000ffff
1377
1378/* The needed properties by the object file. */
1379#define GNU_PROPERTY_1_NEEDED GNU_PROPERTY_UINT32_OR_LO
1380
1381/* Set if the object file requires canonical function pointers and
1382 cannot be used with copy relocation. */
1383#define GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS (1U << 0)
1384
1385/* Processor-specific semantics, lo */
1386#define GNU_PROPERTY_LOPROC 0xc0000000
1387/* Processor-specific semantics, hi */
1388#define GNU_PROPERTY_HIPROC 0xdfffffff
1389/* Application-specific semantics, lo */
1390#define GNU_PROPERTY_LOUSER 0xe0000000
1391/* Application-specific semantics, hi */
1392#define GNU_PROPERTY_HIUSER 0xffffffff
1393
1394/* AArch64 specific GNU properties. */
1395#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
1396
1397#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
1398#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
1399#define GNU_PROPERTY_AARCH64_FEATURE_1_GCS (1U << 2)
1400
1401/* The x86 instruction sets indicated by the corresponding bits are
1402 used in program. Their support in the hardware is optional. */
1403#define GNU_PROPERTY_X86_ISA_1_USED 0xc0010002
1404/* The x86 instruction sets indicated by the corresponding bits are
1405 used in program and they must be supported by the hardware. */
1406#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0008002
1407/* X86 processor-specific features used in program. */
1408#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
1409
1410/* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld),
1411 MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2. */
1412#define GNU_PROPERTY_X86_ISA_1_BASELINE (1U << 0)
1413/* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE,
1414 CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3,
1415 SSSE3, SSE4.1 and SSE4.2. */
1416#define GNU_PROPERTY_X86_ISA_1_V2 (1U << 1)
1417/* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1,
1418 BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE. */
1419#define GNU_PROPERTY_X86_ISA_1_V3 (1U << 2)
1420/* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F,
1421 AVX512BW, AVX512CD, AVX512DQ and AVX512VL. */
1422#define GNU_PROPERTY_X86_ISA_1_V4 (1U << 3)
1423
1424/* This indicates that all executable sections are compatible with
1425 IBT. */
1426#define GNU_PROPERTY_X86_FEATURE_1_IBT (1U << 0)
1427/* This indicates that all executable sections are compatible with
1428 SHSTK. */
1429#define GNU_PROPERTY_X86_FEATURE_1_SHSTK (1U << 1)
1430
1431/* Move records. */
1432typedef struct
1433{
1434 Elf32_Xword m_value; /* Symbol value. */
1435 Elf32_Word m_info; /* Size and index. */
1436 Elf32_Word m_poffset; /* Symbol offset. */
1437 Elf32_Half m_repeat; /* Repeat count. */
1438 Elf32_Half m_stride; /* Stride info. */
1439} Elf32_Move;
1440
1441typedef struct
1442{
1443 Elf64_Xword m_value; /* Symbol value. */
1444 Elf64_Xword m_info; /* Size and index. */
1445 Elf64_Xword m_poffset; /* Symbol offset. */
1446 Elf64_Half m_repeat; /* Repeat count. */
1447 Elf64_Half m_stride; /* Stride info. */
1448} Elf64_Move;
1449
1450/* Macro to construct move records. */
1451#define ELF32_M_SYM(info) ((info) >> 8)
1452#define ELF32_M_SIZE(info) ((unsigned char) (info))
1453#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
1454
1455#define ELF64_M_SYM(info) ELF32_M_SYM (info)
1456#define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
1457#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
1458
1459
1460/* Motorola 68k specific definitions. */
1461
1462/* Values for Elf32_Ehdr.e_flags. */
1463#define EF_CPU32 0x00810000
1464
1465/* m68k relocs. */
1466
1467#define R_68K_NONE 0 /* No reloc */
1468#define R_68K_32 1 /* Direct 32 bit */
1469#define R_68K_16 2 /* Direct 16 bit */
1470#define R_68K_8 3 /* Direct 8 bit */
1471#define R_68K_PC32 4 /* PC relative 32 bit */
1472#define R_68K_PC16 5 /* PC relative 16 bit */
1473#define R_68K_PC8 6 /* PC relative 8 bit */
1474#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
1475#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
1476#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
1477#define R_68K_GOT32O 10 /* 32 bit GOT offset */
1478#define R_68K_GOT16O 11 /* 16 bit GOT offset */
1479#define R_68K_GOT8O 12 /* 8 bit GOT offset */
1480#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
1481#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
1482#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
1483#define R_68K_PLT32O 16 /* 32 bit PLT offset */
1484#define R_68K_PLT16O 17 /* 16 bit PLT offset */
1485#define R_68K_PLT8O 18 /* 8 bit PLT offset */
1486#define R_68K_COPY 19 /* Copy symbol at runtime */
1487#define R_68K_GLOB_DAT 20 /* Create GOT entry */
1488#define R_68K_JMP_SLOT 21 /* Create PLT entry */
1489#define R_68K_RELATIVE 22 /* Adjust by program base */
1490#define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
1491#define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
1492#define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
1493#define R_68K_TLS_LDM32 28 /* 32 bit GOT offset for LDM */
1494#define R_68K_TLS_LDM16 29 /* 16 bit GOT offset for LDM */
1495#define R_68K_TLS_LDM8 30 /* 8 bit GOT offset for LDM */
1496#define R_68K_TLS_LDO32 31 /* 32 bit module-relative offset */
1497#define R_68K_TLS_LDO16 32 /* 16 bit module-relative offset */
1498#define R_68K_TLS_LDO8 33 /* 8 bit module-relative offset */
1499#define R_68K_TLS_IE32 34 /* 32 bit GOT offset for IE */
1500#define R_68K_TLS_IE16 35 /* 16 bit GOT offset for IE */
1501#define R_68K_TLS_IE8 36 /* 8 bit GOT offset for IE */
1502#define R_68K_TLS_LE32 37 /* 32 bit offset relative to
1503 static TLS block */
1504#define R_68K_TLS_LE16 38 /* 16 bit offset relative to
1505 static TLS block */
1506#define R_68K_TLS_LE8 39 /* 8 bit offset relative to
1507 static TLS block */
1508#define R_68K_TLS_DTPMOD32 40 /* 32 bit module number */
1509#define R_68K_TLS_DTPREL32 41 /* 32 bit module-relative offset */
1510#define R_68K_TLS_TPREL32 42 /* 32 bit TP-relative offset */
1511/* Keep this the last entry. */
1512#define R_68K_NUM 43
1513
1514/* Intel 80386 specific definitions. */
1515
1516/* i386 relocs. */
1517
1518#define R_386_NONE 0 /* No reloc */
1519#define R_386_32 1 /* Direct 32 bit */
1520#define R_386_PC32 2 /* PC relative 32 bit */
1521#define R_386_GOT32 3 /* 32 bit GOT entry */
1522#define R_386_PLT32 4 /* 32 bit PLT address */
1523#define R_386_COPY 5 /* Copy symbol at runtime */
1524#define R_386_GLOB_DAT 6 /* Create GOT entry */
1525#define R_386_JMP_SLOT 7 /* Create PLT entry */
1526#define R_386_RELATIVE 8 /* Adjust by program base */
1527#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
1528#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
1529#define R_386_32PLT 11
1530#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */
1531#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS
1532 block offset */
1533#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block
1534 offset */
1535#define R_386_TLS_LE 17 /* Offset relative to static TLS
1536 block */
1537#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of
1538 general dynamic thread local data */
1539#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of
1540 local dynamic thread local data
1541 in LE code */
1542#define R_386_16 20
1543#define R_386_PC16 21
1544#define R_386_8 22
1545#define R_386_PC8 23
1546#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic
1547 thread local data */
1548#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */
1549#define R_386_TLS_GD_CALL 26 /* Relocation for call to
1550 __tls_get_addr() */
1551#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */
1552#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic
1553 thread local data in LE code */
1554#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */
1555#define R_386_TLS_LDM_CALL 30 /* Relocation for call to
1556 __tls_get_addr() in LDM code */
1557#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */
1558#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */
1559#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS
1560 block offset */
1561#define R_386_TLS_LE_32 34 /* Negated offset relative to static
1562 TLS block */
1563#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
1564#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
1565#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
1566#define R_386_SIZE32 38 /* 32-bit symbol size */
1567#define R_386_TLS_GOTDESC 39 /* GOT offset for TLS descriptor. */
1568#define R_386_TLS_DESC_CALL 40 /* Marker of call through TLS
1569 descriptor for
1570 relaxation. */
1571#define R_386_TLS_DESC 41 /* TLS descriptor containing
1572 pointer to code and to
1573 argument, returning the TLS
1574 offset for the symbol. */
1575#define R_386_IRELATIVE 42 /* Adjust indirectly by program base */
1576#define R_386_GOT32X 43 /* Load from 32 bit GOT entry,
1577 relaxable. */
1578/* Keep this the last entry. */
1579#define R_386_NUM 44
1580
1581/* SUN SPARC specific definitions. */
1582
1583/* Legal values for ST_TYPE subfield of st_info (symbol type). */
1584
1585#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */
1586
1587/* Values for Elf64_Ehdr.e_flags. */
1588
1589#define EF_SPARCV9_MM 3
1590#define EF_SPARCV9_TSO 0
1591#define EF_SPARCV9_PSO 1
1592#define EF_SPARCV9_RMO 2
1593#define EF_SPARC_LEDATA 0x800000 /* little endian data */
1594#define EF_SPARC_EXT_MASK 0xFFFF00
1595#define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */
1596#define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */
1597#define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */
1598#define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */
1599
1600/* SPARC relocs. */
1601
1602#define R_SPARC_NONE 0 /* No reloc */
1603#define R_SPARC_8 1 /* Direct 8 bit */
1604#define R_SPARC_16 2 /* Direct 16 bit */
1605#define R_SPARC_32 3 /* Direct 32 bit */
1606#define R_SPARC_DISP8 4 /* PC relative 8 bit */
1607#define R_SPARC_DISP16 5 /* PC relative 16 bit */
1608#define R_SPARC_DISP32 6 /* PC relative 32 bit */
1609#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
1610#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
1611#define R_SPARC_HI22 9 /* High 22 bit */
1612#define R_SPARC_22 10 /* Direct 22 bit */
1613#define R_SPARC_13 11 /* Direct 13 bit */
1614#define R_SPARC_LO10 12 /* Truncated 10 bit */
1615#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
1616#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
1617#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
1618#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
1619#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
1620#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
1621#define R_SPARC_COPY 19 /* Copy symbol at runtime */
1622#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
1623#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
1624#define R_SPARC_RELATIVE 22 /* Adjust by program base */
1625#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
1626
1627/* Additional Sparc64 relocs. */
1628
1629#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
1630#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
1631#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
1632#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
1633#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
1634#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
1635#define R_SPARC_10 30 /* Direct 10 bit */
1636#define R_SPARC_11 31 /* Direct 11 bit */
1637#define R_SPARC_64 32 /* Direct 64 bit */
1638#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */
1639#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
1640#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
1641#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
1642#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
1643#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
1644#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
1645#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
1646#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
1647#define R_SPARC_GLOB_JMP 42 /* was part of v9 ABI but was removed */
1648#define R_SPARC_7 43 /* Direct 7 bit */
1649#define R_SPARC_5 44 /* Direct 5 bit */
1650#define R_SPARC_6 45 /* Direct 6 bit */
1651#define R_SPARC_DISP64 46 /* PC relative 64 bit */
1652#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
1653#define R_SPARC_HIX22 48 /* High 22 bit complemented */
1654#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
1655#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
1656#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
1657#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
1658#define R_SPARC_REGISTER 53 /* Global register usage */
1659#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
1660#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
1661#define R_SPARC_TLS_GD_HI22 56
1662#define R_SPARC_TLS_GD_LO10 57
1663#define R_SPARC_TLS_GD_ADD 58
1664#define R_SPARC_TLS_GD_CALL 59
1665#define R_SPARC_TLS_LDM_HI22 60
1666#define R_SPARC_TLS_LDM_LO10 61
1667#define R_SPARC_TLS_LDM_ADD 62
1668#define R_SPARC_TLS_LDM_CALL 63
1669#define R_SPARC_TLS_LDO_HIX22 64
1670#define R_SPARC_TLS_LDO_LOX10 65
1671#define R_SPARC_TLS_LDO_ADD 66
1672#define R_SPARC_TLS_IE_HI22 67
1673#define R_SPARC_TLS_IE_LO10 68
1674#define R_SPARC_TLS_IE_LD 69
1675#define R_SPARC_TLS_IE_LDX 70
1676#define R_SPARC_TLS_IE_ADD 71
1677#define R_SPARC_TLS_LE_HIX22 72
1678#define R_SPARC_TLS_LE_LOX10 73
1679#define R_SPARC_TLS_DTPMOD32 74
1680#define R_SPARC_TLS_DTPMOD64 75
1681#define R_SPARC_TLS_DTPOFF32 76
1682#define R_SPARC_TLS_DTPOFF64 77
1683#define R_SPARC_TLS_TPOFF32 78
1684#define R_SPARC_TLS_TPOFF64 79
1685#define R_SPARC_GOTDATA_HIX22 80
1686#define R_SPARC_GOTDATA_LOX10 81
1687#define R_SPARC_GOTDATA_OP_HIX22 82
1688#define R_SPARC_GOTDATA_OP_LOX10 83
1689#define R_SPARC_GOTDATA_OP 84
1690#define R_SPARC_H34 85
1691#define R_SPARC_SIZE32 86
1692#define R_SPARC_SIZE64 87
1693#define R_SPARC_WDISP10 88
1694#define R_SPARC_JMP_IREL 248
1695#define R_SPARC_IRELATIVE 249
1696#define R_SPARC_GNU_VTINHERIT 250
1697#define R_SPARC_GNU_VTENTRY 251
1698#define R_SPARC_REV32 252
1699/* Keep this the last entry. */
1700#define R_SPARC_NUM 253
1701
1702/* For Sparc64, legal values for d_tag of Elf64_Dyn. */
1703
1704#define DT_SPARC_REGISTER 0x70000001
1705#define DT_SPARC_NUM 2
1706
1707/* MIPS R3000 specific definitions. */
1708
1709/* Legal values for e_flags field of Elf32_Ehdr. */
1710
1711#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used. */
1712#define EF_MIPS_PIC 2 /* Contains PIC code. */
1713#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence. */
1714#define EF_MIPS_XGOT 8
1715#define EF_MIPS_UCODE 16
1716#define EF_MIPS_ABI2 32
1717#define EF_MIPS_ABI_ON32 64
1718#define EF_MIPS_OPTIONS_FIRST 0x00000080 /* Process the .MIPS.options
1719 section first by ld. */
1720#define EF_MIPS_32BITMODE 0x00000100 /* Indicates code compiled for
1721 a 64-bit machine in 32-bit
1722 mode (regs are 32-bits
1723 wide). */
1724#define EF_MIPS_FP64 512 /* Uses FP64 (12 callee-saved). */
1725#define EF_MIPS_NAN2008 1024 /* Uses IEEE 754-2008 NaN encoding. */
1726#define EF_MIPS_ARCH_ASE 0x0f000000 /* Architectural Extensions
1727 used by this file. */
1728#define EF_MIPS_ARCH_ASE_MDMX 0x08000000 /* Use MDMX multimedia
1729 extensions. */
1730#define EF_MIPS_ARCH_ASE_M16 0x04000000 /* Use MIPS-16 ISA
1731 extensions. */
1732#define EF_MIPS_ARCH_ASE_MICROMIPS 0x02000000 /* Use MICROMIPS ISA
1733 extensions. */
1734#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level. */
1735
1736/* Legal values for MIPS architecture level. */
1737
1738#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1739#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1740#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1741#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1742#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
1743#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
1744#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
1745#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */
1746#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */
1747#define EF_MIPS_ARCH_32R6 0x90000000 /* MIPS32r6 code. */
1748#define EF_MIPS_ARCH_64R6 0xa0000000 /* MIPS64r6 code. */
1749#define EF_MIPS_ABI 0x0000F000 /* The ABI of the file. Also
1750 see EF_MIPS_ABI2 above. */
1751#define EF_MIPS_ABI_O32 0x00001000 /* The original o32 abi. */
1752#define EF_MIPS_ABI_O64 0x00002000 /* O32 extended to work on
1753 64 bit architectures. */
1754#define EF_MIPS_ABI_EABI32 0x00003000 /* EABI in 32 bit mode. */
1755#define EF_MIPS_ABI_EABI64 0x00004000 /* EABI in 64 bit mode. */
1756#define EF_MIPS_MACH 0x00FF0000
1757#define EF_MIPS_MACH_3900 0x00810000
1758#define EF_MIPS_MACH_4010 0x00820000
1759#define EF_MIPS_MACH_4100 0x00830000
1760#define EF_MIPS_MACH_ALLEGREX 0x00840000
1761#define EF_MIPS_MACH_4650 0x00850000
1762#define EF_MIPS_MACH_4120 0x00870000
1763#define EF_MIPS_MACH_4111 0x00880000
1764#define EF_MIPS_MACH_SB1 0x008a0000
1765#define EF_MIPS_MACH_OCTEON 0x008b0000
1766#define EF_MIPS_MACH_XLR 0x008c0000
1767#define EF_MIPS_MACH_OCTEON2 0x008d0000
1768#define EF_MIPS_MACH_OCTEON3 0x008e0000
1769#define EF_MIPS_MACH_5400 0x00910000
1770#define EF_MIPS_MACH_5900 0x00920000
1771#define EF_MIPS_MACH_IAMR2 0x00930000
1772#define EF_MIPS_MACH_5500 0x00980000
1773#define EF_MIPS_MACH_9000 0x00990000
1774#define EF_MIPS_MACH_LS2E 0x00A00000
1775#define EF_MIPS_MACH_LS2F 0x00A10000
1776#define EF_MIPS_MACH_GS464 0x00A20000
1777#define EF_MIPS_MACH_GS464E 0x00A30000
1778#define EF_MIPS_MACH_GS264E 0x00A40000
1779
1780/* The following are unofficial names and should not be used. */
1781
1782#define E_MIPS_ARCH_1 EF_MIPS_ARCH_1
1783#define E_MIPS_ARCH_2 EF_MIPS_ARCH_2
1784#define E_MIPS_ARCH_3 EF_MIPS_ARCH_3
1785#define E_MIPS_ARCH_4 EF_MIPS_ARCH_4
1786#define E_MIPS_ARCH_5 EF_MIPS_ARCH_5
1787#define E_MIPS_ARCH_32 EF_MIPS_ARCH_32
1788#define E_MIPS_ARCH_64 EF_MIPS_ARCH_64
1789
1790/* Special section indices. */
1791
1792#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols. */
1793#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
1794#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
1795#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols. */
1796#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols. */
1797
1798/* Legal values for sh_type field of Elf32_Shdr. */
1799
1800#define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link. */
1801#define SHT_MIPS_MSYM 0x70000001
1802#define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols. */
1803#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes. */
1804#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
1805#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging info. */
1806#define SHT_MIPS_REGINFO 0x70000006 /* Register usage information. */
1807#define SHT_MIPS_PACKAGE 0x70000007
1808#define SHT_MIPS_PACKSYM 0x70000008
1809#define SHT_MIPS_RELD 0x70000009
1810#define SHT_MIPS_IFACE 0x7000000b
1811#define SHT_MIPS_CONTENT 0x7000000c
1812#define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
1813#define SHT_MIPS_SHDR 0x70000010
1814#define SHT_MIPS_FDESC 0x70000011
1815#define SHT_MIPS_EXTSYM 0x70000012
1816#define SHT_MIPS_DENSE 0x70000013
1817#define SHT_MIPS_PDESC 0x70000014
1818#define SHT_MIPS_LOCSYM 0x70000015
1819#define SHT_MIPS_AUXSYM 0x70000016
1820#define SHT_MIPS_OPTSYM 0x70000017
1821#define SHT_MIPS_LOCSTR 0x70000018
1822#define SHT_MIPS_LINE 0x70000019
1823#define SHT_MIPS_RFDESC 0x7000001a
1824#define SHT_MIPS_DELTASYM 0x7000001b
1825#define SHT_MIPS_DELTAINST 0x7000001c
1826#define SHT_MIPS_DELTACLASS 0x7000001d
1827#define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
1828#define SHT_MIPS_DELTADECL 0x7000001f
1829#define SHT_MIPS_SYMBOL_LIB 0x70000020
1830#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
1831#define SHT_MIPS_TRANSLATE 0x70000022
1832#define SHT_MIPS_PIXIE 0x70000023
1833#define SHT_MIPS_XLATE 0x70000024
1834#define SHT_MIPS_XLATE_DEBUG 0x70000025
1835#define SHT_MIPS_WHIRL 0x70000026
1836#define SHT_MIPS_EH_REGION 0x70000027
1837#define SHT_MIPS_XLATE_OLD 0x70000028
1838#define SHT_MIPS_PDR_EXCEPTION 0x70000029
1839#define SHT_MIPS_ABIFLAGS 0x7000002a
1840#define SHT_MIPS_XHASH 0x7000002b
1841
1842/* Legal values for sh_flags field of Elf32_Shdr. */
1843
1844#define SHF_MIPS_GPREL 0x10000000 /* Must be in global data area. */
1845#define SHF_MIPS_MERGE 0x20000000
1846#define SHF_MIPS_ADDR 0x40000000
1847#define SHF_MIPS_STRINGS 0x80000000
1848#define SHF_MIPS_NOSTRIP 0x08000000
1849#define SHF_MIPS_LOCAL 0x04000000
1850#define SHF_MIPS_NAMES 0x02000000
1851#define SHF_MIPS_NODUPE 0x01000000
1852
1853
1854/* Symbol tables. */
1855
1856/* MIPS specific values for `st_other'. */
1857#define STO_MIPS_DEFAULT 0x0
1858#define STO_MIPS_INTERNAL 0x1
1859#define STO_MIPS_HIDDEN 0x2
1860#define STO_MIPS_PROTECTED 0x3
1861#define STO_MIPS_PLT 0x8
1862#define STO_MIPS_SC_ALIGN_UNUSED 0xff
1863
1864/* MIPS specific values for `st_info'. */
1865#define STB_MIPS_SPLIT_COMMON 13
1866
1867/* Entries found in sections of type SHT_MIPS_GPTAB. */
1868
1869typedef union
1870{
1871 struct
1872 {
1873 Elf32_Word gt_current_g_value; /* -G value used for compilation. */
1874 Elf32_Word gt_unused; /* Not used. */
1875 } gt_header; /* First entry in section. */
1876 struct
1877 {
1878 Elf32_Word gt_g_value; /* If this value were used for -G. */
1879 Elf32_Word gt_bytes; /* This many bytes would be used. */
1880 } gt_entry; /* Subsequent entries in section. */
1881} Elf32_gptab;
1882
1883/* Entry found in sections of type SHT_MIPS_REGINFO. */
1884
1885typedef struct
1886{
1887 Elf32_Word ri_gprmask; /* General registers used. */
1888 Elf32_Word ri_cprmask[4]; /* Coprocessor registers used. */
1889 Elf32_Sword ri_gp_value; /* $gp register value. */
1890} Elf32_RegInfo;
1891
1892/* Entries found in sections of type SHT_MIPS_OPTIONS. */
1893
1894typedef struct
1895{
1896 unsigned char kind; /* Determines interpretation of the
1897 variable part of descriptor. */
1898 unsigned char size; /* Size of descriptor, including header. */
1899 Elf32_Section section; /* Section header index of section affected,
1900 0 for global options. */
1901 Elf32_Word info; /* Kind-specific information. */
1902} Elf_Options;
1903
1904/* Values for `kind' field in Elf_Options. */
1905
1906#define ODK_NULL 0 /* Undefined. */
1907#define ODK_REGINFO 1 /* Register usage information. */
1908#define ODK_EXCEPTIONS 2 /* Exception processing options. */
1909#define ODK_PAD 3 /* Section padding options. */
1910#define ODK_HWPATCH 4 /* Hardware workarounds performed */
1911#define ODK_FILL 5 /* record the fill value used by the linker. */
1912#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
1913#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
1914#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
1915
1916/* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
1917
1918#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
1919#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
1920#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
1921#define OEX_SMM 0x20000 /* Force sequential memory mode? */
1922#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
1923#define OEX_PRECISEFP OEX_FPDBUG
1924#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
1925
1926#define OEX_FPU_INVAL 0x10
1927#define OEX_FPU_DIV0 0x08
1928#define OEX_FPU_OFLO 0x04
1929#define OEX_FPU_UFLO 0x02
1930#define OEX_FPU_INEX 0x01
1931
1932/* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
1933
1934#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
1935#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
1936#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
1937#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
1938
1939#define OPAD_PREFIX 0x1
1940#define OPAD_POSTFIX 0x2
1941#define OPAD_SYMBOL 0x4
1942
1943/* Entry found in `.options' section. */
1944
1945typedef struct
1946{
1947 Elf32_Word hwp_flags1; /* Extra flags. */
1948 Elf32_Word hwp_flags2; /* Extra flags. */
1949} Elf_Options_Hw;
1950
1951/* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
1952
1953#define OHWA0_R4KEOP_CHECKED 0x00000001
1954#define OHWA1_R4KEOP_CLEAN 0x00000002
1955
1956/* MIPS relocs. */
1957
1958#define R_MIPS_NONE 0 /* No reloc */
1959#define R_MIPS_16 1 /* Direct 16 bit */
1960#define R_MIPS_32 2 /* Direct 32 bit */
1961#define R_MIPS_REL32 3 /* PC relative 32 bit */
1962#define R_MIPS_26 4 /* Direct 26 bit shifted */
1963#define R_MIPS_HI16 5 /* High 16 bit */
1964#define R_MIPS_LO16 6 /* Low 16 bit */
1965#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
1966#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
1967#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
1968#define R_MIPS_PC16 10 /* PC relative 16 bit */
1969#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
1970#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
1971
1972#define R_MIPS_SHIFT5 16
1973#define R_MIPS_SHIFT6 17
1974#define R_MIPS_64 18
1975#define R_MIPS_GOT_DISP 19
1976#define R_MIPS_GOT_PAGE 20
1977#define R_MIPS_GOT_OFST 21
1978#define R_MIPS_GOT_HI16 22
1979#define R_MIPS_GOT_LO16 23
1980#define R_MIPS_SUB 24
1981#define R_MIPS_INSERT_A 25
1982#define R_MIPS_INSERT_B 26
1983#define R_MIPS_DELETE 27
1984#define R_MIPS_HIGHER 28
1985#define R_MIPS_HIGHEST 29
1986#define R_MIPS_CALL_HI16 30
1987#define R_MIPS_CALL_LO16 31
1988#define R_MIPS_SCN_DISP 32
1989#define R_MIPS_REL16 33
1990#define R_MIPS_ADD_IMMEDIATE 34
1991#define R_MIPS_PJUMP 35
1992#define R_MIPS_RELGOT 36
1993#define R_MIPS_JALR 37
1994#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
1995#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
1996#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
1997#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
1998#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
1999#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
2000#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
2001#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
2002#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
2003#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
2004#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
2005#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
2006#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
2007#define R_MIPS_GLOB_DAT 51
2008#define R_MIPS_PC21_S2 60
2009#define R_MIPS_PC26_S2 61
2010#define R_MIPS_PC18_S3 62
2011#define R_MIPS_PC19_S2 63
2012#define R_MIPS_PCHI16 64
2013#define R_MIPS_PCLO16 65
2014#define R_MIPS16_26 100
2015#define R_MIPS16_GPREL 101
2016#define R_MIPS16_GOT16 102
2017#define R_MIPS16_CALL16 103
2018#define R_MIPS16_HI16 104
2019#define R_MIPS16_LO16 105
2020#define R_MIPS16_TLS_GD 106
2021#define R_MIPS16_TLS_LDM 107
2022#define R_MIPS16_TLS_DTPREL_HI16 108
2023#define R_MIPS16_TLS_DTPREL_LO16 109
2024#define R_MIPS16_TLS_GOTTPREL 110
2025#define R_MIPS16_TLS_TPREL_HI16 111
2026#define R_MIPS16_TLS_TPREL_LO16 112
2027#define R_MIPS16_PC16_S1 113
2028#define R_MIPS_COPY 126
2029#define R_MIPS_JUMP_SLOT 127
2030#define R_MIPS_RELATIVE 128
2031#define R_MICROMIPS_26_S1 133
2032#define R_MICROMIPS_HI16 134
2033#define R_MICROMIPS_LO16 135
2034#define R_MICROMIPS_GPREL16 136
2035#define R_MICROMIPS_LITERAL 137
2036#define R_MICROMIPS_GOT16 138
2037#define R_MICROMIPS_PC7_S1 139
2038#define R_MICROMIPS_PC10_S1 140
2039#define R_MICROMIPS_PC16_S1 141
2040#define R_MICROMIPS_CALL16 142
2041#define R_MICROMIPS_GOT_DISP 145
2042#define R_MICROMIPS_GOT_PAGE 146
2043#define R_MICROMIPS_GOT_OFST 147
2044#define R_MICROMIPS_GOT_HI16 148
2045#define R_MICROMIPS_GOT_LO16 149
2046#define R_MICROMIPS_SUB 150
2047#define R_MICROMIPS_HIGHER 151
2048#define R_MICROMIPS_HIGHEST 152
2049#define R_MICROMIPS_CALL_HI16 153
2050#define R_MICROMIPS_CALL_LO16 154
2051#define R_MICROMIPS_SCN_DISP 155
2052#define R_MICROMIPS_JALR 156
2053#define R_MICROMIPS_HI0_LO16 157
2054#define R_MICROMIPS_TLS_GD 162
2055#define R_MICROMIPS_TLS_LDM 163
2056#define R_MICROMIPS_TLS_DTPREL_HI16 164
2057#define R_MICROMIPS_TLS_DTPREL_LO16 165
2058#define R_MICROMIPS_TLS_GOTTPREL 166
2059#define R_MICROMIPS_TLS_TPREL_HI16 169
2060#define R_MICROMIPS_TLS_TPREL_LO16 170
2061#define R_MICROMIPS_GPREL7_S2 172
2062#define R_MICROMIPS_PC23_S2 173
2063#define R_MIPS_PC32 248
2064#define R_MIPS_EH 249
2065#define R_MIPS_GNU_REL16_S2 250
2066#define R_MIPS_GNU_VTINHERIT 253
2067#define R_MIPS_GNU_VTENTRY 254
2068/* Keep this the last entry. */
2069#define R_MIPS_NUM 255
2070
2071/* Legal values for p_type field of Elf32_Phdr. */
2072
2073#define PT_MIPS_REGINFO 0x70000000 /* Register usage information. */
2074#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
2075#define PT_MIPS_OPTIONS 0x70000002
2076#define PT_MIPS_ABIFLAGS 0x70000003 /* FP mode requirement. */
2077
2078/* Special program header types. */
2079
2080#define PF_MIPS_LOCAL 0x10000000
2081
2082/* Legal values for d_tag field of Elf32_Dyn. */
2083
2084#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
2085#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
2086#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
2087#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
2088#define DT_MIPS_FLAGS 0x70000005 /* Flags */
2089#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
2090#define DT_MIPS_MSYM 0x70000007
2091#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
2092#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
2093#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
2094#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
2095#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
2096#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
2097#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
2098#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
2099#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
2100#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
2101#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
2102#define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
2103 DT_MIPS_DELTA_CLASS. */
2104#define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
2105#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
2106 DT_MIPS_DELTA_INSTANCE. */
2107#define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
2108#define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
2109 DT_MIPS_DELTA_RELOC. */
2110#define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
2111 relocations refer to. */
2112#define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
2113 DT_MIPS_DELTA_SYM. */
2114#define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
2115 class declaration. */
2116#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
2117 DT_MIPS_DELTA_CLASSSYM. */
2118#define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
2119#define DT_MIPS_PIXIE_INIT 0x70000023
2120#define DT_MIPS_SYMBOL_LIB 0x70000024
2121#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
2122#define DT_MIPS_LOCAL_GOTIDX 0x70000026
2123#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
2124#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
2125#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
2126#define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
2127#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
2128#define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
2129#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
2130 function stored in GOT. */
2131#define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
2132 by rld on dlopen() calls. */
2133#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
2134#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
2135#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
2136/* The address of .got.plt in an executable using the new non-PIC ABI. */
2137#define DT_MIPS_PLTGOT 0x70000032
2138/* The base of the PLT in an executable using the new non-PIC ABI if that
2139 PLT is writable. For a non-writable PLT, this is omitted or has a zero
2140 value. */
2141#define DT_MIPS_RWPLT 0x70000034
2142/* An alternative description of the classic MIPS RLD_MAP that is usable
2143 in a PIE as it stores a relative offset from the address of the tag
2144 rather than an absolute address. */
2145#define DT_MIPS_RLD_MAP_REL 0x70000035
2146/* GNU-style hash table with xlat. */
2147#define DT_MIPS_XHASH 0x70000036
2148#define DT_MIPS_NUM 0x37
2149
2150/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
2151
2152#define RHF_NONE 0 /* No flags */
2153#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
2154#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
2155#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
2156#define RHF_NO_MOVE (1 << 3)
2157#define RHF_SGI_ONLY (1 << 4)
2158#define RHF_GUARANTEE_INIT (1 << 5)
2159#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
2160#define RHF_GUARANTEE_START_INIT (1 << 7)
2161#define RHF_PIXIE (1 << 8)
2162#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
2163#define RHF_REQUICKSTART (1 << 10)
2164#define RHF_REQUICKSTARTED (1 << 11)
2165#define RHF_CORD (1 << 12)
2166#define RHF_NO_UNRES_UNDEF (1 << 13)
2167#define RHF_RLD_ORDER_SAFE (1 << 14)
2168
2169/* Entries found in sections of type SHT_MIPS_LIBLIST. */
2170
2171typedef struct
2172{
2173 Elf32_Word l_name; /* Name (string table index) */
2174 Elf32_Word l_time_stamp; /* Timestamp */
2175 Elf32_Word l_checksum; /* Checksum */
2176 Elf32_Word l_version; /* Interface version */
2177 Elf32_Word l_flags; /* Flags */
2178} Elf32_Lib;
2179
2180typedef struct
2181{
2182 Elf64_Word l_name; /* Name (string table index) */
2183 Elf64_Word l_time_stamp; /* Timestamp */
2184 Elf64_Word l_checksum; /* Checksum */
2185 Elf64_Word l_version; /* Interface version */
2186 Elf64_Word l_flags; /* Flags */
2187} Elf64_Lib;
2188
2189
2190/* Legal values for l_flags. */
2191
2192#define LL_NONE 0
2193#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
2194#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
2195#define LL_REQUIRE_MINOR (1 << 2)
2196#define LL_EXPORTS (1 << 3)
2197#define LL_DELAY_LOAD (1 << 4)
2198#define LL_DELTA (1 << 5)
2199
2200/* Entries found in sections of type SHT_MIPS_CONFLICT. */
2201
2202typedef Elf32_Addr Elf32_Conflict;
2203
2204typedef struct
2205{
2206 /* Version of flags structure. */
2207 Elf32_Half version;
2208 /* The level of the ISA: 1-5, 32, 64. */
2209 unsigned char isa_level;
2210 /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */
2211 unsigned char isa_rev;
2212 /* The size of general purpose registers. */
2213 unsigned char gpr_size;
2214 /* The size of co-processor 1 registers. */
2215 unsigned char cpr1_size;
2216 /* The size of co-processor 2 registers. */
2217 unsigned char cpr2_size;
2218 /* The floating-point ABI. */
2219 unsigned char fp_abi;
2220 /* Processor-specific extension. */
2221 Elf32_Word isa_ext;
2222 /* Mask of ASEs used. */
2223 Elf32_Word ases;
2224 /* Mask of general flags. */
2225 Elf32_Word flags1;
2226 Elf32_Word flags2;
2227} Elf_MIPS_ABIFlags_v0;
2228
2229/* Values for the register size bytes of an abi flags structure. */
2230
2231#define MIPS_AFL_REG_NONE 0x00 /* No registers. */
2232#define MIPS_AFL_REG_32 0x01 /* 32-bit registers. */
2233#define MIPS_AFL_REG_64 0x02 /* 64-bit registers. */
2234#define MIPS_AFL_REG_128 0x03 /* 128-bit registers. */
2235
2236/* Masks for the ases word of an ABI flags structure. */
2237
2238#define MIPS_AFL_ASE_DSP 0x00000001 /* DSP ASE. */
2239#define MIPS_AFL_ASE_DSPR2 0x00000002 /* DSP R2 ASE. */
2240#define MIPS_AFL_ASE_EVA 0x00000004 /* Enhanced VA Scheme. */
2241#define MIPS_AFL_ASE_MCU 0x00000008 /* MCU (MicroController) ASE. */
2242#define MIPS_AFL_ASE_MDMX 0x00000010 /* MDMX ASE. */
2243#define MIPS_AFL_ASE_MIPS3D 0x00000020 /* MIPS-3D ASE. */
2244#define MIPS_AFL_ASE_MT 0x00000040 /* MT ASE. */
2245#define MIPS_AFL_ASE_SMARTMIPS 0x00000080 /* SmartMIPS ASE. */
2246#define MIPS_AFL_ASE_VIRT 0x00000100 /* VZ ASE. */
2247#define MIPS_AFL_ASE_MSA 0x00000200 /* MSA ASE. */
2248#define MIPS_AFL_ASE_MIPS16 0x00000400 /* MIPS16 ASE. */
2249#define MIPS_AFL_ASE_MICROMIPS 0x00000800 /* MICROMIPS ASE. */
2250#define MIPS_AFL_ASE_XPA 0x00001000 /* XPA ASE. */
2251#define MIPS_AFL_ASE_MASK 0x00001fff /* All ASEs. */
2252
2253/* Values for the isa_ext word of an ABI flags structure. */
2254
2255#define MIPS_AFL_EXT_XLR 1 /* RMI Xlr instruction. */
2256#define MIPS_AFL_EXT_OCTEON2 2 /* Cavium Networks Octeon2. */
2257#define MIPS_AFL_EXT_OCTEONP 3 /* Cavium Networks OcteonP. */
2258#define MIPS_AFL_EXT_LOONGSON_3A 4 /* Loongson 3A. */
2259#define MIPS_AFL_EXT_OCTEON 5 /* Cavium Networks Octeon. */
2260#define MIPS_AFL_EXT_5900 6 /* MIPS R5900 instruction. */
2261#define MIPS_AFL_EXT_4650 7 /* MIPS R4650 instruction. */
2262#define MIPS_AFL_EXT_4010 8 /* LSI R4010 instruction. */
2263#define MIPS_AFL_EXT_4100 9 /* NEC VR4100 instruction. */
2264#define MIPS_AFL_EXT_3900 10 /* Toshiba R3900 instruction. */
2265#define MIPS_AFL_EXT_10000 11 /* MIPS R10000 instruction. */
2266#define MIPS_AFL_EXT_SB1 12 /* Broadcom SB-1 instruction. */
2267#define MIPS_AFL_EXT_4111 13 /* NEC VR4111/VR4181 instruction. */
2268#define MIPS_AFL_EXT_4120 14 /* NEC VR4120 instruction. */
2269#define MIPS_AFL_EXT_5400 15 /* NEC VR5400 instruction. */
2270#define MIPS_AFL_EXT_5500 16 /* NEC VR5500 instruction. */
2271#define MIPS_AFL_EXT_LOONGSON_2E 17 /* ST Microelectronics Loongson 2E. */
2272#define MIPS_AFL_EXT_LOONGSON_2F 18 /* ST Microelectronics Loongson 2F. */
2273
2274/* Masks for the flags1 word of an ABI flags structure. */
2275#define MIPS_AFL_FLAGS1_ODDSPREG 1 /* Uses odd single-precision registers. */
2276
2277/* Object attribute values. */
2278enum
2279{
2280 /* Not tagged or not using any ABIs affected by the differences. */
2281 Val_GNU_MIPS_ABI_FP_ANY = 0,
2282 /* Using hard-float -mdouble-float. */
2283 Val_GNU_MIPS_ABI_FP_DOUBLE = 1,
2284 /* Using hard-float -msingle-float. */
2285 Val_GNU_MIPS_ABI_FP_SINGLE = 2,
2286 /* Using soft-float. */
2287 Val_GNU_MIPS_ABI_FP_SOFT = 3,
2288 /* Using -mips32r2 -mfp64. */
2289 Val_GNU_MIPS_ABI_FP_OLD_64 = 4,
2290 /* Using -mfpxx. */
2291 Val_GNU_MIPS_ABI_FP_XX = 5,
2292 /* Using -mips32r2 -mfp64. */
2293 Val_GNU_MIPS_ABI_FP_64 = 6,
2294 /* Using -mips32r2 -mfp64 -mno-odd-spreg. */
2295 Val_GNU_MIPS_ABI_FP_64A = 7,
2296 /* Maximum allocated FP ABI value. */
2297 Val_GNU_MIPS_ABI_FP_MAX = 7
2298};
2299
2300/* HPPA specific definitions. */
2301
2302/* Legal values for e_flags field of Elf32_Ehdr. */
2303
2304#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
2305#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
2306#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
2307#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
2308#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
2309 prediction. */
2310#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
2311#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
2312
2313/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
2314
2315#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
2316#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
2317#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
2318
2319/* Additional section indices. */
2320
2321#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tentatively declared
2322 symbols in ANSI C. */
2323#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
2324
2325/* Legal values for sh_type field of Elf32_Shdr. */
2326
2327#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
2328#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
2329#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
2330
2331/* Legal values for sh_flags field of Elf32_Shdr. */
2332
2333#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
2334#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
2335#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
2336
2337/* Legal values for ST_TYPE subfield of st_info (symbol type). */
2338
2339#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
2340
2341#define STT_HP_OPAQUE (STT_LOOS + 0x1)
2342#define STT_HP_STUB (STT_LOOS + 0x2)
2343
2344/* HPPA relocs. */
2345
2346#define R_PARISC_NONE 0 /* No reloc. */
2347#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
2348#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
2349#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
2350#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
2351#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
2352#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
2353#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
2354#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
2355#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
2356#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
2357#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
2358#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
2359#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
2360#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
2361#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
2362#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
2363#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
2364#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
2365#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
2366#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
2367#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
2368#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
2369#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
2370#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
2371#define R_PARISC_FPTR64 64 /* 64 bits function address. */
2372#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
2373#define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
2374#define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
2375#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
2376#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
2377#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
2378#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
2379#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
2380#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
2381#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
2382#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
2383#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
2384#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
2385#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
2386#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
2387#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
2388#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
2389#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
2390#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
2391#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
2392#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
2393#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
2394#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
2395#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
2396#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
2397#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
2398#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
2399#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
2400#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
2401#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
2402#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
2403#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
2404#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
2405#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
2406#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
2407#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */
2408#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */
2409#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */
2410#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */
2411#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */
2412#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */
2413#define R_PARISC_LORESERVE 128
2414#define R_PARISC_COPY 128 /* Copy relocation. */
2415#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
2416#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
2417#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
2418#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
2419#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
2420#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */
2421#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/
2422#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */
2423#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
2424#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
2425#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
2426#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
2427#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
2428#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
2429#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
2430#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/
2431#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/
2432#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */
2433#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */
2434#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */
2435#define R_PARISC_GNU_VTENTRY 232
2436#define R_PARISC_GNU_VTINHERIT 233
2437#define R_PARISC_TLS_GD21L 234 /* GD 21-bit left. */
2438#define R_PARISC_TLS_GD14R 235 /* GD 14-bit right. */
2439#define R_PARISC_TLS_GDCALL 236 /* GD call to __t_g_a. */
2440#define R_PARISC_TLS_LDM21L 237 /* LD module 21-bit left. */
2441#define R_PARISC_TLS_LDM14R 238 /* LD module 14-bit right. */
2442#define R_PARISC_TLS_LDMCALL 239 /* LD module call to __t_g_a. */
2443#define R_PARISC_TLS_LDO21L 240 /* LD offset 21-bit left. */
2444#define R_PARISC_TLS_LDO14R 241 /* LD offset 14-bit right. */
2445#define R_PARISC_TLS_DTPMOD32 242 /* DTP module 32-bit. */
2446#define R_PARISC_TLS_DTPMOD64 243 /* DTP module 64-bit. */
2447#define R_PARISC_TLS_DTPOFF32 244 /* DTP offset 32-bit. */
2448#define R_PARISC_TLS_DTPOFF64 245 /* DTP offset 32-bit. */
2449#define R_PARISC_TLS_LE21L R_PARISC_TPREL21L
2450#define R_PARISC_TLS_LE14R R_PARISC_TPREL14R
2451#define R_PARISC_TLS_IE21L R_PARISC_LTOFF_TP21L
2452#define R_PARISC_TLS_IE14R R_PARISC_LTOFF_TP14R
2453#define R_PARISC_TLS_TPREL32 R_PARISC_TPREL32
2454#define R_PARISC_TLS_TPREL64 R_PARISC_TPREL64
2455#define R_PARISC_HIRESERVE 255
2456
2457/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
2458
2459#define PT_HP_TLS (PT_LOOS + 0x0)
2460#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
2461#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
2462#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
2463#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
2464#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
2465#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
2466#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
2467#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
2468#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
2469#define PT_HP_PARALLEL (PT_LOOS + 0x10)
2470#define PT_HP_FASTBIND (PT_LOOS + 0x11)
2471#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
2472#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
2473#define PT_HP_STACK (PT_LOOS + 0x14)
2474
2475#define PT_PARISC_ARCHEXT 0x70000000
2476#define PT_PARISC_UNWIND 0x70000001
2477
2478/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */
2479
2480#define PF_PARISC_SBP 0x08000000
2481
2482#define PF_HP_PAGE_SIZE 0x00100000
2483#define PF_HP_FAR_SHARED 0x00200000
2484#define PF_HP_NEAR_SHARED 0x00400000
2485#define PF_HP_CODE 0x01000000
2486#define PF_HP_MODIFY 0x02000000
2487#define PF_HP_LAZYSWAP 0x04000000
2488#define PF_HP_SBP 0x08000000
2489
2490
2491/* Alpha specific definitions. */
2492
2493/* Legal values for e_flags field of Elf64_Ehdr. */
2494
2495#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
2496#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
2497
2498/* Legal values for sh_type field of Elf64_Shdr. */
2499
2500/* These two are primerily concerned with ECOFF debugging info. */
2501#define SHT_ALPHA_DEBUG 0x70000001
2502#define SHT_ALPHA_REGINFO 0x70000002
2503
2504/* Legal values for sh_flags field of Elf64_Shdr. */
2505
2506#define SHF_ALPHA_GPREL 0x10000000
2507
2508/* Legal values for st_other field of Elf64_Sym. */
2509#define STO_ALPHA_NOPV 0x80 /* No PV required. */
2510#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
2511
2512/* Alpha relocs. */
2513
2514#define R_ALPHA_NONE 0 /* No reloc */
2515#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
2516#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
2517#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
2518#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
2519#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
2520#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
2521#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
2522#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
2523#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
2524#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
2525#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
2526#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
2527#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
2528#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
2529#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
2530#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
2531#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
2532#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
2533#define R_ALPHA_TLS_GD_HI 28
2534#define R_ALPHA_TLSGD 29
2535#define R_ALPHA_TLS_LDM 30
2536#define R_ALPHA_DTPMOD64 31
2537#define R_ALPHA_GOTDTPREL 32
2538#define R_ALPHA_DTPREL64 33
2539#define R_ALPHA_DTPRELHI 34
2540#define R_ALPHA_DTPRELLO 35
2541#define R_ALPHA_DTPREL16 36
2542#define R_ALPHA_GOTTPREL 37
2543#define R_ALPHA_TPREL64 38
2544#define R_ALPHA_TPRELHI 39
2545#define R_ALPHA_TPRELLO 40
2546#define R_ALPHA_TPREL16 41
2547/* Keep this the last entry. */
2548#define R_ALPHA_NUM 46
2549
2550/* Magic values of the LITUSE relocation addend. */
2551#define LITUSE_ALPHA_ADDR 0
2552#define LITUSE_ALPHA_BASE 1
2553#define LITUSE_ALPHA_BYTOFF 2
2554#define LITUSE_ALPHA_JSR 3
2555#define LITUSE_ALPHA_TLS_GD 4
2556#define LITUSE_ALPHA_TLS_LDM 5
2557
2558/* Legal values for d_tag of Elf64_Dyn. */
2559#define DT_ALPHA_PLTRO (DT_LOPROC + 0)
2560#define DT_ALPHA_NUM 1
2561
2562/* PowerPC specific declarations */
2563
2564/* Values for Elf32/64_Ehdr.e_flags. */
2565#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
2566
2567/* Cygnus local bits below */
2568#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
2569#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
2570 flag */
2571
2572/* PowerPC relocations defined by the ABIs */
2573#define R_PPC_NONE 0
2574#define R_PPC_ADDR32 1 /* 32bit absolute address */
2575#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
2576#define R_PPC_ADDR16 3 /* 16bit absolute address */
2577#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
2578#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
2579#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
2580#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
2581#define R_PPC_ADDR14_BRTAKEN 8
2582#define R_PPC_ADDR14_BRNTAKEN 9
2583#define R_PPC_REL24 10 /* PC relative 26 bit */
2584#define R_PPC_REL14 11 /* PC relative 16 bit */
2585#define R_PPC_REL14_BRTAKEN 12
2586#define R_PPC_REL14_BRNTAKEN 13
2587#define R_PPC_GOT16 14
2588#define R_PPC_GOT16_LO 15
2589#define R_PPC_GOT16_HI 16
2590#define R_PPC_GOT16_HA 17
2591#define R_PPC_PLTREL24 18
2592#define R_PPC_COPY 19
2593#define R_PPC_GLOB_DAT 20
2594#define R_PPC_JMP_SLOT 21
2595#define R_PPC_RELATIVE 22
2596#define R_PPC_LOCAL24PC 23
2597#define R_PPC_UADDR32 24
2598#define R_PPC_UADDR16 25
2599#define R_PPC_REL32 26
2600#define R_PPC_PLT32 27
2601#define R_PPC_PLTREL32 28
2602#define R_PPC_PLT16_LO 29
2603#define R_PPC_PLT16_HI 30
2604#define R_PPC_PLT16_HA 31
2605#define R_PPC_SDAREL16 32
2606#define R_PPC_SECTOFF 33
2607#define R_PPC_SECTOFF_LO 34
2608#define R_PPC_SECTOFF_HI 35
2609#define R_PPC_SECTOFF_HA 36
2610
2611/* PowerPC relocations defined for the TLS access ABI. */
2612#define R_PPC_TLS 67 /* none (sym+add)@tls */
2613#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
2614#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
2615#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
2616#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
2617#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
2618#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
2619#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
2620#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
2621#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
2622#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
2623#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
2624#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
2625#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
2626#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
2627#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
2628#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
2629#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
2630#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
2631#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
2632#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
2633#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
2634#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
2635#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
2636#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
2637#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
2638#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
2639#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
2640#define R_PPC_TLSGD 95 /* none (sym+add)@tlsgd */
2641#define R_PPC_TLSLD 96 /* none (sym+add)@tlsld */
2642
2643/* The remaining relocs are from the Embedded ELF ABI, and are not
2644 in the SVR4 ELF ABI. */
2645#define R_PPC_EMB_NADDR32 101
2646#define R_PPC_EMB_NADDR16 102
2647#define R_PPC_EMB_NADDR16_LO 103
2648#define R_PPC_EMB_NADDR16_HI 104
2649#define R_PPC_EMB_NADDR16_HA 105
2650#define R_PPC_EMB_SDAI16 106
2651#define R_PPC_EMB_SDA2I16 107
2652#define R_PPC_EMB_SDA2REL 108
2653#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
2654#define R_PPC_EMB_MRKREF 110
2655#define R_PPC_EMB_RELSEC16 111
2656#define R_PPC_EMB_RELST_LO 112
2657#define R_PPC_EMB_RELST_HI 113
2658#define R_PPC_EMB_RELST_HA 114
2659#define R_PPC_EMB_BIT_FLD 115
2660#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
2661
2662/* Diab tool relocations. */
2663#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
2664#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
2665#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
2666#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
2667#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
2668#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
2669
2670/* GNU extension to support local ifunc. */
2671#define R_PPC_IRELATIVE 248
2672
2673/* GNU relocs used in PIC code sequences. */
2674#define R_PPC_REL16 249 /* half16 (sym+add-.) */
2675#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */
2676#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */
2677#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */
2678
2679/* This is a phony reloc to handle any old fashioned TOC16 references
2680 that may still be in object files. */
2681#define R_PPC_TOC16 255
2682
2683/* PowerPC specific values for the Dyn d_tag field. */
2684#define DT_PPC_GOT (DT_LOPROC + 0)
2685#define DT_PPC_OPT (DT_LOPROC + 1)
2686#define DT_PPC_NUM 2
2687
2688/* PowerPC specific values for the DT_PPC_OPT Dyn entry. */
2689#define PPC_OPT_TLS 1
2690
2691/* PowerPC64 relocations defined by the ABIs */
2692#define R_PPC64_NONE R_PPC_NONE
2693#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address */
2694#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned */
2695#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address */
2696#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of address */
2697#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of address. */
2698#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
2699#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned */
2700#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
2701#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
2702#define R_PPC64_REL24 R_PPC_REL24 /* PC-rel. 26 bit, word aligned */
2703#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit */
2704#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
2705#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
2706#define R_PPC64_GOT16 R_PPC_GOT16
2707#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
2708#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
2709#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
2710
2711#define R_PPC64_COPY R_PPC_COPY
2712#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
2713#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
2714#define R_PPC64_RELATIVE R_PPC_RELATIVE
2715
2716#define R_PPC64_UADDR32 R_PPC_UADDR32
2717#define R_PPC64_UADDR16 R_PPC_UADDR16
2718#define R_PPC64_REL32 R_PPC_REL32
2719#define R_PPC64_PLT32 R_PPC_PLT32
2720#define R_PPC64_PLTREL32 R_PPC_PLTREL32
2721#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
2722#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
2723#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
2724
2725#define R_PPC64_SECTOFF R_PPC_SECTOFF
2726#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
2727#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
2728#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
2729#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2 */
2730#define R_PPC64_ADDR64 38 /* doubleword64 S + A */
2731#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A) */
2732#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A) */
2733#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A) */
2734#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A) */
2735#define R_PPC64_UADDR64 43 /* doubleword64 S + A */
2736#define R_PPC64_REL64 44 /* doubleword64 S + A - P */
2737#define R_PPC64_PLT64 45 /* doubleword64 L + A */
2738#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P */
2739#define R_PPC64_TOC16 47 /* half16* S + A - .TOC */
2740#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.) */
2741#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.) */
2742#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.) */
2743#define R_PPC64_TOC 51 /* doubleword64 .TOC */
2744#define R_PPC64_PLTGOT16 52 /* half16* M + A */
2745#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A) */
2746#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A) */
2747#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A) */
2748
2749#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2 */
2750#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2 */
2751#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2 */
2752#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2 */
2753#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2 */
2754#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2 */
2755#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2 */
2756#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2 */
2757#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2 */
2758#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2 */
2759#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2 */
2760
2761/* PowerPC64 relocations defined for the TLS access ABI. */
2762#define R_PPC64_TLS 67 /* none (sym+add)@tls */
2763#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
2764#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
2765#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
2766#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
2767#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
2768#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
2769#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
2770#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
2771#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
2772#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
2773#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
2774#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
2775#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
2776#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
2777#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
2778#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
2779#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
2780#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
2781#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
2782#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
2783#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
2784#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
2785#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
2786#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
2787#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
2788#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
2789#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
2790#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
2791#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
2792#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
2793#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
2794#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
2795#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
2796#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
2797#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
2798#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
2799#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
2800#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
2801#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
2802#define R_PPC64_TLSGD 107 /* none (sym+add)@tlsgd */
2803#define R_PPC64_TLSLD 108 /* none (sym+add)@tlsld */
2804#define R_PPC64_TOCSAVE 109 /* none */
2805
2806/* Added when HA and HI relocs were changed to report overflows. */
2807#define R_PPC64_ADDR16_HIGH 110
2808#define R_PPC64_ADDR16_HIGHA 111
2809#define R_PPC64_TPREL16_HIGH 112
2810#define R_PPC64_TPREL16_HIGHA 113
2811#define R_PPC64_DTPREL16_HIGH 114
2812#define R_PPC64_DTPREL16_HIGHA 115
2813
2814/* GNU extension to support local ifunc. */
2815#define R_PPC64_JMP_IREL 247
2816#define R_PPC64_IRELATIVE 248
2817#define R_PPC64_REL16 249 /* half16 (sym+add-.) */
2818#define R_PPC64_REL16_LO 250 /* half16 (sym+add-.)@l */
2819#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
2820#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */
2821
2822/* e_flags bits specifying ABI.
2823 1 for original function descriptor using ABI,
2824 2 for revised ABI without function descriptors,
2825 0 for unspecified or not using any features affected by the differences. */
2826#define EF_PPC64_ABI 3
2827
2828/* PowerPC64 specific values for the Dyn d_tag field. */
2829#define DT_PPC64_GLINK (DT_LOPROC + 0)
2830#define DT_PPC64_OPD (DT_LOPROC + 1)
2831#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
2832#define DT_PPC64_OPT (DT_LOPROC + 3)
2833#define DT_PPC64_NUM 4
2834
2835/* PowerPC64 specific bits in the DT_PPC64_OPT Dyn entry. */
2836#define PPC64_OPT_TLS 1
2837#define PPC64_OPT_MULTI_TOC 2
2838#define PPC64_OPT_LOCALENTRY 4
2839
2840/* PowerPC64 specific values for the Elf64_Sym st_other field. */
2841#define STO_PPC64_LOCAL_BIT 5
2842#define STO_PPC64_LOCAL_MASK (7 << STO_PPC64_LOCAL_BIT)
2843#define PPC64_LOCAL_ENTRY_OFFSET(other) \
2844 (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
2845
2846
2847/* ARM specific declarations */
2848
2849/* Processor specific flags for the ELF header e_flags field. */
2850#define EF_ARM_RELEXEC 0x01
2851#define EF_ARM_HASENTRY 0x02
2852#define EF_ARM_INTERWORK 0x04
2853#define EF_ARM_APCS_26 0x08
2854#define EF_ARM_APCS_FLOAT 0x10
2855#define EF_ARM_PIC 0x20
2856#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use */
2857#define EF_ARM_NEW_ABI 0x80
2858#define EF_ARM_OLD_ABI 0x100
2859#define EF_ARM_SOFT_FLOAT 0x200
2860#define EF_ARM_VFP_FLOAT 0x400
2861#define EF_ARM_MAVERICK_FLOAT 0x800
2862
2863#define EF_ARM_ABI_FLOAT_SOFT 0x200 /* NB conflicts with EF_ARM_SOFT_FLOAT */
2864#define EF_ARM_ABI_FLOAT_HARD 0x400 /* NB conflicts with EF_ARM_VFP_FLOAT */
2865
2866
2867/* Other constants defined in the ARM ELF spec. version B-01. */
2868/* NB. These conflict with values defined above. */
2869#define EF_ARM_SYMSARESORTED 0x04
2870#define EF_ARM_DYNSYMSUSESEGIDX 0x08
2871#define EF_ARM_MAPSYMSFIRST 0x10
2872#define EF_ARM_EABIMASK 0XFF000000
2873
2874/* Constants defined in AAELF. */
2875#define EF_ARM_BE8 0x00800000
2876#define EF_ARM_LE8 0x00400000
2877
2878#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
2879#define EF_ARM_EABI_UNKNOWN 0x00000000
2880#define EF_ARM_EABI_VER1 0x01000000
2881#define EF_ARM_EABI_VER2 0x02000000
2882#define EF_ARM_EABI_VER3 0x03000000
2883#define EF_ARM_EABI_VER4 0x04000000
2884#define EF_ARM_EABI_VER5 0x05000000
2885
2886/* Additional symbol types for Thumb. */
2887#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
2888#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
2889
2890/* ARM-specific values for sh_flags */
2891#define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
2892#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
2893 in the input to a link step. */
2894
2895/* ARM-specific program header flags */
2896#define PF_ARM_SB 0x10000000 /* Segment contains the location
2897 addressed by the static base. */
2898#define PF_ARM_PI 0x20000000 /* Position-independent segment. */
2899#define PF_ARM_ABS 0x40000000 /* Absolute segment. */
2900
2901/* Processor specific values for the Phdr p_type field. */
2902#define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
2903
2904/* Processor specific values for the Shdr sh_type field. */
2905#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
2906#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
2907#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
2908
2909
2910/* AArch64 relocs. */
2911
2912#define R_AARCH64_NONE 0 /* No relocation. */
2913
2914#define R_AARCH64_ABS64 257 /* Direct 64 bit. */
2915#define R_AARCH64_ABS32 258 /* Direct 32 bit. */
2916#define R_AARCH64_ABS16 259 /* Direct 16-bit. */
2917#define R_AARCH64_PREL64 260 /* PC-relative 64-bit. */
2918#define R_AARCH64_PREL32 261 /* PC-relative 32-bit. */
2919#define R_AARCH64_PREL16 262 /* PC-relative 16-bit. */
2920#define R_AARCH64_MOVW_UABS_G0 263 /* Dir. MOVZ imm. from bits 15:0. */
2921#define R_AARCH64_MOVW_UABS_G0_NC 264 /* Likewise for MOVK; no check. */
2922#define R_AARCH64_MOVW_UABS_G1 265 /* Dir. MOVZ imm. from bits 31:16. */
2923#define R_AARCH64_MOVW_UABS_G1_NC 266 /* Likewise for MOVK; no check. */
2924#define R_AARCH64_MOVW_UABS_G2 267 /* Dir. MOVZ imm. from bits 47:32. */
2925#define R_AARCH64_MOVW_UABS_G2_NC 268 /* Likewise for MOVK; no check. */
2926#define R_AARCH64_MOVW_UABS_G3 269 /* Dir. MOV{K,Z} imm. from 63:48. */
2927#define R_AARCH64_MOVW_SABS_G0 270 /* Dir. MOV{N,Z} imm. from 15:0. */
2928#define R_AARCH64_MOVW_SABS_G1 271 /* Dir. MOV{N,Z} imm. from 31:16. */
2929#define R_AARCH64_MOVW_SABS_G2 272 /* Dir. MOV{N,Z} imm. from 47:32. */
2930#define R_AARCH64_LD_PREL_LO19 273 /* PC-rel. LD imm. from bits 20:2. */
2931#define R_AARCH64_ADR_PREL_LO21 274 /* PC-rel. ADR imm. from bits 20:0. */
2932#define R_AARCH64_ADR_PREL_PG_HI21 275 /* Page-rel. ADRP imm. from 32:12. */
2933#define R_AARCH64_ADR_PREL_PG_HI21_NC 276 /* Likewise; no overflow check. */
2934#define R_AARCH64_ADD_ABS_LO12_NC 277 /* Dir. ADD imm. from bits 11:0. */
2935#define R_AARCH64_LDST8_ABS_LO12_NC 278 /* Likewise for LD/ST; no check. */
2936#define R_AARCH64_TSTBR14 279 /* PC-rel. TBZ/TBNZ imm. from 15:2. */
2937#define R_AARCH64_CONDBR19 280 /* PC-rel. cond. br. imm. from 20:2. */
2938#define R_AARCH64_JUMP26 282 /* PC-rel. B imm. from bits 27:2. */
2939#define R_AARCH64_CALL26 283 /* Likewise for CALL. */
2940#define R_AARCH64_LDST16_ABS_LO12_NC 284 /* Dir. ADD imm. from bits 11:1. */
2941#define R_AARCH64_LDST32_ABS_LO12_NC 285 /* Likewise for bits 11:2. */
2942#define R_AARCH64_LDST64_ABS_LO12_NC 286 /* Likewise for bits 11:3. */
2943#define R_AARCH64_MOVW_PREL_G0 287 /* PC-rel. MOV{N,Z} imm. from 15:0. */
2944#define R_AARCH64_MOVW_PREL_G0_NC 288 /* Likewise for MOVK; no check. */
2945#define R_AARCH64_MOVW_PREL_G1 289 /* PC-rel. MOV{N,Z} imm. from 31:16. */
2946#define R_AARCH64_MOVW_PREL_G1_NC 290 /* Likewise for MOVK; no check. */
2947#define R_AARCH64_MOVW_PREL_G2 291 /* PC-rel. MOV{N,Z} imm. from 47:32. */
2948#define R_AARCH64_MOVW_PREL_G2_NC 292 /* Likewise for MOVK; no check. */
2949#define R_AARCH64_MOVW_PREL_G3 293 /* PC-rel. MOV{N,Z} imm. from 63:48. */
2950#define R_AARCH64_LDST128_ABS_LO12_NC 299 /* Dir. ADD imm. from bits 11:4. */
2951#define R_AARCH64_MOVW_GOTOFF_G0 300 /* GOT-rel. off. MOV{N,Z} imm. 15:0. */
2952#define R_AARCH64_MOVW_GOTOFF_G0_NC 301 /* Likewise for MOVK; no check. */
2953#define R_AARCH64_MOVW_GOTOFF_G1 302 /* GOT-rel. o. MOV{N,Z} imm. 31:16. */
2954#define R_AARCH64_MOVW_GOTOFF_G1_NC 303 /* Likewise for MOVK; no check. */
2955#define R_AARCH64_MOVW_GOTOFF_G2 304 /* GOT-rel. o. MOV{N,Z} imm. 47:32. */
2956#define R_AARCH64_MOVW_GOTOFF_G2_NC 305 /* Likewise for MOVK; no check. */
2957#define R_AARCH64_MOVW_GOTOFF_G3 306 /* GOT-rel. o. MOV{N,Z} imm. 63:48. */
2958#define R_AARCH64_GOTREL64 307 /* GOT-relative 64-bit. */
2959#define R_AARCH64_GOTREL32 308 /* GOT-relative 32-bit. */
2960#define R_AARCH64_GOT_LD_PREL19 309 /* PC-rel. GOT off. load imm. 20:2. */
2961#define R_AARCH64_LD64_GOTOFF_LO15 310 /* GOT-rel. off. LD/ST imm. 14:3. */
2962#define R_AARCH64_ADR_GOT_PAGE 311 /* P-page-rel. GOT off. ADRP 32:12. */
2963#define R_AARCH64_LD64_GOT_LO12_NC 312 /* Dir. GOT off. LD/ST imm. 11:3. */
2964#define R_AARCH64_LD64_GOTPAGE_LO15 313 /* GOT-page-rel. GOT off. LD/ST 14:3 */
2965#define R_AARCH64_TLSGD_ADR_PREL21 512 /* PC-relative ADR imm. 20:0. */
2966#define R_AARCH64_TLSGD_ADR_PAGE21 513 /* page-rel. ADRP imm. 32:12. */
2967#define R_AARCH64_TLSGD_ADD_LO12_NC 514 /* direct ADD imm. from 11:0. */
2968#define R_AARCH64_TLSGD_MOVW_G1 515 /* GOT-rel. MOV{N,Z} 31:16. */
2969#define R_AARCH64_TLSGD_MOVW_G0_NC 516 /* GOT-rel. MOVK imm. 15:0. */
2970#define R_AARCH64_TLSLD_ADR_PREL21 517 /* Like 512; local dynamic model. */
2971#define R_AARCH64_TLSLD_ADR_PAGE21 518 /* Like 513; local dynamic model. */
2972#define R_AARCH64_TLSLD_ADD_LO12_NC 519 /* Like 514; local dynamic model. */
2973#define R_AARCH64_TLSLD_MOVW_G1 520 /* Like 515; local dynamic model. */
2974#define R_AARCH64_TLSLD_MOVW_G0_NC 521 /* Like 516; local dynamic model. */
2975#define R_AARCH64_TLSLD_LD_PREL19 522 /* TLS PC-rel. load imm. 20:2. */
2976#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523 /* TLS DTP-rel. MOV{N,Z} 47:32. */
2977#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524 /* TLS DTP-rel. MOV{N,Z} 31:16. */
2978#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525 /* Likewise; MOVK; no check. */
2979#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526 /* TLS DTP-rel. MOV{N,Z} 15:0. */
2980#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527 /* Likewise; MOVK; no check. */
2981#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 528 /* DTP-rel. ADD imm. from 23:12. */
2982#define R_AARCH64_TLSLD_ADD_DTPREL_LO12 529 /* DTP-rel. ADD imm. from 11:0. */
2983#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530 /* Likewise; no ovfl. check. */
2984#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531 /* DTP-rel. LD/ST imm. 11:0. */
2985#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532 /* Likewise; no check. */
2986#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533 /* DTP-rel. LD/ST imm. 11:1. */
2987#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534 /* Likewise; no check. */
2988#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535 /* DTP-rel. LD/ST imm. 11:2. */
2989#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536 /* Likewise; no check. */
2990#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537 /* DTP-rel. LD/ST imm. 11:3. */
2991#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538 /* Likewise; no check. */
2992#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539 /* GOT-rel. MOV{N,Z} 31:16. */
2993#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540 /* GOT-rel. MOVK 15:0. */
2994#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541 /* Page-rel. ADRP 32:12. */
2995#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542 /* Direct LD off. 11:3. */
2996#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543 /* PC-rel. load imm. 20:2. */
2997#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544 /* TLS TP-rel. MOV{N,Z} 47:32. */
2998#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545 /* TLS TP-rel. MOV{N,Z} 31:16. */
2999#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546 /* Likewise; MOVK; no check. */
3000#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547 /* TLS TP-rel. MOV{N,Z} 15:0. */
3001#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548 /* Likewise; MOVK; no check. */
3002#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549 /* TP-rel. ADD imm. 23:12. */
3003#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550 /* TP-rel. ADD imm. 11:0. */
3004#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551 /* Likewise; no ovfl. check. */
3005#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552 /* TP-rel. LD/ST off. 11:0. */
3006#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553 /* Likewise; no ovfl. check. */
3007#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554 /* TP-rel. LD/ST off. 11:1. */
3008#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555 /* Likewise; no check. */
3009#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556 /* TP-rel. LD/ST off. 11:2. */
3010#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557 /* Likewise; no check. */
3011#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558 /* TP-rel. LD/ST off. 11:3. */
3012#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559 /* Likewise; no check. */
3013#define R_AARCH64_TLSDESC_LD_PREL19 560 /* PC-rel. load immediate 20:2. */
3014#define R_AARCH64_TLSDESC_ADR_PREL21 561 /* PC-rel. ADR immediate 20:0. */
3015#define R_AARCH64_TLSDESC_ADR_PAGE21 562 /* Page-rel. ADRP imm. 32:12. */
3016#define R_AARCH64_TLSDESC_LD64_LO12 563 /* Direct LD off. from 11:3. */
3017#define R_AARCH64_TLSDESC_ADD_LO12 564 /* Direct ADD imm. from 11:0. */
3018#define R_AARCH64_TLSDESC_OFF_G1 565 /* GOT-rel. MOV{N,Z} imm. 31:16. */
3019#define R_AARCH64_TLSDESC_OFF_G0_NC 566 /* GOT-rel. MOVK imm. 15:0; no ck. */
3020#define R_AARCH64_TLSDESC_LDR 567 /* Relax LDR. */
3021#define R_AARCH64_TLSDESC_ADD 568 /* Relax ADD. */
3022#define R_AARCH64_TLSDESC_CALL 569 /* Relax BLR. */
3023#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570 /* TP-rel. LD/ST off. 11:4. */
3024#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571 /* Likewise; no check. */
3025#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572 /* DTP-rel. LD/ST imm. 11:4. */
3026#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573 /* Likewise; no check. */
3027#define R_AARCH64_COPY 1024 /* Copy symbol at runtime. */
3028#define R_AARCH64_GLOB_DAT 1025 /* Create GOT entry. */
3029#define R_AARCH64_JUMP_SLOT 1026 /* Create PLT entry. */
3030#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
3031#define R_AARCH64_TLS_DTPMOD 1028 /* Module number, 64 bit. */
3032#define R_AARCH64_TLS_DTPREL 1029 /* Module-relative offset, 64 bit. */
3033#define R_AARCH64_TLS_TPREL 1030 /* TP-relative offset, 64 bit. */
3034#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
3035#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */
3036
3037/* MTE memory tag segment type. */
3038#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 2)
3039
3040/* AArch64 specific values for the Dyn d_tag field. */
3041#define DT_AARCH64_BTI_PLT (DT_LOPROC + 1)
3042#define DT_AARCH64_PAC_PLT (DT_LOPROC + 3)
3043#define DT_AARCH64_VARIANT_PCS (DT_LOPROC + 5)
3044#define DT_AARCH64_NUM 6
3045
3046/* AArch64 specific values for the st_other field. */
3047#define STO_AARCH64_VARIANT_PCS 0x80
3048
3049/* ARM relocs. */
3050
3051#define R_ARM_NONE 0 /* No reloc */
3052#define R_ARM_PC24 1 /* Deprecated PC relative 26
3053 bit branch. */
3054#define R_ARM_ABS32 2 /* Direct 32 bit */
3055#define R_ARM_REL32 3 /* PC relative 32 bit */
3056#define R_ARM_PC13 4
3057#define R_ARM_ABS16 5 /* Direct 16 bit */
3058#define R_ARM_ABS12 6 /* Direct 12 bit */
3059#define R_ARM_THM_ABS5 7 /* Direct & 0x7C (LDR, STR). */
3060#define R_ARM_ABS8 8 /* Direct 8 bit */
3061#define R_ARM_SBREL32 9
3062#define R_ARM_THM_PC22 10 /* PC relative 24 bit (Thumb32 BL). */
3063#define R_ARM_THM_PC8 11 /* PC relative & 0x3FC
3064 (Thumb16 LDR, ADD, ADR). */
3065#define R_ARM_AMP_VCALL9 12
3066#define R_ARM_SWI24 13 /* Obsolete static relocation. */
3067#define R_ARM_TLS_DESC 13 /* Dynamic relocation. */
3068#define R_ARM_THM_SWI8 14 /* Reserved. */
3069#define R_ARM_XPC25 15 /* Reserved. */
3070#define R_ARM_THM_XPC22 16 /* Reserved. */
3071#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */
3072#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */
3073#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */
3074#define R_ARM_COPY 20 /* Copy symbol at runtime */
3075#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
3076#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
3077#define R_ARM_RELATIVE 23 /* Adjust by program base */
3078#define R_ARM_GOTOFF 24 /* 32 bit offset to GOT */
3079#define R_ARM_GOTPC 25 /* 32 bit PC relative offset to GOT */
3080#define R_ARM_GOT32 26 /* 32 bit GOT entry */
3081#define R_ARM_PLT32 27 /* Deprecated, 32 bit PLT address. */
3082#define R_ARM_CALL 28 /* PC relative 24 bit (BL, BLX). */
3083#define R_ARM_JUMP24 29 /* PC relative 24 bit
3084 (B, BL<cond>). */
3085#define R_ARM_THM_JUMP24 30 /* PC relative 24 bit (Thumb32 B.W). */
3086#define R_ARM_BASE_ABS 31 /* Adjust by program base. */
3087#define R_ARM_ALU_PCREL_7_0 32 /* Obsolete. */
3088#define R_ARM_ALU_PCREL_15_8 33 /* Obsolete. */
3089#define R_ARM_ALU_PCREL_23_15 34 /* Obsolete. */
3090#define R_ARM_LDR_SBREL_11_0 35 /* Deprecated, prog. base relative. */
3091#define R_ARM_ALU_SBREL_19_12 36 /* Deprecated, prog. base relative. */
3092#define R_ARM_ALU_SBREL_27_20 37 /* Deprecated, prog. base relative. */
3093#define R_ARM_TARGET1 38
3094#define R_ARM_SBREL31 39 /* Program base relative. */
3095#define R_ARM_V4BX 40
3096#define R_ARM_TARGET2 41
3097#define R_ARM_PREL31 42 /* 32 bit PC relative. */
3098#define R_ARM_MOVW_ABS_NC 43 /* Direct 16-bit (MOVW). */
3099#define R_ARM_MOVT_ABS 44 /* Direct high 16-bit (MOVT). */
3100#define R_ARM_MOVW_PREL_NC 45 /* PC relative 16-bit (MOVW). */
3101#define R_ARM_MOVT_PREL 46 /* PC relative (MOVT). */
3102#define R_ARM_THM_MOVW_ABS_NC 47 /* Direct 16 bit (Thumb32 MOVW). */
3103#define R_ARM_THM_MOVT_ABS 48 /* Direct high 16 bit
3104 (Thumb32 MOVT). */
3105#define R_ARM_THM_MOVW_PREL_NC 49 /* PC relative 16 bit
3106 (Thumb32 MOVW). */
3107#define R_ARM_THM_MOVT_PREL 50 /* PC relative high 16 bit
3108 (Thumb32 MOVT). */
3109#define R_ARM_THM_JUMP19 51 /* PC relative 20 bit
3110 (Thumb32 B<cond>.W). */
3111#define R_ARM_THM_JUMP6 52 /* PC relative X & 0x7E
3112 (Thumb16 CBZ, CBNZ). */
3113#define R_ARM_THM_ALU_PREL_11_0 53 /* PC relative 12 bit
3114 (Thumb32 ADR.W). */
3115#define R_ARM_THM_PC12 54 /* PC relative 12 bit
3116 (Thumb32 LDR{D,SB,H,SH}). */
3117#define R_ARM_ABS32_NOI 55 /* Direct 32-bit. */
3118#define R_ARM_REL32_NOI 56 /* PC relative 32-bit. */
3119#define R_ARM_ALU_PC_G0_NC 57 /* PC relative (ADD, SUB). */
3120#define R_ARM_ALU_PC_G0 58 /* PC relative (ADD, SUB). */
3121#define R_ARM_ALU_PC_G1_NC 59 /* PC relative (ADD, SUB). */
3122#define R_ARM_ALU_PC_G1 60 /* PC relative (ADD, SUB). */
3123#define R_ARM_ALU_PC_G2 61 /* PC relative (ADD, SUB). */
3124#define R_ARM_LDR_PC_G1 62 /* PC relative (LDR,STR,LDRB,STRB). */
3125#define R_ARM_LDR_PC_G2 63 /* PC relative (LDR,STR,LDRB,STRB). */
3126#define R_ARM_LDRS_PC_G0 64 /* PC relative (STR{D,H},
3127 LDR{D,SB,H,SH}). */
3128#define R_ARM_LDRS_PC_G1 65 /* PC relative (STR{D,H},
3129 LDR{D,SB,H,SH}). */
3130#define R_ARM_LDRS_PC_G2 66 /* PC relative (STR{D,H},
3131 LDR{D,SB,H,SH}). */
3132#define R_ARM_LDC_PC_G0 67 /* PC relative (LDC, STC). */
3133#define R_ARM_LDC_PC_G1 68 /* PC relative (LDC, STC). */
3134#define R_ARM_LDC_PC_G2 69 /* PC relative (LDC, STC). */
3135#define R_ARM_ALU_SB_G0_NC 70 /* Program base relative (ADD,SUB). */
3136#define R_ARM_ALU_SB_G0 71 /* Program base relative (ADD,SUB). */
3137#define R_ARM_ALU_SB_G1_NC 72 /* Program base relative (ADD,SUB). */
3138#define R_ARM_ALU_SB_G1 73 /* Program base relative (ADD,SUB). */
3139#define R_ARM_ALU_SB_G2 74 /* Program base relative (ADD,SUB). */
3140#define R_ARM_LDR_SB_G0 75 /* Program base relative (LDR,
3141 STR, LDRB, STRB). */
3142#define R_ARM_LDR_SB_G1 76 /* Program base relative
3143 (LDR, STR, LDRB, STRB). */
3144#define R_ARM_LDR_SB_G2 77 /* Program base relative
3145 (LDR, STR, LDRB, STRB). */
3146#define R_ARM_LDRS_SB_G0 78 /* Program base relative
3147 (LDR, STR, LDRB, STRB). */
3148#define R_ARM_LDRS_SB_G1 79 /* Program base relative
3149 (LDR, STR, LDRB, STRB). */
3150#define R_ARM_LDRS_SB_G2 80 /* Program base relative
3151 (LDR, STR, LDRB, STRB). */
3152#define R_ARM_LDC_SB_G0 81 /* Program base relative (LDC,STC). */
3153#define R_ARM_LDC_SB_G1 82 /* Program base relative (LDC,STC). */
3154#define R_ARM_LDC_SB_G2 83 /* Program base relative (LDC,STC). */
3155#define R_ARM_MOVW_BREL_NC 84 /* Program base relative 16
3156 bit (MOVW). */
3157#define R_ARM_MOVT_BREL 85 /* Program base relative high
3158 16 bit (MOVT). */
3159#define R_ARM_MOVW_BREL 86 /* Program base relative 16
3160 bit (MOVW). */
3161#define R_ARM_THM_MOVW_BREL_NC 87 /* Program base relative 16
3162 bit (Thumb32 MOVW). */
3163#define R_ARM_THM_MOVT_BREL 88 /* Program base relative high
3164 16 bit (Thumb32 MOVT). */
3165#define R_ARM_THM_MOVW_BREL 89 /* Program base relative 16
3166 bit (Thumb32 MOVW). */
3167#define R_ARM_TLS_GOTDESC 90
3168#define R_ARM_TLS_CALL 91
3169#define R_ARM_TLS_DESCSEQ 92 /* TLS relaxation. */
3170#define R_ARM_THM_TLS_CALL 93
3171#define R_ARM_PLT32_ABS 94
3172#define R_ARM_GOT_ABS 95 /* GOT entry. */
3173#define R_ARM_GOT_PREL 96 /* PC relative GOT entry. */
3174#define R_ARM_GOT_BREL12 97 /* GOT entry relative to GOT
3175 origin (LDR). */
3176#define R_ARM_GOTOFF12 98 /* 12 bit, GOT entry relative
3177 to GOT origin (LDR, STR). */
3178#define R_ARM_GOTRELAX 99
3179#define R_ARM_GNU_VTENTRY 100
3180#define R_ARM_GNU_VTINHERIT 101
3181#define R_ARM_THM_PC11 102 /* PC relative & 0xFFE (Thumb16 B). */
3182#define R_ARM_THM_PC9 103 /* PC relative & 0x1FE
3183 (Thumb16 B/B<cond>). */
3184#define R_ARM_TLS_GD32 104 /* PC-rel 32 bit for global dynamic
3185 thread local data */
3186#define R_ARM_TLS_LDM32 105 /* PC-rel 32 bit for local dynamic
3187 thread local data */
3188#define R_ARM_TLS_LDO32 106 /* 32 bit offset relative to TLS
3189 block */
3190#define R_ARM_TLS_IE32 107 /* PC-rel 32 bit for GOT entry of
3191 static TLS block offset */
3192#define R_ARM_TLS_LE32 108 /* 32 bit offset relative to static
3193 TLS block */
3194#define R_ARM_TLS_LDO12 109 /* 12 bit relative to TLS
3195 block (LDR, STR). */
3196#define R_ARM_TLS_LE12 110 /* 12 bit relative to static
3197 TLS block (LDR, STR). */
3198#define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
3199 to GOT origin (LDR). */
3200#define R_ARM_ME_TOO 128 /* Obsolete. */
3201#define R_ARM_THM_TLS_DESCSEQ 129
3202#define R_ARM_THM_TLS_DESCSEQ16 129
3203#define R_ARM_THM_TLS_DESCSEQ32 130
3204#define R_ARM_THM_GOT_BREL12 131 /* GOT entry relative to GOT
3205 origin, 12 bit (Thumb32 LDR). */
3206#define R_ARM_IRELATIVE 160
3207#define R_ARM_RXPC25 249
3208#define R_ARM_RSBREL32 250
3209#define R_ARM_THM_RPC22 251
3210#define R_ARM_RREL32 252
3211#define R_ARM_RABS22 253
3212#define R_ARM_RPC24 254
3213#define R_ARM_RBASE 255
3214/* Keep this the last entry. */
3215#define R_ARM_NUM 256
3216
3217/* C-SKY */
3218#define R_CKCORE_NONE 0 /* no reloc */
3219#define R_CKCORE_ADDR32 1 /* direct 32 bit (S + A) */
3220#define R_CKCORE_PCRELIMM8BY4 2 /* disp ((S + A - P) >> 2) & 0xff */
3221#define R_CKCORE_PCRELIMM11BY2 3 /* disp ((S + A - P) >> 1) & 0x7ff */
3222#define R_CKCORE_PCREL32 5 /* 32-bit rel (S + A - P) */
3223#define R_CKCORE_PCRELJSR_IMM11BY2 6 /* disp ((S + A - P) >>1) & 0x7ff */
3224#define R_CKCORE_RELATIVE 9 /* 32 bit adjust program base(B + A)*/
3225#define R_CKCORE_COPY 10 /* 32 bit adjust by program base */
3226#define R_CKCORE_GLOB_DAT 11 /* off between got and sym (S) */
3227#define R_CKCORE_JUMP_SLOT 12 /* PLT entry (S) */
3228#define R_CKCORE_GOTOFF 13 /* offset to GOT (S + A - GOT) */
3229#define R_CKCORE_GOTPC 14 /* PC offset to GOT (GOT + A - P) */
3230#define R_CKCORE_GOT32 15 /* 32 bit GOT entry (G) */
3231#define R_CKCORE_PLT32 16 /* 32 bit PLT entry (G) */
3232#define R_CKCORE_ADDRGOT 17 /* GOT entry in GLOB_DAT (GOT + G) */
3233#define R_CKCORE_ADDRPLT 18 /* PLT entry in GLOB_DAT (GOT + G) */
3234#define R_CKCORE_PCREL_IMM26BY2 19 /* ((S + A - P) >> 1) & 0x3ffffff */
3235#define R_CKCORE_PCREL_IMM16BY2 20 /* disp ((S + A - P) >> 1) & 0xffff */
3236#define R_CKCORE_PCREL_IMM16BY4 21 /* disp ((S + A - P) >> 2) & 0xffff */
3237#define R_CKCORE_PCREL_IMM10BY2 22 /* disp ((S + A - P) >> 1) & 0x3ff */
3238#define R_CKCORE_PCREL_IMM10BY4 23 /* disp ((S + A - P) >> 2) & 0x3ff */
3239#define R_CKCORE_ADDR_HI16 24 /* high & low 16 bit ADDR */
3240 /* ((S + A) >> 16) & 0xffff */
3241#define R_CKCORE_ADDR_LO16 25 /* (S + A) & 0xffff */
3242#define R_CKCORE_GOTPC_HI16 26 /* high & low 16 bit GOTPC */
3243 /* ((GOT + A - P) >> 16) & 0xffff */
3244#define R_CKCORE_GOTPC_LO16 27 /* (GOT + A - P) & 0xffff */
3245#define R_CKCORE_GOTOFF_HI16 28 /* high & low 16 bit GOTOFF */
3246 /* ((S + A - GOT) >> 16) & 0xffff */
3247#define R_CKCORE_GOTOFF_LO16 29 /* (S + A - GOT) & 0xffff */
3248#define R_CKCORE_GOT12 30 /* 12 bit disp GOT entry (G) */
3249#define R_CKCORE_GOT_HI16 31 /* high & low 16 bit GOT */
3250 /* (G >> 16) & 0xffff */
3251#define R_CKCORE_GOT_LO16 32 /* (G & 0xffff) */
3252#define R_CKCORE_PLT12 33 /* 12 bit disp PLT entry (G) */
3253#define R_CKCORE_PLT_HI16 34 /* high & low 16 bit PLT */
3254 /* (G >> 16) & 0xffff */
3255#define R_CKCORE_PLT_LO16 35 /* G & 0xffff */
3256#define R_CKCORE_ADDRGOT_HI16 36 /* high & low 16 bit ADDRGOT */
3257 /* (GOT + G * 4) & 0xffff */
3258#define R_CKCORE_ADDRGOT_LO16 37 /* (GOT + G * 4) & 0xffff */
3259#define R_CKCORE_ADDRPLT_HI16 38 /* high & low 16 bit ADDRPLT */
3260 /* ((GOT + G * 4) >> 16) & 0xFFFF */
3261#define R_CKCORE_ADDRPLT_LO16 39 /* (GOT+G*4) & 0xffff */
3262#define R_CKCORE_PCREL_JSR_IMM26BY2 40 /* disp ((S+A-P) >>1) & x3ffffff */
3263#define R_CKCORE_TOFFSET_LO16 41 /* (S+A-BTEXT) & 0xffff */
3264#define R_CKCORE_DOFFSET_LO16 42 /* (S+A-BTEXT) & 0xffff */
3265#define R_CKCORE_PCREL_IMM18BY2 43 /* disp ((S+A-P) >>1) & 0x3ffff */
3266#define R_CKCORE_DOFFSET_IMM18 44 /* disp (S+A-BDATA) & 0x3ffff */
3267#define R_CKCORE_DOFFSET_IMM18BY2 45 /* disp ((S+A-BDATA)>>1) & 0x3ffff */
3268#define R_CKCORE_DOFFSET_IMM18BY4 46 /* disp ((S+A-BDATA)>>2) & 0x3ffff */
3269#define R_CKCORE_GOT_IMM18BY4 48 /* disp (G >> 2) */
3270#define R_CKCORE_PLT_IMM18BY4 49 /* disp (G >> 2) */
3271#define R_CKCORE_PCREL_IMM7BY4 50 /* disp ((S+A-P) >>2) & 0x7f */
3272#define R_CKCORE_TLS_LE32 51 /* 32 bit offset to TLS block */
3273#define R_CKCORE_TLS_IE32 52
3274#define R_CKCORE_TLS_GD32 53
3275#define R_CKCORE_TLS_LDM32 54
3276#define R_CKCORE_TLS_LDO32 55
3277#define R_CKCORE_TLS_DTPMOD32 56
3278#define R_CKCORE_TLS_DTPOFF32 57
3279#define R_CKCORE_TLS_TPOFF32 58
3280
3281/* C-SKY elf header definition. */
3282#define EF_CSKY_ABIMASK 0XF0000000
3283#define EF_CSKY_OTHER 0X0FFF0000
3284#define EF_CSKY_PROCESSOR 0X0000FFFF
3285
3286#define EF_CSKY_ABIV1 0X10000000
3287#define EF_CSKY_ABIV2 0X20000000
3288
3289/* C-SKY attributes section. */
3290#define SHT_CSKY_ATTRIBUTES (SHT_LOPROC + 1)
3291
3292/* IA-64 specific declarations. */
3293
3294/* Processor specific flags for the Ehdr e_flags field. */
3295#define EF_IA_64_MASKOS 0x0000000f /* os-specific flags */
3296#define EF_IA_64_ABI64 0x00000010 /* 64-bit ABI */
3297#define EF_IA_64_ARCH 0xff000000 /* arch. version mask */
3298
3299/* Processor specific values for the Phdr p_type field. */
3300#define PT_IA_64_ARCHEXT (PT_LOPROC + 0) /* arch extension bits */
3301#define PT_IA_64_UNWIND (PT_LOPROC + 1) /* ia64 unwind bits */
3302#define PT_IA_64_HP_OPT_ANOT (PT_LOOS + 0x12)
3303#define PT_IA_64_HP_HSL_ANOT (PT_LOOS + 0x13)
3304#define PT_IA_64_HP_STACK (PT_LOOS + 0x14)
3305
3306/* Processor specific flags for the Phdr p_flags field. */
3307#define PF_IA_64_NORECOV 0x80000000 /* spec insns w/o recovery */
3308
3309/* Processor specific values for the Shdr sh_type field. */
3310#define SHT_IA_64_EXT (SHT_LOPROC + 0) /* extension bits */
3311#define SHT_IA_64_UNWIND (SHT_LOPROC + 1) /* unwind bits */
3312
3313/* Processor specific flags for the Shdr sh_flags field. */
3314#define SHF_IA_64_SHORT 0x10000000 /* section near gp */
3315#define SHF_IA_64_NORECOV 0x20000000 /* spec insns w/o recovery */
3316
3317/* Processor specific values for the Dyn d_tag field. */
3318#define DT_IA_64_PLT_RESERVE (DT_LOPROC + 0)
3319#define DT_IA_64_NUM 1
3320
3321/* IA-64 relocations. */
3322#define R_IA64_NONE 0x00 /* none */
3323#define R_IA64_IMM14 0x21 /* symbol + addend, add imm14 */
3324#define R_IA64_IMM22 0x22 /* symbol + addend, add imm22 */
3325#define R_IA64_IMM64 0x23 /* symbol + addend, mov imm64 */
3326#define R_IA64_DIR32MSB 0x24 /* symbol + addend, data4 MSB */
3327#define R_IA64_DIR32LSB 0x25 /* symbol + addend, data4 LSB */
3328#define R_IA64_DIR64MSB 0x26 /* symbol + addend, data8 MSB */
3329#define R_IA64_DIR64LSB 0x27 /* symbol + addend, data8 LSB */
3330#define R_IA64_GPREL22 0x2a /* @gprel(sym + add), add imm22 */
3331#define R_IA64_GPREL64I 0x2b /* @gprel(sym + add), mov imm64 */
3332#define R_IA64_GPREL32MSB 0x2c /* @gprel(sym + add), data4 MSB */
3333#define R_IA64_GPREL32LSB 0x2d /* @gprel(sym + add), data4 LSB */
3334#define R_IA64_GPREL64MSB 0x2e /* @gprel(sym + add), data8 MSB */
3335#define R_IA64_GPREL64LSB 0x2f /* @gprel(sym + add), data8 LSB */
3336#define R_IA64_LTOFF22 0x32 /* @ltoff(sym + add), add imm22 */
3337#define R_IA64_LTOFF64I 0x33 /* @ltoff(sym + add), mov imm64 */
3338#define R_IA64_PLTOFF22 0x3a /* @pltoff(sym + add), add imm22 */
3339#define R_IA64_PLTOFF64I 0x3b /* @pltoff(sym + add), mov imm64 */
3340#define R_IA64_PLTOFF64MSB 0x3e /* @pltoff(sym + add), data8 MSB */
3341#define R_IA64_PLTOFF64LSB 0x3f /* @pltoff(sym + add), data8 LSB */
3342#define R_IA64_FPTR64I 0x43 /* @fptr(sym + add), mov imm64 */
3343#define R_IA64_FPTR32MSB 0x44 /* @fptr(sym + add), data4 MSB */
3344#define R_IA64_FPTR32LSB 0x45 /* @fptr(sym + add), data4 LSB */
3345#define R_IA64_FPTR64MSB 0x46 /* @fptr(sym + add), data8 MSB */
3346#define R_IA64_FPTR64LSB 0x47 /* @fptr(sym + add), data8 LSB */
3347#define R_IA64_PCREL60B 0x48 /* @pcrel(sym + add), brl */
3348#define R_IA64_PCREL21B 0x49 /* @pcrel(sym + add), ptb, call */
3349#define R_IA64_PCREL21M 0x4a /* @pcrel(sym + add), chk.s */
3350#define R_IA64_PCREL21F 0x4b /* @pcrel(sym + add), fchkf */
3351#define R_IA64_PCREL32MSB 0x4c /* @pcrel(sym + add), data4 MSB */
3352#define R_IA64_PCREL32LSB 0x4d /* @pcrel(sym + add), data4 LSB */
3353#define R_IA64_PCREL64MSB 0x4e /* @pcrel(sym + add), data8 MSB */
3354#define R_IA64_PCREL64LSB 0x4f /* @pcrel(sym + add), data8 LSB */
3355#define R_IA64_LTOFF_FPTR22 0x52 /* @ltoff(@fptr(s+a)), imm22 */
3356#define R_IA64_LTOFF_FPTR64I 0x53 /* @ltoff(@fptr(s+a)), imm64 */
3357#define R_IA64_LTOFF_FPTR32MSB 0x54 /* @ltoff(@fptr(s+a)), data4 MSB */
3358#define R_IA64_LTOFF_FPTR32LSB 0x55 /* @ltoff(@fptr(s+a)), data4 LSB */
3359#define R_IA64_LTOFF_FPTR64MSB 0x56 /* @ltoff(@fptr(s+a)), data8 MSB */
3360#define R_IA64_LTOFF_FPTR64LSB 0x57 /* @ltoff(@fptr(s+a)), data8 LSB */
3361#define R_IA64_SEGREL32MSB 0x5c /* @segrel(sym + add), data4 MSB */
3362#define R_IA64_SEGREL32LSB 0x5d /* @segrel(sym + add), data4 LSB */
3363#define R_IA64_SEGREL64MSB 0x5e /* @segrel(sym + add), data8 MSB */
3364#define R_IA64_SEGREL64LSB 0x5f /* @segrel(sym + add), data8 LSB */
3365#define R_IA64_SECREL32MSB 0x64 /* @secrel(sym + add), data4 MSB */
3366#define R_IA64_SECREL32LSB 0x65 /* @secrel(sym + add), data4 LSB */
3367#define R_IA64_SECREL64MSB 0x66 /* @secrel(sym + add), data8 MSB */
3368#define R_IA64_SECREL64LSB 0x67 /* @secrel(sym + add), data8 LSB */
3369#define R_IA64_REL32MSB 0x6c /* data 4 + REL */
3370#define R_IA64_REL32LSB 0x6d /* data 4 + REL */
3371#define R_IA64_REL64MSB 0x6e /* data 8 + REL */
3372#define R_IA64_REL64LSB 0x6f /* data 8 + REL */
3373#define R_IA64_LTV32MSB 0x74 /* symbol + addend, data4 MSB */
3374#define R_IA64_LTV32LSB 0x75 /* symbol + addend, data4 LSB */
3375#define R_IA64_LTV64MSB 0x76 /* symbol + addend, data8 MSB */
3376#define R_IA64_LTV64LSB 0x77 /* symbol + addend, data8 LSB */
3377#define R_IA64_PCREL21BI 0x79 /* @pcrel(sym + add), 21bit inst */
3378#define R_IA64_PCREL22 0x7a /* @pcrel(sym + add), 22bit inst */
3379#define R_IA64_PCREL64I 0x7b /* @pcrel(sym + add), 64bit inst */
3380#define R_IA64_IPLTMSB 0x80 /* dynamic reloc, imported PLT, MSB */
3381#define R_IA64_IPLTLSB 0x81 /* dynamic reloc, imported PLT, LSB */
3382#define R_IA64_COPY 0x84 /* copy relocation */
3383#define R_IA64_SUB 0x85 /* Addend and symbol difference */
3384#define R_IA64_LTOFF22X 0x86 /* LTOFF22, relaxable. */
3385#define R_IA64_LDXMOV 0x87 /* Use of LTOFF22X. */
3386#define R_IA64_TPREL14 0x91 /* @tprel(sym + add), imm14 */
3387#define R_IA64_TPREL22 0x92 /* @tprel(sym + add), imm22 */
3388#define R_IA64_TPREL64I 0x93 /* @tprel(sym + add), imm64 */
3389#define R_IA64_TPREL64MSB 0x96 /* @tprel(sym + add), data8 MSB */
3390#define R_IA64_TPREL64LSB 0x97 /* @tprel(sym + add), data8 LSB */
3391#define R_IA64_LTOFF_TPREL22 0x9a /* @ltoff(@tprel(s+a)), imm2 */
3392#define R_IA64_DTPMOD64MSB 0xa6 /* @dtpmod(sym + add), data8 MSB */
3393#define R_IA64_DTPMOD64LSB 0xa7 /* @dtpmod(sym + add), data8 LSB */
3394#define R_IA64_LTOFF_DTPMOD22 0xaa /* @ltoff(@dtpmod(sym + add)), imm22 */
3395#define R_IA64_DTPREL14 0xb1 /* @dtprel(sym + add), imm14 */
3396#define R_IA64_DTPREL22 0xb2 /* @dtprel(sym + add), imm22 */
3397#define R_IA64_DTPREL64I 0xb3 /* @dtprel(sym + add), imm64 */
3398#define R_IA64_DTPREL32MSB 0xb4 /* @dtprel(sym + add), data4 MSB */
3399#define R_IA64_DTPREL32LSB 0xb5 /* @dtprel(sym + add), data4 LSB */
3400#define R_IA64_DTPREL64MSB 0xb6 /* @dtprel(sym + add), data8 MSB */
3401#define R_IA64_DTPREL64LSB 0xb7 /* @dtprel(sym + add), data8 LSB */
3402#define R_IA64_LTOFF_DTPREL22 0xba /* @ltoff(@dtprel(s+a)), imm22 */
3403
3404/* SH specific declarations */
3405
3406/* Processor specific flags for the ELF header e_flags field. */
3407#define EF_SH_MACH_MASK 0x1f
3408#define EF_SH_UNKNOWN 0x0
3409#define EF_SH1 0x1
3410#define EF_SH2 0x2
3411#define EF_SH3 0x3
3412#define EF_SH_DSP 0x4
3413#define EF_SH3_DSP 0x5
3414#define EF_SH4AL_DSP 0x6
3415#define EF_SH3E 0x8
3416#define EF_SH4 0x9
3417#define EF_SH2E 0xb
3418#define EF_SH4A 0xc
3419#define EF_SH2A 0xd
3420#define EF_SH4_NOFPU 0x10
3421#define EF_SH4A_NOFPU 0x11
3422#define EF_SH4_NOMMU_NOFPU 0x12
3423#define EF_SH2A_NOFPU 0x13
3424#define EF_SH3_NOMMU 0x14
3425#define EF_SH2A_SH4_NOFPU 0x15
3426#define EF_SH2A_SH3_NOFPU 0x16
3427#define EF_SH2A_SH4 0x17
3428#define EF_SH2A_SH3E 0x18
3429
3430/* SH relocs. */
3431#define R_SH_NONE 0
3432#define R_SH_DIR32 1
3433#define R_SH_REL32 2
3434#define R_SH_DIR8WPN 3
3435#define R_SH_IND12W 4
3436#define R_SH_DIR8WPL 5
3437#define R_SH_DIR8WPZ 6
3438#define R_SH_DIR8BP 7
3439#define R_SH_DIR8W 8
3440#define R_SH_DIR8L 9
3441#define R_SH_SWITCH16 25
3442#define R_SH_SWITCH32 26
3443#define R_SH_USES 27
3444#define R_SH_COUNT 28
3445#define R_SH_ALIGN 29
3446#define R_SH_CODE 30
3447#define R_SH_DATA 31
3448#define R_SH_LABEL 32
3449#define R_SH_SWITCH8 33
3450#define R_SH_GNU_VTINHERIT 34
3451#define R_SH_GNU_VTENTRY 35
3452#define R_SH_TLS_GD_32 144
3453#define R_SH_TLS_LD_32 145
3454#define R_SH_TLS_LDO_32 146
3455#define R_SH_TLS_IE_32 147
3456#define R_SH_TLS_LE_32 148
3457#define R_SH_TLS_DTPMOD32 149
3458#define R_SH_TLS_DTPOFF32 150
3459#define R_SH_TLS_TPOFF32 151
3460#define R_SH_GOT32 160
3461#define R_SH_PLT32 161
3462#define R_SH_COPY 162
3463#define R_SH_GLOB_DAT 163
3464#define R_SH_JMP_SLOT 164
3465#define R_SH_RELATIVE 165
3466#define R_SH_GOTOFF 166
3467#define R_SH_GOTPC 167
3468/* Keep this the last entry. */
3469#define R_SH_NUM 256
3470
3471/* S/390 specific definitions. */
3472
3473/* Valid values for the e_flags field. */
3474
3475#define EF_S390_HIGH_GPRS 0x00000001 /* High GPRs kernel facility needed.
3476 This was used in now removed s390-32
3477 arch. */
3478
3479/* Additional s390 relocs */
3480
3481#define R_390_NONE 0 /* No reloc. */
3482#define R_390_8 1 /* Direct 8 bit. */
3483#define R_390_12 2 /* Direct 12 bit. */
3484#define R_390_16 3 /* Direct 16 bit. */
3485#define R_390_32 4 /* Direct 32 bit. */
3486#define R_390_PC32 5 /* PC relative 32 bit. */
3487#define R_390_GOT12 6 /* 12 bit GOT offset. */
3488#define R_390_GOT32 7 /* 32 bit GOT offset. */
3489#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
3490#define R_390_COPY 9 /* Copy symbol at runtime. */
3491#define R_390_GLOB_DAT 10 /* Create GOT entry. */
3492#define R_390_JMP_SLOT 11 /* Create PLT entry. */
3493#define R_390_RELATIVE 12 /* Adjust by program base. */
3494#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
3495#define R_390_GOTPC 14 /* 32 bit PC relative offset to GOT. */
3496#define R_390_GOT16 15 /* 16 bit GOT offset. */
3497#define R_390_PC16 16 /* PC relative 16 bit. */
3498#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
3499#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
3500#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
3501#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
3502#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
3503#define R_390_64 22 /* Direct 64 bit. */
3504#define R_390_PC64 23 /* PC relative 64 bit. */
3505#define R_390_GOT64 24 /* 64 bit GOT offset. */
3506#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
3507#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
3508#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
3509#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
3510#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
3511#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
3512#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
3513#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
3514#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
3515#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
3516#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
3517#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
3518#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
3519#define R_390_TLS_GDCALL 38 /* Tag for function call in general
3520 dynamic TLS code. */
3521#define R_390_TLS_LDCALL 39 /* Tag for function call in local
3522 dynamic TLS code. */
3523#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
3524 thread local data. */
3525#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
3526 thread local data. */
3527#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
3528 block offset. */
3529#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
3530 block offset. */
3531#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
3532 block offset. */
3533#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
3534 thread local data in LE code. */
3535#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
3536 thread local data in LE code. */
3537#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
3538 negated static TLS block offset. */
3539#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
3540 negated static TLS block offset. */
3541#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
3542 negated static TLS block offset. */
3543#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
3544 static TLS block. */
3545#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
3546 static TLS block. */
3547#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
3548 block. */
3549#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
3550 block. */
3551#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
3552#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
3553#define R_390_TLS_TPOFF 56 /* Negated offset in static TLS
3554 block. */
3555#define R_390_20 57 /* Direct 20 bit. */
3556#define R_390_GOT20 58 /* 20 bit GOT offset. */
3557#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
3558#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
3559 block offset. */
3560#define R_390_IRELATIVE 61 /* STT_GNU_IFUNC relocation. */
3561/* Keep this the last entry. */
3562#define R_390_NUM 62
3563
3564
3565/* CRIS relocations. */
3566#define R_CRIS_NONE 0
3567#define R_CRIS_8 1
3568#define R_CRIS_16 2
3569#define R_CRIS_32 3
3570#define R_CRIS_8_PCREL 4
3571#define R_CRIS_16_PCREL 5
3572#define R_CRIS_32_PCREL 6
3573#define R_CRIS_GNU_VTINHERIT 7
3574#define R_CRIS_GNU_VTENTRY 8
3575#define R_CRIS_COPY 9
3576#define R_CRIS_GLOB_DAT 10
3577#define R_CRIS_JUMP_SLOT 11
3578#define R_CRIS_RELATIVE 12
3579#define R_CRIS_16_GOT 13
3580#define R_CRIS_32_GOT 14
3581#define R_CRIS_16_GOTPLT 15
3582#define R_CRIS_32_GOTPLT 16
3583#define R_CRIS_32_GOTREL 17
3584#define R_CRIS_32_PLT_GOTREL 18
3585#define R_CRIS_32_PLT_PCREL 19
3586
3587#define R_CRIS_NUM 20
3588
3589
3590/* AMD x86-64 relocations. */
3591#define R_X86_64_NONE 0 /* No reloc */
3592#define R_X86_64_64 1 /* Direct 64 bit */
3593#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
3594#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
3595#define R_X86_64_PLT32 4 /* 32 bit PLT address */
3596#define R_X86_64_COPY 5 /* Copy symbol at runtime */
3597#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
3598#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
3599#define R_X86_64_RELATIVE 8 /* Adjust by program base */
3600#define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
3601 offset to GOT */
3602#define R_X86_64_32 10 /* Direct 32 bit zero extended */
3603#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
3604#define R_X86_64_16 12 /* Direct 16 bit zero extended */
3605#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
3606#define R_X86_64_8 14 /* Direct 8 bit sign extended */
3607#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
3608#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
3609#define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
3610#define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
3611#define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
3612 to two GOT entries for GD symbol */
3613#define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
3614 to two GOT entries for LD symbol */
3615#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
3616#define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
3617 to GOT entry for IE symbol */
3618#define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
3619#define R_X86_64_PC64 24 /* PC relative 64 bit */
3620#define R_X86_64_GOTOFF64 25 /* 64 bit offset to GOT */
3621#define R_X86_64_GOTPC32 26 /* 32 bit signed pc relative
3622 offset to GOT */
3623#define R_X86_64_GOT64 27 /* 64-bit GOT entry offset */
3624#define R_X86_64_GOTPCREL64 28 /* 64-bit PC relative offset
3625 to GOT entry */
3626#define R_X86_64_GOTPC64 29 /* 64-bit PC relative offset to GOT */
3627#define R_X86_64_GOTPLT64 30 /* like GOT64, says PLT entry needed */
3628#define R_X86_64_PLTOFF64 31 /* 64-bit GOT relative offset
3629 to PLT entry */
3630#define R_X86_64_SIZE32 32 /* Size of symbol plus 32-bit addend */
3631#define R_X86_64_SIZE64 33 /* Size of symbol plus 64-bit addend */
3632#define R_X86_64_GOTPC32_TLSDESC 34 /* GOT offset for TLS descriptor. */
3633#define R_X86_64_TLSDESC_CALL 35 /* Marker for call through TLS
3634 descriptor. */
3635#define R_X86_64_TLSDESC 36 /* TLS descriptor. */
3636#define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */
3637#define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */
3638 /* 39 Reserved was R_X86_64_PC32_BND */
3639 /* 40 Reserved was R_X86_64_PLT32_BND */
3640#define R_X86_64_GOTPCRELX 41 /* Load from 32 bit signed pc relative
3641 offset to GOT entry without REX
3642 prefix, relaxable. */
3643#define R_X86_64_REX_GOTPCRELX 42 /* Load from 32 bit signed pc relative
3644 offset to GOT entry with REX prefix,
3645 relaxable. */
3646#define R_X86_64_NUM 43
3647
3648/* x86-64 sh_type values. */
3649#define SHT_X86_64_UNWIND 0x70000001 /* Unwind information. */
3650
3651/* x86-64 d_tag values. */
3652#define DT_X86_64_PLT (DT_LOPROC + 0)
3653#define DT_X86_64_PLTSZ (DT_LOPROC + 1)
3654#define DT_X86_64_PLTENT (DT_LOPROC + 3)
3655#define DT_X86_64_NUM 4
3656
3657/* AM33 relocations. */
3658#define R_MN10300_NONE 0 /* No reloc. */
3659#define R_MN10300_32 1 /* Direct 32 bit. */
3660#define R_MN10300_16 2 /* Direct 16 bit. */
3661#define R_MN10300_8 3 /* Direct 8 bit. */
3662#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */
3663#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */
3664#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */
3665#define R_MN10300_GNU_VTINHERIT 7 /* Ancient C++ vtable garbage... */
3666#define R_MN10300_GNU_VTENTRY 8 /* ... collection annotation. */
3667#define R_MN10300_24 9 /* Direct 24 bit. */
3668#define R_MN10300_GOTPC32 10 /* 32-bit PCrel offset to GOT. */
3669#define R_MN10300_GOTPC16 11 /* 16-bit PCrel offset to GOT. */
3670#define R_MN10300_GOTOFF32 12 /* 32-bit offset from GOT. */
3671#define R_MN10300_GOTOFF24 13 /* 24-bit offset from GOT. */
3672#define R_MN10300_GOTOFF16 14 /* 16-bit offset from GOT. */
3673#define R_MN10300_PLT32 15 /* 32-bit PCrel to PLT entry. */
3674#define R_MN10300_PLT16 16 /* 16-bit PCrel to PLT entry. */
3675#define R_MN10300_GOT32 17 /* 32-bit offset to GOT entry. */
3676#define R_MN10300_GOT24 18 /* 24-bit offset to GOT entry. */
3677#define R_MN10300_GOT16 19 /* 16-bit offset to GOT entry. */
3678#define R_MN10300_COPY 20 /* Copy symbol at runtime. */
3679#define R_MN10300_GLOB_DAT 21 /* Create GOT entry. */
3680#define R_MN10300_JMP_SLOT 22 /* Create PLT entry. */
3681#define R_MN10300_RELATIVE 23 /* Adjust by program base. */
3682#define R_MN10300_TLS_GD 24 /* 32-bit offset for global dynamic. */
3683#define R_MN10300_TLS_LD 25 /* 32-bit offset for local dynamic. */
3684#define R_MN10300_TLS_LDO 26 /* Module-relative offset. */
3685#define R_MN10300_TLS_GOTIE 27 /* GOT offset for static TLS block
3686 offset. */
3687#define R_MN10300_TLS_IE 28 /* GOT address for static TLS block
3688 offset. */
3689#define R_MN10300_TLS_LE 29 /* Offset relative to static TLS
3690 block. */
3691#define R_MN10300_TLS_DTPMOD 30 /* ID of module containing symbol. */
3692#define R_MN10300_TLS_DTPOFF 31 /* Offset in module TLS block. */
3693#define R_MN10300_TLS_TPOFF 32 /* Offset in static TLS block. */
3694#define R_MN10300_SYM_DIFF 33 /* Adjustment for next reloc as needed
3695 by linker relaxation. */
3696#define R_MN10300_ALIGN 34 /* Alignment requirement for linker
3697 relaxation. */
3698#define R_MN10300_NUM 35
3699
3700
3701/* M32R relocs. */
3702#define R_M32R_NONE 0 /* No reloc. */
3703#define R_M32R_16 1 /* Direct 16 bit. */
3704#define R_M32R_32 2 /* Direct 32 bit. */
3705#define R_M32R_24 3 /* Direct 24 bit. */
3706#define R_M32R_10_PCREL 4 /* PC relative 10 bit shifted. */
3707#define R_M32R_18_PCREL 5 /* PC relative 18 bit shifted. */
3708#define R_M32R_26_PCREL 6 /* PC relative 26 bit shifted. */
3709#define R_M32R_HI16_ULO 7 /* High 16 bit with unsigned low. */
3710#define R_M32R_HI16_SLO 8 /* High 16 bit with signed low. */
3711#define R_M32R_LO16 9 /* Low 16 bit. */
3712#define R_M32R_SDA16 10 /* 16 bit offset in SDA. */
3713#define R_M32R_GNU_VTINHERIT 11
3714#define R_M32R_GNU_VTENTRY 12
3715/* M32R relocs use SHT_RELA. */
3716#define R_M32R_16_RELA 33 /* Direct 16 bit. */
3717#define R_M32R_32_RELA 34 /* Direct 32 bit. */
3718#define R_M32R_24_RELA 35 /* Direct 24 bit. */
3719#define R_M32R_10_PCREL_RELA 36 /* PC relative 10 bit shifted. */
3720#define R_M32R_18_PCREL_RELA 37 /* PC relative 18 bit shifted. */
3721#define R_M32R_26_PCREL_RELA 38 /* PC relative 26 bit shifted. */
3722#define R_M32R_HI16_ULO_RELA 39 /* High 16 bit with unsigned low */
3723#define R_M32R_HI16_SLO_RELA 40 /* High 16 bit with signed low */
3724#define R_M32R_LO16_RELA 41 /* Low 16 bit */
3725#define R_M32R_SDA16_RELA 42 /* 16 bit offset in SDA */
3726#define R_M32R_RELA_GNU_VTINHERIT 43
3727#define R_M32R_RELA_GNU_VTENTRY 44
3728#define R_M32R_REL32 45 /* PC relative 32 bit. */
3729
3730#define R_M32R_GOT24 48 /* 24 bit GOT entry */
3731#define R_M32R_26_PLTREL 49 /* 26 bit PC relative to PLT shifted */
3732#define R_M32R_COPY 50 /* Copy symbol at runtime */
3733#define R_M32R_GLOB_DAT 51 /* Create GOT entry */
3734#define R_M32R_JMP_SLOT 52 /* Create PLT entry */
3735#define R_M32R_RELATIVE 53 /* Adjust by program base */
3736#define R_M32R_GOTOFF 54 /* 24 bit offset to GOT */
3737#define R_M32R_GOTPC24 55 /* 24 bit PC relative offset to GOT */
3738#define R_M32R_GOT16_HI_ULO 56 /* High 16 bit GOT entry with unsigned
3739 low */
3740#define R_M32R_GOT16_HI_SLO 57 /* High 16 bit GOT entry with signed
3741 low */
3742#define R_M32R_GOT16_LO 58 /* Low 16 bit GOT entry */
3743#define R_M32R_GOTPC_HI_ULO 59 /* High 16 bit PC relative offset to
3744 GOT with unsigned low */
3745#define R_M32R_GOTPC_HI_SLO 60 /* High 16 bit PC relative offset to
3746 GOT with signed low */
3747#define R_M32R_GOTPC_LO 61 /* Low 16 bit PC relative offset to
3748 GOT */
3749#define R_M32R_GOTOFF_HI_ULO 62 /* High 16 bit offset to GOT
3750 with unsigned low */
3751#define R_M32R_GOTOFF_HI_SLO 63 /* High 16 bit offset to GOT
3752 with signed low */
3753#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
3754#define R_M32R_NUM 256 /* Keep this the last entry. */
3755
3756/* MicroBlaze relocations */
3757#define R_MICROBLAZE_NONE 0 /* No reloc. */
3758#define R_MICROBLAZE_32 1 /* Direct 32 bit. */
3759#define R_MICROBLAZE_32_PCREL 2 /* PC relative 32 bit. */
3760#define R_MICROBLAZE_64_PCREL 3 /* PC relative 64 bit. */
3761#define R_MICROBLAZE_32_PCREL_LO 4 /* Low 16 bits of PCREL32. */
3762#define R_MICROBLAZE_64 5 /* Direct 64 bit. */
3763#define R_MICROBLAZE_32_LO 6 /* Low 16 bit. */
3764#define R_MICROBLAZE_SRO32 7 /* Read-only small data area. */
3765#define R_MICROBLAZE_SRW32 8 /* Read-write small data area. */
3766#define R_MICROBLAZE_64_NONE 9 /* No reloc. */
3767#define R_MICROBLAZE_32_SYM_OP_SYM 10 /* Symbol Op Symbol relocation. */
3768#define R_MICROBLAZE_GNU_VTINHERIT 11 /* GNU C++ vtable hierarchy. */
3769#define R_MICROBLAZE_GNU_VTENTRY 12 /* GNU C++ vtable member usage. */
3770#define R_MICROBLAZE_GOTPC_64 13 /* PC-relative GOT offset. */
3771#define R_MICROBLAZE_GOT_64 14 /* GOT entry offset. */
3772#define R_MICROBLAZE_PLT_64 15 /* PLT offset (PC-relative). */
3773#define R_MICROBLAZE_REL 16 /* Adjust by program base. */
3774#define R_MICROBLAZE_JUMP_SLOT 17 /* Create PLT entry. */
3775#define R_MICROBLAZE_GLOB_DAT 18 /* Create GOT entry. */
3776#define R_MICROBLAZE_GOTOFF_64 19 /* 64 bit offset to GOT. */
3777#define R_MICROBLAZE_GOTOFF_32 20 /* 32 bit offset to GOT. */
3778#define R_MICROBLAZE_COPY 21 /* Runtime copy. */
3779#define R_MICROBLAZE_TLS 22 /* TLS Reloc. */
3780#define R_MICROBLAZE_TLSGD 23 /* TLS General Dynamic. */
3781#define R_MICROBLAZE_TLSLD 24 /* TLS Local Dynamic. */
3782#define R_MICROBLAZE_TLSDTPMOD32 25 /* TLS Module ID. */
3783#define R_MICROBLAZE_TLSDTPREL32 26 /* TLS Offset Within TLS Block. */
3784#define R_MICROBLAZE_TLSDTPREL64 27 /* TLS Offset Within TLS Block. */
3785#define R_MICROBLAZE_TLSGOTTPREL32 28 /* TLS Offset From Thread Pointer. */
3786#define R_MICROBLAZE_TLSTPREL32 29 /* TLS Offset From Thread Pointer. */
3787
3788/* Legal values for d_tag (dynamic entry type). */
3789#define DT_NIOS2_GP 0x70000002 /* Address of _gp. */
3790
3791/* Nios II relocations. */
3792#define R_NIOS2_NONE 0 /* No reloc. */
3793#define R_NIOS2_S16 1 /* Direct signed 16 bit. */
3794#define R_NIOS2_U16 2 /* Direct unsigned 16 bit. */
3795#define R_NIOS2_PCREL16 3 /* PC relative 16 bit. */
3796#define R_NIOS2_CALL26 4 /* Direct call. */
3797#define R_NIOS2_IMM5 5 /* 5 bit constant expression. */
3798#define R_NIOS2_CACHE_OPX 6 /* 5 bit expression, shift 22. */
3799#define R_NIOS2_IMM6 7 /* 6 bit constant expression. */
3800#define R_NIOS2_IMM8 8 /* 8 bit constant expression. */
3801#define R_NIOS2_HI16 9 /* High 16 bit. */
3802#define R_NIOS2_LO16 10 /* Low 16 bit. */
3803#define R_NIOS2_HIADJ16 11 /* High 16 bit, adjusted. */
3804#define R_NIOS2_BFD_RELOC_32 12 /* 32 bit symbol value + addend. */
3805#define R_NIOS2_BFD_RELOC_16 13 /* 16 bit symbol value + addend. */
3806#define R_NIOS2_BFD_RELOC_8 14 /* 8 bit symbol value + addend. */
3807#define R_NIOS2_GPREL 15 /* 16 bit GP pointer offset. */
3808#define R_NIOS2_GNU_VTINHERIT 16 /* GNU C++ vtable hierarchy. */
3809#define R_NIOS2_GNU_VTENTRY 17 /* GNU C++ vtable member usage. */
3810#define R_NIOS2_UJMP 18 /* Unconditional branch. */
3811#define R_NIOS2_CJMP 19 /* Conditional branch. */
3812#define R_NIOS2_CALLR 20 /* Indirect call through register. */
3813#define R_NIOS2_ALIGN 21 /* Alignment requirement for
3814 linker relaxation. */
3815#define R_NIOS2_GOT16 22 /* 16 bit GOT entry. */
3816#define R_NIOS2_CALL16 23 /* 16 bit GOT entry for function. */
3817#define R_NIOS2_GOTOFF_LO 24 /* %lo of offset to GOT pointer. */
3818#define R_NIOS2_GOTOFF_HA 25 /* %hiadj of offset to GOT pointer. */
3819#define R_NIOS2_PCREL_LO 26 /* %lo of PC relative offset. */
3820#define R_NIOS2_PCREL_HA 27 /* %hiadj of PC relative offset. */
3821#define R_NIOS2_TLS_GD16 28 /* 16 bit GOT offset for TLS GD. */
3822#define R_NIOS2_TLS_LDM16 29 /* 16 bit GOT offset for TLS LDM. */
3823#define R_NIOS2_TLS_LDO16 30 /* 16 bit module relative offset. */
3824#define R_NIOS2_TLS_IE16 31 /* 16 bit GOT offset for TLS IE. */
3825#define R_NIOS2_TLS_LE16 32 /* 16 bit LE TP-relative offset. */
3826#define R_NIOS2_TLS_DTPMOD 33 /* Module number. */
3827#define R_NIOS2_TLS_DTPREL 34 /* Module-relative offset. */
3828#define R_NIOS2_TLS_TPREL 35 /* TP-relative offset. */
3829#define R_NIOS2_COPY 36 /* Copy symbol at runtime. */
3830#define R_NIOS2_GLOB_DAT 37 /* Create GOT entry. */
3831#define R_NIOS2_JUMP_SLOT 38 /* Create PLT entry. */
3832#define R_NIOS2_RELATIVE 39 /* Adjust by program base. */
3833#define R_NIOS2_GOTOFF 40 /* 16 bit offset to GOT pointer. */
3834#define R_NIOS2_CALL26_NOAT 41 /* Direct call in .noat section. */
3835#define R_NIOS2_GOT_LO 42 /* %lo() of GOT entry. */
3836#define R_NIOS2_GOT_HA 43 /* %hiadj() of GOT entry. */
3837#define R_NIOS2_CALL_LO 44 /* %lo() of function GOT entry. */
3838#define R_NIOS2_CALL_HA 45 /* %hiadj() of function GOT entry. */
3839
3840/* TILEPro relocations. */
3841#define R_TILEPRO_NONE 0 /* No reloc */
3842#define R_TILEPRO_32 1 /* Direct 32 bit */
3843#define R_TILEPRO_16 2 /* Direct 16 bit */
3844#define R_TILEPRO_8 3 /* Direct 8 bit */
3845#define R_TILEPRO_32_PCREL 4 /* PC relative 32 bit */
3846#define R_TILEPRO_16_PCREL 5 /* PC relative 16 bit */
3847#define R_TILEPRO_8_PCREL 6 /* PC relative 8 bit */
3848#define R_TILEPRO_LO16 7 /* Low 16 bit */
3849#define R_TILEPRO_HI16 8 /* High 16 bit */
3850#define R_TILEPRO_HA16 9 /* High 16 bit, adjusted */
3851#define R_TILEPRO_COPY 10 /* Copy relocation */
3852#define R_TILEPRO_GLOB_DAT 11 /* Create GOT entry */
3853#define R_TILEPRO_JMP_SLOT 12 /* Create PLT entry */
3854#define R_TILEPRO_RELATIVE 13 /* Adjust by program base */
3855#define R_TILEPRO_BROFF_X1 14 /* X1 pipe branch offset */
3856#define R_TILEPRO_JOFFLONG_X1 15 /* X1 pipe jump offset */
3857#define R_TILEPRO_JOFFLONG_X1_PLT 16 /* X1 pipe jump offset to PLT */
3858#define R_TILEPRO_IMM8_X0 17 /* X0 pipe 8-bit */
3859#define R_TILEPRO_IMM8_Y0 18 /* Y0 pipe 8-bit */
3860#define R_TILEPRO_IMM8_X1 19 /* X1 pipe 8-bit */
3861#define R_TILEPRO_IMM8_Y1 20 /* Y1 pipe 8-bit */
3862#define R_TILEPRO_MT_IMM15_X1 21 /* X1 pipe mtspr */
3863#define R_TILEPRO_MF_IMM15_X1 22 /* X1 pipe mfspr */
3864#define R_TILEPRO_IMM16_X0 23 /* X0 pipe 16-bit */
3865#define R_TILEPRO_IMM16_X1 24 /* X1 pipe 16-bit */
3866#define R_TILEPRO_IMM16_X0_LO 25 /* X0 pipe low 16-bit */
3867#define R_TILEPRO_IMM16_X1_LO 26 /* X1 pipe low 16-bit */
3868#define R_TILEPRO_IMM16_X0_HI 27 /* X0 pipe high 16-bit */
3869#define R_TILEPRO_IMM16_X1_HI 28 /* X1 pipe high 16-bit */
3870#define R_TILEPRO_IMM16_X0_HA 29 /* X0 pipe high 16-bit, adjusted */
3871#define R_TILEPRO_IMM16_X1_HA 30 /* X1 pipe high 16-bit, adjusted */
3872#define R_TILEPRO_IMM16_X0_PCREL 31 /* X0 pipe PC relative 16 bit */
3873#define R_TILEPRO_IMM16_X1_PCREL 32 /* X1 pipe PC relative 16 bit */
3874#define R_TILEPRO_IMM16_X0_LO_PCREL 33 /* X0 pipe PC relative low 16 bit */
3875#define R_TILEPRO_IMM16_X1_LO_PCREL 34 /* X1 pipe PC relative low 16 bit */
3876#define R_TILEPRO_IMM16_X0_HI_PCREL 35 /* X0 pipe PC relative high 16 bit */
3877#define R_TILEPRO_IMM16_X1_HI_PCREL 36 /* X1 pipe PC relative high 16 bit */
3878#define R_TILEPRO_IMM16_X0_HA_PCREL 37 /* X0 pipe PC relative ha() 16 bit */
3879#define R_TILEPRO_IMM16_X1_HA_PCREL 38 /* X1 pipe PC relative ha() 16 bit */
3880#define R_TILEPRO_IMM16_X0_GOT 39 /* X0 pipe 16-bit GOT offset */
3881#define R_TILEPRO_IMM16_X1_GOT 40 /* X1 pipe 16-bit GOT offset */
3882#define R_TILEPRO_IMM16_X0_GOT_LO 41 /* X0 pipe low 16-bit GOT offset */
3883#define R_TILEPRO_IMM16_X1_GOT_LO 42 /* X1 pipe low 16-bit GOT offset */
3884#define R_TILEPRO_IMM16_X0_GOT_HI 43 /* X0 pipe high 16-bit GOT offset */
3885#define R_TILEPRO_IMM16_X1_GOT_HI 44 /* X1 pipe high 16-bit GOT offset */
3886#define R_TILEPRO_IMM16_X0_GOT_HA 45 /* X0 pipe ha() 16-bit GOT offset */
3887#define R_TILEPRO_IMM16_X1_GOT_HA 46 /* X1 pipe ha() 16-bit GOT offset */
3888#define R_TILEPRO_MMSTART_X0 47 /* X0 pipe mm "start" */
3889#define R_TILEPRO_MMEND_X0 48 /* X0 pipe mm "end" */
3890#define R_TILEPRO_MMSTART_X1 49 /* X1 pipe mm "start" */
3891#define R_TILEPRO_MMEND_X1 50 /* X1 pipe mm "end" */
3892#define R_TILEPRO_SHAMT_X0 51 /* X0 pipe shift amount */
3893#define R_TILEPRO_SHAMT_X1 52 /* X1 pipe shift amount */
3894#define R_TILEPRO_SHAMT_Y0 53 /* Y0 pipe shift amount */
3895#define R_TILEPRO_SHAMT_Y1 54 /* Y1 pipe shift amount */
3896#define R_TILEPRO_DEST_IMM8_X1 55 /* X1 pipe destination 8-bit */
3897/* Relocs 56-59 are currently not defined. */
3898#define R_TILEPRO_TLS_GD_CALL 60 /* "jal" for TLS GD */
3899#define R_TILEPRO_IMM8_X0_TLS_GD_ADD 61 /* X0 pipe "addi" for TLS GD */
3900#define R_TILEPRO_IMM8_X1_TLS_GD_ADD 62 /* X1 pipe "addi" for TLS GD */
3901#define R_TILEPRO_IMM8_Y0_TLS_GD_ADD 63 /* Y0 pipe "addi" for TLS GD */
3902#define R_TILEPRO_IMM8_Y1_TLS_GD_ADD 64 /* Y1 pipe "addi" for TLS GD */
3903#define R_TILEPRO_TLS_IE_LOAD 65 /* "lw_tls" for TLS IE */
3904#define R_TILEPRO_IMM16_X0_TLS_GD 66 /* X0 pipe 16-bit TLS GD offset */
3905#define R_TILEPRO_IMM16_X1_TLS_GD 67 /* X1 pipe 16-bit TLS GD offset */
3906#define R_TILEPRO_IMM16_X0_TLS_GD_LO 68 /* X0 pipe low 16-bit TLS GD offset */
3907#define R_TILEPRO_IMM16_X1_TLS_GD_LO 69 /* X1 pipe low 16-bit TLS GD offset */
3908#define R_TILEPRO_IMM16_X0_TLS_GD_HI 70 /* X0 pipe high 16-bit TLS GD offset */
3909#define R_TILEPRO_IMM16_X1_TLS_GD_HI 71 /* X1 pipe high 16-bit TLS GD offset */
3910#define R_TILEPRO_IMM16_X0_TLS_GD_HA 72 /* X0 pipe ha() 16-bit TLS GD offset */
3911#define R_TILEPRO_IMM16_X1_TLS_GD_HA 73 /* X1 pipe ha() 16-bit TLS GD offset */
3912#define R_TILEPRO_IMM16_X0_TLS_IE 74 /* X0 pipe 16-bit TLS IE offset */
3913#define R_TILEPRO_IMM16_X1_TLS_IE 75 /* X1 pipe 16-bit TLS IE offset */
3914#define R_TILEPRO_IMM16_X0_TLS_IE_LO 76 /* X0 pipe low 16-bit TLS IE offset */
3915#define R_TILEPRO_IMM16_X1_TLS_IE_LO 77 /* X1 pipe low 16-bit TLS IE offset */
3916#define R_TILEPRO_IMM16_X0_TLS_IE_HI 78 /* X0 pipe high 16-bit TLS IE offset */
3917#define R_TILEPRO_IMM16_X1_TLS_IE_HI 79 /* X1 pipe high 16-bit TLS IE offset */
3918#define R_TILEPRO_IMM16_X0_TLS_IE_HA 80 /* X0 pipe ha() 16-bit TLS IE offset */
3919#define R_TILEPRO_IMM16_X1_TLS_IE_HA 81 /* X1 pipe ha() 16-bit TLS IE offset */
3920#define R_TILEPRO_TLS_DTPMOD32 82 /* ID of module containing symbol */
3921#define R_TILEPRO_TLS_DTPOFF32 83 /* Offset in TLS block */
3922#define R_TILEPRO_TLS_TPOFF32 84 /* Offset in static TLS block */
3923#define R_TILEPRO_IMM16_X0_TLS_LE 85 /* X0 pipe 16-bit TLS LE offset */
3924#define R_TILEPRO_IMM16_X1_TLS_LE 86 /* X1 pipe 16-bit TLS LE offset */
3925#define R_TILEPRO_IMM16_X0_TLS_LE_LO 87 /* X0 pipe low 16-bit TLS LE offset */
3926#define R_TILEPRO_IMM16_X1_TLS_LE_LO 88 /* X1 pipe low 16-bit TLS LE offset */
3927#define R_TILEPRO_IMM16_X0_TLS_LE_HI 89 /* X0 pipe high 16-bit TLS LE offset */
3928#define R_TILEPRO_IMM16_X1_TLS_LE_HI 90 /* X1 pipe high 16-bit TLS LE offset */
3929#define R_TILEPRO_IMM16_X0_TLS_LE_HA 91 /* X0 pipe ha() 16-bit TLS LE offset */
3930#define R_TILEPRO_IMM16_X1_TLS_LE_HA 92 /* X1 pipe ha() 16-bit TLS LE offset */
3931
3932#define R_TILEPRO_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
3933#define R_TILEPRO_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
3934
3935#define R_TILEPRO_NUM 130
3936
3937
3938/* TILE-Gx relocations. */
3939#define R_TILEGX_NONE 0 /* No reloc */
3940#define R_TILEGX_64 1 /* Direct 64 bit */
3941#define R_TILEGX_32 2 /* Direct 32 bit */
3942#define R_TILEGX_16 3 /* Direct 16 bit */
3943#define R_TILEGX_8 4 /* Direct 8 bit */
3944#define R_TILEGX_64_PCREL 5 /* PC relative 64 bit */
3945#define R_TILEGX_32_PCREL 6 /* PC relative 32 bit */
3946#define R_TILEGX_16_PCREL 7 /* PC relative 16 bit */
3947#define R_TILEGX_8_PCREL 8 /* PC relative 8 bit */
3948#define R_TILEGX_HW0 9 /* hword 0 16-bit */
3949#define R_TILEGX_HW1 10 /* hword 1 16-bit */
3950#define R_TILEGX_HW2 11 /* hword 2 16-bit */
3951#define R_TILEGX_HW3 12 /* hword 3 16-bit */
3952#define R_TILEGX_HW0_LAST 13 /* last hword 0 16-bit */
3953#define R_TILEGX_HW1_LAST 14 /* last hword 1 16-bit */
3954#define R_TILEGX_HW2_LAST 15 /* last hword 2 16-bit */
3955#define R_TILEGX_COPY 16 /* Copy relocation */
3956#define R_TILEGX_GLOB_DAT 17 /* Create GOT entry */
3957#define R_TILEGX_JMP_SLOT 18 /* Create PLT entry */
3958#define R_TILEGX_RELATIVE 19 /* Adjust by program base */
3959#define R_TILEGX_BROFF_X1 20 /* X1 pipe branch offset */
3960#define R_TILEGX_JUMPOFF_X1 21 /* X1 pipe jump offset */
3961#define R_TILEGX_JUMPOFF_X1_PLT 22 /* X1 pipe jump offset to PLT */
3962#define R_TILEGX_IMM8_X0 23 /* X0 pipe 8-bit */
3963#define R_TILEGX_IMM8_Y0 24 /* Y0 pipe 8-bit */
3964#define R_TILEGX_IMM8_X1 25 /* X1 pipe 8-bit */
3965#define R_TILEGX_IMM8_Y1 26 /* Y1 pipe 8-bit */
3966#define R_TILEGX_DEST_IMM8_X1 27 /* X1 pipe destination 8-bit */
3967#define R_TILEGX_MT_IMM14_X1 28 /* X1 pipe mtspr */
3968#define R_TILEGX_MF_IMM14_X1 29 /* X1 pipe mfspr */
3969#define R_TILEGX_MMSTART_X0 30 /* X0 pipe mm "start" */
3970#define R_TILEGX_MMEND_X0 31 /* X0 pipe mm "end" */
3971#define R_TILEGX_SHAMT_X0 32 /* X0 pipe shift amount */
3972#define R_TILEGX_SHAMT_X1 33 /* X1 pipe shift amount */
3973#define R_TILEGX_SHAMT_Y0 34 /* Y0 pipe shift amount */
3974#define R_TILEGX_SHAMT_Y1 35 /* Y1 pipe shift amount */
3975#define R_TILEGX_IMM16_X0_HW0 36 /* X0 pipe hword 0 */
3976#define R_TILEGX_IMM16_X1_HW0 37 /* X1 pipe hword 0 */
3977#define R_TILEGX_IMM16_X0_HW1 38 /* X0 pipe hword 1 */
3978#define R_TILEGX_IMM16_X1_HW1 39 /* X1 pipe hword 1 */
3979#define R_TILEGX_IMM16_X0_HW2 40 /* X0 pipe hword 2 */
3980#define R_TILEGX_IMM16_X1_HW2 41 /* X1 pipe hword 2 */
3981#define R_TILEGX_IMM16_X0_HW3 42 /* X0 pipe hword 3 */
3982#define R_TILEGX_IMM16_X1_HW3 43 /* X1 pipe hword 3 */
3983#define R_TILEGX_IMM16_X0_HW0_LAST 44 /* X0 pipe last hword 0 */
3984#define R_TILEGX_IMM16_X1_HW0_LAST 45 /* X1 pipe last hword 0 */
3985#define R_TILEGX_IMM16_X0_HW1_LAST 46 /* X0 pipe last hword 1 */
3986#define R_TILEGX_IMM16_X1_HW1_LAST 47 /* X1 pipe last hword 1 */
3987#define R_TILEGX_IMM16_X0_HW2_LAST 48 /* X0 pipe last hword 2 */
3988#define R_TILEGX_IMM16_X1_HW2_LAST 49 /* X1 pipe last hword 2 */
3989#define R_TILEGX_IMM16_X0_HW0_PCREL 50 /* X0 pipe PC relative hword 0 */
3990#define R_TILEGX_IMM16_X1_HW0_PCREL 51 /* X1 pipe PC relative hword 0 */
3991#define R_TILEGX_IMM16_X0_HW1_PCREL 52 /* X0 pipe PC relative hword 1 */
3992#define R_TILEGX_IMM16_X1_HW1_PCREL 53 /* X1 pipe PC relative hword 1 */
3993#define R_TILEGX_IMM16_X0_HW2_PCREL 54 /* X0 pipe PC relative hword 2 */
3994#define R_TILEGX_IMM16_X1_HW2_PCREL 55 /* X1 pipe PC relative hword 2 */
3995#define R_TILEGX_IMM16_X0_HW3_PCREL 56 /* X0 pipe PC relative hword 3 */
3996#define R_TILEGX_IMM16_X1_HW3_PCREL 57 /* X1 pipe PC relative hword 3 */
3997#define R_TILEGX_IMM16_X0_HW0_LAST_PCREL 58 /* X0 pipe PC-rel last hword 0 */
3998#define R_TILEGX_IMM16_X1_HW0_LAST_PCREL 59 /* X1 pipe PC-rel last hword 0 */
3999#define R_TILEGX_IMM16_X0_HW1_LAST_PCREL 60 /* X0 pipe PC-rel last hword 1 */
4000#define R_TILEGX_IMM16_X1_HW1_LAST_PCREL 61 /* X1 pipe PC-rel last hword 1 */
4001#define R_TILEGX_IMM16_X0_HW2_LAST_PCREL 62 /* X0 pipe PC-rel last hword 2 */
4002#define R_TILEGX_IMM16_X1_HW2_LAST_PCREL 63 /* X1 pipe PC-rel last hword 2 */
4003#define R_TILEGX_IMM16_X0_HW0_GOT 64 /* X0 pipe hword 0 GOT offset */
4004#define R_TILEGX_IMM16_X1_HW0_GOT 65 /* X1 pipe hword 0 GOT offset */
4005#define R_TILEGX_IMM16_X0_HW0_PLT_PCREL 66 /* X0 pipe PC-rel PLT hword 0 */
4006#define R_TILEGX_IMM16_X1_HW0_PLT_PCREL 67 /* X1 pipe PC-rel PLT hword 0 */
4007#define R_TILEGX_IMM16_X0_HW1_PLT_PCREL 68 /* X0 pipe PC-rel PLT hword 1 */
4008#define R_TILEGX_IMM16_X1_HW1_PLT_PCREL 69 /* X1 pipe PC-rel PLT hword 1 */
4009#define R_TILEGX_IMM16_X0_HW2_PLT_PCREL 70 /* X0 pipe PC-rel PLT hword 2 */
4010#define R_TILEGX_IMM16_X1_HW2_PLT_PCREL 71 /* X1 pipe PC-rel PLT hword 2 */
4011#define R_TILEGX_IMM16_X0_HW0_LAST_GOT 72 /* X0 pipe last hword 0 GOT offset */
4012#define R_TILEGX_IMM16_X1_HW0_LAST_GOT 73 /* X1 pipe last hword 0 GOT offset */
4013#define R_TILEGX_IMM16_X0_HW1_LAST_GOT 74 /* X0 pipe last hword 1 GOT offset */
4014#define R_TILEGX_IMM16_X1_HW1_LAST_GOT 75 /* X1 pipe last hword 1 GOT offset */
4015#define R_TILEGX_IMM16_X0_HW3_PLT_PCREL 76 /* X0 pipe PC-rel PLT hword 3 */
4016#define R_TILEGX_IMM16_X1_HW3_PLT_PCREL 77 /* X1 pipe PC-rel PLT hword 3 */
4017#define R_TILEGX_IMM16_X0_HW0_TLS_GD 78 /* X0 pipe hword 0 TLS GD offset */
4018#define R_TILEGX_IMM16_X1_HW0_TLS_GD 79 /* X1 pipe hword 0 TLS GD offset */
4019#define R_TILEGX_IMM16_X0_HW0_TLS_LE 80 /* X0 pipe hword 0 TLS LE offset */
4020#define R_TILEGX_IMM16_X1_HW0_TLS_LE 81 /* X1 pipe hword 0 TLS LE offset */
4021#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE 82 /* X0 pipe last hword 0 LE off */
4022#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE 83 /* X1 pipe last hword 0 LE off */
4023#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE 84 /* X0 pipe last hword 1 LE off */
4024#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE 85 /* X1 pipe last hword 1 LE off */
4025#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD 86 /* X0 pipe last hword 0 GD off */
4026#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD 87 /* X1 pipe last hword 0 GD off */
4027#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD 88 /* X0 pipe last hword 1 GD off */
4028#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD 89 /* X1 pipe last hword 1 GD off */
4029/* Relocs 90-91 are currently not defined. */
4030#define R_TILEGX_IMM16_X0_HW0_TLS_IE 92 /* X0 pipe hword 0 TLS IE offset */
4031#define R_TILEGX_IMM16_X1_HW0_TLS_IE 93 /* X1 pipe hword 0 TLS IE offset */
4032#define R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL 94 /* X0 pipe PC-rel PLT last hword 0 */
4033#define R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL 95 /* X1 pipe PC-rel PLT last hword 0 */
4034#define R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL 96 /* X0 pipe PC-rel PLT last hword 1 */
4035#define R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL 97 /* X1 pipe PC-rel PLT last hword 1 */
4036#define R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL 98 /* X0 pipe PC-rel PLT last hword 2 */
4037#define R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL 99 /* X1 pipe PC-rel PLT last hword 2 */
4038#define R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE 100 /* X0 pipe last hword 0 IE off */
4039#define R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE 101 /* X1 pipe last hword 0 IE off */
4040#define R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE 102 /* X0 pipe last hword 1 IE off */
4041#define R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE 103 /* X1 pipe last hword 1 IE off */
4042/* Relocs 104-105 are currently not defined. */
4043#define R_TILEGX_TLS_DTPMOD64 106 /* 64-bit ID of symbol's module */
4044#define R_TILEGX_TLS_DTPOFF64 107 /* 64-bit offset in TLS block */
4045#define R_TILEGX_TLS_TPOFF64 108 /* 64-bit offset in static TLS block */
4046#define R_TILEGX_TLS_DTPMOD32 109 /* 32-bit ID of symbol's module */
4047#define R_TILEGX_TLS_DTPOFF32 110 /* 32-bit offset in TLS block */
4048#define R_TILEGX_TLS_TPOFF32 111 /* 32-bit offset in static TLS block */
4049#define R_TILEGX_TLS_GD_CALL 112 /* "jal" for TLS GD */
4050#define R_TILEGX_IMM8_X0_TLS_GD_ADD 113 /* X0 pipe "addi" for TLS GD */
4051#define R_TILEGX_IMM8_X1_TLS_GD_ADD 114 /* X1 pipe "addi" for TLS GD */
4052#define R_TILEGX_IMM8_Y0_TLS_GD_ADD 115 /* Y0 pipe "addi" for TLS GD */
4053#define R_TILEGX_IMM8_Y1_TLS_GD_ADD 116 /* Y1 pipe "addi" for TLS GD */
4054#define R_TILEGX_TLS_IE_LOAD 117 /* "ld_tls" for TLS IE */
4055#define R_TILEGX_IMM8_X0_TLS_ADD 118 /* X0 pipe "addi" for TLS GD/IE */
4056#define R_TILEGX_IMM8_X1_TLS_ADD 119 /* X1 pipe "addi" for TLS GD/IE */
4057#define R_TILEGX_IMM8_Y0_TLS_ADD 120 /* Y0 pipe "addi" for TLS GD/IE */
4058#define R_TILEGX_IMM8_Y1_TLS_ADD 121 /* Y1 pipe "addi" for TLS GD/IE */
4059
4060#define R_TILEGX_GNU_VTINHERIT 128 /* GNU C++ vtable hierarchy */
4061#define R_TILEGX_GNU_VTENTRY 129 /* GNU C++ vtable member usage */
4062
4063#define R_TILEGX_NUM 130
4064
4065/* RISC-V ELF Flags */
4066#define EF_RISCV_RVC 0x0001
4067#define EF_RISCV_FLOAT_ABI 0x0006
4068#define EF_RISCV_FLOAT_ABI_SOFT 0x0000
4069#define EF_RISCV_FLOAT_ABI_SINGLE 0x0002
4070#define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004
4071#define EF_RISCV_FLOAT_ABI_QUAD 0x0006
4072#define EF_RISCV_RVE 0x0008
4073#define EF_RISCV_TSO 0x0010
4074
4075/* RISC-V relocations. */
4076#define R_RISCV_NONE 0
4077#define R_RISCV_32 1
4078#define R_RISCV_64 2
4079#define R_RISCV_RELATIVE 3
4080#define R_RISCV_COPY 4
4081#define R_RISCV_JUMP_SLOT 5
4082#define R_RISCV_TLS_DTPMOD32 6
4083#define R_RISCV_TLS_DTPMOD64 7
4084#define R_RISCV_TLS_DTPREL32 8
4085#define R_RISCV_TLS_DTPREL64 9
4086#define R_RISCV_TLS_TPREL32 10
4087#define R_RISCV_TLS_TPREL64 11
4088#define R_RISCV_TLSDESC 12
4089#define R_RISCV_BRANCH 16
4090#define R_RISCV_JAL 17
4091#define R_RISCV_CALL 18
4092#define R_RISCV_CALL_PLT 19
4093#define R_RISCV_GOT_HI20 20
4094#define R_RISCV_TLS_GOT_HI20 21
4095#define R_RISCV_TLS_GD_HI20 22
4096#define R_RISCV_PCREL_HI20 23
4097#define R_RISCV_PCREL_LO12_I 24
4098#define R_RISCV_PCREL_LO12_S 25
4099#define R_RISCV_HI20 26
4100#define R_RISCV_LO12_I 27
4101#define R_RISCV_LO12_S 28
4102#define R_RISCV_TPREL_HI20 29
4103#define R_RISCV_TPREL_LO12_I 30
4104#define R_RISCV_TPREL_LO12_S 31
4105#define R_RISCV_TPREL_ADD 32
4106#define R_RISCV_ADD8 33
4107#define R_RISCV_ADD16 34
4108#define R_RISCV_ADD32 35
4109#define R_RISCV_ADD64 36
4110#define R_RISCV_SUB8 37
4111#define R_RISCV_SUB16 38
4112#define R_RISCV_SUB32 39
4113#define R_RISCV_SUB64 40
4114#define R_RISCV_GOT32_PCREL 41
4115#define R_RISCV_ALIGN 43
4116#define R_RISCV_RVC_BRANCH 44
4117#define R_RISCV_RVC_JUMP 45
4118#define R_RISCV_RELAX 51
4119#define R_RISCV_SUB6 52
4120#define R_RISCV_SET6 53
4121#define R_RISCV_SET8 54
4122#define R_RISCV_SET16 55
4123#define R_RISCV_SET32 56
4124#define R_RISCV_32_PCREL 57
4125#define R_RISCV_IRELATIVE 58
4126#define R_RISCV_PLT32 59
4127#define R_RISCV_SET_ULEB128 60
4128#define R_RISCV_SUB_ULEB128 61
4129#define R_RISCV_TLSDESC_HI20 62
4130#define R_RISCV_TLSDESC_LOAD_LO12 63
4131#define R_RISCV_TLSDESC_ADD_LO12 64
4132#define R_RISCV_TLSDESC_CALL 65
4133
4134#define R_RISCV_NUM 66
4135
4136/* RISC-V specific values for the st_other field. */
4137#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
4138 convention */
4139
4140/* RISC-V specific values for the sh_type field. */
4141#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
4142
4143/* RISC-V specific values for the p_type field (deprecated). */
4144#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
4145
4146/* RISC-V specific values for the d_tag field. */
4147#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
4148
4149/* BPF specific declarations. */
4150
4151#define R_BPF_NONE 0 /* No reloc */
4152#define R_BPF_64_64 1
4153#define R_BPF_64_32 10
4154
4155/* Imagination Meta specific relocations. */
4156
4157#define R_METAG_HIADDR16 0
4158#define R_METAG_LOADDR16 1
4159#define R_METAG_ADDR32 2 /* 32bit absolute address */
4160#define R_METAG_NONE 3 /* No reloc */
4161#define R_METAG_RELBRANCH 4
4162#define R_METAG_GETSETOFF 5
4163
4164/* Backward compatibility */
4165#define R_METAG_REG32OP1 6
4166#define R_METAG_REG32OP2 7
4167#define R_METAG_REG32OP3 8
4168#define R_METAG_REG16OP1 9
4169#define R_METAG_REG16OP2 10
4170#define R_METAG_REG16OP3 11
4171#define R_METAG_REG32OP4 12
4172
4173#define R_METAG_HIOG 13
4174#define R_METAG_LOOG 14
4175
4176#define R_METAG_REL8 15
4177#define R_METAG_REL16 16
4178
4179/* GNU */
4180#define R_METAG_GNU_VTINHERIT 30
4181#define R_METAG_GNU_VTENTRY 31
4182
4183/* PIC relocations */
4184#define R_METAG_HI16_GOTOFF 32
4185#define R_METAG_LO16_GOTOFF 33
4186#define R_METAG_GETSET_GOTOFF 34
4187#define R_METAG_GETSET_GOT 35
4188#define R_METAG_HI16_GOTPC 36
4189#define R_METAG_LO16_GOTPC 37
4190#define R_METAG_HI16_PLT 38
4191#define R_METAG_LO16_PLT 39
4192#define R_METAG_RELBRANCH_PLT 40
4193#define R_METAG_GOTOFF 41
4194#define R_METAG_PLT 42
4195#define R_METAG_COPY 43
4196#define R_METAG_JMP_SLOT 44
4197#define R_METAG_RELATIVE 45
4198#define R_METAG_GLOB_DAT 46
4199
4200/* TLS relocations */
4201#define R_METAG_TLS_GD 47
4202#define R_METAG_TLS_LDM 48
4203#define R_METAG_TLS_LDO_HI16 49
4204#define R_METAG_TLS_LDO_LO16 50
4205#define R_METAG_TLS_LDO 51
4206#define R_METAG_TLS_IE 52
4207#define R_METAG_TLS_IENONPIC 53
4208#define R_METAG_TLS_IENONPIC_HI16 54
4209#define R_METAG_TLS_IENONPIC_LO16 55
4210#define R_METAG_TLS_TPOFF 56
4211#define R_METAG_TLS_DTPMOD 57
4212#define R_METAG_TLS_DTPOFF 58
4213#define R_METAG_TLS_LE 59
4214#define R_METAG_TLS_LE_HI16 60
4215#define R_METAG_TLS_LE_LO16 61
4216
4217/* NDS32 relocations. */
4218#define R_NDS32_NONE 0
4219#define R_NDS32_32_RELA 20
4220#define R_NDS32_COPY 39
4221#define R_NDS32_GLOB_DAT 40
4222#define R_NDS32_JMP_SLOT 41
4223#define R_NDS32_RELATIVE 42
4224#define R_NDS32_TLS_TPOFF 102
4225#define R_NDS32_TLS_DESC 119
4226
4227/* LoongArch ELF Flags */
4228#define EF_LARCH_ABI_MODIFIER_MASK 0x07
4229#define EF_LARCH_ABI_SOFT_FLOAT 0x01
4230#define EF_LARCH_ABI_SINGLE_FLOAT 0x02
4231#define EF_LARCH_ABI_DOUBLE_FLOAT 0x03
4232#define EF_LARCH_OBJABI_V1 0x40
4233
4234/* LoongArch specific dynamic relocations */
4235#define R_LARCH_NONE 0
4236#define R_LARCH_32 1
4237#define R_LARCH_64 2
4238#define R_LARCH_RELATIVE 3
4239#define R_LARCH_COPY 4
4240#define R_LARCH_JUMP_SLOT 5
4241#define R_LARCH_TLS_DTPMOD32 6
4242#define R_LARCH_TLS_DTPMOD64 7
4243#define R_LARCH_TLS_DTPREL32 8
4244#define R_LARCH_TLS_DTPREL64 9
4245#define R_LARCH_TLS_TPREL32 10
4246#define R_LARCH_TLS_TPREL64 11
4247#define R_LARCH_IRELATIVE 12
4248#define R_LARCH_TLS_DESC32 13
4249#define R_LARCH_TLS_DESC64 14
4250
4251/* Reserved for future relocs that the dynamic linker must understand. */
4252
4253/* used by the static linker for relocating .text. */
4254#define R_LARCH_MARK_LA 20
4255#define R_LARCH_MARK_PCREL 21
4256#define R_LARCH_SOP_PUSH_PCREL 22
4257#define R_LARCH_SOP_PUSH_ABSOLUTE 23
4258#define R_LARCH_SOP_PUSH_DUP 24
4259#define R_LARCH_SOP_PUSH_GPREL 25
4260#define R_LARCH_SOP_PUSH_TLS_TPREL 26
4261#define R_LARCH_SOP_PUSH_TLS_GOT 27
4262#define R_LARCH_SOP_PUSH_TLS_GD 28
4263#define R_LARCH_SOP_PUSH_PLT_PCREL 29
4264#define R_LARCH_SOP_ASSERT 30
4265#define R_LARCH_SOP_NOT 31
4266#define R_LARCH_SOP_SUB 32
4267#define R_LARCH_SOP_SL 33
4268#define R_LARCH_SOP_SR 34
4269#define R_LARCH_SOP_ADD 35
4270#define R_LARCH_SOP_AND 36
4271#define R_LARCH_SOP_IF_ELSE 37
4272#define R_LARCH_SOP_POP_32_S_10_5 38
4273#define R_LARCH_SOP_POP_32_U_10_12 39
4274#define R_LARCH_SOP_POP_32_S_10_12 40
4275#define R_LARCH_SOP_POP_32_S_10_16 41
4276#define R_LARCH_SOP_POP_32_S_10_16_S2 42
4277#define R_LARCH_SOP_POP_32_S_5_20 43
4278#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
4279#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
4280#define R_LARCH_SOP_POP_32_U 46
4281
4282/* used by the static linker for relocating non .text. */
4283#define R_LARCH_ADD8 47
4284#define R_LARCH_ADD16 48
4285#define R_LARCH_ADD24 49
4286#define R_LARCH_ADD32 50
4287#define R_LARCH_ADD64 51
4288#define R_LARCH_SUB8 52
4289#define R_LARCH_SUB16 53
4290#define R_LARCH_SUB24 54
4291#define R_LARCH_SUB32 55
4292#define R_LARCH_SUB64 56
4293#define R_LARCH_GNU_VTINHERIT 57
4294#define R_LARCH_GNU_VTENTRY 58
4295
4296/* reserved 59-63 */
4297
4298#define R_LARCH_B16 64
4299#define R_LARCH_B21 65
4300#define R_LARCH_B26 66
4301#define R_LARCH_ABS_HI20 67
4302#define R_LARCH_ABS_LO12 68
4303#define R_LARCH_ABS64_LO20 69
4304#define R_LARCH_ABS64_HI12 70
4305#define R_LARCH_PCALA_HI20 71
4306#define R_LARCH_PCALA_LO12 72
4307#define R_LARCH_PCALA64_LO20 73
4308#define R_LARCH_PCALA64_HI12 74
4309#define R_LARCH_GOT_PC_HI20 75
4310#define R_LARCH_GOT_PC_LO12 76
4311#define R_LARCH_GOT64_PC_LO20 77
4312#define R_LARCH_GOT64_PC_HI12 78
4313#define R_LARCH_GOT_HI20 79
4314#define R_LARCH_GOT_LO12 80
4315#define R_LARCH_GOT64_LO20 81
4316#define R_LARCH_GOT64_HI12 82
4317#define R_LARCH_TLS_LE_HI20 83
4318#define R_LARCH_TLS_LE_LO12 84
4319#define R_LARCH_TLS_LE64_LO20 85
4320#define R_LARCH_TLS_LE64_HI12 86
4321#define R_LARCH_TLS_IE_PC_HI20 87
4322#define R_LARCH_TLS_IE_PC_LO12 88
4323#define R_LARCH_TLS_IE64_PC_LO20 89
4324#define R_LARCH_TLS_IE64_PC_HI12 90
4325#define R_LARCH_TLS_IE_HI20 91
4326#define R_LARCH_TLS_IE_LO12 92
4327#define R_LARCH_TLS_IE64_LO20 93
4328#define R_LARCH_TLS_IE64_HI12 94
4329#define R_LARCH_TLS_LD_PC_HI20 95
4330#define R_LARCH_TLS_LD_HI20 96
4331#define R_LARCH_TLS_GD_PC_HI20 97
4332#define R_LARCH_TLS_GD_HI20 98
4333#define R_LARCH_32_PCREL 99
4334#define R_LARCH_RELAX 100
4335#define R_LARCH_DELETE 101
4336#define R_LARCH_ALIGN 102
4337#define R_LARCH_PCREL20_S2 103
4338#define R_LARCH_CFA 104
4339#define R_LARCH_ADD6 105
4340#define R_LARCH_SUB6 106
4341#define R_LARCH_ADD_ULEB128 107
4342#define R_LARCH_SUB_ULEB128 108
4343#define R_LARCH_64_PCREL 109
4344#define R_LARCH_CALL36 110
4345#define R_LARCH_TLS_DESC_PC_HI20 111
4346#define R_LARCH_TLS_DESC_PC_LO12 112
4347#define R_LARCH_TLS_DESC64_PC_LO20 113
4348#define R_LARCH_TLS_DESC64_PC_HI12 114
4349#define R_LARCH_TLS_DESC_HI20 115
4350#define R_LARCH_TLS_DESC_LO12 116
4351#define R_LARCH_TLS_DESC64_LO20 117
4352#define R_LARCH_TLS_DESC64_HI12 118
4353#define R_LARCH_TLS_DESC_LD 119
4354#define R_LARCH_TLS_DESC_CALL 120
4355#define R_LARCH_TLS_LE_HI20_R 121
4356#define R_LARCH_TLS_LE_ADD_R 122
4357#define R_LARCH_TLS_LE_LO12_R 123
4358#define R_LARCH_TLS_LD_PCREL20_S2 124
4359#define R_LARCH_TLS_GD_PCREL20_S2 125
4360#define R_LARCH_TLS_DESC_PCREL20_S2 126
4361
4362/* ARC specific declarations. */
4363
4364/* Processor specific flags for the Ehdr e_flags field. */
4365#define EF_ARC_MACH_MSK 0x000000ff
4366#define EF_ARC_OSABI_MSK 0x00000f00
4367#define EF_ARC_ALL_MSK (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
4368
4369/* Processor specific values for the Shdr sh_type field. */
4370#define SHT_ARC_ATTRIBUTES (SHT_LOPROC + 1) /* ARC attributes section. */
4371
4372/* ARCompact/ARCv2 specific relocs. */
4373#define R_ARC_NONE 0x0
4374#define R_ARC_8 0x1
4375#define R_ARC_16 0x2
4376#define R_ARC_24 0x3
4377#define R_ARC_32 0x4
4378
4379#define R_ARC_B22_PCREL 0x6
4380#define R_ARC_H30 0x7
4381#define R_ARC_N8 0x8
4382#define R_ARC_N16 0x9
4383#define R_ARC_N24 0xA
4384#define R_ARC_N32 0xB
4385#define R_ARC_SDA 0xC
4386#define R_ARC_SECTOFF 0xD
4387#define R_ARC_S21H_PCREL 0xE
4388#define R_ARC_S21W_PCREL 0xF
4389#define R_ARC_S25H_PCREL 0x10
4390#define R_ARC_S25W_PCREL 0x11
4391#define R_ARC_SDA32 0x12
4392#define R_ARC_SDA_LDST 0x13
4393#define R_ARC_SDA_LDST1 0x14
4394#define R_ARC_SDA_LDST2 0x15
4395#define R_ARC_SDA16_LD 0x16
4396#define R_ARC_SDA16_LD1 0x17
4397#define R_ARC_SDA16_LD2 0x18
4398#define R_ARC_S13_PCREL 0x19
4399#define R_ARC_W 0x1A
4400#define R_ARC_32_ME 0x1B
4401#define R_ARC_N32_ME 0x1C
4402#define R_ARC_SECTOFF_ME 0x1D
4403#define R_ARC_SDA32_ME 0x1E
4404#define R_ARC_W_ME 0x1F
4405#define R_ARC_H30_ME 0x20
4406#define R_ARC_SECTOFF_U8 0x21
4407#define R_ARC_SECTOFF_S9 0x22
4408#define R_AC_SECTOFF_U8 0x23
4409#define R_AC_SECTOFF_U8_1 0x24
4410#define R_AC_SECTOFF_U8_2 0x25
4411#define R_AC_SECTOFF_S9 0x26
4412#define R_AC_SECTOFF_S9_1 0x27
4413#define R_AC_SECTOFF_S9_2 0x28
4414#define R_ARC_SECTOFF_ME_1 0x29
4415#define R_ARC_SECTOFF_ME_2 0x2A
4416#define R_ARC_SECTOFF_1 0x2B
4417#define R_ARC_SECTOFF_2 0x2C
4418#define R_ARC_SDA_12 0x2D
4419#define R_ARC_SDA16_ST2 0x30
4420#define R_ARC_32_PCREL 0x31
4421#define R_ARC_PC32 0x32
4422#define R_ARC_GOTPC32 0x33
4423#define R_ARC_PLT32 0x34
4424#define R_ARC_COPY 0x35
4425#define R_ARC_GLOB_DAT 0x36
4426#define R_ARC_JMP_SLOT 0x37
4427#define R_ARC_RELATIVE 0x38
4428#define R_ARC_GOTOFF 0x39
4429#define R_ARC_GOTPC 0x3A
4430#define R_ARC_GOT32 0x3B
4431#define R_ARC_S21W_PCREL_PLT 0x3C
4432#define R_ARC_S25H_PCREL_PLT 0x3D
4433
4434#define R_ARC_JLI_SECTOFF 0x3F
4435
4436#define R_ARC_TLS_DTPMOD 0x42
4437#define R_ARC_TLS_DTPOFF 0x43
4438#define R_ARC_TLS_TPOFF 0x44
4439#define R_ARC_TLS_GD_GOT 0x45
4440#define R_ARC_TLS_GD_LD 0x46
4441#define R_ARC_TLS_GD_CALL 0x47
4442#define R_ARC_TLS_IE_GOT 0x48
4443#define R_ARC_TLS_DTPOFF_S9 0x49
4444#define R_ARC_TLS_LE_S9 0x4A
4445#define R_ARC_TLS_LE_32 0x4B
4446#define R_ARC_S25W_PCREL_PLT 0x4C
4447#define R_ARC_S21H_PCREL_PLT 0x4D
4448#define R_ARC_NPS_CMEM16 0x4E
4449
4450/* OpenRISC 1000 specific relocs. */
4451#define R_OR1K_NONE 0
4452#define R_OR1K_32 1
4453#define R_OR1K_16 2
4454#define R_OR1K_8 3
4455#define R_OR1K_LO_16_IN_INSN 4
4456#define R_OR1K_HI_16_IN_INSN 5
4457#define R_OR1K_INSN_REL_26 6
4458#define R_OR1K_GNU_VTENTRY 7
4459#define R_OR1K_GNU_VTINHERIT 8
4460#define R_OR1K_32_PCREL 9
4461#define R_OR1K_16_PCREL 10
4462#define R_OR1K_8_PCREL 11
4463#define R_OR1K_GOTPC_HI16 12
4464#define R_OR1K_GOTPC_LO16 13
4465#define R_OR1K_GOT16 14
4466#define R_OR1K_PLT26 15
4467#define R_OR1K_GOTOFF_HI16 16
4468#define R_OR1K_GOTOFF_LO16 17
4469#define R_OR1K_COPY 18
4470#define R_OR1K_GLOB_DAT 19
4471#define R_OR1K_JMP_SLOT 20
4472#define R_OR1K_RELATIVE 21
4473#define R_OR1K_TLS_GD_HI16 22
4474#define R_OR1K_TLS_GD_LO16 23
4475#define R_OR1K_TLS_LDM_HI16 24
4476#define R_OR1K_TLS_LDM_LO16 25
4477#define R_OR1K_TLS_LDO_HI16 26
4478#define R_OR1K_TLS_LDO_LO16 27
4479#define R_OR1K_TLS_IE_HI16 28
4480#define R_OR1K_TLS_IE_LO16 29
4481#define R_OR1K_TLS_LE_HI16 30
4482#define R_OR1K_TLS_LE_LO16 31
4483#define R_OR1K_TLS_TPOFF 32
4484#define R_OR1K_TLS_DTPOFF 33
4485#define R_OR1K_TLS_DTPMOD 34
4486
4487#endif /* elf.h */
lib/libc/glibc/include/alloca.h deleted-40
......@@ -1,40 +0,0 @@
1#ifndef _ALLOCA_H
2
3#include <stdlib/alloca.h>
4
5# ifndef _ISOMAC
6
7#include <elf.h>
8
9#undef __alloca
10
11/* Now define the internal interfaces. */
12extern void *__alloca (size_t __size);
13
14#ifdef __GNUC__
15# define __alloca(size) __builtin_alloca (size)
16#endif /* GCC. */
17
18extern int __libc_use_alloca (size_t size) __attribute__ ((const));
19extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
20libc_hidden_proto (__libc_alloca_cutoff)
21
22#define __MAX_ALLOCA_CUTOFF 65536
23
24#include <allocalim.h>
25
26#if defined stackinfo_get_sp && defined stackinfo_sub_sp
27# define alloca_account(size, avar) \
28 ({ void *old__ = stackinfo_get_sp (); \
29 void *m__ = __alloca (size); \
30 avar += stackinfo_sub_sp (old__); \
31 m__; })
32#else
33# define alloca_account(size, avar) \
34 ({ size_t s__ = (size); \
35 avar += s__; \
36 __alloca (s__); })
37#endif
38
39# endif /* !_ISOMAC */
40#endif
lib/libc/glibc/include/bits/cpu-set.h deleted-9
......@@ -1,9 +0,0 @@
1#ifndef _BITS_CPU_SET_H
2#include <posix/bits/cpu-set.h>
3
4#ifndef _ISOMAC
5int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp);
6libc_hidden_proto (__sched_cpucount)
7#endif
8
9#endif /* _BITS_CPU_SET_H */
lib/libc/glibc/include/bits/stdlib-float.h deleted-8
......@@ -1,8 +0,0 @@
1/* No floating-point inline functions in rtld and for the conform tests. */
2#ifdef _ISOMAC
3# include <stdlib/bits/stdlib-float.h>
4#else
5# if !IS_IN (rtld)
6# include <stdlib/bits/stdlib-float.h>
7# endif
8#endif
lib/libc/glibc/include/bits/types/__locale_t.h deleted-1
......@@ -1 +0,0 @@
1#include <locale/bits/types/__locale_t.h>
lib/libc/glibc/include/bits/types/locale_t.h deleted-1
......@@ -1 +0,0 @@
1#include <locale/bits/types/locale_t.h>
lib/libc/glibc/include/bits/types/sig_atomic_t.h deleted-1
......@@ -1 +0,0 @@
1#include <signal/bits/types/sig_atomic_t.h>
lib/libc/glibc/include/bits/types/struct_itimerspec.h deleted-1
......@@ -1 +0,0 @@
1#include <time/bits/types/struct_itimerspec.h>
lib/libc/glibc/include/bits/types/struct_tm.h deleted-1
......@@ -1 +0,0 @@
1#include <time/bits/types/struct_tm.h>
lib/libc/glibc/include/dso_handle.h deleted-3
......@@ -1,3 +0,0 @@
1/* __dso_handle is always defined by either crtbegin.o from GCC or our
2 dso_handle.c. */
3extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
lib/libc/glibc/include/elf.h deleted-42
......@@ -1,42 +0,0 @@
1#ifndef _ELF_H
2#include <elf/elf.h>
3
4#ifndef _ISOMAC
5
6# include <libc-pointer-arith.h>
7
8/* Compute the offset of the note descriptor from size of note entry's
9 owner string and note alignment. */
10# define ELF_NOTE_DESC_OFFSET(namesz, align) \
11 ALIGN_UP (sizeof (ElfW(Nhdr)) + (namesz), (align))
12
13/* Compute the offset of the next note entry from size of note entry's
14 owner string, size of the note descriptor and note alignment. */
15# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
16 ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))
17
18# ifdef HIDDEN_VAR_NEEDS_DYNAMIC_RELOC
19# define DL_ADDRESS_WITHOUT_RELOC(expr) (expr)
20# else
21/* Evaluate EXPR without run-time relocation for it. EXPR should be an
22 array, an address of an object, or a string literal. */
23# define DL_ADDRESS_WITHOUT_RELOC(expr) \
24 ({ \
25 __auto_type _result = (expr); \
26 asm ("" : "+r" (_result)); \
27 _result; \
28 })
29# endif
30
31/* Some information which is not meant for the public and therefore not
32 in <elf.h>. */
33# include <dl-dtprocnum.h>
34# ifdef DT_1_SUPPORTED_MASK
35# error DT_1_SUPPORTED_MASK is defined!
36# endif
37# define DT_1_SUPPORTED_MASK \
38 (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
39 | DF_1_ORIGIN | DF_1_NODEFLIB | DF_1_PIE)
40
41#endif /* !_ISOMAC */
42#endif /* elf.h */
lib/libc/glibc/include/libc-pointer-arith.h deleted-71
......@@ -1,71 +0,0 @@
1/* Helper macros for pointer arithmetic.
2 Copyright (C) 2012-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LIBC_POINTER_ARITH_H
20#define _LIBC_POINTER_ARITH_H 1
21
22#include <stdint.h>
23
24/* 1 if 'type' is a pointer type, 0 otherwise. */
25# define __pointer_type(type) (__builtin_classify_type ((type) 0) == 5)
26
27/* intptr_t if P is true, or T if P is false. */
28# define __integer_if_pointer_type_sub(T, P) \
29 __typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
30 : (__typeof__ (0 ? (intptr_t *) 0 : (void *) (!(P)))) 0))
31
32/* intptr_t if EXPR has a pointer type, or the type of EXPR otherwise. */
33# define __integer_if_pointer_type(expr) \
34 __integer_if_pointer_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
35 __pointer_type (__typeof__ (expr)))
36
37/* Cast an integer or a pointer VAL to integer with proper type. */
38# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
39
40/* Cast an integer VAL to void * pointer. */
41# define cast_to_pointer(val) ((void *) (uintptr_t) (val))
42
43/* Align a value by rounding down to closest size.
44 e.g. Using size of 4096, we get this behavior:
45 {4095, 4096, 4097} = {0, 4096, 4096}. */
46#define ALIGN_DOWN(base, size) ((base) & -((__typeof__ (base)) (size)))
47
48/* Align a value by rounding up to closest size.
49 e.g. Using size of 4096, we get this behavior:
50 {4095, 4096, 4097} = {4096, 4096, 8192}.
51
52 Note: The size argument has side effects (expanded multiple times). */
53#define ALIGN_UP(base, size) ALIGN_DOWN ((base) + (size) - 1, (size))
54
55/* Same as ALIGN_DOWN(), but automatically casts when base is a pointer. */
56#define PTR_ALIGN_DOWN(base, size) \
57 ((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size)))
58
59/* Same as ALIGN_UP(), but automatically casts when base is a pointer. */
60#define PTR_ALIGN_UP(base, size) \
61 ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
62
63/* Check if BASE is aligned on SIZE */
64#define PTR_IS_ALIGNED(base, size) \
65 ((((uintptr_t) (base)) & (size - 1)) == 0)
66
67/* Returns the ptrdiff_t difference between P1 and P2. */
68#define PTR_DIFF(p1, p2) \
69 ((ptrdiff_t)((uintptr_t)(p1) - (uintptr_t)(p2)))
70
71#endif
lib/libc/glibc/include/pthread.h deleted-23
......@@ -1,23 +0,0 @@
1#include_next <pthread.h>
2
3#ifndef _ISOMAC
4/* Prototypes repeated instead of using __typeof because pthread.h is
5 included in C++ tests, and declaring functions with __typeof and
6 __THROW doesn't work for C++. */
7extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
8 const pthread_barrierattr_t *__restrict
9 __attr, unsigned int __count)
10 __THROW __nonnull ((1));
11libc_hidden_proto (__pthread_barrier_init)
12extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
13 __THROWNL __nonnull ((1));
14libc_hidden_proto (__pthread_barrier_wait)
15
16/* This function is called to initialize the pthread library. */
17extern void __pthread_initialize (void) __attribute__ ((weak));
18
19extern int __pthread_kill (pthread_t threadid, int signo);
20
21extern pthread_t __pthread_self (void);
22
23#endif
lib/libc/glibc/include/signal.h deleted-74
......@@ -1,74 +0,0 @@
1#ifndef _SIGNAL_H
2# include <signal/signal.h>
3
4# ifndef _ISOMAC
5# include <sigsetops.h>
6
7libc_hidden_proto (sigemptyset)
8libc_hidden_proto (sigfillset)
9libc_hidden_proto (sigaddset)
10libc_hidden_proto (sigdelset)
11libc_hidden_proto (sigismember)
12extern int __sigpause (int sig_or_mask, int is_sig);
13libc_hidden_proto (__sigpause)
14libc_hidden_proto (raise)
15libc_hidden_proto (__libc_current_sigrtmin)
16libc_hidden_proto (__libc_current_sigrtmax)
17extern const char * const __sys_siglist[_NSIG] attribute_hidden;
18extern const char * const __sys_sigabbrev[_NSIG] attribute_hidden;
19
20/* Now define the internal interfaces. */
21extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
22extern int __kill (__pid_t __pid, int __sig);
23libc_hidden_proto (__kill)
24extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
25 struct sigaction *__restrict __oact);
26libc_hidden_proto (__sigaction)
27extern int __sigblock (int __mask);
28libc_hidden_proto (__sigblock)
29extern int __sigsetmask (int __mask);
30extern int __sigprocmask (int __how,
31 const sigset_t *__set, sigset_t *__oset);
32libc_hidden_proto (__sigprocmask)
33extern int __sigsuspend (const sigset_t *__set);
34libc_hidden_proto (__sigsuspend)
35extern int __sigwait (const sigset_t *__set, int *__sig);
36libc_hidden_proto (__sigwait)
37extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);
38libc_hidden_proto (__sigwaitinfo)
39#if __TIMESIZE == 64
40# define __sigtimedwait64 __sigtimedwait
41#else
42# include <struct___timespec64.h>
43extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info,
44 const struct __timespec64 *__timeout);
45libc_hidden_proto (__sigtimedwait64)
46#endif
47extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info,
48 const struct timespec *__timeout);
49libc_hidden_proto (__sigtimedwait)
50extern int __sigqueue (__pid_t __pid, int __sig,
51 const union sigval __val);
52#ifdef __USE_MISC
53extern int __sigreturn (struct sigcontext *__scp);
54#endif
55extern int __sigaltstack (const stack_t *__ss,
56 stack_t *__oss);
57libc_hidden_proto (__sigaltstack)
58extern int __libc_sigaction (int sig, const struct sigaction *act,
59 struct sigaction *oact);
60libc_hidden_proto (__libc_sigaction)
61
62extern int __default_sigpause (int mask);
63extern int __xpg_sigpause (int sig);
64
65/* Allocate real-time signal with highest/lowest available priority. */
66extern int __libc_allocate_rtsig (int __high);
67
68# if IS_IN (rtld)
69extern __typeof (__sigaction) __sigaction attribute_hidden;
70extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
71# endif
72
73# endif /* _ISOMAC */
74#endif /* signal.h */
lib/libc/glibc/include/stap-probe.h deleted-78
......@@ -1,78 +0,0 @@
1/* Macros for defining Systemtap <sys/sdt.h> static probe points.
2 Copyright (C) 2012-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _STAP_PROBE_H
20#define _STAP_PROBE_H 1
21
22#ifdef USE_STAP_PROBE
23
24# include <stap-probe-machine.h>
25# include <sys/sdt.h>
26
27/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
28
29 Without USE_STAP_PROBE, that does nothing but evaluates all
30 its arguments (to prevent bit rot, unlike e.g. assert).
31
32 Systemtap's header defines the macros STAP_PROBE (provider, name) and
33 STAP_PROBEn (provider, name, arg1, ..., argn). For "provider" we paste
34 in MODULE_NAME (libc, libpthread, etc.) automagically.
35
36 The format of the arg parameters is discussed here:
37
38 https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
39
40 The precise details of how register names are specified is
41 architecture specific and can be found in the gdb and SystemTap
42 source code. */
43
44# define LIBC_PROBE(name, n, ...) \
45 LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
46
47# define LIBC_PROBE_1(lib, name, n, ...) \
48 STAP_PROBE##n (lib, name, ## __VA_ARGS__)
49
50# define STAP_PROBE0 STAP_PROBE
51
52# define LIBC_PROBE_ASM(name, template) \
53 STAP_PROBE_ASM (MODULE_NAME, name, template)
54
55# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
56
57#else /* Not USE_STAP_PROBE. */
58
59# ifndef __ASSEMBLER__
60/* Evaluate all the arguments and verify that N matches their number. */
61# define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__)
62
63# define STAP_PROBE0() do {} while (0)
64# define STAP_PROBE1(a1) do {} while (0)
65# define STAP_PROBE2(a1, a2) do {} while (0)
66# define STAP_PROBE3(a1, a2, a3) do {} while (0)
67# define STAP_PROBE4(a1, a2, a3, a4) do {} while (0)
68
69# else
70# define LIBC_PROBE(name, n, ...) /* Nothing. */
71# endif
72
73# define LIBC_PROBE_ASM(name, template) /* Nothing. */
74# define LIBC_PROBE_ASM_OPERANDS(n, ...) /* Nothing. */
75
76#endif /* USE_STAP_PROBE. */
77
78#endif /* stap-probe.h */
lib/libc/glibc/include/stdlib.h deleted-393
......@@ -1,393 +0,0 @@
1#ifndef _STDLIB_H
2
3#ifndef _ISOMAC
4# include <stdbool.h>
5# include <stddef.h>
6#endif
7
8/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
9#include <bits/floatn.h>
10#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
11# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
12# pragma GCC system_header
13# endif
14#endif
15
16#include <stdlib/stdlib.h>
17
18/* Now define the internal interfaces. */
19#if !defined _ISOMAC
20# include <sys/stat.h>
21
22# include <rtld-malloc.h>
23# include <internal-sigset.h>
24
25extern __typeof (strtol_l) __strtol_l;
26extern __typeof (strtoul_l) __strtoul_l;
27extern __typeof (strtoll_l) __strtoll_l;
28extern __typeof (strtoull_l) __strtoull_l;
29extern __typeof (strtod_l) __strtod_l;
30extern __typeof (strtof_l) __strtof_l;
31extern __typeof (strtold_l) __strtold_l;
32libc_hidden_proto (__strtol_l)
33libc_hidden_proto (__strtoul_l)
34libc_hidden_proto (__strtoll_l)
35libc_hidden_proto (__strtoull_l)
36libc_hidden_proto (__strtod_l)
37libc_hidden_proto (__strtof_l)
38libc_hidden_proto (__strtold_l)
39
40extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
41extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
42extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
43extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
44extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
45extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
46extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
47extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
48libc_hidden_proto (__isoc23_strtol)
49libc_hidden_proto (__isoc23_strtoul)
50libc_hidden_proto (__isoc23_strtoll)
51libc_hidden_proto (__isoc23_strtoull)
52libc_hidden_proto (__isoc23_strtol_l)
53libc_hidden_proto (__isoc23_strtoul_l)
54libc_hidden_proto (__isoc23_strtoll_l)
55libc_hidden_proto (__isoc23_strtoull_l)
56
57#if __GLIBC_USE (C23_STRTOL)
58/* Redirect internal uses of these functions to the C23 versions; the
59 redirection in the installed header does not work with
60 libc_hidden_proto. */
61# undef strtol
62# define strtol __isoc23_strtol
63# undef atoi
64# define atoi(nptr) __isoc23_strtol(nptr, NULL, 10)
65# undef strtoul
66# define strtoul __isoc23_strtoul
67# undef strtoll
68# define strtoll __isoc23_strtoll
69# undef strtoull
70# define strtoull __isoc23_strtoull
71# undef strtol_l
72# define strtol_l __isoc23_strtol_l
73# undef strtoul_l
74# define strtoul_l __isoc23_strtoul_l
75# undef strtoll_l
76# define strtoll_l __isoc23_strtoll_l
77# undef strtoull_l
78# define strtoull_l __isoc23_strtoull_l
79#endif
80
81extern void __abort_fork_reset_child (void) attribute_hidden;
82extern void __abort_lock_rdlock (internal_sigset_t *set) attribute_hidden;
83extern void __abort_lock_wrlock (internal_sigset_t *set) attribute_hidden;
84extern void __abort_lock_unlock (const internal_sigset_t *set)
85 attribute_hidden;
86
87libc_hidden_proto (exit)
88libc_hidden_proto (abort)
89libc_hidden_proto (getenv)
90extern __typeof (secure_getenv) __libc_secure_getenv;
91libc_hidden_proto (__libc_secure_getenv)
92libc_hidden_proto (bsearch)
93libc_hidden_proto (qsort)
94extern __typeof (qsort_r) __qsort_r;
95libc_hidden_proto (__qsort_r)
96libc_hidden_proto (lrand48_r)
97libc_hidden_proto (wctomb)
98
99extern long int __random (void) attribute_hidden;
100extern void __srandom (unsigned int __seed);
101extern char *__initstate (unsigned int __seed, char *__statebuf,
102 size_t __statelen);
103extern char *__setstate (char *__statebuf);
104extern int __random_r (struct random_data *__buf, int32_t *__result)
105 attribute_hidden;
106extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
107 attribute_hidden;
108extern int __initstate_r (unsigned int __seed, char *__statebuf,
109 size_t __statelen, struct random_data *__buf)
110 attribute_hidden;
111extern int __setstate_r (char *__statebuf, struct random_data *__buf)
112 attribute_hidden;
113extern int __rand_r (unsigned int *__seed);
114extern int __erand48_r (unsigned short int __xsubi[3],
115 struct drand48_data *__buffer, double *__result)
116 attribute_hidden;
117extern int __nrand48_r (unsigned short int __xsubi[3],
118 struct drand48_data *__buffer,
119 long int *__result) attribute_hidden;
120extern int __jrand48_r (unsigned short int __xsubi[3],
121 struct drand48_data *__buffer,
122 long int *__result) attribute_hidden;
123extern int __srand48_r (long int __seedval,
124 struct drand48_data *__buffer) attribute_hidden;
125extern int __seed48_r (unsigned short int __seed16v[3],
126 struct drand48_data *__buffer) attribute_hidden;
127extern int __lcong48_r (unsigned short int __param[7],
128 struct drand48_data *__buffer) attribute_hidden;
129
130/* Internal function to compute next state of the generator. */
131extern int __drand48_iterate (unsigned short int __xsubi[3],
132 struct drand48_data *__buffer)
133 attribute_hidden;
134
135/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
136extern struct drand48_data __libc_drand48_data attribute_hidden;
137
138extern int __setenv (const char *__name, const char *__value, int __replace)
139 attribute_hidden;
140extern int __unsetenv (const char *__name) attribute_hidden;
141extern int __clearenv (void) attribute_hidden;
142extern char *__mktemp (char *__template) __THROW __nonnull ((1));
143libc_hidden_proto (__mktemp)
144extern char *__canonicalize_file_name (const char *__name);
145extern char *__realpath (const char *__name, char *__resolved);
146libc_hidden_proto (__realpath)
147extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
148 attribute_hidden;
149# ifndef _ISOMAC
150extern int __ptsname_internal (int fd, char *buf, size_t buflen,
151 struct stat64 *stp) attribute_hidden;
152# endif
153extern int __getpt (void);
154extern int __posix_openpt (int __oflag) attribute_hidden;
155
156extern int __add_to_environ (const char *name, const char *value,
157 const char *combines, int replace)
158 attribute_hidden;
159
160extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
161
162extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
163libc_hidden_proto (__cxa_atexit);
164
165extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
166 void *d);
167extern void __call_tls_dtors (void);
168libc_hidden_proto (__call_tls_dtors)
169
170extern void __cxa_finalize (void *d);
171
172extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
173
174extern void *__libc_memalign (size_t alignment, size_t size)
175 __attribute_malloc__;
176
177extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
178 __THROW __attribute_warn_unused_result__;
179libc_hidden_proto (__libc_reallocarray)
180
181extern int __libc_system (const char *line);
182
183extern __typeof (getpt) __getpt;
184extern __typeof (ptsname_r) __ptsname_r;
185libc_hidden_proto (__getpt)
186libc_hidden_proto (__ptsname_r)
187libc_hidden_proto (grantpt)
188libc_hidden_proto (unlockpt)
189
190__typeof (arc4random) __arc4random;
191libc_hidden_proto (__arc4random);
192__typeof (arc4random_buf) __arc4random_buf;
193libc_hidden_proto (__arc4random_buf);
194__typeof (arc4random_uniform) __arc4random_uniform;
195libc_hidden_proto (__arc4random_uniform);
196extern void __arc4random_buf_internal (void *buffer, size_t len)
197 attribute_hidden;
198
199extern double __strtod_internal (const char *__restrict __nptr,
200 char **__restrict __endptr, int __group)
201 __THROW __nonnull ((1)) __wur;
202extern float __strtof_internal (const char *__restrict __nptr,
203 char **__restrict __endptr, int __group)
204 __THROW __nonnull ((1)) __wur;
205extern long double __strtold_internal (const char *__restrict __nptr,
206 char **__restrict __endptr,
207 int __group)
208 __THROW __nonnull ((1)) __wur;
209extern long int __strtol_internal (const char *__restrict __nptr,
210 char **__restrict __endptr,
211 int __base, int __group)
212 __THROW __nonnull ((1)) __wur;
213extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
214 char **__restrict __endptr,
215 int __base, int __group)
216 __THROW __nonnull ((1)) __wur;
217__extension__
218extern long long int __strtoll_internal (const char *__restrict __nptr,
219 char **__restrict __endptr,
220 int __base, int __group)
221 __THROW __nonnull ((1)) __wur;
222__extension__
223extern unsigned long long int __strtoull_internal (const char *
224 __restrict __nptr,
225 char **__restrict __endptr,
226 int __base, int __group)
227 __THROW __nonnull ((1)) __wur;
228libc_hidden_proto (__strtof_internal)
229libc_hidden_proto (__strtod_internal)
230libc_hidden_proto (__strtold_internal)
231libc_hidden_proto (__strtol_internal)
232libc_hidden_proto (__strtoll_internal)
233libc_hidden_proto (__strtoul_internal)
234libc_hidden_proto (__strtoull_internal)
235
236extern double ____strtod_l_internal (const char *__restrict __nptr,
237 char **__restrict __endptr, int __group,
238 locale_t __loc);
239extern float ____strtof_l_internal (const char *__restrict __nptr,
240 char **__restrict __endptr, int __group,
241 locale_t __loc);
242extern long double ____strtold_l_internal (const char *__restrict __nptr,
243 char **__restrict __endptr,
244 int __group, locale_t __loc);
245extern long int ____strtol_l_internal (const char *__restrict __nptr,
246 char **__restrict __endptr,
247 int __base, int __group,
248 bool __bin_cst, locale_t __loc);
249extern unsigned long int ____strtoul_l_internal (const char *
250 __restrict __nptr,
251 char **__restrict __endptr,
252 int __base, int __group,
253 bool __bin_cst,
254 locale_t __loc);
255__extension__
256extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
257 char **__restrict __endptr,
258 int __base, int __group,
259 bool __bin_cst, locale_t __loc);
260__extension__
261extern unsigned long long int ____strtoull_l_internal (const char *
262 __restrict __nptr,
263 char **
264 __restrict __endptr,
265 int __base, int __group,
266 bool __bin_cst,
267 locale_t __loc);
268
269libc_hidden_proto (____strtof_l_internal)
270libc_hidden_proto (____strtod_l_internal)
271libc_hidden_proto (____strtold_l_internal)
272libc_hidden_proto (____strtol_l_internal)
273libc_hidden_proto (____strtoll_l_internal)
274libc_hidden_proto (____strtoul_l_internal)
275libc_hidden_proto (____strtoull_l_internal)
276
277#include <bits/floatn.h>
278libc_hidden_proto (strtof)
279libc_hidden_proto (strtod)
280#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
281libc_hidden_proto (strtold)
282#endif
283libc_hidden_proto (strtol)
284libc_hidden_proto (strtoll)
285libc_hidden_proto (strtoul)
286libc_hidden_proto (strtoull)
287
288libc_hidden_proto (atoi)
289
290extern float __strtof_nan (const char *, char **, char);
291extern double __strtod_nan (const char *, char **, char);
292extern long double __strtold_nan (const char *, char **, char);
293extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
294extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
295extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
296
297libc_hidden_proto (__strtof_nan)
298libc_hidden_proto (__strtod_nan)
299libc_hidden_proto (__strtold_nan)
300libc_hidden_proto (__wcstof_nan)
301libc_hidden_proto (__wcstod_nan)
302libc_hidden_proto (__wcstold_nan)
303
304/* Enable _FloatN bits as needed. */
305#include <bits/floatn.h>
306
307#if __HAVE_DISTINCT_FLOAT128
308extern __typeof (strtof128_l) __strtof128_l;
309
310libc_hidden_proto (__strtof128_l)
311libc_hidden_proto (strtof128)
312
313extern _Float128 __strtof128_nan (const char *, char **, char);
314extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
315
316libc_hidden_proto (__strtof128_nan)
317libc_hidden_proto (__wcstof128_nan)
318
319extern _Float128 __strtof128_internal (const char *__restrict __nptr,
320 char **__restrict __endptr,
321 int __group);
322libc_hidden_proto (__strtof128_internal)
323
324extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
325 char **__restrict __endptr,
326 int __group, locale_t __loc);
327
328libc_hidden_proto (____strtof128_l_internal)
329#endif
330
331extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
332 int *__restrict __sign);
333extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
334 int *__restrict __sign);
335extern char *__gcvt (double __value, int __ndigit, char *__buf);
336extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
337 int *__restrict __sign, char *__restrict __buf,
338 size_t __len);
339libc_hidden_proto (__ecvt_r)
340extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
341 int *__restrict __sign, char *__restrict __buf,
342 size_t __len);
343libc_hidden_proto (__fcvt_r)
344extern char *__qecvt (long double __value, int __ndigit,
345 int *__restrict __decpt, int *__restrict __sign);
346extern char *__qfcvt (long double __value, int __ndigit,
347 int *__restrict __decpt, int *__restrict __sign);
348extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
349extern int __qecvt_r (long double __value, int __ndigit,
350 int *__restrict __decpt, int *__restrict __sign,
351 char *__restrict __buf, size_t __len);
352libc_hidden_proto (__qecvt_r)
353extern int __qfcvt_r (long double __value, int __ndigit,
354 int *__restrict __decpt, int *__restrict __sign,
355 char *__restrict __buf, size_t __len);
356libc_hidden_proto (__qfcvt_r)
357
358# if IS_IN (libc)
359# undef MB_CUR_MAX
360# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
361# endif
362
363struct abort_msg_s
364{
365 unsigned int size;
366 char msg[0];
367};
368extern struct abort_msg_s *__abort_msg;
369libc_hidden_proto (__abort_msg)
370
371enum readonly_error_type
372{
373 readonly_noerror,
374 readonly_area_writable,
375 readonly_procfs_inaccessible,
376 readonly_procfs_open_fail,
377};
378
379extern enum readonly_error_type __readonly_area (const void *ptr,
380 size_t size)
381 attribute_hidden;
382extern enum readonly_error_type __readonly_area_fallback (const void *ptr,
383 size_t size)
384 attribute_hidden;
385
386# if IS_IN (rtld)
387extern __typeof (unsetenv) unsetenv attribute_hidden;
388extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
389# endif
390
391#endif
392
393#endif /* include/stdlib.h */
lib/libc/glibc/include/struct___timeval64.h deleted-17
......@@ -1,17 +0,0 @@
1#ifndef _STRUCT_TIMEVAL64_H
2#define _STRUCT_TIMEVAL64_H
3
4#if __TIMESIZE == 64
5# define __timeval64 timeval
6#else
7/* The glibc Y2038-proof struct __timeval64 structure for a time value.
8 This structure is NOT supposed to be passed to the Linux kernel.
9 Instead, it shall be converted to struct __timespec64 and time shall
10 be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */
11struct __timeval64
12{
13 __time64_t tv_sec; /* Seconds */
14 __suseconds64_t tv_usec; /* Microseconds */
15};
16#endif
17#endif /* _STRUCT_TIMEVAL64_H */
lib/libc/glibc/include/sys/signal.h deleted-1
......@@ -1 +0,0 @@
1#include <signal/sys/signal.h>
lib/libc/glibc/include/syscall.h deleted-1
......@@ -1 +0,0 @@
1#include <misc/syscall.h>
lib/libc/glibc/io/fcntl.h deleted-354
......@@ -1,354 +0,0 @@
1/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/*
19 * POSIX Standard: 6.5 File Control Operations <fcntl.h>
20 */
21
22#ifndef _FCNTL_H
23#define _FCNTL_H 1
24
25#include <features.h>
26
27/* This must be early so <bits/fcntl.h> can define types winningly. */
28__BEGIN_DECLS
29
30/* Get __mode_t, __dev_t and __off_t .*/
31#include <bits/types.h>
32
33/* Get the definitions of O_*, F_*, FD_*: all the
34 numbers and flag bits for `open', `fcntl', et al. */
35#include <bits/fcntl.h>
36
37/* Detect if open needs mode as a third argument (or for openat as a fourth
38 argument). */
39#ifdef __O_TMPFILE
40# define __OPEN_NEEDS_MODE(oflag) \
41 (((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
42#else
43# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
44#endif
45
46/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
47 Earlier POSIX standards permitted any type ending in `_t' to be defined
48 by any POSIX header, so we don't conditionalize the definitions here. */
49#ifndef __mode_t_defined
50typedef __mode_t mode_t;
51# define __mode_t_defined
52#endif
53
54#ifndef __off_t_defined
55# ifndef __USE_FILE_OFFSET64
56typedef __off_t off_t;
57# else
58typedef __off64_t off_t;
59# endif
60# define __off_t_defined
61#endif
62
63#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
64typedef __off64_t off64_t;
65# define __off64_t_defined
66#endif
67
68#ifndef __pid_t_defined
69typedef __pid_t pid_t;
70# define __pid_t_defined
71#endif
72
73/* For XPG all symbols from <sys/stat.h> should also be available. */
74#ifdef __USE_XOPEN2K8
75# include <bits/types/struct_timespec.h>
76#endif
77#if defined __USE_XOPEN || defined __USE_XOPEN2K8
78# include <bits/stat.h>
79
80# define S_IFMT __S_IFMT
81# define S_IFDIR __S_IFDIR
82# define S_IFCHR __S_IFCHR
83# define S_IFBLK __S_IFBLK
84# define S_IFREG __S_IFREG
85# ifdef __S_IFIFO
86# define S_IFIFO __S_IFIFO
87# endif
88# ifdef __S_IFLNK
89# define S_IFLNK __S_IFLNK
90# endif
91# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
92# define S_IFSOCK __S_IFSOCK
93# endif
94
95/* Protection bits. */
96
97# define S_ISUID __S_ISUID /* Set user ID on execution. */
98# define S_ISGID __S_ISGID /* Set group ID on execution. */
99
100# if defined __USE_MISC || defined __USE_XOPEN
101/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
102# define S_ISVTX __S_ISVTX
103# endif
104
105# define S_IRUSR __S_IREAD /* Read by owner. */
106# define S_IWUSR __S_IWRITE /* Write by owner. */
107# define S_IXUSR __S_IEXEC /* Execute by owner. */
108/* Read, write, and execute by owner. */
109# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
110
111# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
112# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
113# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
114/* Read, write, and execute by group. */
115# define S_IRWXG (S_IRWXU >> 3)
116
117# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
118# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
119# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
120/* Read, write, and execute by others. */
121# define S_IRWXO (S_IRWXG >> 3)
122#endif
123
124#ifdef __USE_MISC
125# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
126/* Values for the second argument to access.
127 These may be OR'd together. */
128# define R_OK 4 /* Test for read permission. */
129# define W_OK 2 /* Test for write permission. */
130# define X_OK 1 /* Test for execute permission. */
131# define F_OK 0 /* Test for existence. */
132# endif
133#endif /* Use misc. */
134
135/* XPG wants the following symbols. <stdio.h> has the same definitions. */
136#if defined __USE_XOPEN || defined __USE_XOPEN2K8
137# define SEEK_SET 0 /* Seek from beginning of file. */
138# define SEEK_CUR 1 /* Seek from current position. */
139# define SEEK_END 2 /* Seek from end of file. */
140#endif /* XPG */
141
142/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS
143 is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
144 unlinkat. The two functions do completely different things and therefore,
145 the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
146 faccessat would be undefined behavior and thus treating it equivalent to
147 AT_EACCESS is valid undefined behavior. */
148#ifdef __USE_ATFILE
149# define AT_FDCWD -100 /* Special value used to indicate
150 the *at functions should use the
151 current working directory. */
152# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
153# define AT_REMOVEDIR 0x200 /* Remove directory instead of
154 unlinking file. */
155# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
156# ifdef __USE_GNU
157# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
158 traversal. */
159# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
160# define AT_STATX_SYNC_TYPE 0x6000
161# define AT_STATX_SYNC_AS_STAT 0x0000
162# define AT_STATX_FORCE_SYNC 0x2000
163# define AT_STATX_DONT_SYNC 0x4000
164# define AT_RECURSIVE 0x8000 /* Apply to the entire subtree. */
165# endif
166# define AT_EACCESS 0x200 /* Test access permitted for
167 effective IDs, not real IDs. */
168#endif
169
170
171/* zig patch: fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards
172 * re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */
173#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
174/* Do the file control operation described by CMD on FD.
175 The remaining arguments are interpreted depending on CMD.
176
177 This function is a cancellation point and therefore not marked with
178 __THROW. */
179#ifndef __USE_TIME64_REDIRECTS
180# ifndef __USE_FILE_OFFSET64
181extern int fcntl (int __fd, int __cmd, ...);
182# else
183# ifdef __REDIRECT
184extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
185# else
186# define fcntl fcntl64
187# endif
188# endif
189# ifdef __USE_LARGEFILE64
190extern int fcntl64 (int __fd, int __cmd, ...);
191# endif
192#else /* __USE_TIME64_REDIRECTS */
193# ifdef __REDIRECT
194extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
195 __fcntl_time64);
196extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
197 __fcntl_time64);
198# else
199extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
200# define fcntl64 __fcntl_time64
201# define fcntl __fcntl_time64
202# endif
203#endif
204#else /* glibc 2.27 or lower */
205extern int fcntl (int __fd, int __cmd, ...);
206#endif
207
208/* Open FILE and return a new file descriptor for it, or -1 on error.
209 OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set
210 in OFLAG, the third argument is taken as a `mode_t', the mode of the
211 created file.
212
213 This function is a cancellation point and therefore not marked with
214 __THROW. */
215#ifndef __USE_FILE_OFFSET64
216extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
217#else
218# ifdef __REDIRECT
219extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
220 __nonnull ((1));
221# else
222# define open open64
223# endif
224#endif
225#ifdef __USE_LARGEFILE64
226extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
227#endif
228
229#ifdef __USE_ATFILE
230/* Similar to `open' but a relative path name is interpreted relative to
231 the directory for which FD is a descriptor.
232
233 NOTE: some other `openat' implementation support additional functionality
234 through this interface, especially using the O_XATTR flag. This is not
235 yet supported here.
236
237 This function is a cancellation point and therefore not marked with
238 __THROW. */
239# ifndef __USE_FILE_OFFSET64
240extern int openat (int __fd, const char *__file, int __oflag, ...)
241 __nonnull ((2));
242# else
243# ifdef __REDIRECT
244extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
245 ...), openat64) __nonnull ((2));
246# else
247# define openat openat64
248# endif
249# endif
250# ifdef __USE_LARGEFILE64
251extern int openat64 (int __fd, const char *__file, int __oflag, ...)
252 __nonnull ((2));
253# endif
254#endif
255
256/* Create and open FILE, with mode MODE. This takes an `int' MODE
257 argument because that is what `mode_t' will be widened to.
258
259 This function is a cancellation point and therefore not marked with
260 __THROW. */
261#ifndef __USE_FILE_OFFSET64
262extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
263#else
264# ifdef __REDIRECT
265extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
266 creat64) __nonnull ((1));
267# else
268# define creat creat64
269# endif
270#endif
271#ifdef __USE_LARGEFILE64
272extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
273#endif
274
275#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
276 && !defined __USE_POSIX))
277/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
278 files consistent. Some systems have them there and some here, and some
279 software depends on the macros being defined without including both. */
280
281/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
282 LEN is always relative to the current file position.
283 The CMD argument is one of the following. */
284
285# define F_ULOCK 0 /* Unlock a previously locked region. */
286# define F_LOCK 1 /* Lock a region for exclusive use. */
287# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
288# define F_TEST 3 /* Test a region for other processes locks. */
289
290# ifndef __USE_FILE_OFFSET64
291extern int lockf (int __fd, int __cmd, off_t __len) __wur;
292# else
293# ifdef __REDIRECT
294extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len),
295 lockf64) __wur;
296# else
297# define lockf lockf64
298# endif
299# endif
300# ifdef __USE_LARGEFILE64
301extern int lockf64 (int __fd, int __cmd, off64_t __len) __wur;
302# endif
303#endif
304
305#ifdef __USE_XOPEN2K
306/* Advice the system about the expected behaviour of the application with
307 respect to the file associated with FD. */
308# ifndef __USE_FILE_OFFSET64
309extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
310 int __advise) __THROW;
311# else
312 # ifdef __REDIRECT_NTH
313extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
314 __off64_t __len, int __advise),
315 posix_fadvise64);
316# else
317# define posix_fadvise posix_fadvise64
318# endif
319# endif
320# ifdef __USE_LARGEFILE64
321extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
322 int __advise) __THROW;
323# endif
324
325
326/* Reserve storage for the data of the file associated with FD.
327
328 This function is a possible cancellation point and therefore not
329 marked with __THROW. */
330# ifndef __USE_FILE_OFFSET64
331extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
332# else
333 # ifdef __REDIRECT
334extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
335 __off64_t __len),
336 posix_fallocate64);
337# else
338# define posix_fallocate posix_fallocate64
339# endif
340# endif
341# ifdef __USE_LARGEFILE64
342extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
343# endif
344#endif
345
346
347/* Define some inlines helping to catch common problems. */
348#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
349# include <bits/fcntl2.h>
350#endif
351
352__END_DECLS
353
354#endif /* fcntl.h */
lib/libc/glibc/io/mknod.c deleted-27
......@@ -1,27 +0,0 @@
1/* Copyright (C) 1995-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sys/stat.h>
19#include <fcntl.h>
20
21int
22__mknod (const char *path, mode_t mode, dev_t dev)
23{
24 return __mknodat (AT_FDCWD, path, mode, dev);
25}
26libc_hidden_def (__mknod)
27weak_alias (__mknod, mknod)
lib/libc/glibc/locale/bits/types/__locale_t.h deleted-43
......@@ -1,43 +0,0 @@
1/* Definition of struct __locale_struct and __locale_t.
2 Copyright (C) 1997-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES___LOCALE_T_H
20#define _BITS_TYPES___LOCALE_T_H 1
21
22/* POSIX.1-2008: the locale_t type, representing a locale context
23 (implementation-namespace version). This type should be treated
24 as opaque by applications; some details are exposed for the sake of
25 efficiency in e.g. ctype functions. */
26
27struct __locale_struct
28{
29 /* Note: LC_ALL is not a valid index into this array. */
30 struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */
31
32 /* To increase the speed of this solution we add some special members. */
33 const unsigned short int *__ctype_b;
34 const int *__ctype_tolower;
35 const int *__ctype_toupper;
36
37 /* Note: LC_ALL is not a valid index into this array. */
38 const char *__names[13];
39};
40
41typedef struct __locale_struct *__locale_t;
42
43#endif /* bits/types/__locale_t.h */
lib/libc/glibc/locale/bits/types/locale_t.h deleted-26
......@@ -1,26 +0,0 @@
1/* Definition of locale_t.
2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_TYPES_LOCALE_T_H
20#define _BITS_TYPES_LOCALE_T_H 1
21
22#include <bits/types/__locale_t.h>
23
24typedef __locale_t locale_t;
25
26#endif /* bits/types/locale_t.h */
lib/libc/glibc/misc/syscall.h deleted-1
......@@ -1 +0,0 @@
1#include <sys/syscall.h>
lib/libc/glibc/posix/bits/cpu-set.h deleted-124
......@@ -1,124 +0,0 @@
1/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
2 scheduling interface.
3 Copyright (C) 1996-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#ifndef _BITS_CPU_SET_H
21#define _BITS_CPU_SET_H 1
22
23#ifndef _SCHED_H
24# error "Never include <bits/cpu-set.h> directly; use <sched.h> instead."
25#endif
26
27/* Size definition for CPU sets. */
28#define __CPU_SETSIZE 1024
29#define __NCPUBITS (8 * sizeof (__cpu_mask))
30
31/* Type for array elements in 'cpu_set_t'. */
32typedef __CPU_MASK_TYPE __cpu_mask;
33
34/* Basic access functions. */
35#define __CPUELT(cpu) ((cpu) / __NCPUBITS)
36#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
37
38/* Data structure to describe CPU mask. */
39typedef struct
40{
41 __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
42} cpu_set_t;
43
44/* Access functions for CPU masks. */
45#if __GNUC_PREREQ (2, 91)
46# define __CPU_ZERO_S(setsize, cpusetp) \
47 do __builtin_memset (cpusetp, '\0', setsize); while (0)
48#else
49# define __CPU_ZERO_S(setsize, cpusetp) \
50 do { \
51 size_t __i; \
52 size_t __imax = (setsize) / sizeof (__cpu_mask); \
53 __cpu_mask *__bits = (cpusetp)->__bits; \
54 for (__i = 0; __i < __imax; ++__i) \
55 __bits[__i] = 0; \
56 } while (0)
57#endif
58#define __CPU_SET_S(cpu, setsize, cpusetp) \
59 (__extension__ \
60 ({ size_t __cpu = (cpu); \
61 __cpu / 8 < (setsize) \
62 ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
63 |= __CPUMASK (__cpu)) \
64 : 0; }))
65#define __CPU_CLR_S(cpu, setsize, cpusetp) \
66 (__extension__ \
67 ({ size_t __cpu = (cpu); \
68 __cpu / 8 < (setsize) \
69 ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
70 &= ~__CPUMASK (__cpu)) \
71 : 0; }))
72#define __CPU_ISSET_S(cpu, setsize, cpusetp) \
73 (__extension__ \
74 ({ size_t __cpu = (cpu); \
75 __cpu / 8 < (setsize) \
76 ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
77 & __CPUMASK (__cpu))) != 0 \
78 : 0; }))
79
80#define __CPU_COUNT_S(setsize, cpusetp) \
81 __sched_cpucount (setsize, cpusetp)
82
83#if __GNUC_PREREQ (2, 91)
84# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
85 (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
86#else
87# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
88 (__extension__ \
89 ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \
90 const __cpu_mask *__arr2 = (cpusetp2)->__bits; \
91 size_t __imax = (setsize) / sizeof (__cpu_mask); \
92 size_t __i; \
93 for (__i = 0; __i < __imax; ++__i) \
94 if (__arr1[__i] != __arr2[__i]) \
95 break; \
96 __i == __imax; }))
97#endif
98
99#define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
100 (__extension__ \
101 ({ cpu_set_t *__dest = (destset); \
102 const __cpu_mask *__arr1 = (srcset1)->__bits; \
103 const __cpu_mask *__arr2 = (srcset2)->__bits; \
104 size_t __imax = (setsize) / sizeof (__cpu_mask); \
105 size_t __i; \
106 for (__i = 0; __i < __imax; ++__i) \
107 ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \
108 __dest; }))
109
110#define __CPU_ALLOC_SIZE(count) \
111 ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask))
112#define __CPU_ALLOC(count) __sched_cpualloc (count)
113#define __CPU_FREE(cpuset) __sched_cpufree (cpuset)
114
115__BEGIN_DECLS
116
117extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
118 __THROW;
119extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
120extern void __sched_cpufree (cpu_set_t *__set) __THROW;
121
122__END_DECLS
123
124#endif /* bits/cpu-set.h */
lib/libc/glibc/signal/bits/types/sig_atomic_t.h deleted-10
......@@ -1,10 +0,0 @@
1#ifndef __sig_atomic_t_defined
2#define __sig_atomic_t_defined 1
3
4#include <bits/types.h>
5
6/* An integral type that can be modified atomically, without the
7 possibility of a signal arriving in the middle of the operation. */
8typedef __sig_atomic_t sig_atomic_t;
9
10#endif
lib/libc/glibc/signal/signal.h deleted-395
......@@ -1,395 +0,0 @@
1/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/*
19 * ISO C99 Standard: 7.14 Signal handling <signal.h>
20 */
21
22#ifndef _SIGNAL_H
23#define _SIGNAL_H
24
25#include <features.h>
26
27__BEGIN_DECLS
28
29#include <bits/types.h>
30#include <bits/signum-generic.h>
31
32#include <bits/types/sig_atomic_t.h>
33
34#if defined __USE_POSIX
35#include <bits/types/sigset_t.h>
36#endif
37
38#if defined __USE_XOPEN || defined __USE_XOPEN2K
39# ifndef __pid_t_defined
40typedef __pid_t pid_t;
41# define __pid_t_defined
42#endif
43#ifdef __USE_XOPEN
44# endif
45# ifndef __uid_t_defined
46typedef __uid_t uid_t;
47# define __uid_t_defined
48# endif
49#endif /* Unix98 */
50
51#ifdef __USE_POSIX199309
52/* We need `struct timespec' later on. */
53# include <bits/types/struct_timespec.h>
54#endif
55
56#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
57# include <bits/types/siginfo_t.h>
58# include <bits/siginfo-consts.h>
59#endif
60
61#ifdef __USE_MISC
62# include <bits/types/sigval_t.h>
63#endif
64
65#ifdef __USE_POSIX199309
66# include <bits/types/sigevent_t.h>
67# include <bits/sigevent-consts.h>
68#endif
69
70
71/* Type of a signal handler. */
72typedef void (*__sighandler_t) (int);
73
74/* The X/Open definition of `signal' specifies the SVID semantic. Use
75 the additional function `sysv_signal' when X/Open compatibility is
76 requested. */
77extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
78 __THROW;
79#ifdef __USE_GNU
80extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
81 __THROW;
82#endif
83
84/* Set the handler for the signal SIG to HANDLER, returning the old
85 handler, or SIG_ERR on error.
86 By default `signal' has the BSD semantic. */
87#ifdef __USE_MISC
88extern __sighandler_t signal (int __sig, __sighandler_t __handler)
89 __THROW;
90#else
91/* Make sure the used `signal' implementation is the SVID version. */
92# ifdef __REDIRECT_NTH
93extern __sighandler_t __REDIRECT_NTH (signal,
94 (int __sig, __sighandler_t __handler),
95 __sysv_signal);
96# else
97# define signal __sysv_signal
98# endif
99#endif
100
101#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8
102/* The X/Open definition of `signal' conflicts with the BSD version.
103 So they defined another function `bsd_signal'. */
104extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
105 __THROW;
106#endif
107
108/* Send signal SIG to process number PID. If PID is zero,
109 send SIG to all processes in the current process's process group.
110 If PID is < -1, send SIG to all processes in process group - PID. */
111#ifdef __USE_POSIX
112extern int kill (__pid_t __pid, int __sig) __THROW;
113#endif /* Use POSIX. */
114
115#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
116/* Send SIG to all processes in process group PGRP.
117 If PGRP is zero, send SIG to all processes in
118 the current process's process group. */
119extern int killpg (__pid_t __pgrp, int __sig) __THROW;
120#endif /* Use misc || X/Open Unix. */
121
122/* Raise signal SIG, i.e., send SIG to yourself. */
123extern int raise (int __sig) __THROW;
124
125#ifdef __USE_MISC
126/* SVID names for the same things. */
127extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
128 __THROW;
129extern int gsignal (int __sig) __THROW;
130#endif /* Use misc. */
131
132#ifdef __USE_XOPEN2K8
133/* Print a message describing the meaning of the given signal number. */
134extern void psignal (int __sig, const char *__s);
135
136/* Print a message describing the meaning of the given signal information. */
137extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
138#endif /* POSIX 2008. */
139
140
141
142/* The `sigpause' function in X/Open defines the argument as the
143 signal number. This requires redirecting to another function
144 because the default version in glibc uses an old BSD interface.
145
146 This function is a cancellation point and therefore not marked with
147 __THROW. */
148
149#ifdef __USE_XOPEN_EXTENDED
150# ifdef __GNUC__
151extern int sigpause (int __sig) __asm__ ("__xpg_sigpause")
152 __attribute_deprecated_msg__ ("Use the sigsuspend function instead");
153# else
154extern int __sigpause (int __sig_or_mask, int __is_sig);
155/* Remove a signal from the signal mask and suspend the process. */
156# define sigpause(sig) __sigpause ((sig), 1)
157# endif
158#endif
159
160
161#ifdef __USE_MISC
162/* None of the following functions should be used anymore. They are here
163 only for compatibility. A single word (`int') is not guaranteed to be
164 enough to hold a complete signal mask and therefore these functions
165 simply do not work in many situations. Use `sigprocmask' instead. */
166
167/* Compute mask for signal SIG. */
168# define sigmask(sig) \
169 __glibc_macro_warning ("sigmask is deprecated") \
170 ((int)(1u << ((sig) - 1)))
171
172/* Block signals in MASK, returning the old mask. */
173extern int sigblock (int __mask) __THROW __attribute_deprecated__;
174
175/* Set the mask of blocked signals to MASK, returning the old mask. */
176extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
177
178/* Return currently selected signal mask. */
179extern int siggetmask (void) __THROW __attribute_deprecated__;
180#endif /* Use misc. */
181
182
183#ifdef __USE_MISC
184# define NSIG _NSIG
185#endif
186
187#ifdef __USE_GNU
188typedef __sighandler_t sighandler_t;
189#endif
190
191/* 4.4 BSD uses the name `sig_t' for this. */
192#ifdef __USE_MISC
193typedef __sighandler_t sig_t;
194#endif
195
196#ifdef __USE_POSIX
197
198/* Clear all signals from SET. */
199extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
200
201/* Set all signals in SET. */
202extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
203
204/* Add SIGNO to SET. */
205extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
206
207/* Remove SIGNO from SET. */
208extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
209
210/* Return 1 if SIGNO is in SET, 0 if not. */
211extern int sigismember (const sigset_t *__set, int __signo)
212 __THROW __nonnull ((1));
213
214# ifdef __USE_GNU
215/* Return non-empty value is SET is not empty. */
216extern int sigisemptyset (const sigset_t *__set) __THROW __nonnull ((1));
217
218/* Build new signal set by combining the two inputs set using logical AND. */
219extern int sigandset (sigset_t *__set, const sigset_t *__left,
220 const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
221
222/* Build new signal set by combining the two inputs set using logical OR. */
223extern int sigorset (sigset_t *__set, const sigset_t *__left,
224 const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
225# endif /* GNU */
226
227/* Get the system-specific definitions of `struct sigaction'
228 and the `SA_*' and `SIG_*'. constants. */
229# include <bits/sigaction.h>
230
231/* Get and/or change the set of blocked signals. */
232extern int sigprocmask (int __how, const sigset_t *__restrict __set,
233 sigset_t *__restrict __oset) __THROW;
234
235/* Change the set of blocked signals to SET,
236 wait until a signal arrives, and restore the set of blocked signals.
237
238 This function is a cancellation point and therefore not marked with
239 __THROW. */
240extern int sigsuspend (const sigset_t *__set) __nonnull ((1));
241
242/* Get and/or set the action for signal SIG. */
243extern int sigaction (int __sig, const struct sigaction *__restrict __act,
244 struct sigaction *__restrict __oact) __THROW;
245
246/* Put in SET all signals that are blocked and waiting to be delivered. */
247extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
248
249
250# ifdef __USE_POSIX199506
251/* Select any of pending signals from SET or wait for any to arrive.
252
253 This function is a cancellation point and therefore not marked with
254 __THROW. */
255extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
256 __nonnull ((1, 2));
257# endif /* Use POSIX 1995. */
258
259# ifdef __USE_POSIX199309
260/* Select any of pending signals from SET and place information in INFO.
261
262 This function is a cancellation point and therefore not marked with
263 __THROW. */
264extern int sigwaitinfo (const sigset_t *__restrict __set,
265 siginfo_t *__restrict __info) __nonnull ((1));
266
267/* Select any of pending signals from SET and place information in INFO.
268 Wait the time specified by TIMEOUT if no signal is pending.
269
270 This function is a cancellation point and therefore not marked with
271 __THROW. */
272# ifndef __USE_TIME64_REDIRECTS
273extern int sigtimedwait (const sigset_t *__restrict __set,
274 siginfo_t *__restrict __info,
275 const struct timespec *__restrict __timeout)
276 __nonnull ((1));
277# else
278# ifdef __REDIRECT
279extern int __REDIRECT (sigtimedwait,
280 (const sigset_t *__restrict __set,
281 siginfo_t *__restrict __info,
282 const struct timespec *__restrict __timeout),
283 __sigtimedwait64)
284 __nonnull ((1));
285# else
286# define sigtimedwait __sigtimedwait64
287# endif
288# endif
289
290/* Send signal SIG to the process PID. Associate data in VAL with the
291 signal. */
292extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
293 __THROW;
294# endif /* Use POSIX 199306. */
295
296#endif /* Use POSIX. */
297
298#ifdef __USE_MISC
299
300/* Get machine-dependent `struct sigcontext' and signal subcodes. */
301# include <bits/sigcontext.h>
302
303/* Restore the state saved in SCP. */
304extern int sigreturn (struct sigcontext *__scp) __THROW;
305
306#endif /* Use misc. */
307
308
309#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
310# define __need_size_t
311# include <stddef.h>
312
313# include <bits/types/stack_t.h>
314# if defined __USE_XOPEN || defined __USE_XOPEN2K8
315/* This will define `ucontext_t' and `mcontext_t'. */
316# include <sys/ucontext.h>
317# endif
318#endif /* Use POSIX.1-2008 or X/Open Unix. */
319
320#if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
321/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
322 (causing them to fail with EINTR); if INTERRUPT is zero, make system
323 calls be restarted after signal SIG. */
324extern int siginterrupt (int __sig, int __interrupt) __THROW
325 __attribute_deprecated_msg__ ("Use sigaction with SA_RESTART instead");
326
327# include <bits/sigstack.h>
328# include <bits/sigstksz.h>
329# include <bits/ss_flags.h>
330
331/* Alternate signal handler stack interface.
332 This interface should always be preferred over `sigstack'. */
333extern int sigaltstack (const stack_t *__restrict __ss,
334 stack_t *__restrict __oss) __THROW;
335#endif /* __USE_XOPEN_EXTENDED || __USE_MISC */
336
337#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
338 || defined __USE_MISC)
339# include <bits/types/struct_sigstack.h>
340#endif
341
342#if ((defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
343 || defined __USE_MISC)
344/* Run signals handlers on the stack specified by SS (if not NULL).
345 If OSS is not NULL, it is filled in with the old signal stack status.
346 This interface is obsolete and on many platform not implemented. */
347extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
348 __THROW __attribute_deprecated__;
349#endif
350
351#ifdef __USE_XOPEN_EXTENDED
352/* Simplified interface for signal management. */
353
354/* Add SIG to the calling process' signal mask. */
355extern int sighold (int __sig) __THROW
356 __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
357
358/* Remove SIG from the calling process' signal mask. */
359extern int sigrelse (int __sig) __THROW
360 __attribute_deprecated_msg__ ("Use the sigprocmask function instead");
361
362/* Set the disposition of SIG to SIG_IGN. */
363extern int sigignore (int __sig) __THROW
364 __attribute_deprecated_msg__ ("Use the signal function instead");
365
366/* Set the disposition of SIG. */
367extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW
368 __attribute_deprecated_msg__
369 ("Use the signal and sigprocmask functions instead");
370#endif
371
372#if defined __USE_POSIX199506 || defined __USE_UNIX98
373/* Some of the functions for handling signals in threaded programs must
374 be defined here. */
375# include <bits/pthreadtypes.h>
376# include <bits/sigthread.h>
377#endif /* use Unix98 */
378
379/* The following functions are used internally in the C library and in
380 other code which need deep insights. */
381
382/* Return number of available real-time signal with highest priority. */
383extern int __libc_current_sigrtmin (void) __THROW;
384/* Return number of available real-time signal with lowest priority. */
385extern int __libc_current_sigrtmax (void) __THROW;
386
387#define SIGRTMIN (__libc_current_sigrtmin ())
388#define SIGRTMAX (__libc_current_sigrtmax ())
389
390/* System-specific extensions. */
391#include <bits/signal_ext.h>
392
393__END_DECLS
394
395#endif /* not signal.h */
lib/libc/glibc/signal/sys/signal.h deleted-1
......@@ -1 +0,0 @@
1#include <signal.h>
lib/libc/glibc/stdlib/alloca.h deleted-40
......@@ -1,40 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _ALLOCA_H
19#define _ALLOCA_H 1
20
21#include <features.h>
22
23#define __need_size_t
24#include <stddef.h>
25
26__BEGIN_DECLS
27
28/* Remove any previous definition. */
29#undef alloca
30
31/* Allocate a block that will be freed when the calling function exits. */
32extern void *alloca (size_t __size) __THROW;
33
34#ifdef __GNUC__
35# define alloca(size) __builtin_alloca (size)
36#endif /* GCC. */
37
38__END_DECLS
39
40#endif /* alloca.h */
lib/libc/glibc/stdlib/bits/stdlib-float.h deleted-29
......@@ -1,29 +0,0 @@
1/* Floating-point inline functions for stdlib.h.
2 Copyright (C) 2012-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _STDLIB_H
20# error "Never use <bits/stdlib-float.h> directly; include <stdlib.h> instead."
21#endif
22
23#ifdef __USE_EXTERN_INLINES
24__extern_inline double
25__NTH (atof (const char *__nptr))
26{
27 return strtod (__nptr, (char **) NULL);
28}
29#endif /* Optimizing and Inlining. */
lib/libc/glibc/stdlib/exit.h deleted-94
......@@ -1,94 +0,0 @@
1/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _EXIT_H
19#define _EXIT_H 1
20
21#include <stdbool.h>
22#include <stdint.h>
23#include <libc-lock.h>
24
25enum
26{
27 ef_free, /* `ef_free' MUST be zero! */
28 ef_us,
29 ef_on,
30 ef_at,
31 ef_cxa
32};
33
34struct exit_function
35 {
36 /* `flavour' should be of type of the `enum' above but since we need
37 this element in an atomic operation we have to use `long int'. */
38 long int flavor;
39 union
40 {
41 void (*at) (void);
42 struct
43 {
44 void (*fn) (int status, void *arg);
45 void *arg;
46 } on;
47 struct
48 {
49 void (*fn) (void *arg, int status);
50 void *arg;
51 void *dso_handle;
52 } cxa;
53 } func;
54 };
55struct exit_function_list
56 {
57 struct exit_function_list *next;
58 size_t idx;
59 struct exit_function fns[32];
60 };
61
62extern struct exit_function_list *__exit_funcs attribute_hidden;
63extern struct exit_function_list *__quick_exit_funcs attribute_hidden;
64extern uint64_t __new_exitfn_called attribute_hidden;
65
66/* True once all registered atexit/at_quick_exit/onexit handlers have been
67 called */
68extern bool __exit_funcs_done attribute_hidden;
69
70/* This lock protects __exit_funcs, __quick_exit_funcs, __exit_funcs_done
71 and __new_exitfn_called globals against simultaneous access from
72 atexit/on_exit/at_quick_exit in multiple threads, and also from
73 simultaneous access while another thread is in the middle of calling
74 exit handlers. See BZ#14333. Note: for lists, the entire list, and
75 each associated entry in the list, is protected for all access by this
76 lock. */
77__libc_lock_define (extern, __exit_funcs_lock);
78
79
80extern struct exit_function *__new_exitfn (struct exit_function_list **listp)
81 attribute_hidden;
82
83extern void __run_exit_handlers (int status,
84 struct exit_function_list **listp,
85 bool run_list_atexit, bool run_dtors)
86 attribute_hidden __attribute__ ((__noreturn__));
87
88extern int __internal_atexit (void (*func) (void *), void *arg, void *d,
89 struct exit_function_list **listp)
90 attribute_hidden;
91extern int __cxa_at_quick_exit (void (*func) (void *), void *d);
92
93
94#endif /* exit.h */
lib/libc/glibc/stdlib/stdlib.h deleted-1216
......@@ -1,1216 +0,0 @@
1/* Copyright (C) 1991-2026 Free Software Foundation, Inc.
2 Copyright The GNU Toolchain Authors.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/*
20 * ISO C99 Standard: 7.20 General utilities <stdlib.h>
21 */
22
23#ifndef _STDLIB_H
24
25#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
26#include <bits/libc-header-start.h>
27
28/* Get size_t, wchar_t and NULL from <stddef.h>. */
29#define __need_size_t
30#define __need_wchar_t
31#define __need_NULL
32#include <stddef.h>
33
34__BEGIN_DECLS
35
36#define _STDLIB_H 1
37
38#if __GLIBC_USE (ISOC23)
39# define __STDC_VERSION_STDLIB_H__ 202311L
40#endif
41
42#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
43/* XPG requires a few symbols from <sys/wait.h> being defined. */
44# include <bits/waitflags.h>
45# include <bits/waitstatus.h>
46
47/* Define the macros <sys/wait.h> also would define this way. */
48# define WEXITSTATUS(status) __WEXITSTATUS (status)
49# define WTERMSIG(status) __WTERMSIG (status)
50# define WSTOPSIG(status) __WSTOPSIG (status)
51# define WIFEXITED(status) __WIFEXITED (status)
52# define WIFSIGNALED(status) __WIFSIGNALED (status)
53# define WIFSTOPPED(status) __WIFSTOPPED (status)
54# ifdef __WIFCONTINUED
55# define WIFCONTINUED(status) __WIFCONTINUED (status)
56# endif
57#endif /* X/Open or XPG7 and <sys/wait.h> not included. */
58
59/* _FloatN API tests for enablement. */
60#include <bits/floatn.h>
61
62/* Returned by `div'. */
63typedef struct
64 {
65 int quot; /* Quotient. */
66 int rem; /* Remainder. */
67 } div_t;
68
69/* Returned by `ldiv'. */
70#ifndef __ldiv_t_defined
71typedef struct
72 {
73 long int quot; /* Quotient. */
74 long int rem; /* Remainder. */
75 } ldiv_t;
76# define __ldiv_t_defined 1
77#endif
78
79#if defined __USE_ISOC99 && !defined __lldiv_t_defined
80/* Returned by `lldiv'. */
81__extension__ typedef struct
82 {
83 long long int quot; /* Quotient. */
84 long long int rem; /* Remainder. */
85 } lldiv_t;
86# define __lldiv_t_defined 1
87#endif
88
89
90/* The largest number rand will return (same as INT_MAX). */
91#define RAND_MAX 2147483647
92
93
94/* We define these the same for all machines.
95 Changes from this to the outside world should be done in `_exit'. */
96#define EXIT_FAILURE 1 /* Failing exit status. */
97#define EXIT_SUCCESS 0 /* Successful exit status. */
98
99
100/* Maximum length of a multibyte character in the current locale. */
101#define MB_CUR_MAX (__ctype_get_mb_cur_max ())
102extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
103
104
105/* Convert a string to a floating-point number. */
106extern double atof (const char *__nptr)
107 __THROW __attribute_pure__ __nonnull ((1)) __wur;
108/* Convert a string to an integer. */
109extern int atoi (const char *__nptr)
110 __THROW __attribute_pure__ __nonnull ((1)) __wur;
111/* Convert a string to a long integer. */
112extern long int atol (const char *__nptr)
113 __THROW __attribute_pure__ __nonnull ((1)) __wur;
114
115#ifdef __USE_ISOC99
116/* Convert a string to a long long integer. */
117__extension__ extern long long int atoll (const char *__nptr)
118 __THROW __attribute_pure__ __nonnull ((1)) __wur;
119#endif
120
121/* Convert a string to a floating-point number. */
122extern double strtod (const char *__restrict __nptr,
123 char **__restrict __endptr)
124 __THROW __nonnull ((1));
125
126#ifdef __USE_ISOC99
127/* Likewise for `float' and `long double' sizes of floating-point numbers. */
128extern float strtof (const char *__restrict __nptr,
129 char **__restrict __endptr) __THROW __nonnull ((1));
130
131extern long double strtold (const char *__restrict __nptr,
132 char **__restrict __endptr)
133 __THROW __nonnull ((1));
134#endif
135
136/* Likewise for '_FloatN' and '_FloatNx'. */
137
138#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
139extern _Float16 strtof16 (const char *__restrict __nptr,
140 char **__restrict __endptr)
141 __THROW __nonnull ((1));
142#endif
143
144#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
145extern _Float32 strtof32 (const char *__restrict __nptr,
146 char **__restrict __endptr)
147 __THROW __nonnull ((1));
148#endif
149
150#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
151extern _Float64 strtof64 (const char *__restrict __nptr,
152 char **__restrict __endptr)
153 __THROW __nonnull ((1));
154#endif
155
156#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
157extern _Float128 strtof128 (const char *__restrict __nptr,
158 char **__restrict __endptr)
159 __THROW __nonnull ((1));
160#endif
161
162#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
163extern _Float32x strtof32x (const char *__restrict __nptr,
164 char **__restrict __endptr)
165 __THROW __nonnull ((1));
166#endif
167
168#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
169extern _Float64x strtof64x (const char *__restrict __nptr,
170 char **__restrict __endptr)
171 __THROW __nonnull ((1));
172#endif
173
174#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
175extern _Float128x strtof128x (const char *__restrict __nptr,
176 char **__restrict __endptr)
177 __THROW __nonnull ((1));
178#endif
179
180/* Convert a string to a long integer. */
181extern long int strtol (const char *__restrict __nptr,
182 char **__restrict __endptr, int __base)
183 __THROW __nonnull ((1));
184/* Convert a string to an unsigned long integer. */
185extern unsigned long int strtoul (const char *__restrict __nptr,
186 char **__restrict __endptr, int __base)
187 __THROW __nonnull ((1));
188
189#ifdef __USE_MISC
190/* Convert a string to a quadword integer. */
191__extension__
192extern long long int strtoq (const char *__restrict __nptr,
193 char **__restrict __endptr, int __base)
194 __THROW __nonnull ((1));
195/* Convert a string to an unsigned quadword integer. */
196__extension__
197extern unsigned long long int strtouq (const char *__restrict __nptr,
198 char **__restrict __endptr, int __base)
199 __THROW __nonnull ((1));
200#endif /* Use misc. */
201
202#ifdef __USE_ISOC99
203/* Convert a string to a quadword integer. */
204__extension__
205extern long long int strtoll (const char *__restrict __nptr,
206 char **__restrict __endptr, int __base)
207 __THROW __nonnull ((1));
208/* Convert a string to an unsigned quadword integer. */
209__extension__
210extern unsigned long long int strtoull (const char *__restrict __nptr,
211 char **__restrict __endptr, int __base)
212 __THROW __nonnull ((1));
213#endif /* ISO C99 or use MISC. */
214
215/* Versions of the above functions that handle '0b' and '0B' prefixes
216 in base 0 or 2. */
217#if __GLIBC_USE (C23_STRTOL)
218# ifdef __REDIRECT
219extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
220 char **__restrict __endptr,
221 int __base), __isoc23_strtol)
222 __nonnull ((1));
223extern unsigned long int __REDIRECT_NTH (strtoul,
224 (const char *__restrict __nptr,
225 char **__restrict __endptr,
226 int __base), __isoc23_strtoul)
227 __nonnull ((1));
228# ifdef __USE_MISC
229__extension__
230extern long long int __REDIRECT_NTH (strtoq, (const char *__restrict __nptr,
231 char **__restrict __endptr,
232 int __base), __isoc23_strtoll)
233 __nonnull ((1));
234__extension__
235extern unsigned long long int __REDIRECT_NTH (strtouq,
236 (const char *__restrict __nptr,
237 char **__restrict __endptr,
238 int __base), __isoc23_strtoull)
239 __nonnull ((1));
240# endif
241__extension__
242extern long long int __REDIRECT_NTH (strtoll, (const char *__restrict __nptr,
243 char **__restrict __endptr,
244 int __base), __isoc23_strtoll)
245 __nonnull ((1));
246__extension__
247extern unsigned long long int __REDIRECT_NTH (strtoull,
248 (const char *__restrict __nptr,
249 char **__restrict __endptr,
250 int __base), __isoc23_strtoull)
251 __nonnull ((1));
252# else
253extern long int __isoc23_strtol (const char *__restrict __nptr,
254 char **__restrict __endptr, int __base)
255 __THROW __nonnull ((1));
256extern unsigned long int __isoc23_strtoul (const char *__restrict __nptr,
257 char **__restrict __endptr,
258 int __base)
259 __THROW __nonnull ((1));
260__extension__
261extern long long int __isoc23_strtoll (const char *__restrict __nptr,
262 char **__restrict __endptr, int __base)
263 __THROW __nonnull ((1));
264__extension__
265extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,
266 char **__restrict __endptr,
267 int __base)
268 __THROW __nonnull ((1));
269# define strtol __isoc23_strtol
270# define strtoul __isoc23_strtoul
271# ifdef __USE_MISC
272# define strtoq __isoc23_strtoll
273# define strtouq __isoc23_strtoull
274# endif
275# define strtoll __isoc23_strtoll
276# define strtoull __isoc23_strtoull
277# endif
278#endif
279
280/* Convert a floating-point number to a string. */
281#if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
282extern int strfromd (char *__dest, size_t __size, const char *__format,
283 double __f)
284 __THROW __nonnull ((3));
285
286extern int strfromf (char *__dest, size_t __size, const char *__format,
287 float __f)
288 __THROW __nonnull ((3));
289
290extern int strfroml (char *__dest, size_t __size, const char *__format,
291 long double __f)
292 __THROW __nonnull ((3));
293#endif
294
295#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
296extern int strfromf16 (char *__dest, size_t __size, const char * __format,
297 _Float16 __f)
298 __THROW __nonnull ((3));
299#endif
300
301#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
302extern int strfromf32 (char *__dest, size_t __size, const char * __format,
303 _Float32 __f)
304 __THROW __nonnull ((3));
305#endif
306
307#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
308extern int strfromf64 (char *__dest, size_t __size, const char * __format,
309 _Float64 __f)
310 __THROW __nonnull ((3));
311#endif
312
313#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
314extern int strfromf128 (char *__dest, size_t __size, const char * __format,
315 _Float128 __f)
316 __THROW __nonnull ((3));
317#endif
318
319#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
320extern int strfromf32x (char *__dest, size_t __size, const char * __format,
321 _Float32x __f)
322 __THROW __nonnull ((3));
323#endif
324
325#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
326extern int strfromf64x (char *__dest, size_t __size, const char * __format,
327 _Float64x __f)
328 __THROW __nonnull ((3));
329#endif
330
331#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
332extern int strfromf128x (char *__dest, size_t __size, const char * __format,
333 _Float128x __f)
334 __THROW __nonnull ((3));
335#endif
336
337
338#ifdef __USE_GNU
339/* Parallel versions of the functions above which take the locale to
340 use as an additional parameter. These are GNU extensions inspired
341 by the POSIX.1-2008 extended locale API. */
342# include <bits/types/locale_t.h>
343
344extern long int strtol_l (const char *__restrict __nptr,
345 char **__restrict __endptr, int __base,
346 locale_t __loc) __THROW __nonnull ((1, 4));
347
348extern unsigned long int strtoul_l (const char *__restrict __nptr,
349 char **__restrict __endptr,
350 int __base, locale_t __loc)
351 __THROW __nonnull ((1, 4));
352
353__extension__
354extern long long int strtoll_l (const char *__restrict __nptr,
355 char **__restrict __endptr, int __base,
356 locale_t __loc)
357 __THROW __nonnull ((1, 4));
358
359__extension__
360extern unsigned long long int strtoull_l (const char *__restrict __nptr,
361 char **__restrict __endptr,
362 int __base, locale_t __loc)
363 __THROW __nonnull ((1, 4));
364
365/* Versions of the above functions that handle '0b' and '0B' prefixes
366 in base 0 or 2. */
367# if __GLIBC_USE (C23_STRTOL)
368# ifdef __REDIRECT
369extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,
370 char **__restrict __endptr,
371 int __base, locale_t __loc),
372 __isoc23_strtol_l)
373 __nonnull ((1, 4));
374extern unsigned long int __REDIRECT_NTH (strtoul_l,
375 (const char *__restrict __nptr,
376 char **__restrict __endptr,
377 int __base, locale_t __loc),
378 __isoc23_strtoul_l)
379 __nonnull ((1, 4));
380__extension__
381extern long long int __REDIRECT_NTH (strtoll_l, (const char *__restrict __nptr,
382 char **__restrict __endptr,
383 int __base,
384 locale_t __loc),
385 __isoc23_strtoll_l)
386 __nonnull ((1, 4));
387__extension__
388extern unsigned long long int __REDIRECT_NTH (strtoull_l,
389 (const char *__restrict __nptr,
390 char **__restrict __endptr,
391 int __base, locale_t __loc),
392 __isoc23_strtoull_l)
393 __nonnull ((1, 4));
394# else
395extern long int __isoc23_strtol_l (const char *__restrict __nptr,
396 char **__restrict __endptr, int __base,
397 locale_t __loc) __THROW __nonnull ((1, 4));
398extern unsigned long int __isoc23_strtoul_l (const char *__restrict __nptr,
399 char **__restrict __endptr,
400 int __base, locale_t __loc)
401 __THROW __nonnull ((1, 4));
402__extension__
403extern long long int __isoc23_strtoll_l (const char *__restrict __nptr,
404 char **__restrict __endptr,
405 int __base, locale_t __loc)
406 __THROW __nonnull ((1, 4));
407__extension__
408extern unsigned long long int __isoc23_strtoull_l (const char *__restrict __nptr,
409 char **__restrict __endptr,
410 int __base, locale_t __loc)
411 __THROW __nonnull ((1, 4));
412# define strtol_l __isoc23_strtol_l
413# define strtoul_l __isoc23_strtoul_l
414# define strtoll_l __isoc23_strtoll_l
415# define strtoull_l __isoc23_strtoull_l
416# endif
417# endif
418
419extern double strtod_l (const char *__restrict __nptr,
420 char **__restrict __endptr, locale_t __loc)
421 __THROW __nonnull ((1, 3));
422
423extern float strtof_l (const char *__restrict __nptr,
424 char **__restrict __endptr, locale_t __loc)
425 __THROW __nonnull ((1, 3));
426
427extern long double strtold_l (const char *__restrict __nptr,
428 char **__restrict __endptr,
429 locale_t __loc)
430 __THROW __nonnull ((1, 3));
431
432# if __HAVE_FLOAT16
433extern _Float16 strtof16_l (const char *__restrict __nptr,
434 char **__restrict __endptr,
435 locale_t __loc)
436 __THROW __nonnull ((1, 3));
437# endif
438
439# if __HAVE_FLOAT32
440extern _Float32 strtof32_l (const char *__restrict __nptr,
441 char **__restrict __endptr,
442 locale_t __loc)
443 __THROW __nonnull ((1, 3));
444# endif
445
446# if __HAVE_FLOAT64
447extern _Float64 strtof64_l (const char *__restrict __nptr,
448 char **__restrict __endptr,
449 locale_t __loc)
450 __THROW __nonnull ((1, 3));
451# endif
452
453# if __HAVE_FLOAT128
454extern _Float128 strtof128_l (const char *__restrict __nptr,
455 char **__restrict __endptr,
456 locale_t __loc)
457 __THROW __nonnull ((1, 3));
458# endif
459
460# if __HAVE_FLOAT32X
461extern _Float32x strtof32x_l (const char *__restrict __nptr,
462 char **__restrict __endptr,
463 locale_t __loc)
464 __THROW __nonnull ((1, 3));
465# endif
466
467# if __HAVE_FLOAT64X
468extern _Float64x strtof64x_l (const char *__restrict __nptr,
469 char **__restrict __endptr,
470 locale_t __loc)
471 __THROW __nonnull ((1, 3));
472# endif
473
474# if __HAVE_FLOAT128X
475extern _Float128x strtof128x_l (const char *__restrict __nptr,
476 char **__restrict __endptr,
477 locale_t __loc)
478 __THROW __nonnull ((1, 3));
479# endif
480#endif /* GNU */
481
482
483#ifdef __USE_EXTERN_INLINES
484__extern_inline int
485__NTH (atoi (const char *__nptr))
486{
487 return (int) strtol (__nptr, (char **) NULL, 10);
488}
489__extern_inline long int
490__NTH (atol (const char *__nptr))
491{
492 return strtol (__nptr, (char **) NULL, 10);
493}
494
495# ifdef __USE_ISOC99
496__extension__ __extern_inline long long int
497__NTH (atoll (const char *__nptr))
498{
499 return strtoll (__nptr, (char **) NULL, 10);
500}
501# endif
502#endif /* Optimizing and Inlining. */
503
504
505#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
506/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
507 digit first. Returns a pointer to static storage overwritten by the
508 next call. */
509extern char *l64a (long int __n) __THROW __wur;
510
511/* Read a number from a string S in base 64 as above. */
512extern long int a64l (const char *__s)
513 __THROW __attribute_pure__ __nonnull ((1)) __wur;
514
515#endif /* Use misc || extended X/Open. */
516
517#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
518# include <sys/types.h> /* we need int32_t... */
519
520/* These are the functions that actually do things. The `random', `srandom',
521 `initstate' and `setstate' functions are those from BSD Unices.
522 The `rand' and `srand' functions are required by the ANSI standard.
523 We provide both interfaces to the same random number generator. */
524/* Return a random long integer between 0 and 2^31-1 inclusive. */
525extern long int random (void) __THROW;
526
527/* Seed the random number generator with the given number. */
528extern void srandom (unsigned int __seed) __THROW;
529
530/* Initialize the random number generator to use state buffer STATEBUF,
531 of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16,
532 32, 64, 128 and 256, the bigger the better; values less than 8 will
533 cause an error and values greater than 256 will be rounded down. */
534extern char *initstate (unsigned int __seed, char *__statebuf,
535 size_t __statelen) __THROW __nonnull ((2));
536
537/* Switch the random number generator to state buffer STATEBUF,
538 which should have been previously initialized by `initstate'. */
539extern char *setstate (char *__statebuf) __THROW __nonnull ((1));
540
541
542# ifdef __USE_MISC
543/* Reentrant versions of the `random' family of functions.
544 These functions all use the following data structure to contain
545 state, rather than global state variables. */
546
547struct random_data
548 {
549 int32_t *fptr; /* Front pointer. */
550 int32_t *rptr; /* Rear pointer. */
551 int32_t *state; /* Array of state values. */
552 int rand_type; /* Type of random number generator. */
553 int rand_deg; /* Degree of random number generator. */
554 int rand_sep; /* Distance between front and rear. */
555 int32_t *end_ptr; /* Pointer behind state table. */
556 };
557
558extern int random_r (struct random_data *__restrict __buf,
559 int32_t *__restrict __result) __THROW __nonnull ((1, 2));
560
561extern int srandom_r (unsigned int __seed, struct random_data *__buf)
562 __THROW __nonnull ((2));
563
564extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
565 size_t __statelen,
566 struct random_data *__restrict __buf)
567 __THROW __nonnull ((2, 4));
568
569extern int setstate_r (char *__restrict __statebuf,
570 struct random_data *__restrict __buf)
571 __THROW __nonnull ((1, 2));
572# endif /* Use misc. */
573#endif /* Use extended X/Open || misc. */
574
575
576/* Return a random integer between 0 and RAND_MAX inclusive. */
577extern int rand (void) __THROW;
578/* Seed the random number generator with the given number. */
579extern void srand (unsigned int __seed) __THROW;
580
581#ifdef __USE_POSIX199506
582/* Reentrant interface according to POSIX.1. */
583extern int rand_r (unsigned int *__seed) __THROW;
584#endif
585
586
587#if defined __USE_MISC || defined __USE_XOPEN
588/* System V style 48-bit random number generator functions. */
589
590/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
591extern double drand48 (void) __THROW;
592extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1));
593
594/* Return non-negative, long integer in [0,2^31). */
595extern long int lrand48 (void) __THROW;
596extern long int nrand48 (unsigned short int __xsubi[3])
597 __THROW __nonnull ((1));
598
599/* Return signed, long integers in [-2^31,2^31). */
600extern long int mrand48 (void) __THROW;
601extern long int jrand48 (unsigned short int __xsubi[3])
602 __THROW __nonnull ((1));
603
604/* Seed random number generator. */
605extern void srand48 (long int __seedval) __THROW;
606extern unsigned short int *seed48 (unsigned short int __seed16v[3])
607 __THROW __nonnull ((1));
608extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1));
609
610# ifdef __USE_MISC
611/* Data structure for communication with thread safe versions. This
612 type is to be regarded as opaque. It's only exported because users
613 have to allocate objects of this type. */
614struct drand48_data
615 {
616 unsigned short int __x[3]; /* Current state. */
617 unsigned short int __old_x[3]; /* Old state. */
618 unsigned short int __c; /* Additive const. in congruential formula. */
619 unsigned short int __init; /* Flag for initializing. */
620 __extension__ unsigned long long int __a; /* Factor in congruential
621 formula. */
622 };
623
624/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
625extern int drand48_r (struct drand48_data *__restrict __buffer,
626 double *__restrict __result) __THROW __nonnull ((1, 2));
627extern int erand48_r (unsigned short int __xsubi[3],
628 struct drand48_data *__restrict __buffer,
629 double *__restrict __result) __THROW __nonnull ((1, 2));
630
631/* Return non-negative, long integer in [0,2^31). */
632extern int lrand48_r (struct drand48_data *__restrict __buffer,
633 long int *__restrict __result)
634 __THROW __nonnull ((1, 2));
635extern int nrand48_r (unsigned short int __xsubi[3],
636 struct drand48_data *__restrict __buffer,
637 long int *__restrict __result)
638 __THROW __nonnull ((1, 2));
639
640/* Return signed, long integers in [-2^31,2^31). */
641extern int mrand48_r (struct drand48_data *__restrict __buffer,
642 long int *__restrict __result)
643 __THROW __nonnull ((1, 2));
644extern int jrand48_r (unsigned short int __xsubi[3],
645 struct drand48_data *__restrict __buffer,
646 long int *__restrict __result)
647 __THROW __nonnull ((1, 2));
648
649/* Seed random number generator. */
650extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
651 __THROW __nonnull ((2));
652
653extern int seed48_r (unsigned short int __seed16v[3],
654 struct drand48_data *__buffer) __THROW __nonnull ((1, 2));
655
656extern int lcong48_r (unsigned short int __param[7],
657 struct drand48_data *__buffer)
658 __THROW __nonnull ((1, 2));
659
660/* Return a random integer between zero and 2**32-1 (inclusive). */
661extern __uint32_t arc4random (void)
662 __THROW __wur;
663
664/* Fill the buffer with random data. */
665extern void arc4random_buf (void *__buf, size_t __size)
666 __THROW __nonnull ((1));
667
668/* Return a random number between zero (inclusive) and the specified
669 limit (exclusive). */
670extern __uint32_t arc4random_uniform (__uint32_t __upper_bound)
671 __THROW __wur;
672# endif /* Use misc. */
673#endif /* Use misc or X/Open. */
674
675/* Allocate SIZE bytes of memory. */
676extern void *malloc (size_t __size) __THROW __attribute_malloc__
677 __attribute_alloc_size__ ((1)) __wur;
678/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
679extern void *calloc (size_t __nmemb, size_t __size)
680 __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
681
682/* Re-allocate the previously allocated block
683 in PTR, making the new block SIZE bytes long. */
684/* __attribute_malloc__ is not used, because if realloc returns
685 the same pointer that was passed to it, aliasing needs to be allowed
686 between objects pointed by the old and new pointers. */
687extern void *realloc (void *__ptr, size_t __size)
688 __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
689
690/* Free a block allocated by `malloc', `realloc' or `calloc'. */
691extern void free (void *__ptr) __THROW;
692
693#if __GLIBC_USE(ISOC23)
694/* Free a block allocated by `malloc', `realloc' or `calloc' but not
695 `aligned_alloc', `memalign', `posix_memalign', `valloc' or
696 `pvalloc'. SIZE must be equal to the original requested size
697 provided to `malloc', `realloc' or `calloc'. For `calloc' SIZE is
698 NMEMB elements * SIZE bytes. It is forbidden to call `free_sized'
699 for allocations which the caller did not directly allocate but
700 must still deallocate, such as `strdup' or `strndup'. Instead
701 continue using `free` for these cases. */
702extern void free_sized (void *__ptr, size_t __size) __THROW;
703
704/* Free a block allocated by `aligned_alloc', `memalign' or
705 `posix_memalign'. ALIGNMENT and SIZE must be the same as the values
706 provided to `aligned_alloc', `memalign' or `posix_memalign'. */
707extern void free_aligned_sized (void *__ptr, size_t __alignment, size_t __size)
708 __THROW;
709#endif
710
711#ifdef __USE_MISC
712/* Re-allocate the previously allocated block in PTR, making the new
713 block large enough for NMEMB elements of SIZE bytes each. */
714/* __attribute_malloc__ is not used, because if reallocarray returns
715 the same pointer that was passed to it, aliasing needs to be allowed
716 between objects pointed by the old and new pointers. */
717extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
718 __THROW __attribute_warn_unused_result__
719 __attribute_alloc_size__ ((2, 3))
720 __attr_dealloc_free;
721
722/* Add reallocarray as its own deallocator. */
723extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
724 __THROW __attr_dealloc (reallocarray, 1);
725#endif
726
727#ifdef __USE_MISC
728# include <alloca.h>
729#endif /* Use misc. */
730
731#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
732 || defined __USE_MISC
733/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */
734extern void *valloc (size_t __size) __THROW __attribute_malloc__
735 __attribute_alloc_size__ ((1)) __wur;
736#endif
737
738#ifdef __USE_XOPEN2K
739/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */
740extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
741 __THROW __nonnull ((1)) __wur;
742#endif
743
744#ifdef __USE_ISOC11
745/* ISO C variant of aligned allocation. */
746extern void *aligned_alloc (size_t __alignment, size_t __size)
747 __THROW __attribute_malloc__ __attribute_alloc_align__ ((1))
748 __attribute_alloc_size__ ((2)) __wur;
749#endif
750
751/* Abort execution and generate a core-dump. */
752extern void abort (void) __THROW __attribute__ ((__noreturn__)) __COLD;
753
754
755/* Register a function to be called when `exit' is called. */
756extern int atexit (void (*__func) (void)) __THROW __nonnull ((1));
757
758#if defined __USE_ISOC11 || defined __USE_ISOCXX11
759/* Register a function to be called when `quick_exit' is called. */
760# ifdef __cplusplus
761extern "C++" int at_quick_exit (void (*__func) (void))
762 __THROW __asm ("at_quick_exit") __nonnull ((1));
763# else
764extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
765# endif
766#endif
767
768#ifdef __USE_MISC
769/* Register a function to be called with the status
770 given to `exit' and the given argument. */
771extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
772 __THROW __nonnull ((1));
773#endif
774
775/* Call all functions registered with `atexit' and `on_exit',
776 in the reverse of the order in which they were registered,
777 perform stdio cleanup, and terminate program execution with STATUS. */
778extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
779
780#if defined __USE_ISOC11 || defined __USE_ISOCXX11
781/* Call all functions registered with `at_quick_exit' in the reverse
782 of the order in which they were registered and terminate program
783 execution with STATUS. */
784extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__));
785#endif
786
787#ifdef __USE_ISOC99
788/* Terminate the program with STATUS without calling any of the
789 functions registered with `atexit' or `on_exit'. */
790extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
791#endif
792
793
794/* Return the value of envariable NAME, or NULL if it doesn't exist. */
795extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
796
797#ifdef __USE_GNU
798/* This function is similar to the above but returns NULL if the
799 programs is running with SUID or SGID enabled. */
800extern char *secure_getenv (const char *__name)
801 __THROW __nonnull ((1)) __wur;
802#endif
803
804#if defined __USE_MISC || defined __USE_XOPEN
805/* The SVID says this is in <stdio.h>, but this seems a better place. */
806/* Put STRING, which is of the form "NAME=VALUE", in the environment.
807 If there is no `=', remove NAME from the environment. */
808extern int putenv (char *__string) __THROW __nonnull ((1));
809#endif
810
811#ifdef __USE_XOPEN2K
812/* Set NAME to VALUE in the environment.
813 If REPLACE is nonzero, overwrite an existing value. */
814extern int setenv (const char *__name, const char *__value, int __replace)
815 __THROW __nonnull ((2));
816
817/* Remove the variable NAME from the environment. */
818extern int unsetenv (const char *__name) __THROW __nonnull ((1));
819#endif
820
821#ifdef __USE_MISC
822/* The `clearenv' was planned to be added to POSIX.1 but probably
823 never made it. Nevertheless the POSIX.9 standard (POSIX bindings
824 for Fortran 77) requires this function. */
825extern int clearenv (void) __THROW;
826#endif
827
828
829#if defined __USE_MISC \
830 || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)
831/* Generate a unique temporary file name from TEMPLATE.
832 The last six characters of TEMPLATE must be "XXXXXX";
833 they are replaced with a string that makes the file name unique.
834 Always returns TEMPLATE, it's either a temporary file name or a null
835 string if it cannot get a unique file name. */
836extern char *mktemp (char *__template) __THROW __nonnull ((1));
837#endif
838
839#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
840/* Generate a unique temporary file name from TEMPLATE.
841 The last six characters of TEMPLATE must be "XXXXXX";
842 they are replaced with a string that makes the filename unique.
843 Returns a file descriptor open on the file for reading and writing,
844 or -1 if it cannot create a uniquely-named file.
845
846 This function is a possible cancellation point and therefore not
847 marked with __THROW. */
848# ifndef __USE_FILE_OFFSET64
849extern int mkstemp (char *__template) __nonnull ((1)) __wur;
850# else
851# ifdef __REDIRECT
852extern int __REDIRECT (mkstemp, (char *__template), mkstemp64)
853 __nonnull ((1)) __wur;
854# else
855# define mkstemp mkstemp64
856# endif
857# endif
858# ifdef __USE_LARGEFILE64
859extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
860# endif
861#endif
862
863#ifdef __USE_MISC
864/* Similar to mkstemp, but the template can have a suffix after the
865 XXXXXX. The length of the suffix is specified in the second
866 parameter.
867
868 This function is a possible cancellation point and therefore not
869 marked with __THROW. */
870# ifndef __USE_FILE_OFFSET64
871extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
872# else
873# ifdef __REDIRECT
874extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen),
875 mkstemps64) __nonnull ((1)) __wur;
876# else
877# define mkstemps mkstemps64
878# endif
879# endif
880# ifdef __USE_LARGEFILE64
881extern int mkstemps64 (char *__template, int __suffixlen)
882 __nonnull ((1)) __wur;
883# endif
884#endif
885
886#ifdef __USE_XOPEN2K8
887/* Create a unique temporary directory from TEMPLATE.
888 The last six characters of TEMPLATE must be "XXXXXX";
889 they are replaced with a string that makes the directory name unique.
890 Returns TEMPLATE, or a null pointer if it cannot get a unique name.
891 The directory is created mode 700. */
892extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
893#endif
894
895#ifdef __USE_GNU
896/* Generate a unique temporary file name from TEMPLATE similar to
897 mkstemp. But allow the caller to pass additional flags which are
898 used in the open call to create the file..
899
900 This function is a possible cancellation point and therefore not
901 marked with __THROW. */
902# ifndef __USE_FILE_OFFSET64
903extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
904# else
905# ifdef __REDIRECT
906extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
907 __nonnull ((1)) __wur;
908# else
909# define mkostemp mkostemp64
910# endif
911# endif
912# ifdef __USE_LARGEFILE64
913extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
914# endif
915
916/* Similar to mkostemp, but the template can have a suffix after the
917 XXXXXX. The length of the suffix is specified in the second
918 parameter.
919
920 This function is a possible cancellation point and therefore not
921 marked with __THROW. */
922# ifndef __USE_FILE_OFFSET64
923extern int mkostemps (char *__template, int __suffixlen, int __flags)
924 __nonnull ((1)) __wur;
925# else
926# ifdef __REDIRECT
927extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen,
928 int __flags), mkostemps64)
929 __nonnull ((1)) __wur;
930# else
931# define mkostemps mkostemps64
932# endif
933# endif
934# ifdef __USE_LARGEFILE64
935extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
936 __nonnull ((1)) __wur;
937# endif
938#endif
939
940
941/* Execute the given line as a shell command.
942
943 This function is a cancellation point and therefore not marked with
944 __THROW. */
945extern int system (const char *__command) __wur;
946
947
948#ifdef __USE_GNU
949/* Return a malloc'd string containing the canonical absolute name of the
950 existing named file. */
951extern char *canonicalize_file_name (const char *__name)
952 __THROW __nonnull ((1)) __attribute_malloc__
953 __attr_dealloc_free __wur;
954#endif
955
956#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
957/* Return the canonical absolute name of file NAME. If RESOLVED is
958 null, the result is malloc'd; otherwise, if the canonical name is
959 PATH_MAX chars or more, returns null with `errno' set to
960 ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
961 returns the name in RESOLVED. */
962extern char *realpath (const char *__restrict __name,
963 char *__restrict __resolved) __THROW __wur;
964#endif
965
966
967/* Shorthand for type of comparison functions. */
968#ifndef __COMPAR_FN_T
969# define __COMPAR_FN_T
970typedef int (*__compar_fn_t) (const void *, const void *);
971
972# ifdef __USE_GNU
973typedef __compar_fn_t comparison_fn_t;
974# endif
975#endif
976#ifdef __USE_GNU
977typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
978#endif
979
980/* Do a binary search for KEY in BASE, which consists of NMEMB elements
981 of SIZE bytes each, using COMPAR to perform the comparisons. */
982extern void *bsearch (const void *__key, const void *__base,
983 size_t __nmemb, size_t __size, __compar_fn_t __compar)
984 __nonnull ((1, 2, 5)) __wur;
985
986#ifdef __USE_EXTERN_INLINES
987# include <bits/stdlib-bsearch.h>
988#endif
989
990#if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
991# define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR) \
992 __glibc_const_generic (BASE, const void *, \
993 bsearch (KEY, BASE, NMEMB, SIZE, COMPAR))
994#endif
995
996/* Sort NMEMB elements of BASE, of SIZE bytes each,
997 using COMPAR to perform the comparisons. */
998extern void qsort (void *__base, size_t __nmemb, size_t __size,
999 __compar_fn_t __compar) __nonnull ((1, 4));
1000#ifdef __USE_GNU
1001extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
1002 __compar_d_fn_t __compar, void *__arg)
1003 __nonnull ((1, 4));
1004#endif
1005
1006
1007/* Return the absolute value of X. */
1008extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
1009extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
1010
1011#ifdef __USE_ISOC99
1012__extension__ extern long long int llabs (long long int __x)
1013 __THROW __attribute__ ((__const__)) __wur;
1014#endif
1015
1016#if __GLIBC_USE (ISOC2Y)
1017extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur;
1018extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur;
1019__extension__ extern unsigned long long int ullabs (long long int __x)
1020 __THROW __attribute__ ((__const__)) __wur;
1021#endif
1022
1023/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
1024 of the value of NUMER over DENOM. */
1025/* GCC may have built-ins for these someday. */
1026extern div_t div (int __numer, int __denom)
1027 __THROW __attribute__ ((__const__)) __wur;
1028extern ldiv_t ldiv (long int __numer, long int __denom)
1029 __THROW __attribute__ ((__const__)) __wur;
1030
1031#ifdef __USE_ISOC99
1032__extension__ extern lldiv_t lldiv (long long int __numer,
1033 long long int __denom)
1034 __THROW __attribute__ ((__const__)) __wur;
1035#endif
1036
1037
1038#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
1039 || defined __USE_MISC
1040/* Convert floating point numbers to strings. The returned values are
1041 valid only until another call to the same function. */
1042
1043/* Convert VALUE to a string with NDIGIT digits and return a pointer to
1044 this. Set *DECPT with the position of the decimal character and *SIGN
1045 with the sign of the number. */
1046extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
1047 int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
1048
1049/* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT
1050 with the position of the decimal character and *SIGN with the sign of
1051 the number. */
1052extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
1053 int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
1054
1055/* If possible convert VALUE to a string with NDIGIT significant digits.
1056 Otherwise use exponential representation. The resulting string will
1057 be written to BUF. */
1058extern char *gcvt (double __value, int __ndigit, char *__buf)
1059 __THROW __nonnull ((3)) __wur;
1060#endif
1061
1062#ifdef __USE_MISC
1063/* Long double versions of above functions. */
1064extern char *qecvt (long double __value, int __ndigit,
1065 int *__restrict __decpt, int *__restrict __sign)
1066 __THROW __nonnull ((3, 4)) __wur;
1067extern char *qfcvt (long double __value, int __ndigit,
1068 int *__restrict __decpt, int *__restrict __sign)
1069 __THROW __nonnull ((3, 4)) __wur;
1070extern char *qgcvt (long double __value, int __ndigit, char *__buf)
1071 __THROW __nonnull ((3)) __wur;
1072
1073
1074/* Reentrant version of the functions above which provide their own
1075 buffers. */
1076extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
1077 int *__restrict __sign, char *__restrict __buf,
1078 size_t __len) __THROW __nonnull ((3, 4, 5));
1079extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
1080 int *__restrict __sign, char *__restrict __buf,
1081 size_t __len) __THROW __nonnull ((3, 4, 5));
1082
1083extern int qecvt_r (long double __value, int __ndigit,
1084 int *__restrict __decpt, int *__restrict __sign,
1085 char *__restrict __buf, size_t __len)
1086 __THROW __nonnull ((3, 4, 5));
1087extern int qfcvt_r (long double __value, int __ndigit,
1088 int *__restrict __decpt, int *__restrict __sign,
1089 char *__restrict __buf, size_t __len)
1090 __THROW __nonnull ((3, 4, 5));
1091#endif /* misc */
1092
1093
1094/* Return the length of the multibyte character
1095 in S, which is no longer than N. */
1096extern int mblen (const char *__s, size_t __n) __THROW;
1097/* Return the length of the given multibyte character,
1098 putting its `wchar_t' representation in *PWC. */
1099extern int mbtowc (wchar_t *__restrict __pwc,
1100 const char *__restrict __s, size_t __n) __THROW;
1101/* Put the multibyte character represented
1102 by WCHAR in S, returning its length. */
1103extern int wctomb (char *__s, wchar_t __wchar) __THROW;
1104
1105
1106/* Convert a multibyte string to a wide char string. */
1107extern size_t mbstowcs (wchar_t *__restrict __pwcs,
1108 const char *__restrict __s, size_t __n) __THROW
1109 __attr_access ((__read_only__, 2));
1110/* Convert a wide char string to multibyte string. */
1111extern size_t wcstombs (char *__restrict __s,
1112 const wchar_t *__restrict __pwcs, size_t __n)
1113 __THROW
1114 __fortified_attr_access (__write_only__, 1, 3)
1115 __attr_access ((__read_only__, 2));
1116
1117#ifdef __USE_MISC
1118/* Determine whether the string value of RESPONSE matches the affirmation
1119 or negative response expression as specified by the LC_MESSAGES category
1120 in the program's current locale. Returns 1 if affirmative, 0 if
1121 negative, and -1 if not matching. */
1122extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur;
1123#endif
1124
1125
1126#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
1127/* Parse comma separated suboption from *OPTIONP and match against
1128 strings in TOKENS. If found return index and set *VALUEP to
1129 optional value introduced by an equal sign. If the suboption is
1130 not part of TOKENS return in *VALUEP beginning of unknown
1131 suboption. On exit *OPTIONP is set to the beginning of the next
1132 token or at the terminating NUL character. */
1133extern int getsubopt (char **__restrict __optionp,
1134 char *const *__restrict __tokens,
1135 char **__restrict __valuep)
1136 __THROW __nonnull ((1, 2, 3)) __wur;
1137#endif
1138
1139
1140/* X/Open pseudo terminal handling. */
1141
1142#ifdef __USE_XOPEN2KXSI
1143/* Return a master pseudo-terminal handle. */
1144extern int posix_openpt (int __oflag) __wur;
1145#endif
1146
1147#ifdef __USE_XOPEN_EXTENDED
1148/* The next four functions all take a master pseudo-tty fd and
1149 perform an operation on the associated slave: */
1150
1151/* Chown the slave to the calling user. */
1152extern int grantpt (int __fd) __THROW;
1153
1154/* Release an internal lock so the slave can be opened.
1155 Call after grantpt(). */
1156extern int unlockpt (int __fd) __THROW;
1157
1158/* Return the pathname of the pseudo terminal slave associated with
1159 the master FD is open on, or NULL on errors.
1160 The returned storage is good until the next call to this function. */
1161extern char *ptsname (int __fd) __THROW __wur;
1162#endif
1163
1164#ifdef __USE_GNU
1165/* Store at most BUFLEN characters of the pathname of the slave pseudo
1166 terminal associated with the master FD is open on in BUF.
1167 Return 0 on success, otherwise an error number. */
1168extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
1169 __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3);
1170
1171/* Open a master pseudo terminal and return its file descriptor. */
1172extern int getpt (void);
1173#endif
1174
1175#ifdef __USE_MISC
1176/* Put the 1 minute, 5 minute and 15 minute load averages into the first
1177 NELEM elements of LOADAVG. Return the number written (never more than
1178 three, but may be less than NELEM), or -1 if an error occurred. */
1179extern int getloadavg (double __loadavg[], int __nelem)
1180 __THROW __nonnull ((1));
1181#endif
1182
1183#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K
1184/* Return the index into the active-logins file (utmp) for
1185 the controlling terminal. */
1186extern int ttyslot (void) __THROW;
1187#endif
1188
1189#if __GLIBC_USE (ISOC23)
1190# ifndef __cplusplus
1191# include <bits/types/once_flag.h>
1192
1193/* Call function __FUNC exactly once, even if invoked from several threads.
1194 All calls must be made with the same __FLAGS object. */
1195extern void call_once (once_flag *__flag, void (*__func)(void));
1196# endif /* !__cplusplus */
1197
1198/* Return the alignment of P. */
1199extern size_t memalignment (const void *__p);
1200#endif
1201
1202#include <bits/stdlib-float.h>
1203
1204/* Define some macros helping to catch buffer overflows. */
1205#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
1206# include <bits/stdlib.h>
1207#endif
1208
1209#include <bits/floatn.h>
1210#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
1211# include <bits/stdlib-ldbl.h>
1212#endif
1213
1214__END_DECLS
1215
1216#endif /* stdlib.h */
lib/libc/glibc/sysdeps/arm/arm-features.h deleted-59
......@@ -1,59 +0,0 @@
1/* Macros to test for CPU features on ARM. Generic ARM version.
2 Copyright (C) 2012-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _ARM_ARM_FEATURES_H
20#define _ARM_ARM_FEATURES_H 1
21
22/* An OS-specific arm-features.h file should define ARM_HAVE_VFP to
23 an appropriate expression for testing at runtime whether the VFP
24 hardware is present. We'll then redefine it to a constant if we
25 know at compile time that we can assume VFP. */
26
27#ifndef __SOFTFP__
28/* The compiler is generating VFP instructions, so we're already
29 assuming the hardware exists. */
30# undef ARM_HAVE_VFP
31# define ARM_HAVE_VFP 1
32#endif
33
34/* An OS-specific arm-features.h file may define ARM_ASSUME_NO_IWMMXT
35 to indicate at compile time that iWMMXt hardware is never present
36 at runtime (or that we never care about its state) and so need not
37 be checked for. */
38
39/* A more-specific arm-features.h file may define ARM_ALWAYS_BX to indicate
40 that instructions using pc as a destination register must never be used,
41 so a "bx" (or "blx") instruction is always required. */
42
43/* The log2 of the minimum alignment required for an address that
44 is the target of a computed branch (i.e. a "bx" instruction).
45 A more-specific arm-features.h file may define this to set a more
46 stringent requirement.
47
48 Using this only makes sense for code in ARM mode (where instructions
49 always have a fixed size of four bytes), or for Thumb-mode code that is
50 specifically aligning all the related branch targets to match (since
51 Thumb instructions might be either two or four bytes). */
52#ifndef ARM_BX_ALIGN_LOG2
53# define ARM_BX_ALIGN_LOG2 2
54#endif
55
56/* An OS-specific arm-features.h file may define ARM_NO_INDEX_REGISTER to
57 indicate that the two-register addressing modes must never be used. */
58
59#endif /* arm-features.h */
lib/libc/glibc/sysdeps/arm/sysdep.h deleted-295
......@@ -1,295 +0,0 @@
1/* Assembler macros for ARM.
2 Copyright (C) 1997-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/generic/sysdep.h>
20#include <features.h>
21
22#ifndef __ASSEMBLER__
23# include <stdint.h>
24#else
25# include <arm-features.h>
26#endif
27
28/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */
29#ifndef __ARM_ARCH
30# ifdef __ARM_ARCH_2__
31# define __ARM_ARCH 2
32# elif defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
33# define __ARM_ARCH 3
34# elif defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__)
35# define __ARM_ARCH 4
36# elif defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5E__) \
37 || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \
38 || defined(__ARM_ARCH_5TEJ__)
39# define __ARM_ARCH 5
40# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
41 || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
42 || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__)
43# define __ARM_ARCH 6
44# elif defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
45 || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
46 || defined(__ARM_ARCH_7EM__)
47# define __ARM_ARCH 7
48# else
49# error unknown arm architecture
50# endif
51#endif
52
53#if __ARM_ARCH > 4 || defined (__ARM_ARCH_4T__)
54# define ARCH_HAS_BX
55#endif
56#if __ARM_ARCH > 4
57# define ARCH_HAS_BLX
58#endif
59#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
60# define ARCH_HAS_HARD_TP
61#endif
62#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6T2__)
63# define ARCH_HAS_T2
64#endif
65
66#ifdef __ASSEMBLER__
67
68/* Syntactic details of assembler. */
69
70#define ALIGNARG(log2) log2
71#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
72
73#define PLTJMP(_x) _x##(PLT)
74
75#ifdef ARCH_HAS_BX
76# define BX(R) bx R
77# define BXC(C, R) bx##C R
78# ifdef ARCH_HAS_BLX
79# define BLX(R) blx R
80# else
81# define BLX(R) mov lr, pc; bx R
82# endif
83#else
84# define BX(R) mov pc, R
85# define BXC(C, R) mov##C pc, R
86# define BLX(R) mov lr, pc; mov pc, R
87#endif
88
89#define DO_RET(R) BX(R)
90#define RETINSTR(C, R) BXC(C, R)
91
92/* Define an entry point visible from C. */
93#define ENTRY(name) \
94 .globl C_SYMBOL_NAME(name); \
95 .type C_SYMBOL_NAME(name),%function; \
96 .align ALIGNARG(4); \
97 C_LABEL(name) \
98 CFI_SECTIONS; \
99 cfi_startproc; \
100 CALL_MCOUNT
101
102#define CFI_SECTIONS \
103 .cfi_sections .debug_frame
104
105#undef END
106#define END(name) \
107 cfi_endproc; \
108 ASM_SIZE_DIRECTIVE(name)
109
110/* If compiled for profiling, call `mcount' at the start of each function. */
111#ifdef PROF
112/* Call __gnu_mcount_nc (GCC >= 4.4). */
113#define CALL_MCOUNT \
114 push {lr}; \
115 cfi_adjust_cfa_offset (4); \
116 cfi_rel_offset (lr, 0); \
117 bl PLTJMP(mcount); \
118 cfi_adjust_cfa_offset (-4); \
119 cfi_restore (lr)
120#else
121#define CALL_MCOUNT /* Do nothing. */
122#endif
123
124/* Since C identifiers are not normally prefixed with an underscore
125 on this system, the asm identifier `syscall_error' intrudes on the
126 C name space. Make sure we use an innocuous name. */
127#define syscall_error __syscall_error
128#define mcount __gnu_mcount_nc
129
130/* Tag_ABI_align8_preserved: This code preserves 8-byte
131 alignment in any callee. */
132 .eabi_attribute 25, 1
133/* Tag_ABI_align8_needed: This code may require 8-byte alignment from
134 the caller. */
135 .eabi_attribute 24, 1
136
137/* The thumb2 encoding is reasonably complete. Unless suppressed, use it. */
138 .syntax unified
139# if defined(__thumb2__) && !defined(NO_THUMB)
140 .thumb
141#else
142# undef __thumb__
143# undef __thumb2__
144 .arm
145# endif
146
147/* Load or store to/from address X + Y into/from R, (maybe) using T.
148 X or Y can use T freely; T can be R if OP is a load. The first
149 version eschews the two-register addressing mode, while the
150 second version uses it. */
151# define LDST_INDEXED_NOINDEX(OP, R, T, X, Y) \
152 add T, X, Y; \
153 OP R, [T]
154# define LDST_INDEXED_INDEX(OP, R, X, Y) \
155 OP R, [X, Y]
156
157# ifdef ARM_NO_INDEX_REGISTER
158/* We're never using the two-register addressing mode, so this
159 always uses an intermediate add. */
160# define LDST_INDEXED(OP, R, T, X, Y) LDST_INDEXED_NOINDEX (OP, R, T, X, Y)
161# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_NOINDEX (OP, R, T, pc, X)
162# else
163/* The two-register addressing mode is OK, except on Thumb with pc. */
164# define LDST_INDEXED(OP, R, T, X, Y) LDST_INDEXED_INDEX (OP, R, X, Y)
165# ifdef __thumb2__
166# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_NOINDEX (OP, R, T, pc, X)
167# else
168# define LDST_PC_INDEXED(OP, R, T, X) LDST_INDEXED_INDEX (OP, R, pc, X)
169# endif
170# endif
171
172/* Load or store to/from a pc-relative EXPR into/from R, using T. */
173# ifdef __thumb2__
174# define LDST_PCREL(OP, R, T, EXPR) \
175 ldr T, 98f; \
176 .subsection 2; \
17798: .word EXPR - 99f - PC_OFS; \
178 .previous; \
17999: add T, T, pc; \
180 OP R, [T]
181# elif defined (ARCH_HAS_T2) && ARM_PCREL_MOVW_OK
182# define LDST_PCREL(OP, R, T, EXPR) \
183 movw T, #:lower16:EXPR - 99f - PC_OFS; \
184 movt T, #:upper16:EXPR - 99f - PC_OFS; \
18599: LDST_PC_INDEXED (OP, R, T, T)
186# else
187# define LDST_PCREL(OP, R, T, EXPR) \
188 ldr T, 98f; \
189 .subsection 2; \
19098: .word EXPR - 99f - PC_OFS; \
191 .previous; \
19299: OP R, [pc, T]
193# endif
194
195/* Load from a global SYMBOL + CONSTANT into R, using T. */
196# if defined (ARCH_HAS_T2) && !defined (PIC)
197# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
198 movw T, #:lower16:SYMBOL; \
199 movt T, #:upper16:SYMBOL; \
200 ldr R, [T, $CONSTANT]
201# elif defined (ARCH_HAS_T2) && defined (PIC) && ARM_PCREL_MOVW_OK
202# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
203 movw R, #:lower16:_GLOBAL_OFFSET_TABLE_ - 97f - PC_OFS; \
204 movw T, #:lower16:99f - 98f - PC_OFS; \
205 movt R, #:upper16:_GLOBAL_OFFSET_TABLE_ - 97f - PC_OFS; \
206 movt T, #:upper16:99f - 98f - PC_OFS; \
207 .pushsection .rodata.cst4, "aM", %progbits, 4; \
208 .balign 4; \
20999: .word SYMBOL##(GOT); \
210 .popsection; \
21197: add R, R, pc; \
21298: LDST_PC_INDEXED (ldr, T, T, T); \
213 LDST_INDEXED (ldr, R, T, R, T); \
214 ldr R, [R, $CONSTANT]
215# else
216# define LDR_GLOBAL(R, T, SYMBOL, CONSTANT) \
217 ldr T, 99f; \
218 ldr R, 100f; \
21998: add T, T, pc; \
220 ldr T, [T, R]; \
221 .subsection 2; \
22299: .word _GLOBAL_OFFSET_TABLE_ - 98b - PC_OFS; \
223100: .word SYMBOL##(GOT); \
224 .previous; \
225 ldr R, [T, $CONSTANT]
226# endif
227
228/* This is the same as LDR_GLOBAL, but for a SYMBOL that is known to
229 be in the same linked object (as for one with hidden visibility).
230 We can avoid the GOT indirection in the PIC case. For the pure
231 static case, LDR_GLOBAL is already optimal. */
232# ifdef PIC
233# define LDR_HIDDEN(R, T, SYMBOL, CONSTANT) \
234 LDST_PCREL (ldr, R, T, SYMBOL + CONSTANT)
235# else
236# define LDR_HIDDEN(R, T, SYMBOL, CONSTANT) \
237 LDR_GLOBAL (R, T, SYMBOL, CONSTANT)
238# endif
239
240/* Cope with negative memory offsets, which thumb can't encode.
241 Use NEGOFF_ADJ_BASE to (conditionally) alter the base register,
242 and then NEGOFF_OFF1 to use 0 for thumb and the offset for arm,
243 or NEGOFF_OFF2 to use A-B for thumb and A for arm. */
244# ifdef __thumb2__
245# define NEGOFF_ADJ_BASE(R, OFF) add R, R, $OFF
246# define NEGOFF_ADJ_BASE2(D, S, OFF) add D, S, $OFF
247# define NEGOFF_OFF1(R, OFF) [R]
248# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $((OFFA) - (OFFB))]
249# else
250# define NEGOFF_ADJ_BASE(R, OFF)
251# define NEGOFF_ADJ_BASE2(D, S, OFF) mov D, S
252# define NEGOFF_OFF1(R, OFF) [R, $OFF]
253# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $OFFA]
254# endif
255
256/* Helper to get the TLS base pointer. The interface is that TMP is a
257 register that may be used to hold the LR, if necessary. TMP may be
258 LR itself to indicate that LR need not be saved. The base pointer
259 is returned in R0. Only R0 and TMP are modified. */
260
261# ifdef ARCH_HAS_HARD_TP
262/* If the cpu has cp15 available, use it. */
263# define GET_TLS(TMP) mrc p15, 0, r0, c13, c0, 3
264# else
265/* At this generic level we have no tricks to pull. Call the ABI routine. */
266# define GET_TLS(TMP) \
267 push { r1, r2, r3, lr }; \
268 cfi_remember_state; \
269 cfi_adjust_cfa_offset (16); \
270 cfi_rel_offset (r1, 0); \
271 cfi_rel_offset (r2, 4); \
272 cfi_rel_offset (r3, 8); \
273 cfi_rel_offset (lr, 12); \
274 bl __aeabi_read_tp; \
275 pop { r1, r2, r3, lr }; \
276 cfi_restore_state
277# endif /* ARCH_HAS_HARD_TP */
278
279/* These are the directives used for EABI unwind info.
280 Wrap them in macros so another configuration's sysdep.h
281 file can define them away if it doesn't use EABI unwind info. */
282# define eabi_fnstart .fnstart
283# define eabi_fnend .fnend
284# define eabi_save(...) .save __VA_ARGS__
285# define eabi_cantunwind .cantunwind
286# define eabi_pad(n) .pad n
287
288#endif /* __ASSEMBLER__ */
289
290/* This number is the offset from the pc at the current location. */
291#ifdef __thumb__
292# define PC_OFS 4
293#else
294# define PC_OFS 8
295#endif
lib/libc/glibc/sysdeps/generic/dl-dtprocnum.h deleted-21
......@@ -1,21 +0,0 @@
1/* Configuration of lookup functions.
2 Copyright (C) 2000-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* Number of extra dynamic section entries for this architecture. By
20 default there are none. */
21#define DT_THISPROCNUM 0
lib/libc/glibc/sysdeps/generic/libc-lock.h deleted-128
......@@ -1,128 +0,0 @@
1/* libc-internal interface for mutex locks. Stub version.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LIBC_LOCK_H
20#define _LIBC_LOCK_H 1
21
22
23/* Define a lock variable NAME with storage class CLASS. The lock must be
24 initialized with __libc_lock_init before it can be used (or define it
25 with __libc_lock_define_initialized, below). Use `extern' for CLASS to
26 declare a lock defined in another module. In public structure
27 definitions you must use a pointer to the lock structure (i.e., NAME
28 begins with a `*'), because its storage size will not be known outside
29 of libc. */
30#define __libc_lock_define(CLASS,NAME)
31#define __libc_lock_define_recursive(CLASS,NAME)
32#define __rtld_lock_define_recursive(CLASS,NAME)
33#define __libc_rwlock_define(CLASS,NAME)
34
35/* Define an initialized lock variable NAME with storage class CLASS. */
36#define __libc_lock_define_initialized(CLASS,NAME)
37#define __libc_rwlock_define_initialized(CLASS,NAME)
38
39/* Define an initialized recursive lock variable NAME with storage
40 class CLASS. */
41#define __libc_lock_define_initialized_recursive(CLASS,NAME)
42#define __rtld_lock_define_initialized_recursive(CLASS,NAME)
43
44/* Initialize the named lock variable, leaving it in a consistent, unlocked
45 state. */
46#define __libc_lock_init(NAME)
47#define __rtld_lock_initialize(NAME)
48#define __libc_rwlock_init(NAME)
49
50/* Same as last but this time we initialize a recursive mutex. */
51#define __libc_lock_init_recursive(NAME)
52
53/* Finalize the named lock variable, which must be locked. It cannot be
54 used again until __libc_lock_init is called again on it. This must be
55 called on a lock variable before the containing storage is reused. */
56#define __libc_lock_fini(NAME)
57#define __libc_rwlock_fini(NAME)
58
59/* Finalize recursive named lock. */
60#define __libc_lock_fini_recursive(NAME)
61
62/* Lock the named lock variable. */
63#define __libc_lock_lock(NAME)
64#define __libc_rwlock_rdlock(NAME)
65#define __libc_rwlock_wrlock(NAME)
66
67/* Lock the recursive named lock variable. */
68#define __libc_lock_lock_recursive(NAME)
69#define __rtld_lock_lock_recursive(NAME)
70
71/* Try to lock the named lock variable. */
72#define __libc_lock_trylock(NAME) 0
73#define __libc_rwlock_tryrdlock(NAME) 0
74#define __libc_rwlock_trywrlock(NAME) 0
75
76/* Try to lock the recursive named lock variable. */
77#define __libc_lock_trylock_recursive(NAME) 0
78
79/* Unlock the named lock variable. */
80#define __libc_lock_unlock(NAME)
81#define __libc_rwlock_unlock(NAME)
82
83/* Unlock the recursive named lock variable. */
84#define __libc_lock_unlock_recursive(NAME)
85#define __rtld_lock_unlock_recursive(NAME)
86
87
88/* Define once control variable. */
89#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
90
91/* Call handler iff the first call. */
92#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
93 do { \
94 if ((ONCE_CONTROL) == 0) { \
95 INIT_FUNCTION (); \
96 (ONCE_CONTROL) = 1; \
97 } \
98 } while (0)
99
100/* Get once control variable. */
101#define __libc_once_get(ONCE_CONTROL) \
102 ((ONCE_CONTROL) == 1)
103
104/* Start a critical region with a cleanup function */
105#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
106{ \
107 typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0; \
108 typeof (ARG) __save_ARG = ARG; \
109 /* close brace is in __libc_cleanup_region_end below. */
110
111/* End a critical region started with __libc_cleanup_region_start. */
112#define __libc_cleanup_region_end(DOIT) \
113 if ((DOIT) && __save_FCT != 0) \
114 (*__save_FCT)(__save_ARG); \
115}
116
117/* Sometimes we have to exit the block in the middle. */
118#define __libc_cleanup_end(DOIT) \
119 if ((DOIT) && __save_FCT != 0) \
120 (*__save_FCT)(__save_ARG); \
121
122#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
123#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
124
125/* We need portable names for some of the functions. */
126#define __libc_mutex_unlock
127
128#endif /* libc-lock.h */
lib/libc/glibc/sysdeps/generic/single-thread.h deleted-25
......@@ -1,25 +0,0 @@
1/* Single thread optimization, generic version.
2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SINGLE_THREAD_H
20#define _SINGLE_THREAD_H
21
22#define SINGLE_THREAD_P (0)
23#define RTLD_SINGLE_THREAD_P (0)
24
25#endif /* _SINGLE_THREAD_H */
lib/libc/glibc/sysdeps/generic/struct_stat_time64.h deleted-6
......@@ -1,6 +0,0 @@
1#ifndef _BITS_STRUCT_STAT_TIME64_H
2#define _BITS_STRUCT_STAT_TIME64_H 1
3
4#define __stat64_t64 stat64
5
6#endif
lib/libc/glibc/sysdeps/generic/sys/syscall.h deleted-2
......@@ -1,2 +0,0 @@
1/* For Unix-like systems, this file should contain definitions
2 of macros SYS_call for each system call, giving the call numbers. */
lib/libc/glibc/sysdeps/generic/xstatver.h deleted-4
......@@ -1,4 +0,0 @@
1/* Versions of the 'struct stat' data structure used in compatibility xstat
2 functions. */
3#define _STAT_VER 0
4#define _MKNOD_VER 0
lib/libc/glibc/sysdeps/htl/bits/pthread.h deleted-36
......@@ -1,36 +0,0 @@
1/* Pthread data structures. Generic version.
2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_PTHREAD_H
20#define _BITS_PTHREAD_H 1
21
22#include <bits/types/__pthread_t.h>
23
24/* Return true if __T1 and __T2 both name the same thread. Otherwise,
25 false. */
26extern int __pthread_equal (__pthread_t __t1, __pthread_t __t2);
27
28#ifdef __USE_EXTERN_INLINES
29__extern_inline int
30__pthread_equal (__pthread_t __t1, __pthread_t __t2)
31{
32 return __t1 == __t2;
33}
34#endif
35
36#endif /* bits/pthread.h */
lib/libc/glibc/sysdeps/htl/bits/thread-shared-types.h deleted-37
......@@ -1,37 +0,0 @@
1/* Common threading primitives definitions for both POSIX and C11.
2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _THREAD_SHARED_TYPES_H
20#define _THREAD_SHARED_TYPES_H 1
21
22#include <bits/pthreadtypes-arch.h>
23#include <bits/types/struct___pthread_once.h>
24#include <bits/types/__thrd_t.h>
25
26typedef int __tss_t;
27
28typedef union
29{
30 struct __pthread_once __data;
31 int __align __ONCE_ALIGNMENT;
32 char __size[__SIZEOF_PTHREAD_ONCE_T];
33} __once_flag;
34
35#define __ONCE_FLAG_INIT { { __PTHREAD_ONCE_INIT } }
36
37#endif /* _THREAD_SHARED_TYPES_H */
lib/libc/glibc/sysdeps/htl/libc-lockP.h deleted-116
......@@ -1,116 +0,0 @@
1/* Private libc-internal interface for mutex locks.
2 Copyright (C) 2015-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_LIBC_LOCKP_H
20#define _BITS_LIBC_LOCKP_H 1
21
22#include <pthread.h>
23
24typedef pthread_rwlock_t __libc_rwlock_t;
25
26#define __libc_rwlock_define(CLASS,NAME) \
27 CLASS __libc_rwlock_t NAME;
28#define __libc_rwlock_define_initialized(CLASS,NAME) \
29 CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER;
30#define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL)
31#define __libc_rwlock_fini(NAME) ((void) 0)
32#define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME))
33#define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME))
34#define __libc_rwlock_tryrdlock(NAME) __pthread_rwlock_tryrdlock (&(NAME))
35#define __libc_rwlock_trywrlock(NAME) __pthread_rwlock_trywrlock (&(NAME))
36#define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME))
37
38/* If we check for a weakly referenced symbol and then perform a
39 normal jump to it te code generated for some platforms in case of
40 PIC is unnecessarily slow. What would happen is that the function
41 is first referenced as data and then it is called indirectly
42 through the PLT. We can make this a direct jump. */
43#ifdef __PIC__
44# define __libc_maybe_call(FUNC, ARGS, ELSE) \
45 (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \
46 _fn != NULL ? (*_fn) ARGS : ELSE; }))
47#else
48# define __libc_maybe_call(FUNC, ARGS, ELSE) \
49 (FUNC != NULL ? FUNC ARGS : ELSE)
50#endif
51
52/* Functions that are used by this file and are internal to the GNU C
53 library. */
54
55extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
56 const pthread_mutexattr_t *__mutex_attr);
57extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
58libc_hidden_proto (__pthread_mutex_destroy)
59
60extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
61
62extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
63
64extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
65
66extern int __pthread_mutexattr_init (pthread_mutexattr_t *__attr);
67libc_hidden_proto (__pthread_mutexattr_init)
68
69extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
70libc_hidden_proto (__pthread_mutexattr_destroy)
71
72extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
73 const pthread_rwlockattr_t *__attr);
74libc_hidden_proto (__pthread_rwlock_init)
75
76extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
77libc_hidden_proto (__pthread_rwlock_destroy)
78
79extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
80libc_hidden_proto (__pthread_rwlock_rdlock)
81
82extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock);
83libc_hidden_proto (__pthread_rwlock_tryrdlock)
84
85extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
86libc_hidden_proto (__pthread_rwlock_wrlock)
87
88extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock);
89libc_hidden_proto (__pthread_rwlock_trywrlock)
90
91extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
92libc_hidden_proto (__pthread_rwlock_unlock)
93
94extern int __pthread_once (pthread_once_t *__once_control,
95 void (*__init_routine) (void));
96libc_hidden_proto (__pthread_once);
97
98extern int __pthread_atfork (void (*__prepare) (void),
99 void (*__parent) (void),
100 void (*__child) (void));
101
102extern int __pthread_setcancelstate (int state, int *oldstate);
103libc_hidden_proto (__pthread_setcancelstate)
104/* Make the pthread functions weak so that we can elide them from
105 single-threaded processes. */
106#if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread)
107# ifdef weak_extern
108weak_extern (__pthread_initialize)
109weak_extern (__pthread_atfork)
110# else
111# pragma weak __pthread_initialize
112# pragma weak __pthread_atfork
113# endif
114#endif
115
116#endif /* bits/libc-lockP.h */
lib/libc/glibc/sysdeps/htl/pthread.h deleted-921
......@@ -1,921 +0,0 @@
1/* Posix threads. Hurd version.
2 Copyright (C) 2000-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/*
20 * POSIX Threads Extension: ??? <pthread.h>
21 */
22
23#ifndef _PTHREAD_H
24#define _PTHREAD_H 1
25
26#include <features.h>
27
28#include <sys/cdefs.h>
29#ifndef __extern_inline
30/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
31 inline semantics, unless -fgnu89-inline is used. */
32# if !defined __cplusplus || __GNUC_PREREQ (4,3)
33# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
34# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
35# if __GNUC_PREREQ (4,3)
36# define __extern_always_inline \
37 extern __always_inline __attribute__ ((__gnu_inline__, __artificial__))
38# else
39# define __extern_always_inline \
40 extern __always_inline __attribute__ ((__gnu_inline__))
41# endif
42# else
43# define __extern_inline extern __inline
44# define __extern_always_inline extern __always_inline
45# endif
46# endif
47#endif
48
49#include <sched.h>
50#include <time.h>
51
52__BEGIN_DECLS
53
54#include <bits/pthreadtypes.h>
55
56#include <bits/pthread.h>
57
58/* Possible values for the process shared attribute. */
59#define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE
60#define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED
61
62
63/* Thread attributes. */
64
65/* Possible values for the inheritsched attribute. */
66#define PTHREAD_EXPLICIT_SCHED __PTHREAD_EXPLICIT_SCHED
67#define PTHREAD_INHERIT_SCHED __PTHREAD_INHERIT_SCHED
68
69/* Possible values for the `contentionscope' attribute. */
70#define PTHREAD_SCOPE_SYSTEM __PTHREAD_SCOPE_SYSTEM
71#define PTHREAD_SCOPE_PROCESS __PTHREAD_SCOPE_PROCESS
72
73/* Possible values for the `detachstate' attribute. */
74#define PTHREAD_CREATE_JOINABLE __PTHREAD_CREATE_JOINABLE
75#define PTHREAD_CREATE_DETACHED __PTHREAD_CREATE_DETACHED
76
77#include <bits/types/struct___pthread_attr.h>
78
79/* Initialize the thread attribute object in *ATTR to the default
80 values. */
81extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
82
83/* Destroy the thread attribute object in *ATTR. */
84extern int pthread_attr_destroy (pthread_attr_t *__attr)
85 __THROW __nonnull ((1));
86
87
88/* Return the value of the inheritsched attribute in *ATTR in
89 *INHERITSCHED. */
90extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,
91 int *__restrict __inheritsched)
92 __THROW __nonnull ((1, 2));
93
94/* Set the value of the inheritsched attribute in *ATTR to
95 INHERITSCHED. */
96extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
97 int __inheritsched)
98 __THROW __nonnull ((1));
99
100
101/* Return the value of the schedparam attribute in *ATTR in *PARAM. */
102extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
103 struct sched_param *__restrict __param)
104 __THROW __nonnull ((1, 2));
105
106/* Set the value of the schedparam attribute in *ATTR to PARAM. */
107extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
108 const struct sched_param *__restrict
109 __param) __THROW __nonnull ((1, 2));
110
111
112/* Return the value of the schedpolicy attribute in *ATTR to *POLICY. */
113extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr,
114 int *__restrict __policy)
115 __THROW __nonnull ((1, 2));
116
117/* Set the value of the schedpolicy attribute in *ATTR to POLICY. */
118extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr,
119 int __policy)
120 __THROW __nonnull ((1));
121
122
123/* Return the value of the contentionscope attribute in *ATTR in
124 *CONTENTIONSCOPE. */
125extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
126 int *__restrict __contentionscope)
127 __THROW __nonnull ((1, 2));
128
129/* Set the value of the contentionscope attribute in *ATTR to
130 CONTENTIONSCOPE. */
131extern int pthread_attr_setscope (pthread_attr_t *__attr,
132 int __contentionscope)
133 __THROW __nonnull ((1));
134
135
136/* Return the value of the stackaddr attribute in *ATTR in
137 *STACKADDR. */
138extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
139 void **__restrict __stackaddr)
140 __THROW __nonnull ((1, 2));
141
142/* Set the value of the stackaddr attribute in *ATTR to STACKADDR. */
143extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
144 void *__stackaddr)
145 __THROW __nonnull ((1));
146
147
148#ifdef __USE_XOPEN2K
149/* Return the value of the stackaddr and stacksize attributes in *ATTR
150 in *STACKADDR and *STACKSIZE respectively. */
151extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
152 void **__restrict __stackaddr,
153 size_t *__restrict __stacksize)
154 __THROW __nonnull ((1, 2, 3));
155
156/* Set the value of the stackaddr and stacksize attributes in *ATTR to
157 STACKADDR and STACKSIZE respectively. */
158extern int pthread_attr_setstack (pthread_attr_t *__attr,
159 void *__stackaddr,
160 size_t __stacksize)
161 __THROW __nonnull ((1));
162#endif
163
164
165/* Return the value of the detachstate attribute in *ATTR in
166 *DETACHSTATE. */
167extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
168 int *__detachstate)
169 __THROW __nonnull ((1, 2));
170
171/* Set the value of the detachstate attribute in *ATTR to
172 DETACHSTATE. */
173extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
174 int __detachstate)
175 __THROW __nonnull ((1));
176
177
178/* Return the value of the guardsize attribute in *ATTR in
179 *GUARDSIZE. */
180extern int pthread_attr_getguardsize (const pthread_attr_t *__restrict __attr,
181 size_t *__restrict __guardsize)
182 __THROW __nonnull ((1, 2));
183
184/* Set the value of the guardsize attribute in *ATTR to GUARDSIZE. */
185extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
186 size_t __guardsize)
187 __THROW __nonnull ((1));
188
189
190/* Return the value of the stacksize attribute in *ATTR in
191 *STACKSIZE. */
192extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr,
193 size_t *__restrict __stacksize)
194 __THROW __nonnull ((1, 2));
195
196/* Set the value of the stacksize attribute in *ATTR to STACKSIZE. */
197extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
198 size_t __stacksize)
199 __THROW __nonnull ((1));
200
201#ifdef __USE_GNU
202/* Initialize thread attribute *ATTR with attributes corresponding to the
203 already running thread THREAD. It shall be called on an uninitialized ATTR
204 and destroyed with pthread_attr_destroy when no longer needed. */
205extern int pthread_getattr_np (pthread_t __thr, pthread_attr_t *__attr)
206 __THROW __nonnull ((2));
207#endif
208
209
210/* Create a thread with attributes given by ATTR, executing
211 START_ROUTINE with argument ARG. */
212extern int pthread_create (pthread_t *__restrict __threadp,
213 __const pthread_attr_t *__restrict __attr,
214 void *(*__start_routine)(void *),
215 void *__restrict __arg) __THROWNL __nonnull ((1, 3));
216
217/* Terminate the current thread and make STATUS available to any
218 thread that might join us. */
219extern void pthread_exit (void *__status) __attribute__ ((__noreturn__));
220
221/* Make calling thread wait for termination of thread THREAD. Return
222 the exit status of the thread in *STATUS. */
223extern int pthread_join (pthread_t __threadp, void **__status);
224
225#ifdef __USE_GNU
226/* Check whether thread TH has terminated. If yes return the status of
227 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
228extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
229
230/* Make calling thread wait for termination of the thread TH, but only
231 until TIMEOUT. The exit status of the thread is stored in
232 *THREAD_RETURN, if THREAD_RETURN is not NULL.
233
234 This function is a cancellation point and therefore not marked with
235 __THROW. */
236extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
237 const struct timespec *__abstime);
238
239/* Make calling thread wait for termination of the thread TH, but only
240 until TIMEOUT measured against the clock specified by CLOCKID. The
241 exit status of the thread is stored in *THREAD_RETURN, if
242 THREAD_RETURN is not NULL.
243
244 This function is a cancellation point and therefore not marked with
245 __THROW. */
246extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
247 clockid_t __clockid,
248 const struct timespec *__abstime);
249#endif
250
251/* Indicate that the storage for THREAD can be reclaimed when it
252 terminates. */
253extern int pthread_detach (pthread_t __threadp);
254
255/* Compare thread IDs T1 and T2. Return nonzero if they are equal, 0
256 if they are not. */
257extern int pthread_equal (pthread_t __t1, pthread_t __t2);
258
259#ifdef __USE_EXTERN_INLINES
260
261__extern_inline int
262pthread_equal (pthread_t __t1, pthread_t __t2)
263{
264 return __pthread_equal (__t1, __t2);
265}
266
267#endif /* Use extern inlines. */
268
269
270/* Return the thread ID of the calling thread. */
271extern pthread_t pthread_self (void) __THROW;
272
273
274/* Mutex attributes. */
275
276#define PTHREAD_PRIO_NONE_NP __PTHREAD_PRIO_NONE
277#define PTHREAD_PRIO_INHERIT_NP __PTHREAD_PRIO_INHERIT
278#define PTHREAD_PRIO_PROTECT_NP __PTHREAD_PRIO_PROTECT
279#ifdef __USE_UNIX98
280# define PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE_NP
281# define PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT_NP
282# define PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT_NP
283#endif
284
285#define PTHREAD_MUTEX_TIMED_NP __PTHREAD_MUTEX_TIMED
286#define PTHREAD_MUTEX_ERRORCHECK_NP __PTHREAD_MUTEX_ERRORCHECK
287#define PTHREAD_MUTEX_RECURSIVE_NP __PTHREAD_MUTEX_RECURSIVE
288#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
289# define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_TIMED_NP
290# define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
291# define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
292# define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
293#endif
294#ifdef __USE_GNU
295/* For compatibility. */
296# define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_TIMED_NP
297#endif
298
299#ifdef __USE_XOPEN2K
300# define PTHREAD_MUTEX_STALLED __PTHREAD_MUTEX_STALLED
301# define PTHREAD_MUTEX_ROBUST __PTHREAD_MUTEX_ROBUST
302# define PTHREAD_MUTEX_ROBUST_NP __PTHREAD_MUTEX_ROBUST
303#endif
304
305#include <bits/types/struct___pthread_mutexattr.h>
306
307/* Initialize the mutex attribute object in *ATTR to the default
308 values. */
309extern int pthread_mutexattr_init(pthread_mutexattr_t *__attr)
310 __THROW __nonnull ((1));
311
312/* Destroy the mutex attribute structure in *ATTR. */
313extern int pthread_mutexattr_destroy(pthread_mutexattr_t *__attr)
314 __THROW __nonnull ((1));
315
316
317#ifdef __USE_UNIX98
318/* Return the value of the prioceiling attribute in *ATTR in
319 *PRIOCEILING. */
320extern int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *__restrict __attr,
321 int *__restrict __prioceiling)
322 __THROW __nonnull ((1, 2));
323
324/* Set the value of the prioceiling attribute in *ATTR to
325 PRIOCEILING. */
326extern int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *__attr,
327 int __prioceiling)
328 __THROW __nonnull ((1));
329
330
331/* Return the value of the protocol attribute in *ATTR in
332 *PROTOCOL. */
333extern int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *__restrict __attr,
334 int *__restrict __protocol)
335 __THROW __nonnull ((1, 2));
336
337/* Set the value of the protocol attribute in *ATTR to PROTOCOL. */
338extern int pthread_mutexattr_setprotocol(pthread_mutexattr_t *__attr,
339 int __protocol)
340 __THROW __nonnull ((1));
341#endif
342
343#ifdef __USE_XOPEN2K
344/* Get the robustness flag of the mutex attribute ATTR. */
345extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
346 int *__robustness)
347 __THROW __nonnull ((1, 2));
348# ifdef __USE_GNU
349extern int pthread_mutexattr_getrobust_np (const pthread_mutexattr_t *__attr,
350 int *__robustness)
351 __THROW __nonnull ((1, 2));
352# endif
353
354/* Set the robustness flag of the mutex attribute ATTR. */
355extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
356 int __robustness)
357 __THROW __nonnull ((1));
358# ifdef __USE_GNU
359extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
360 int __robustness)
361 __THROW __nonnull ((1));
362# endif
363#endif
364
365
366/* Return the value of the process shared attribute in *ATTR in
367 *PSHARED. */
368extern int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict __attr,
369 int *__restrict __pshared)
370 __THROW __nonnull ((1, 2));
371
372/* Set the value of the process shared attribute in *ATTR to
373 PSHARED. */
374extern int pthread_mutexattr_setpshared(pthread_mutexattr_t *__attr,
375 int __pshared)
376 __THROW __nonnull ((1));
377
378
379#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
380/* Return the value of the type attribute in *ATTR in *TYPE. */
381extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict __attr,
382 int *__restrict __type)
383 __THROW __nonnull ((1, 2));
384
385/* Set the value of the type attribute in *ATTR to TYPE. */
386extern int pthread_mutexattr_settype(pthread_mutexattr_t *__attr,
387 int __type)
388 __THROW __nonnull ((1));
389#endif
390
391
392/* Mutexes. */
393
394#include <bits/types/struct___pthread_mutex.h>
395
396#define PTHREAD_MUTEX_INITIALIZER __PTHREAD_MUTEX_INITIALIZER
397/* Static initializer for recursive mutexes. */
398
399#ifdef __USE_GNU
400# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
401 __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
402# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
403 __PTHREAD_RECURSIVE_MUTEX_INITIALIZER
404#endif
405
406/* Create a mutex with attributes given by ATTR and store it in
407 *__MUTEX. */
408extern int pthread_mutex_init (struct __pthread_mutex *__restrict __mutex,
409 const pthread_mutexattr_t *__restrict __attr)
410 __THROW __nonnull ((1));
411
412/* Destroy the mutex __MUTEX. */
413extern int pthread_mutex_destroy (struct __pthread_mutex *__mutex)
414 __THROW __nonnull ((1));
415
416/* Wait until lock for MUTEX becomes available and lock it. */
417extern int pthread_mutex_lock (pthread_mutex_t *__mutex);
418
419/* Try to lock MUTEX. */
420extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
421 __THROWNL __nonnull ((1));
422
423#ifdef __USE_XOPEN2K
424/* Try to lock MUTEX, block until *ABSTIME if it is already held. */
425extern int pthread_mutex_timedlock (struct __pthread_mutex *__restrict __mutex,
426 const struct timespec *__restrict __abstime)
427 __THROWNL __nonnull ((1, 2));
428#endif
429
430#ifdef __USE_GNU
431extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
432 clockid_t __clockid,
433 const struct timespec *__restrict
434 __abstime) __THROWNL __nonnull ((1, 3));
435#endif
436
437/* Unlock MUTEX. */
438extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
439 __THROWNL __nonnull ((1));
440
441/* Transfer ownership of the mutex MUTEX to the thread TID. The
442 caller must own the lock. */
443extern int __pthread_mutex_transfer_np (struct __pthread_mutex *__mutex,
444 pthread_t __tid)
445 __THROWNL __nonnull ((1));
446
447
448#ifdef __USE_UNIX98
449/* Return the priority ceiling of mutex *MUTEX in *PRIOCEILING. */
450extern int pthread_mutex_getprioceiling (const pthread_mutex_t *__restrict __mutex,
451 int *__restrict __prioceiling)
452 __THROW __nonnull ((1, 2));
453
454/* After acquiring the mutex *MUTEX, set its priority ceiling to PRIO
455 and return the old priority ceiling in *OLDPRIO. Before returning,
456 release the mutex. */
457extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
458 int __prio, int *__restrict __oldprio)
459 __THROW __nonnull ((1, 3));
460#endif
461
462#ifdef __USE_XOPEN2K8
463
464/* Declare the state protected by robust mutex MTXP as consistent. */
465extern int pthread_mutex_consistent (pthread_mutex_t *__mtxp)
466 __THROW __nonnull ((1));
467
468# ifdef __USE_GNU
469extern int pthread_mutex_consistent_np (pthread_mutex_t *__mtxp)
470 __THROW __nonnull ((1));
471# endif
472#endif
473
474
475
476/* Condition attributes. */
477
478#include <bits/types/struct___pthread_condattr.h>
479
480/* Initialize the condition attribute in *ATTR to the default
481 values. */
482extern int pthread_condattr_init (pthread_condattr_t *__attr)
483 __THROW __nonnull ((1));
484
485/* Destroy the condition attribute structure in *ATTR. */
486extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
487 __THROW __nonnull ((1));
488
489
490#ifdef __USE_XOPEN2K
491/* Return the value of the clock attribute in *ATTR in *CLOCK_ID. */
492extern int pthread_condattr_getclock (const pthread_condattr_t *__restrict __attr,
493 __clockid_t *__restrict __clock_id)
494 __THROW __nonnull ((1, 2));
495
496/* Set the value of the clock attribute in *ATTR to CLOCK_ID. */
497extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
498 __clockid_t __clock_id)
499 __THROW __nonnull ((1));
500#endif
501
502
503/* Return the value of the process shared attribute in *ATTR in
504 *PSHARED. */
505extern int pthread_condattr_getpshared (const pthread_condattr_t *__restrict __attr,
506 int *__restrict __pshared)
507 __THROW __nonnull ((1, 2));
508
509/* Set the value of the process shared attribute in *ATTR to
510 PSHARED. */
511extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
512 int __pshared)
513 __THROW __nonnull ((1));
514
515
516/* Condition variables. */
517
518#include <bits/types/struct___pthread_cond.h>
519
520#define PTHREAD_COND_INITIALIZER __PTHREAD_COND_INITIALIZER
521
522extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
523 const pthread_condattr_t *__restrict __attr)
524 __THROW __nonnull ((1));
525
526extern int pthread_cond_destroy (pthread_cond_t *__cond)
527 __THROW __nonnull ((1));
528
529/* Unblock at least one of the threads that are blocked on condition
530 variable COND. */
531extern int pthread_cond_signal (pthread_cond_t *__cond)
532 __THROWNL __nonnull ((1));
533
534/* Unblock all threads that are blocked on condition variable COND. */
535extern int pthread_cond_broadcast (pthread_cond_t *__cond)
536 __THROWNL __nonnull ((1));
537
538/* Block on condition variable COND. MUTEX should be held by the
539 calling thread. On success, MUTEX will be held by the calling
540 thread. */
541extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
542 pthread_mutex_t *__restrict __mutex)
543 __nonnull ((1, 2));
544
545/* Block on condition variable COND. MUTEX should be held by the
546 calling thread. On success, MUTEX will be held by the calling
547 thread. If the time specified by ABSTIME passes, ETIMEDOUT is
548 returned, and MUTEX will nevertheless be held. */
549extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
550 pthread_mutex_t *__restrict __mutex,
551 __const struct timespec *__restrict __abstime)
552 __nonnull ((1, 2, 3));
553
554# ifdef __USE_GNU
555/* Wait for condition variable COND to be signaled or broadcast until
556 ABSTIME measured by the specified clock. MUTEX is assumed to be
557 locked before. CLOCK is the clock to use. ABSTIME is an absolute
558 time specification against CLOCK's epoch.
559
560 This function is a cancellation point and therefore not marked with
561 __THROW. */
562extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
563 pthread_mutex_t *__restrict __mutex,
564 __clockid_t __clock_id,
565 const struct timespec *__restrict __abstime)
566 __nonnull ((1, 2, 4));
567# endif
568
569
570/* Spin locks. */
571
572#ifdef __USE_XOPEN2K
573
574# include <bits/types/__pthread_spinlock_t.h>
575
576# define PTHREAD_SPINLOCK_INITIALIZER __PTHREAD_SPIN_LOCK_INITIALIZER
577
578/* Destroy the spin lock object LOCK. */
579extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
580 __nonnull ((1));
581
582/* Initialize the spin lock object LOCK. PSHARED determines whether
583 the spin lock can be operated upon by multiple processes. */
584extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
585 __nonnull ((1));
586
587/* Lock the spin lock object LOCK. If the lock is held by another
588 thread spin until it becomes available. */
589extern int pthread_spin_lock (pthread_spinlock_t *__lock)
590 __nonnull ((1));
591
592/* Lock the spin lock object LOCK. Fail if the lock is held by
593 another thread. */
594extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
595 __nonnull ((1));
596
597/* Unlock the spin lock object LOCK. */
598extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
599 __nonnull ((1));
600
601#endif /* XPG6. */
602
603
604/* rwlock attributes. */
605
606#if defined __USE_UNIX98 || defined __USE_XOPEN2K
607
608# include <bits/types/struct___pthread_rwlockattr.h>
609
610/* Initialize rwlock attribute object in *ATTR to the default
611 values. */
612extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
613 __THROW __nonnull ((1));
614
615/* Destroy the rwlock attribute object in *ATTR. */
616extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
617 __THROW __nonnull ((1));
618
619
620/* Return the value of the process shared attribute in *ATTR in
621 *PSHARED. */
622extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__restrict __attr,
623 int *__restrict __pshared)
624 __THROW __nonnull ((1, 2));
625
626/* Set the value of the process shared attribute in *ATTR to
627 PSHARED. */
628extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
629 int __pshared)
630 __THROW __nonnull ((1));
631
632/* Return current setting of reader/writer preference. */
633extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
634 __restrict __attr,
635 int *__restrict __pref)
636 __THROW __nonnull ((1, 2));
637
638/* Set reader/write preference. */
639extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
640 int __pref) __THROW __nonnull ((1));
641
642
643/* rwlocks. */
644
645# include <bits/types/struct___pthread_rwlock.h>
646
647# define PTHREAD_RWLOCK_INITIALIZER __PTHREAD_RWLOCK_INITIALIZER
648/* Create a rwlock object with attributes given by ATTR and store the
649 result in *RWLOCK. */
650extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
651 const pthread_rwlockattr_t *__restrict __attr)
652 __THROW __nonnull ((1));
653
654/* Destroy the rwlock *RWLOCK. */
655extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
656 __THROW __nonnull ((1));
657
658/* Acquire the rwlock *RWLOCK for reading. */
659extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
660 __THROWNL __nonnull ((1));
661
662/* Acquire the rwlock *RWLOCK for reading. */
663extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
664 __THROWNL __nonnull ((1));
665
666# ifdef __USE_XOPEN2K
667/* Acquire the rwlock *RWLOCK for reading blocking until *ABSTIME if
668 it is already held. */
669extern int pthread_rwlock_timedrdlock (struct __pthread_rwlock *__restrict __rwlock,
670 const struct timespec *__restrict __abstime)
671 __THROWNL __nonnull ((1, 2));
672# endif
673
674# ifdef __USE_GNU
675extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
676 clockid_t __clockid,
677 const struct timespec *__restrict
678 __abstime) __THROWNL __nonnull ((1, 3));
679# endif
680
681/* Acquire the rwlock *RWLOCK for writing. */
682extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
683 __THROWNL __nonnull ((1));
684
685/* Try to acquire the rwlock *RWLOCK for writing. */
686extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
687 __THROWNL __nonnull ((1));
688
689# ifdef __USE_XOPEN2K
690/* Acquire the rwlock *RWLOCK for writing blocking until *ABSTIME if
691 it is already held. */
692extern int pthread_rwlock_timedwrlock (struct __pthread_rwlock *__restrict __rwlock,
693 const struct timespec *__restrict __abstime)
694 __THROWNL __nonnull ((1, 2));
695# endif
696
697# ifdef __USE_GNU
698extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
699 clockid_t __clockid,
700 const struct timespec *__restrict
701 __abstime) __THROWNL __nonnull ((1, 3));
702# endif
703
704/* Release the lock held by the current thread on *RWLOCK. */
705extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
706 __THROWNL __nonnull ((1));
707
708#endif /* __USE_UNIX98 || __USE_XOPEN2K */
709
710
711
712/* Cancellation. */
713
714/* Register a cleanup handler. */
715extern void pthread_cleanup_push (void (*__routine) (void *), void *__arg);
716
717/* Unregister a cleanup handler. */
718extern void pthread_cleanup_pop (int __execute);
719
720#include <bits/cancelation.h>
721
722#define pthread_cleanup_push(rt, rtarg) __pthread_cleanup_push(rt, rtarg)
723#define pthread_cleanup_pop(execute) __pthread_cleanup_pop(execute)
724
725#define PTHREAD_CANCEL_DISABLE 0
726#define PTHREAD_CANCEL_ENABLE 1
727
728/* Return the calling thread's cancelation state in *OLDSTATE and set
729 its state to STATE. */
730extern int pthread_setcancelstate (int __state, int *__oldstate);
731
732#define PTHREAD_CANCEL_DEFERRED 0
733#define PTHREAD_CANCEL_ASYNCHRONOUS 1
734
735/* Return the calling thread's cancelation type in *OLDTYPE and set
736 its type to TYPE. */
737extern int pthread_setcanceltype (int __type, int *__oldtype);
738
739/* Value returned by pthread_join if the target thread was
740 canceled. */
741#define PTHREAD_CANCELED ((void *) -1)
742
743/* Cancel THEAD. */
744extern int pthread_cancel (pthread_t __thr);
745
746/* Add an explicit cancelation point. */
747extern void pthread_testcancel (void);
748
749
750/* Barriers attributes. */
751
752#ifdef __USE_XOPEN2K
753
754# include <bits/types/struct___pthread_barrierattr.h>
755
756/* Initialize barrier attribute object in *ATTR to the default
757 values. */
758extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
759 __THROW __nonnull ((1));
760
761/* Destroy the barrier attribute object in *ATTR. */
762extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
763 __THROW __nonnull ((1));
764
765
766/* Return the value of the process shared attribute in *ATTR in
767 *PSHARED. */
768extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *__restrict __attr,
769 int *__restrict __pshared)
770 __THROW __nonnull ((1, 2));
771
772/* Set the value of the process shared attribute in *ATTR to
773 PSHARED. */
774extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
775 int __pshared)
776 __THROW __nonnull ((1));
777
778
779/* Barriers. */
780
781# include <bits/types/struct___pthread_barrier.h>
782
783/* Returned by pthread_barrier_wait to exactly one thread each time a
784 barrier is passed. */
785# define PTHREAD_BARRIER_SERIAL_THREAD -1
786
787/* Initialize barrier BARRIER. */
788extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
789 const pthread_barrierattr_t *__restrict __attr,
790 unsigned __count)
791 __THROW __nonnull ((1));
792
793/* Destroy barrier BARRIER. */
794extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
795 __THROW __nonnull ((1));
796
797/* Wait on barrier BARRIER. */
798extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
799 __THROWNL __nonnull ((1));
800
801#endif /* __USE_XOPEN2K */
802
803
804
805/* Thread specific data. */
806
807#include <bits/types/__pthread_key.h>
808
809/* Create a thread specific data key in KEY visible to all threads.
810 On thread destruction, DESTRUCTOR shall be called with the thread
811 specific data associate with KEY if it is not NULL. */
812extern int pthread_key_create (pthread_key_t *__key,
813 void (*__destructor) (void *))
814 __THROW __nonnull ((1));
815
816/* Delete the thread specific data key KEY. The associated destructor
817 function is not called. */
818extern int pthread_key_delete (pthread_key_t __key) __THROW;
819
820/* Return the caller thread's thread specific value of KEY. */
821extern void *pthread_getspecific (pthread_key_t __key) __THROW;
822
823/* Set the caller thread's thread specific value of KEY to VALUE. */
824extern int pthread_setspecific (pthread_key_t __key, const void *__value)
825 __THROW __attr_access_none (2);
826
827
828/* Dynamic package initialization. */
829
830#include <bits/types/struct___pthread_once.h>
831
832#define PTHREAD_ONCE_INIT (struct __pthread_once) { __PTHREAD_ONCE_INIT }
833
834/* Call INIT_ROUTINE if this function has never been called with
835 *ONCE_CONTROL, otherwise do nothing. */
836extern int pthread_once (pthread_once_t *__once_control,
837 void (*__init_routine) (void)) __nonnull ((1, 2));
838
839
840/* Concurrency. */
841
842#ifdef __USE_UNIX98
843/* Set the desired concurrency level to NEW_LEVEL. */
844extern int pthread_setconcurrency (int __new_level) __THROW;
845
846/* Get the current concurrency level. */
847extern int pthread_getconcurrency (void) __THROW;
848#endif
849
850
851/* Forking. */
852
853/* Register the function PREPARE to be run before the process forks,
854 the function PARENT to be run after a fork in the parent and the
855 function CHILD to be run in the child after the fork. If no
856 handling is desired then any of PREPARE, PARENT and CHILD may be
857 NULL. The prepare handles will be called in the reverse order
858 which they were registered and the parent and child handlers in the
859 order in which they were registered. */
860extern int pthread_atfork (void (*__prepare) (void), void (*__parent) (void),
861 void (*__child) (void)) __THROW;
862
863
864/* Signals (should be in <signal.h>). */
865
866/* Send signal SIGNO to thread THREAD. */
867extern int pthread_kill (pthread_t __thr, int __signo) __THROW;
868
869
870/* Time. */
871
872#ifdef __USE_XOPEN2K
873/* Return the thread cpu clock. */
874extern int pthread_getcpuclockid (pthread_t __thr, __clockid_t *__clock)
875 __THROW __nonnull ((2));
876#endif
877
878
879/* Scheduling. */
880
881/* Return thread THREAD's scheduling parameters. */
882extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy,
883 struct sched_param *__restrict __param)
884 __THROW __nonnull ((2, 3));
885
886/* Set thread THREAD's scheduling parameters. */
887extern int pthread_setschedparam (pthread_t __thr, int __policy,
888 const struct sched_param *__param)
889 __THROW __nonnull ((3));
890
891/* Set thread THREAD's scheduling priority. */
892extern int pthread_setschedprio (pthread_t __thr, int __prio) __THROW;
893
894#ifdef __USE_GNU
895/* Get thread name visible in the kernel and its interfaces. */
896extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
897 size_t __buflen)
898 __THROW __nonnull ((2)) __attr_access ((__write_only__, 2));
899
900/* Set thread name visible in the kernel and its interfaces. */
901extern int pthread_setname_np (pthread_t __target_thread, const char *__name)
902 __THROW __nonnull ((2)) __attr_access ((__read_only__, 2));
903#endif
904
905#ifdef __USE_GNU
906/* Yield the processor to another thread or process.
907 This function is similar to the POSIX `sched_yield' function but
908 might be differently implemented in the case of a m-on-n thread
909 implementation. */
910extern int pthread_yield (void) __THROW;
911#endif
912
913
914/* Kernel-specific interfaces. */
915
916#include <bits/pthread-np.h>
917
918
919__END_DECLS
920
921#endif /* pthread.h */
lib/libc/glibc/sysdeps/i386/htl/bits/pthreadtypes-arch.h deleted-36
......@@ -1,36 +0,0 @@
1/* Machine-specific pthread type layouts. Hurd i386 version.
2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_PTHREADTYPES_ARCH_H
20#define _BITS_PTHREADTYPES_ARCH_H 1
21
22#define __SIZEOF_PTHREAD_MUTEX_T 32
23#define __SIZEOF_PTHREAD_ATTR_T 32
24#define __SIZEOF_PTHREAD_RWLOCK_T 28
25#define __SIZEOF_PTHREAD_BARRIER_T 24
26#define __SIZEOF_PTHREAD_MUTEXATTR_T 16
27#define __SIZEOF_PTHREAD_COND_T 20
28#define __SIZEOF_PTHREAD_CONDATTR_T 8
29#define __SIZEOF_PTHREAD_RWLOCKATTR_T 4
30#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
31#define __SIZEOF_PTHREAD_ONCE_T 8
32
33#define __LOCK_ALIGNMENT
34#define __ONCE_ALIGNMENT
35
36#endif /* bits/pthreadtypes.h */
lib/libc/glibc/sysdeps/m68k/coldfire/sysdep.h deleted-40
......@@ -1,40 +0,0 @@
1/* Assembler macros for Coldfire.
2 Copyright (C) 1998-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/m68k/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* Perform operation OP with PC-relative SRC as the first operand and
24 DST as the second. TMP is available as a temporary if needed. */
25# define PCREL_OP(OP, SRC, DST, TMP) \
26 move.l &SRC - ., TMP; OP (-8, %pc, TMP), DST
27
28/* Load the address of the GOT into register R. */
29# define LOAD_GOT(R) \
30 move.l &_GLOBAL_OFFSET_TABLE_@GOTPC, R; \
31 lea (-6, %pc, R), R
32
33#else
34
35/* As above, but PC is the spelling of the PC register. We need this
36 so that the macro can be used in both normal and extended asms. */
37# define PCREL_OP(OP, SRC, DST, TMP, PC) \
38 "move.l #" SRC " - ., " TMP "\n\t" OP " (-8, " PC ", " TMP "), " DST
39
40#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/mach/libc-lock.h deleted-226
......@@ -1,226 +0,0 @@
1/* libc-internal interface for mutex locks. Mach cthreads version.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _LIBC_LOCK_H
20#define _LIBC_LOCK_H 1
21
22#ifdef _LIBC
23
24#include <tls.h>
25#include <lowlevellock.h>
26
27typedef unsigned int __libc_lock_t;
28typedef struct
29{
30 __libc_lock_t lock;
31 int cnt;
32 void *owner;
33} __libc_lock_recursive_t;
34
35typedef __libc_lock_recursive_t __rtld_lock_recursive_t;
36
37#define __libc_lock_owner_self() \
38 (__LIBC_NO_TLS () ? (void *) 1 : THREAD_SELF)
39
40#else
41typedef struct __libc_lock_opaque__ __libc_lock_t;
42typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
43#endif
44
45/* Define a lock variable NAME with storage class CLASS. The lock must be
46 initialized with __libc_lock_init before it can be used (or define it
47 with __libc_lock_define_initialized, below). Use `extern' for CLASS to
48 declare a lock defined in another module. In public structure
49 definitions you must use a pointer to the lock structure (i.e., NAME
50 begins with a `*'), because its storage size will not be known outside
51 of libc. */
52#define __libc_lock_define(CLASS,NAME) \
53 CLASS __libc_lock_t NAME;
54
55/* Define an initialized lock variable NAME with storage class CLASS. */
56#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
57#define __libc_lock_define_initialized(CLASS,NAME) \
58 CLASS __libc_lock_t NAME = LLL_LOCK_INITIALIZER;
59
60/* Initialize the named lock variable, leaving it in a consistent, unlocked
61 state. */
62#define __libc_lock_init(NAME) (NAME) = LLL_LOCK_INITIALIZER
63
64/* Finalize the named lock variable, which must be locked. It cannot be
65 used again until __libc_lock_init is called again on it. This must be
66 called on a lock variable before the containing storage is reused. */
67#define __libc_lock_fini __libc_lock_unlock
68#define __libc_lock_fini_recursive __libc_lock_unlock_recursive
69#define __rtld_lock_fini_recursive __rtld_lock_unlock_recursive
70
71/* Lock the named lock variable. */
72#define __libc_lock_lock(NAME) \
73 ({ lll_lock ((NAME), LLL_PRIVATE); 0; })
74
75/* Lock the named lock variable. */
76#define __libc_lock_trylock(NAME) lll_trylock (NAME)
77
78/* Unlock the named lock variable. */
79#define __libc_lock_unlock(NAME) \
80 ({ lll_unlock ((NAME), LLL_PRIVATE); 0; })
81
82#define __libc_lock_define_recursive(CLASS,NAME) \
83 CLASS __libc_lock_recursive_t NAME;
84
85#define _LIBC_LOCK_RECURSIVE_INITIALIZER { LLL_LOCK_INITIALIZER, 0, 0 }
86
87#define __libc_lock_define_initialized_recursive(CLASS,NAME) \
88 CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
89
90#define __rtld_lock_define_recursive(CLASS,NAME) \
91 __libc_lock_define_recursive (CLASS, NAME)
92#define _RTLD_LOCK_RECURSIVE_INITIALIZER \
93 _LIBC_LOCK_RECURSIVE_INITIALIZER
94#define __rtld_lock_define_initialized_recursive(CLASS,NAME) \
95 __libc_lock_define_initialized_recursive (CLASS, NAME)
96
97#define __libc_lock_init_recursive(NAME) \
98 ({ \
99 (NAME) = (__libc_lock_recursive_t)_LIBC_LOCK_RECURSIVE_INITIALIZER; \
100 0; \
101 })
102
103#define __libc_lock_trylock_recursive(NAME) \
104 ({ \
105 __libc_lock_recursive_t *const __lock = &(NAME); \
106 void *__self = __libc_lock_owner_self (); \
107 int __r = 0; \
108 if (__self == __lock->owner) \
109 ++__lock->cnt; \
110 else if ((__r = lll_trylock (__lock->lock)) == 0) \
111 __lock->owner = __self, __lock->cnt = 1; \
112 __r; \
113 })
114
115#define __libc_lock_lock_recursive(NAME) \
116 ({ \
117 __libc_lock_recursive_t *const __lock = &(NAME); \
118 void *__self = __libc_lock_owner_self (); \
119 if (__self != __lock->owner) \
120 { \
121 lll_lock (__lock->lock, 0); \
122 __lock->owner = __self; \
123 } \
124 ++__lock->cnt; \
125 (void)0; \
126 })
127
128#define __libc_lock_unlock_recursive(NAME) \
129 ({ \
130 __libc_lock_recursive_t *const __lock = &(NAME); \
131 if (--__lock->cnt == 0) \
132 { \
133 __lock->owner = 0; \
134 lll_unlock (__lock->lock, 0); \
135 } \
136 })
137
138
139#define __rtld_lock_initialize(NAME) \
140 (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
141#define __rtld_lock_trylock_recursive(NAME) \
142 __libc_lock_trylock_recursive (NAME)
143#define __rtld_lock_lock_recursive(NAME) \
144 __libc_lock_lock_recursive(NAME)
145#define __rtld_lock_unlock_recursive(NAME) \
146 __libc_lock_unlock_recursive (NAME)
147
148/* XXX for now, waiting for a futex-based pthread_rwlock implementation */
149#define __mach_rwlock_define __libc_lock_define
150#define __mach_rwlock_define_initialized __libc_lock_define_initialized
151#define __mach_rwlock_init __libc_lock_init
152#define __mach_rwlock_fini __libc_lock_fini
153#define __mach_rwlock_rdlock __libc_lock_lock
154#define __mach_rwlock_wrlock __libc_lock_lock
155#define __mach_rwlock_tryrdlock __libc_lock_trylock
156#define __mach_rwlock_trywrlock __libc_lock_trylock
157#define __mach_rwlock_unlock __libc_lock_unlock
158
159struct __libc_cleanup_frame
160{
161 void (*__fct) (void *);
162 void *__argp;
163 int __doit;
164};
165
166__extern_inline void
167__libc_cleanup_fct (struct __libc_cleanup_frame *framep)
168{
169 if (framep->__doit)
170 framep->__fct (framep->__argp);
171}
172
173/* Start a critical region with a cleanup function */
174#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
175 do \
176 { \
177 struct __libc_cleanup_frame __cleanup \
178 __attribute__ ((__cleanup__ (__libc_cleanup_fct))) = \
179 { .__fct = (FCT), .__argp = (ARG), .__doit = (DOIT) };
180
181/* This one closes the brace above. */
182#define __libc_cleanup_region_end(DOIT) \
183 __cleanup.__doit = (DOIT); \
184 } \
185 while (0)
186
187#define __libc_cleanup_end(DOIT) __cleanup.__doit = (DOIT);
188
189#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
190#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
191
192/* Use mutexes as once control variables. */
193
194struct __libc_once
195 {
196 __libc_lock_t lock;
197 int done;
198 };
199
200#define __libc_once_define(CLASS,NAME) \
201 CLASS struct __libc_once NAME = { _LIBC_LOCK_INITIALIZER, 0 }
202
203/* Call handler iff the first call. */
204#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
205 do { \
206 __libc_lock_lock (ONCE_CONTROL.lock); \
207 if (!ONCE_CONTROL.done) \
208 (INIT_FUNCTION) (); \
209 ONCE_CONTROL.done = 1; \
210 __libc_lock_unlock (ONCE_CONTROL.lock); \
211 } while (0)
212
213/* Get once control variable. */
214#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL).done != 0)
215
216#ifdef _LIBC
217/* We need portable names for some functions. E.g., when they are
218 used as argument to __libc_cleanup_region_start. */
219#define __libc_mutex_unlock __libc_lock_unlock
220
221/* Hide the definitions which are only supposed to be used inside libc in
222 a separate file. This file is not present in the installation! */
223# include <libc-lockP.h>
224#endif
225
226#endif /* libc-lock.h */
lib/libc/glibc/sysdeps/mach/sys/syscall.h deleted-1
......@@ -1 +0,0 @@
1/* The Mach syscalls are in <mach/syscall_sw.h>. */
lib/libc/glibc/sysdeps/mach/sysdep.h deleted-77
......@@ -1,77 +0,0 @@
1/* Copyright (C) 1994-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifdef __ASSEMBLER__
19
20/* Get the Mach definitions of ENTRY and kernel_trap. */
21#include <mach/machine/syscall_sw.h>
22
23/* This macro is defined in Mach system headers, but string functions use it
24 with different definitions depending on whether being compiled for
25 wide-characters or not. */
26#undef P2ALIGN
27
28/* The Mach definitions assume underscores should be prepended to
29 symbol names. Redefine them to do so only when appropriate. */
30#undef EXT
31#undef LEXT
32#define EXT(x) C_SYMBOL_NAME(x)
33#define LEXT(x) C_SYMBOL_NAME(x##:)
34
35/* For ELF we need to add the `.type' directive to make shared libraries
36 work right. */
37#undef ENTRY
38#undef ENTRY2
39#define ENTRY(name) \
40 .globl name; \
41 .align ALIGN; \
42 .type name,@function; \
43 name:
44
45#endif
46
47/* This is invoked by things run when there is random lossage, before they
48 try to do anything else. Just to be safe, deallocate the reply port so
49 bogons arriving on it don't foul up future RPCs. */
50
51#ifndef __ASSEMBLER__
52#define FATAL_PREPARE_INCLUDE <mach/mig_support.h>
53#define FATAL_PREPARE __mig_dealloc_reply_port (__mig_get_reply_port ())
54#endif
55
56/* sysdeps/mach/MACHINE/sysdep.h should define the following macros. */
57
58/* Produce a text assembler label for the C global symbol NAME. */
59#ifndef ENTRY
60#define ENTRY(name) .error ENTRY not defined by sysdeps/mach/MACHINE/sysdep.h
61/* This is not used on all machines. */
62#endif
63
64/* LOSE can be defined as the `halt' instruction or something
65 similar which will cause the process to die in a characteristic
66 way suggesting a bug. */
67#ifndef LOSE
68#define LOSE ({ volatile int zero = 0; zero / zero; })
69#endif
70
71/* One of these should be defined to specify the stack direction. */
72#if !defined (STACK_GROWTH_UP) && !defined (STACK_GROWTH_DOWN)
73#error stack direction unspecified
74#endif
75
76/* Used by some assembly code. */
77#define C_SYMBOL_NAME(name) name
lib/libc/glibc/sysdeps/mips/dl-dtprocnum.h deleted-21
......@@ -1,21 +0,0 @@
1/* Configuration of lookup functions. MIPS version.
2 Copyright (C) 2000-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* Number of extra dynamic section entries for this architecture. By
20 default there are none. */
21#define DT_THISPROCNUM DT_MIPS_NUM
lib/libc/glibc/sysdeps/mips/isarev.h deleted-8
......@@ -1,8 +0,0 @@
1#ifndef _ISAREV_H
2#define _ISAREV_H
3
4#ifndef __mips_isa_rev
5# define __mips_isa_rev 0
6#endif
7
8#endif
lib/libc/glibc/sysdeps/nptl/libc-lock.h deleted-194
......@@ -1,194 +0,0 @@
1/* libc-internal interface for mutex locks. NPTL version.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _LIBC_LOCK_H
20#define _LIBC_LOCK_H 1
21
22#include <pthread.h>
23#define __need_NULL
24#include <stddef.h>
25#include <libc-lock-arch.h>
26
27
28/* Mutex type. */
29#if defined _LIBC || defined _IO_MTSAFE_IO
30# if (!IS_IN (libc) && !IS_IN (libpthread)) || !defined _LIBC
31typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t;
32# else
33typedef struct
34{
35 int lock __LIBC_LOCK_ALIGNMENT;
36 int cnt;
37 void *owner;
38} __libc_lock_recursive_t;
39# endif
40#else
41typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
42#endif
43
44/* Define a lock variable NAME with storage class CLASS. The lock must be
45 initialized with __libc_lock_init before it can be used (or define it
46 with __libc_lock_define_initialized, below). Use `extern' for CLASS to
47 declare a lock defined in another module. In public structure
48 definitions you must use a pointer to the lock structure (i.e., NAME
49 begins with a `*'), because its storage size will not be known outside
50 of libc. */
51#define __libc_lock_define_recursive(CLASS,NAME) \
52 CLASS __libc_lock_recursive_t NAME;
53
54/* Define an initialized recursive lock variable NAME with storage
55 class CLASS. */
56#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
57# define __libc_lock_define_initialized_recursive(CLASS, NAME) \
58 CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
59# define _LIBC_LOCK_RECURSIVE_INITIALIZER \
60 { LLL_LOCK_INITIALIZER, 0, NULL }
61#else
62# define __libc_lock_define_initialized_recursive(CLASS,NAME) \
63 CLASS __libc_lock_recursive_t NAME = _LIBC_LOCK_RECURSIVE_INITIALIZER;
64# define _LIBC_LOCK_RECURSIVE_INITIALIZER \
65 {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}
66#endif
67
68/* Initialize a recursive mutex. */
69#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
70# define __libc_lock_init_recursive(NAME) \
71 ((void) ((NAME) = (__libc_lock_recursive_t) _LIBC_LOCK_RECURSIVE_INITIALIZER))
72#else
73# define __libc_lock_init_recursive(NAME) \
74 do { \
75 if (__pthread_mutex_init != NULL) \
76 { \
77 pthread_mutexattr_t __attr; \
78 __pthread_mutexattr_init (&__attr); \
79 __pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
80 __pthread_mutex_init (&(NAME).mutex, &__attr); \
81 __pthread_mutexattr_destroy (&__attr); \
82 } \
83 } while (0)
84#endif
85
86/* Finalize recursive named lock. */
87#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
88# define __libc_lock_fini_recursive(NAME) ((void) 0)
89#else
90# define __libc_lock_fini_recursive(NAME) \
91 __libc_maybe_call (__pthread_mutex_destroy, (&(NAME).mutex), 0)
92#endif
93
94/* Lock the recursive named lock variable. */
95#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
96# define __libc_lock_lock_recursive(NAME) \
97 do { \
98 void *self = THREAD_SELF; \
99 if ((NAME).owner != self) \
100 { \
101 lll_lock ((NAME).lock, LLL_PRIVATE); \
102 (NAME).owner = self; \
103 } \
104 ++(NAME).cnt; \
105 } while (0)
106#else
107# define __libc_lock_lock_recursive(NAME) \
108 __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
109#endif
110
111/* Try to lock the recursive named lock variable. */
112#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
113# define __libc_lock_trylock_recursive(NAME) \
114 ({ \
115 int result = 0; \
116 void *self = THREAD_SELF; \
117 if ((NAME).owner != self) \
118 { \
119 if (lll_trylock ((NAME).lock) == 0) \
120 { \
121 (NAME).owner = self; \
122 (NAME).cnt = 1; \
123 } \
124 else \
125 result = EBUSY; \
126 } \
127 else \
128 ++(NAME).cnt; \
129 result; \
130 })
131#else
132# define __libc_lock_trylock_recursive(NAME) \
133 __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
134#endif
135
136/* Unlock the recursive named lock variable. */
137#if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
138/* We do no error checking here. */
139# define __libc_lock_unlock_recursive(NAME) \
140 do { \
141 if (--(NAME).cnt == 0) \
142 { \
143 (NAME).owner = NULL; \
144 lll_unlock ((NAME).lock, LLL_PRIVATE); \
145 } \
146 } while (0)
147#else
148# define __libc_lock_unlock_recursive(NAME) \
149 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
150#endif
151
152/* Put the unwind buffer BUFFER on the per-thread callback stack. The
153 caller must fill BUFFER->__routine and BUFFER->__arg before calling
154 this function. */
155void __libc_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer);
156libc_hidden_proto (__libc_cleanup_push_defer)
157/* Remove BUFFER from the unwind callback stack. The caller must invoke
158 the callback if desired. */
159void __libc_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer);
160libc_hidden_proto (__libc_cleanup_pop_restore)
161
162/* Start critical region with cleanup. */
163#define __libc_cleanup_region_start(DOIT, FCT, ARG) \
164 { bool _cleanup_start_doit; \
165 struct _pthread_cleanup_buffer _buffer; \
166 /* Non-addressable copy of FCT, so that we avoid indirect calls on \
167 the non-unwinding path. */ \
168 void (*_cleanup_routine) (void *) = (FCT); \
169 _buffer.__arg = (ARG); \
170 if (DOIT) \
171 { \
172 _cleanup_start_doit = true; \
173 _buffer.__routine = _cleanup_routine; \
174 __libc_cleanup_push_defer (&_buffer); \
175 } \
176 else \
177 _cleanup_start_doit = false;
178
179/* End critical region with cleanup. */
180#define __libc_cleanup_region_end(DOIT) \
181 if (_cleanup_start_doit) \
182 __libc_cleanup_pop_restore (&_buffer); \
183 if (DOIT) \
184 _cleanup_routine (_buffer.__arg); \
185 } /* matches __libc_cleanup_region_start */
186
187
188/* Hide the definitions which are only supposed to be used inside libc in
189 a separate file. This file is not present in the installation! */
190#ifdef _LIBC
191# include "libc-lockP.h"
192#endif
193
194#endif /* libc-lock.h */
lib/libc/glibc/sysdeps/nptl/libc-lockP.h deleted-244
......@@ -1,244 +0,0 @@
1/* Private libc-internal interface for mutex locks. NPTL version.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, see <https://www.gnu.org/licenses/>. */
18
19#ifndef _LIBC_LOCKP_H
20#define _LIBC_LOCKP_H 1
21
22#include <pthread.h>
23#define __need_NULL
24#include <stddef.h>
25
26
27/* Fortunately Linux now has a mean to do locking which is realtime
28 safe without the aid of the thread library. We also need no fancy
29 options like error checking mutexes etc. We only need simple
30 locks, maybe recursive. This can be easily and cheaply implemented
31 using futexes. We will use them everywhere except in ld.so since
32 ld.so might be used on old kernels with a different libc.so. */
33#include <lowlevellock.h>
34#include <tls.h>
35#include <libc-lock-arch.h>
36
37/* Mutex type. */
38typedef int __libc_lock_t __LIBC_LOCK_ALIGNMENT;
39typedef struct { pthread_mutex_t mutex; } __rtld_lock_recursive_t;
40typedef pthread_rwlock_t __libc_rwlock_t;
41
42/* Define a lock variable NAME with storage class CLASS. The lock must be
43 initialized with __libc_lock_init before it can be used (or define it
44 with __libc_lock_define_initialized, below). Use `extern' for CLASS to
45 declare a lock defined in another module. In public structure
46 definitions you must use a pointer to the lock structure (i.e., NAME
47 begins with a `*'), because its storage size will not be known outside
48 of libc. */
49#define __libc_lock_define(CLASS,NAME) \
50 CLASS __libc_lock_t NAME;
51#define __libc_rwlock_define(CLASS,NAME) \
52 CLASS __libc_rwlock_t NAME;
53#define __rtld_lock_define_recursive(CLASS,NAME) \
54 CLASS __rtld_lock_recursive_t NAME;
55
56/* Define an initialized lock variable NAME with storage class CLASS.
57
58 For the C library we take a deeper look at the initializer. For
59 this implementation all fields are initialized to zero. Therefore
60 we don't initialize the variable which allows putting it into the
61 BSS section. */
62
63_Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0");
64#define _LIBC_LOCK_INITIALIZER LLL_LOCK_INITIALIZER
65#define __libc_lock_define_initialized(CLASS,NAME) \
66 CLASS __libc_lock_t NAME;
67
68#define __libc_rwlock_define_initialized(CLASS,NAME) \
69 CLASS __libc_rwlock_t NAME = PTHREAD_RWLOCK_INITIALIZER;
70
71#define __rtld_lock_define_initialized_recursive(CLASS,NAME) \
72 CLASS __rtld_lock_recursive_t NAME = _RTLD_LOCK_RECURSIVE_INITIALIZER;
73#define _RTLD_LOCK_RECURSIVE_INITIALIZER \
74 {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}
75
76#define __rtld_lock_initialize(NAME) \
77 (void) ((NAME) = (__rtld_lock_recursive_t) _RTLD_LOCK_RECURSIVE_INITIALIZER)
78
79/* If we check for a weakly referenced symbol and then perform a
80 normal jump to it te code generated for some platforms in case of
81 PIC is unnecessarily slow. What would happen is that the function
82 is first referenced as data and then it is called indirectly
83 through the PLT. We can make this a direct jump. */
84#ifdef __PIC__
85# define __libc_maybe_call(FUNC, ARGS, ELSE) \
86 (__extension__ ({ __typeof (FUNC) *_fn = (FUNC); \
87 _fn != NULL ? (*_fn) ARGS : ELSE; }))
88#else
89# define __libc_maybe_call(FUNC, ARGS, ELSE) \
90 (FUNC != NULL ? FUNC ARGS : ELSE)
91#endif
92
93/* Initialize the named lock variable, leaving it in a consistent, unlocked
94 state. */
95#define __libc_lock_init(NAME) ((void) ((NAME) = LLL_LOCK_INITIALIZER))
96#define __libc_rwlock_init(NAME) __pthread_rwlock_init (&(NAME), NULL)
97
98/* Finalize the named lock variable, which must be locked. It cannot be
99 used again until __libc_lock_init is called again on it. This must be
100 called on a lock variable before the containing storage is reused. */
101#define __libc_lock_fini(NAME) ((void) 0)
102#define __libc_rwlock_fini(NAME) ((void) 0)
103
104/* Lock the named lock variable. */
105#define __libc_lock_lock(NAME) ({ lll_lock (NAME, LLL_PRIVATE); 0; })
106#define __libc_rwlock_rdlock(NAME) __pthread_rwlock_rdlock (&(NAME))
107#define __libc_rwlock_wrlock(NAME) __pthread_rwlock_wrlock (&(NAME))
108
109/* Try to lock the named lock variable. */
110#define __libc_lock_trylock(NAME) lll_trylock (NAME)
111
112/* Unlock the named lock variable. */
113#define __libc_lock_unlock(NAME) lll_unlock (NAME, LLL_PRIVATE)
114#define __libc_rwlock_unlock(NAME) __pthread_rwlock_unlock (&(NAME))
115
116#if IS_IN (rtld)
117# define __rtld_lock_lock_recursive(NAME) \
118 ___rtld_mutex_lock (&(NAME).mutex)
119
120# define __rtld_lock_unlock_recursive(NAME) \
121 ___rtld_mutex_unlock (&(NAME).mutex)
122#else /* Not in the dynamic loader. */
123# define __rtld_lock_lock_recursive(NAME) \
124 __pthread_mutex_lock (&(NAME).mutex)
125
126# define __rtld_lock_unlock_recursive(NAME) \
127 __pthread_mutex_unlock (&(NAME).mutex)
128#endif
129
130/* Define once control variable. */
131#if PTHREAD_ONCE_INIT == 0
132/* Special case for static variables where we can avoid the initialization
133 if it is zero. */
134# define __libc_once_define(CLASS, NAME) \
135 CLASS pthread_once_t NAME
136#else
137# define __libc_once_define(CLASS, NAME) \
138 CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT
139#endif
140
141/* Call handler iff the first call. Use a local call in libc, but the
142 global pthread_once symbol elsewhere. */
143#if IS_IN (libc)
144# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
145 __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
146#else
147# define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
148 pthread_once (&(ONCE_CONTROL), INIT_FUNCTION)
149#endif
150
151/* Get once control variable. */
152#define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT)
153
154/* __libc_cleanup_push and __libc_cleanup_pop depend on exception
155 handling and stack unwinding. */
156#ifdef __EXCEPTIONS
157
158/* Normal cleanup handling, based on C cleanup attribute. */
159static __always_inline void
160__libc_cleanup_routine (struct __pthread_cleanup_frame *f)
161{
162 if (f->__do_it)
163 f->__cancel_routine (f->__cancel_arg);
164}
165
166# define __libc_cleanup_push(fct, arg) \
167 do { \
168 struct __pthread_cleanup_frame __clframe \
169 __attribute__ ((__cleanup__ (__libc_cleanup_routine))) \
170 = { .__cancel_routine = (fct), .__cancel_arg = (arg), \
171 .__do_it = 1 };
172
173# define __libc_cleanup_pop(execute) \
174 __clframe.__do_it = (execute); \
175 } while (0)
176#endif /* __EXCEPTIONS */
177
178/* Register handlers to execute before and after `fork'. Note that the
179 last parameter is NULL. The handlers registered by the libc are
180 never removed so this is OK. */
181extern int __register_atfork (void (*__prepare) (void),
182 void (*__parent) (void),
183 void (*__child) (void),
184 void *__dso_handle);
185
186/* Functions that are used by this file and are internal to the GNU C
187 library. */
188
189extern int __pthread_mutex_init (pthread_mutex_t *__mutex,
190 const pthread_mutexattr_t *__mutex_attr);
191libc_hidden_proto (__pthread_mutex_init)
192extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex);
193libc_hidden_proto (__pthread_mutex_destroy)
194extern int __pthread_mutex_trylock (pthread_mutex_t *__mutex);
195
196extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
197libc_hidden_proto (__pthread_mutex_lock)
198extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
199libc_hidden_proto (__pthread_mutex_unlock)
200
201extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *__attr);
202
203extern int __pthread_rwlock_init (pthread_rwlock_t *__rwlock,
204 const pthread_rwlockattr_t *__attr);
205libc_hidden_proto (__pthread_rwlock_init)
206
207extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock);
208
209extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock);
210libc_hidden_proto (__pthread_rwlock_rdlock)
211
212extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock);
213libc_hidden_proto (__pthread_rwlock_wrlock)
214
215extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock);
216libc_hidden_proto (__pthread_rwlock_unlock)
217extern int __pthread_once (pthread_once_t *__once_control,
218 void (*__init_routine) (void));
219libc_hidden_proto (__pthread_once)
220
221extern int __pthread_atfork (void (*__prepare) (void),
222 void (*__parent) (void),
223 void (*__child) (void));
224
225extern int __pthread_setcancelstate (int state, int *oldstate);
226libc_hidden_proto (__pthread_setcancelstate)
227
228/* Make the pthread functions weak so that we can elide them from
229 single-threaded processes. */
230#ifndef __NO_WEAK_PTHREAD_ALIASES
231# ifdef weak_extern
232weak_extern (__pthread_mutex_trylock)
233weak_extern (__pthread_mutexattr_destroy)
234weak_extern (__pthread_initialize)
235weak_extern (__pthread_atfork)
236# else
237# pragma weak __pthread_mutex_trylock
238# pragma weak __pthread_mutexattr_destroy
239# pragma weak __pthread_initialize
240# pragma weak __pthread_atfork
241# endif
242#endif
243
244#endif /* libc-lockP.h */
lib/libc/glibc/sysdeps/nptl/pthread.h deleted-1353
......@@ -1,1353 +0,0 @@
1/* Copyright (C) 2002-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _PTHREAD_H
19#define _PTHREAD_H 1
20
21#include <features.h>
22#include <sched.h>
23#include <time.h>
24
25#include <bits/endian.h>
26#include <bits/pthreadtypes.h>
27#include <bits/setjmp.h>
28#include <bits/wordsize.h>
29#include <bits/types/struct_timespec.h>
30#include <bits/types/__sigset_t.h>
31#include <bits/types/struct___jmp_buf_tag.h>
32#ifdef __USE_MISC
33# include <bits/pthread_stack_min-dynamic.h>
34#endif
35
36/* Detach state. */
37enum
38{
39 PTHREAD_CREATE_JOINABLE,
40#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
41 PTHREAD_CREATE_DETACHED
42#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
43};
44
45
46/* Mutex types. */
47enum
48{
49 PTHREAD_MUTEX_TIMED_NP,
50 PTHREAD_MUTEX_RECURSIVE_NP,
51 PTHREAD_MUTEX_ERRORCHECK_NP,
52 PTHREAD_MUTEX_ADAPTIVE_NP
53#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
54 ,
55 PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
56 PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
57 PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
58 PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
59#endif
60#ifdef __USE_GNU
61 /* For compatibility. */
62 , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP
63#endif
64};
65
66
67#ifdef __USE_XOPEN2K
68/* Robust mutex or not flags. */
69enum
70{
71 PTHREAD_MUTEX_STALLED,
72 PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
73 PTHREAD_MUTEX_ROBUST,
74 PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
75};
76#endif
77
78
79#if defined __USE_POSIX199506 || defined __USE_UNIX98
80/* Mutex protocols. */
81enum
82{
83 PTHREAD_PRIO_NONE,
84 PTHREAD_PRIO_INHERIT,
85 PTHREAD_PRIO_PROTECT
86};
87#endif
88
89
90#define PTHREAD_MUTEX_INITIALIZER \
91 { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_TIMED_NP) } }
92#ifdef __USE_GNU
93# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
94 { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } }
95# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
96 { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } }
97# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
98 { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } }
99#endif
100
101
102/* Read-write lock types. */
103#if defined __USE_UNIX98 || defined __USE_XOPEN2K
104enum
105{
106 PTHREAD_RWLOCK_PREFER_READER_NP,
107 PTHREAD_RWLOCK_PREFER_WRITER_NP,
108 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
109 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
110};
111
112
113/* Read-write lock initializers. */
114# define PTHREAD_RWLOCK_INITIALIZER \
115 { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_DEFAULT_NP) } }
116# ifdef __USE_GNU
117# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
118 { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) } }
119# endif
120#endif /* Unix98 or XOpen2K */
121
122
123/* Scheduler inheritance. */
124enum
125{
126 PTHREAD_INHERIT_SCHED,
127#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED
128 PTHREAD_EXPLICIT_SCHED
129#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED
130};
131
132
133/* Scope handling. */
134enum
135{
136 PTHREAD_SCOPE_SYSTEM,
137#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM
138 PTHREAD_SCOPE_PROCESS
139#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS
140};
141
142
143/* Process shared or private flag. */
144enum
145{
146 PTHREAD_PROCESS_PRIVATE,
147#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
148 PTHREAD_PROCESS_SHARED
149#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
150};
151
152
153
154/* Conditional variable handling. */
155#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0}, 0, 0 } }
156
157
158/* Cleanup buffers */
159struct _pthread_cleanup_buffer
160{
161 void (*__routine) (void *); /* Function to call. */
162 void *__arg; /* Its argument. */
163 int __canceltype; /* Saved cancellation type. */
164 struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */
165};
166
167/* Cancellation */
168enum
169{
170 PTHREAD_CANCEL_ENABLE,
171#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE
172 PTHREAD_CANCEL_DISABLE
173#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE
174};
175enum
176{
177 PTHREAD_CANCEL_DEFERRED,
178#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED
179 PTHREAD_CANCEL_ASYNCHRONOUS
180#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
181};
182#define PTHREAD_CANCELED ((void *) -1)
183
184
185/* Single execution handling. */
186#define PTHREAD_ONCE_INIT 0
187
188
189#ifdef __USE_XOPEN2K
190/* Value returned by 'pthread_barrier_wait' for one of the threads after
191 the required number of threads have called this function.
192 -1 is distinct from 0 and all errno constants */
193# define PTHREAD_BARRIER_SERIAL_THREAD -1
194#endif
195
196
197__BEGIN_DECLS
198
199/* Create a new thread, starting with execution of START-ROUTINE
200 getting passed ARG. Creation attributed come from ATTR. The new
201 handle is stored in *NEWTHREAD. */
202extern int pthread_create (pthread_t *__restrict __newthread,
203 const pthread_attr_t *__restrict __attr,
204 void *(*__start_routine) (void *),
205 void *__restrict __arg) __THROWNL __nonnull ((1, 3));
206
207/* Terminate calling thread.
208
209 The registered cleanup handlers are called via exception handling
210 so we cannot mark this function with __THROW.*/
211extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
212
213/* Make calling thread wait for termination of the thread TH. The
214 exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN
215 is not NULL.
216
217 This function is a cancellation point and therefore not marked with
218 __THROW. */
219extern int pthread_join (pthread_t __th, void **__thread_return);
220
221#ifdef __USE_GNU
222/* Check whether thread TH has terminated. If yes return the status of
223 the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */
224extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW;
225
226# ifndef __USE_TIME64_REDIRECTS
227/* Make calling thread wait for termination of the thread TH, but only
228 until TIMEOUT. The exit status of the thread is stored in
229 *THREAD_RETURN, if THREAD_RETURN is not NULL.
230
231 This function is a cancellation point and therefore not marked with
232 __THROW. */
233extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
234 const struct timespec *__abstime);
235
236/* Make calling thread wait for termination of the thread TH, but only
237 until TIMEOUT measured against the clock specified by CLOCKID. The
238 exit status of the thread is stored in *THREAD_RETURN, if
239 THREAD_RETURN is not NULL.
240
241 This function is a cancellation point and therefore not marked with
242 __THROW. */
243extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return,
244 clockid_t __clockid,
245 const struct timespec *__abstime);
246# else
247# ifdef __REDIRECT
248extern int __REDIRECT (pthread_timedjoin_np,
249 (pthread_t __th, void **__thread_return,
250 const struct timespec *__abstime),
251 __pthread_timedjoin_np64);
252
253extern int __REDIRECT (pthread_clockjoin_np,
254 (pthread_t __th, void **__thread_return,
255 clockid_t __clockid,
256 const struct timespec *__abstime),
257 __pthread_clockjoin_np64);
258# else
259# define pthread_timedjoin_np __pthread_timedjoin_np64
260# define pthread_clockjoin_np __pthread_clockjoin_np64
261# endif
262# endif
263#endif
264
265/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN.
266 The resources of TH will therefore be freed immediately when it
267 terminates, instead of waiting for another thread to perform PTHREAD_JOIN
268 on it. */
269extern int pthread_detach (pthread_t __th) __THROW;
270
271
272/* Obtain the identifier of the current thread. */
273extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
274
275/* Compare two thread identifiers. */
276extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
277 __THROW __attribute__ ((__const__));
278
279
280/* Thread attribute handling. */
281
282/* Initialize thread attribute *ATTR with default attributes
283 (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER,
284 no user-provided stack). */
285extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1));
286
287/* Destroy thread attribute *ATTR. */
288extern int pthread_attr_destroy (pthread_attr_t *__attr)
289 __THROW __nonnull ((1));
290
291/* Get detach state attribute. */
292extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
293 int *__detachstate)
294 __THROW __nonnull ((1, 2));
295
296/* Set detach state attribute. */
297extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
298 int __detachstate)
299 __THROW __nonnull ((1));
300
301
302/* Get the size of the guard area created for stack overflow protection. */
303extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
304 size_t *__guardsize)
305 __THROW __nonnull ((1, 2));
306
307/* Set the size of the guard area created for stack overflow protection. */
308extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
309 size_t __guardsize)
310 __THROW __nonnull ((1));
311
312
313/* Return in *PARAM the scheduling parameters of *ATTR. */
314extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
315 struct sched_param *__restrict __param)
316 __THROW __nonnull ((1, 2));
317
318/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */
319extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
320 const struct sched_param *__restrict
321 __param) __THROW __nonnull ((1, 2));
322
323/* Return in *POLICY the scheduling policy of *ATTR. */
324extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
325 __attr, int *__restrict __policy)
326 __THROW __nonnull ((1, 2));
327
328/* Set scheduling policy in *ATTR according to POLICY. */
329extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
330 __THROW __nonnull ((1));
331
332/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */
333extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
334 __attr, int *__restrict __inherit)
335 __THROW __nonnull ((1, 2));
336
337/* Set scheduling inheritance mode in *ATTR according to INHERIT. */
338extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
339 int __inherit)
340 __THROW __nonnull ((1));
341
342
343/* Return in *SCOPE the scheduling contention scope of *ATTR. */
344extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
345 int *__restrict __scope)
346 __THROW __nonnull ((1, 2));
347
348/* Set scheduling contention scope in *ATTR according to SCOPE. */
349extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
350 __THROW __nonnull ((1));
351
352/* Return the previously set address for the stack. */
353extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
354 __attr, void **__restrict __stackaddr)
355 __THROW __nonnull ((1, 2)) __attribute_deprecated__;
356
357/* Set the starting address of the stack of the thread to be created.
358 Depending on whether the stack grows up or down the value must either
359 be higher or lower than all the address in the memory block. The
360 minimal size of the block must be PTHREAD_STACK_MIN. */
361extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
362 void *__stackaddr)
363 __THROW __nonnull ((1)) __attribute_deprecated__;
364
365/* Return the currently used minimal stack size. */
366extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
367 __attr, size_t *__restrict __stacksize)
368 __THROW __nonnull ((1, 2));
369
370/* Add information about the minimum stack size needed for the thread
371 to be started. This size must never be less than PTHREAD_STACK_MIN
372 and must also not exceed the system limits. */
373extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
374 size_t __stacksize)
375 __THROW __nonnull ((1));
376
377#ifdef __USE_XOPEN2K
378/* Return the previously set address for the stack. */
379extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
380 void **__restrict __stackaddr,
381 size_t *__restrict __stacksize)
382 __THROW __nonnull ((1, 2, 3));
383
384/* The following two interfaces are intended to replace the last two. They
385 require setting the address as well as the size since only setting the
386 address will make the implementation on some architectures impossible. */
387extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
388 size_t __stacksize) __THROW __nonnull ((1));
389#endif
390
391#ifdef __USE_GNU
392/* Thread created with attribute ATTR will be limited to run only on
393 the processors represented in CPUSET. */
394extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
395 size_t __cpusetsize,
396 const cpu_set_t *__cpuset)
397 __THROW __nonnull ((1, 3));
398
399/* Get bit set in CPUSET representing the processors threads created with
400 ATTR can run on. */
401extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr,
402 size_t __cpusetsize,
403 cpu_set_t *__cpuset)
404 __THROW __nonnull ((1, 3));
405
406/* Get the default attributes used by pthread_create in this process. */
407extern int pthread_getattr_default_np (pthread_attr_t *__attr)
408 __THROW __nonnull ((1));
409
410/* Store *SIGMASK as the signal mask for the new thread in *ATTR. */
411extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr,
412 const __sigset_t *sigmask);
413
414/* Store the signal mask of *ATTR in *SIGMASK. If there is no signal
415 mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on
416 success. */
417extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr,
418 __sigset_t *sigmask);
419
420/* Special return value from pthread_attr_getsigmask_np if the signal
421 mask has not been set. */
422#define PTHREAD_ATTR_NO_SIGMASK_NP (-1)
423
424/* Set the default attributes to be used by pthread_create in this
425 process. */
426extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
427 __THROW __nonnull ((1));
428
429/* Initialize thread attribute *ATTR with attributes corresponding to the
430 already running thread TH. It shall be called on uninitialized ATTR
431 and destroyed with pthread_attr_destroy when no longer needed. */
432extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
433 __THROW __nonnull ((2));
434#endif
435
436
437/* Functions for scheduling control. */
438
439/* Set the scheduling parameters for TARGET_THREAD according to POLICY
440 and *PARAM. */
441extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
442 const struct sched_param *__param)
443 __THROW __nonnull ((3));
444
445/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */
446extern int pthread_getschedparam (pthread_t __target_thread,
447 int *__restrict __policy,
448 struct sched_param *__restrict __param)
449 __THROW __nonnull ((2, 3));
450
451/* Set the scheduling priority for TARGET_THREAD. */
452extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
453 __THROW;
454
455
456#ifdef __USE_GNU
457/* Get thread name visible in the kernel and its interfaces. */
458extern int pthread_getname_np (pthread_t __target_thread, char *__buf,
459 size_t __buflen)
460 __THROW __nonnull ((2));
461
462/* Set thread name visible in the kernel and its interfaces. */
463extern int pthread_setname_np (pthread_t __target_thread, const char *__name)
464 __THROW __nonnull ((2));
465#endif
466
467
468#ifdef __USE_UNIX98
469/* Determine level of concurrency. */
470extern int pthread_getconcurrency (void) __THROW;
471
472/* Set new concurrency level to LEVEL. */
473extern int pthread_setconcurrency (int __level) __THROW;
474#endif
475
476#ifdef __USE_GNU
477extern int pthread_yield (void) __THROW;
478# ifdef __REDIRECT_NTH
479extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield)
480 __attribute_deprecated_msg__ ("\
481pthread_yield is deprecated, use sched_yield instead");
482# else
483# define pthread_yield sched_yield
484# endif
485
486
487/* Limit specified thread TH to run only on the processors represented
488 in CPUSET. */
489extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
490 const cpu_set_t *__cpuset)
491 __THROW __nonnull ((3));
492
493/* Get bit set in CPUSET representing the processors TH can run on. */
494extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
495 cpu_set_t *__cpuset)
496 __THROW __nonnull ((3));
497#endif
498
499
500/* Functions for handling initialization. */
501
502/* Guarantee that the initialization function INIT_ROUTINE will be called
503 only once, even if pthread_once is executed several times with the
504 same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or
505 extern variable initialized to PTHREAD_ONCE_INIT.
506
507 The initialization functions might throw exception which is why
508 this function is not marked with __THROW. */
509extern int pthread_once (pthread_once_t *__once_control,
510 void (*__init_routine) (void)) __nonnull ((1, 2));
511
512
513/* Functions for handling cancellation.
514
515 Note that these functions are explicitly not marked to not throw an
516 exception in C++ code. If cancellation is implemented by unwinding
517 this is necessary to have the compiler generate the unwind information. */
518
519/* Set cancellability state of current thread to STATE, returning old
520 state in *OLDSTATE if OLDSTATE is not NULL. */
521extern int pthread_setcancelstate (int __state, int *__oldstate);
522
523/* Set cancellation state of current thread to TYPE, returning the old
524 type in *OLDTYPE if OLDTYPE is not NULL. */
525extern int pthread_setcanceltype (int __type, int *__oldtype);
526
527/* Cancel THREAD immediately or at the next possibility. */
528extern int pthread_cancel (pthread_t __th);
529
530/* Test for pending cancellation for the current thread and terminate
531 the thread as per pthread_exit(PTHREAD_CANCELED) if it has been
532 cancelled. */
533extern void pthread_testcancel (void);
534
535
536/* Cancellation handling with integration into exception handling. */
537
538struct __cancel_jmp_buf_tag
539{
540 __jmp_buf __cancel_jmp_buf;
541 int __mask_was_saved;
542};
543
544typedef struct
545{
546 struct __cancel_jmp_buf_tag __cancel_jmp_buf[1];
547 void *__pad[4];
548} __pthread_unwind_buf_t __attribute__ ((__aligned__));
549
550/* No special attributes by default. */
551#ifndef __cleanup_fct_attribute
552# define __cleanup_fct_attribute
553#endif
554
555
556/* Structure to hold the cleanup handler information. */
557struct __pthread_cleanup_frame
558{
559 void (*__cancel_routine) (void *);
560 void *__cancel_arg;
561 int __do_it;
562 int __cancel_type;
563};
564
565#if defined __GNUC__ && defined __EXCEPTIONS
566# ifdef __cplusplus
567/* Class to handle cancellation handler invocation. */
568class __pthread_cleanup_class
569{
570 void (*__cancel_routine) (void *);
571 void *__cancel_arg;
572 int __do_it;
573 int __cancel_type;
574
575 public:
576 __pthread_cleanup_class (void (*__fct) (void *), void *__arg)
577 : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { }
578 ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); }
579 void __setdoit (int __newval) { __do_it = __newval; }
580 void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED,
581 &__cancel_type); }
582 void __restore () const { pthread_setcanceltype (__cancel_type, 0); }
583};
584
585/* Install a cleanup handler: ROUTINE will be called with arguments ARG
586 when the thread is canceled or calls pthread_exit. ROUTINE will also
587 be called with arguments ARG when the matching pthread_cleanup_pop
588 is executed with non-zero EXECUTE argument.
589
590 pthread_cleanup_push and pthread_cleanup_pop are macros and must always
591 be used in matching pairs at the same nesting level of braces. */
592# define pthread_cleanup_push(routine, arg) \
593 do { \
594 __pthread_cleanup_class __clframe (routine, arg)
595
596/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
597 If EXECUTE is non-zero, the handler function is called. */
598# define pthread_cleanup_pop(execute) \
599 __clframe.__setdoit (execute); \
600 } while (0)
601
602# ifdef __USE_GNU
603/* Install a cleanup handler as pthread_cleanup_push does, but also
604 saves the current cancellation type and sets it to deferred
605 cancellation. */
606# define pthread_cleanup_push_defer_np(routine, arg) \
607 do { \
608 __pthread_cleanup_class __clframe (routine, arg); \
609 __clframe.__defer ()
610
611/* Remove a cleanup handler as pthread_cleanup_pop does, but also
612 restores the cancellation type that was in effect when the matching
613 pthread_cleanup_push_defer was called. */
614# define pthread_cleanup_pop_restore_np(execute) \
615 __clframe.__restore (); \
616 __clframe.__setdoit (execute); \
617 } while (0)
618# endif
619# else
620/* Function called to call the cleanup handler. As an extern inline
621 function the compiler is free to decide inlining the change when
622 needed or fall back on the copy which must exist somewhere
623 else. */
624__extern_inline void
625__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
626{
627 if (__frame->__do_it)
628 __frame->__cancel_routine (__frame->__cancel_arg);
629}
630
631/* Install a cleanup handler: ROUTINE will be called with arguments ARG
632 when the thread is canceled or calls pthread_exit. ROUTINE will also
633 be called with arguments ARG when the matching pthread_cleanup_pop
634 is executed with non-zero EXECUTE argument.
635
636 pthread_cleanup_push and pthread_cleanup_pop are macros and must always
637 be used in matching pairs at the same nesting level of braces. */
638# define pthread_cleanup_push(routine, arg) \
639 do { \
640 struct __pthread_cleanup_frame __clframe \
641 __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
642 = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
643 .__do_it = 1 };
644
645/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
646 If EXECUTE is non-zero, the handler function is called. */
647# define pthread_cleanup_pop(execute) \
648 __clframe.__do_it = (execute); \
649 } while (0)
650
651# ifdef __USE_GNU
652/* Install a cleanup handler as pthread_cleanup_push does, but also
653 saves the current cancellation type and sets it to deferred
654 cancellation. */
655# define pthread_cleanup_push_defer_np(routine, arg) \
656 do { \
657 struct __pthread_cleanup_frame __clframe \
658 __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
659 = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
660 .__do_it = 1 }; \
661 (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \
662 &__clframe.__cancel_type)
663
664/* Remove a cleanup handler as pthread_cleanup_pop does, but also
665 restores the cancellation type that was in effect when the matching
666 pthread_cleanup_push_defer was called. */
667# define pthread_cleanup_pop_restore_np(execute) \
668 (void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \
669 __clframe.__do_it = (execute); \
670 } while (0)
671# endif
672# endif
673#else
674/* Install a cleanup handler: ROUTINE will be called with arguments ARG
675 when the thread is canceled or calls pthread_exit. ROUTINE will also
676 be called with arguments ARG when the matching pthread_cleanup_pop
677 is executed with non-zero EXECUTE argument.
678
679 pthread_cleanup_push and pthread_cleanup_pop are macros and must always
680 be used in matching pairs at the same nesting level of braces. */
681# define pthread_cleanup_push(routine, arg) \
682 do { \
683 __pthread_unwind_buf_t __cancel_buf; \
684 void (*__cancel_routine) (void *) = (routine); \
685 void *__cancel_arg = (arg); \
686 int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
687 0); \
688 if (__glibc_unlikely (__not_first_call)) \
689 { \
690 __cancel_routine (__cancel_arg); \
691 __pthread_unwind_next (&__cancel_buf); \
692 /* NOTREACHED */ \
693 } \
694 \
695 __pthread_register_cancel (&__cancel_buf); \
696 do {
697extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
698 __cleanup_fct_attribute;
699
700/* Remove a cleanup handler installed by the matching pthread_cleanup_push.
701 If EXECUTE is non-zero, the handler function is called. */
702# define pthread_cleanup_pop(execute) \
703 do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
704 } while (0); \
705 __pthread_unregister_cancel (&__cancel_buf); \
706 if (execute) \
707 __cancel_routine (__cancel_arg); \
708 } while (0)
709extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
710 __cleanup_fct_attribute;
711
712# ifdef __USE_GNU
713/* Install a cleanup handler as pthread_cleanup_push does, but also
714 saves the current cancellation type and sets it to deferred
715 cancellation. */
716# define pthread_cleanup_push_defer_np(routine, arg) \
717 do { \
718 __pthread_unwind_buf_t __cancel_buf; \
719 void (*__cancel_routine) (void *) = (routine); \
720 void *__cancel_arg = (arg); \
721 int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \
722 0); \
723 if (__glibc_unlikely (__not_first_call)) \
724 { \
725 __cancel_routine (__cancel_arg); \
726 __pthread_unwind_next (&__cancel_buf); \
727 /* NOTREACHED */ \
728 } \
729 \
730 __pthread_register_cancel_defer (&__cancel_buf); \
731 do {
732extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf)
733 __cleanup_fct_attribute;
734
735/* Remove a cleanup handler as pthread_cleanup_pop does, but also
736 restores the cancellation type that was in effect when the matching
737 pthread_cleanup_push_defer was called. */
738# define pthread_cleanup_pop_restore_np(execute) \
739 do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\
740 } while (0); \
741 __pthread_unregister_cancel_restore (&__cancel_buf); \
742 if (execute) \
743 __cancel_routine (__cancel_arg); \
744 } while (0)
745extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf)
746 __cleanup_fct_attribute;
747# endif
748
749/* Internal interface to initiate cleanup. */
750extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
751 __cleanup_fct_attribute __attribute__ ((__noreturn__))
752# ifndef SHARED
753 __attribute__ ((__weak__))
754# endif
755 ;
756#endif
757
758/* Function used in the macros. Calling __sigsetjmp, with its first
759 argument declared as an array, results in a -Wstringop-overflow
760 warning from GCC 11 because struct pthread_unwind_buf is smaller
761 than jmp_buf. The calls from the macros have __SAVEMASK set to 0,
762 so nothing beyond the common prefix is used and this warning is a
763 false positive. Use an alias with its first argument declared to
764 use the type in the macros if possible to avoid this warning. */
765#if __GNUC_PREREQ (11, 0)
766extern int __REDIRECT_NTHNL (__sigsetjmp_cancel,
767 (struct __cancel_jmp_buf_tag __env[1],
768 int __savemask),
769 __sigsetjmp) __attribute_returns_twice__;
770#else
771# define __sigsetjmp_cancel(env, savemask) \
772 __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask))
773extern int __sigsetjmp (struct __jmp_buf_tag __env[1],
774 int __savemask) __THROWNL;
775#endif
776
777
778/* Mutex handling. */
779
780/* Initialize a mutex. */
781extern int pthread_mutex_init (pthread_mutex_t *__mutex,
782 const pthread_mutexattr_t *__mutexattr)
783 __THROW __nonnull ((1));
784
785/* Destroy a mutex. */
786extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
787 __THROW __nonnull ((1));
788
789/* Try locking a mutex. */
790extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
791 __THROWNL __nonnull ((1));
792
793/* Lock a mutex. */
794extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
795 __THROWNL __nonnull ((1));
796
797#ifdef __USE_XOPEN2K
798/* Wait until lock becomes available, or specified time passes. */
799# ifndef __USE_TIME64_REDIRECTS
800extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
801 const struct timespec *__restrict
802 __abstime) __THROWNL __nonnull ((1, 2));
803# else
804# ifdef __REDIRECT_NTHNL
805extern int __REDIRECT_NTHNL (pthread_mutex_timedlock,
806 (pthread_mutex_t *__restrict __mutex,
807 const struct timespec *__restrict __abstime),
808 __pthread_mutex_timedlock64) __nonnull ((1, 2));
809# else
810# define pthread_mutex_timedlock __pthread_mutex_timedlock64
811# endif
812# endif
813#endif
814
815#ifdef __USE_GNU
816# ifndef __USE_TIME64_REDIRECTS
817extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex,
818 clockid_t __clockid,
819 const struct timespec *__restrict
820 __abstime) __THROWNL __nonnull ((1, 3));
821# else
822# ifdef __REDIRECT_NTHNL
823extern int __REDIRECT_NTHNL (pthread_mutex_clocklock,
824 (pthread_mutex_t *__restrict __mutex,
825 clockid_t __clockid,
826 const struct timespec *__restrict __abstime),
827 __pthread_mutex_clocklock64) __nonnull ((1, 3));
828# else
829# define pthread_mutex_clocklock __pthread_mutex_clocklock64
830# endif
831# endif
832#endif
833
834/* Unlock a mutex. */
835extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
836 __THROWNL __nonnull ((1));
837
838
839/* Get the priority ceiling of MUTEX. */
840extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
841 __restrict __mutex,
842 int *__restrict __prioceiling)
843 __THROW __nonnull ((1, 2));
844
845/* Set the priority ceiling of MUTEX to PRIOCEILING, return old
846 priority ceiling value in *OLD_CEILING. */
847extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
848 int __prioceiling,
849 int *__restrict __old_ceiling)
850 __THROW __nonnull ((1, 3));
851
852
853#ifdef __USE_XOPEN2K8
854/* Declare the state protected by MUTEX as consistent. */
855extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
856 __THROW __nonnull ((1));
857# ifdef __USE_GNU
858# ifdef __REDIRECT_NTH
859extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *),
860 pthread_mutex_consistent) __nonnull ((1))
861 __attribute_deprecated_msg__ ("\
862pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent");
863# else
864# define pthread_mutex_consistent_np pthread_mutex_consistent
865# endif
866# endif
867#endif
868
869
870/* Functions for handling mutex attributes. */
871
872/* Initialize mutex attribute object ATTR with default attributes
873 (kind is PTHREAD_MUTEX_TIMED_NP). */
874extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
875 __THROW __nonnull ((1));
876
877/* Destroy mutex attribute object ATTR. */
878extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
879 __THROW __nonnull ((1));
880
881/* Get the process-shared flag of the mutex attribute ATTR. */
882extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
883 __restrict __attr,
884 int *__restrict __pshared)
885 __THROW __nonnull ((1, 2));
886
887/* Set the process-shared flag of the mutex attribute ATTR. */
888extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
889 int __pshared)
890 __THROW __nonnull ((1));
891
892#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
893/* Return in *KIND the mutex kind attribute in *ATTR. */
894extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
895 __attr, int *__restrict __kind)
896 __THROW __nonnull ((1, 2));
897
898/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
899 PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
900 PTHREAD_MUTEX_DEFAULT). */
901extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
902 __THROW __nonnull ((1));
903#endif
904
905/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */
906extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
907 __restrict __attr,
908 int *__restrict __protocol)
909 __THROW __nonnull ((1, 2));
910
911/* Set the mutex protocol attribute in *ATTR to PROTOCOL (either
912 PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */
913extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
914 int __protocol)
915 __THROW __nonnull ((1));
916
917/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
918extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
919 __restrict __attr,
920 int *__restrict __prioceiling)
921 __THROW __nonnull ((1, 2));
922
923/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
924extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
925 int __prioceiling)
926 __THROW __nonnull ((1));
927
928#ifdef __USE_XOPEN2K
929/* Get the robustness flag of the mutex attribute ATTR. */
930extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
931 int *__robustness)
932 __THROW __nonnull ((1, 2));
933# ifdef __USE_GNU
934# ifdef __REDIRECT_NTH
935extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
936 (pthread_mutexattr_t *, int *),
937 pthread_mutexattr_getrobust) __nonnull ((1))
938 __attribute_deprecated_msg__ ("\
939pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
940# else
941# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust
942# endif
943# endif
944
945/* Set the robustness flag of the mutex attribute ATTR. */
946extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
947 int __robustness)
948 __THROW __nonnull ((1));
949# ifdef __USE_GNU
950# ifdef __REDIRECT_NTH
951extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
952 (pthread_mutexattr_t *, int),
953 pthread_mutexattr_setrobust) __nonnull ((1))
954 __attribute_deprecated_msg__ ("\
955pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
956# else
957# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust
958# endif
959# endif
960#endif
961
962#if defined __USE_UNIX98 || defined __USE_XOPEN2K
963/* Functions for handling read-write locks. */
964
965/* Initialize read-write lock RWLOCK using attributes ATTR, or use
966 the default values if later is NULL. */
967extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
968 const pthread_rwlockattr_t *__restrict
969 __attr) __THROW __nonnull ((1));
970
971/* Destroy read-write lock RWLOCK. */
972extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
973 __THROW __nonnull ((1));
974
975/* Acquire read lock for RWLOCK. */
976extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
977 __THROWNL __nonnull ((1));
978
979/* Try to acquire read lock for RWLOCK. */
980extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
981 __THROWNL __nonnull ((1));
982
983# ifdef __USE_XOPEN2K
984/* Try to acquire read lock for RWLOCK or return after specified time. */
985# ifndef __USE_TIME64_REDIRECTS
986extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
987 const struct timespec *__restrict
988 __abstime) __THROWNL __nonnull ((1, 2));
989# else
990# ifdef __REDIRECT_NTHNL
991extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock,
992 (pthread_rwlock_t *__restrict __rwlock,
993 const struct timespec *__restrict __abstime),
994 __pthread_rwlock_timedrdlock64)
995 __nonnull ((1, 2));
996# else
997# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64
998# endif
999# endif
1000# endif
1001
1002# ifdef __USE_GNU
1003# ifndef __USE_TIME64_REDIRECTS
1004extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock,
1005 clockid_t __clockid,
1006 const struct timespec *__restrict
1007 __abstime) __THROWNL __nonnull ((1, 3));
1008# else
1009# ifdef __REDIRECT_NTHNL
1010extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock,
1011 (pthread_rwlock_t *__restrict __rwlock,
1012 clockid_t __clockid,
1013 const struct timespec *__restrict __abstime),
1014 __pthread_rwlock_clockrdlock64)
1015 __nonnull ((1, 3));
1016# else
1017# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64
1018# endif
1019# endif
1020# endif
1021
1022/* Acquire write lock for RWLOCK. */
1023extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1024 __THROWNL __nonnull ((1));
1025
1026/* Try to acquire write lock for RWLOCK. */
1027extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1028 __THROWNL __nonnull ((1));
1029
1030# ifdef __USE_XOPEN2K
1031/* Try to acquire write lock for RWLOCK or return after specified time. */
1032# ifndef __USE_TIME64_REDIRECTS
1033extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1034 const struct timespec *__restrict
1035 __abstime) __THROWNL __nonnull ((1, 2));
1036# else
1037# ifdef __REDIRECT_NTHNL
1038extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock,
1039 (pthread_rwlock_t *__restrict __rwlock,
1040 const struct timespec *__restrict __abstime),
1041 __pthread_rwlock_timedwrlock64)
1042 __nonnull ((1, 2));
1043# else
1044# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64
1045# endif
1046# endif
1047# endif
1048
1049# ifdef __USE_GNU
1050# ifndef __USE_TIME64_REDIRECTS
1051extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock,
1052 clockid_t __clockid,
1053 const struct timespec *__restrict
1054 __abstime) __THROWNL __nonnull ((1, 3));
1055
1056# else
1057# ifdef __REDIRECT_NTHNL
1058extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock,
1059 (pthread_rwlock_t *__restrict __rwlock,
1060 clockid_t __clockid,
1061 const struct timespec *__restrict __abstime),
1062 __pthread_rwlock_clockwrlock64)
1063 __nonnull ((1, 3));
1064# else
1065# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64
1066# endif
1067# endif
1068# endif
1069
1070/* Unlock RWLOCK. */
1071extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1072 __THROWNL __nonnull ((1));
1073
1074
1075/* Functions for handling read-write lock attributes. */
1076
1077/* Initialize attribute object ATTR with default values. */
1078extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1079 __THROW __nonnull ((1));
1080
1081/* Destroy attribute object ATTR. */
1082extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1083 __THROW __nonnull ((1));
1084
1085/* Return current setting of process-shared attribute of ATTR in PSHARED. */
1086extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
1087 __restrict __attr,
1088 int *__restrict __pshared)
1089 __THROW __nonnull ((1, 2));
1090
1091/* Set process-shared attribute of ATTR to PSHARED. */
1092extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1093 int __pshared)
1094 __THROW __nonnull ((1));
1095
1096/* Return current setting of reader/writer preference. */
1097extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
1098 __restrict __attr,
1099 int *__restrict __pref)
1100 __THROW __nonnull ((1, 2));
1101
1102/* Set reader/write preference. */
1103extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1104 int __pref) __THROW __nonnull ((1));
1105#endif
1106
1107
1108/* Functions for handling conditional variables. */
1109
1110/* Initialize condition variable COND using attributes ATTR, or use
1111 the default values if later is NULL. */
1112extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1113 const pthread_condattr_t *__restrict __cond_attr)
1114 __THROW __nonnull ((1));
1115
1116/* Destroy condition variable COND. */
1117extern int pthread_cond_destroy (pthread_cond_t *__cond)
1118 __THROW __nonnull ((1));
1119
1120/* Wake up one thread waiting for condition variable COND. */
1121extern int pthread_cond_signal (pthread_cond_t *__cond)
1122 __THROWNL __nonnull ((1));
1123
1124/* Wake up all threads waiting for condition variables COND. */
1125extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1126 __THROWNL __nonnull ((1));
1127
1128/* Wait for condition variable COND to be signaled or broadcast.
1129 MUTEX is assumed to be locked before.
1130
1131 This function is a cancellation point and therefore not marked with
1132 __THROW. */
1133extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1134 pthread_mutex_t *__restrict __mutex)
1135 __nonnull ((1, 2));
1136
1137/* Wait for condition variable COND to be signaled or broadcast until
1138 ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an
1139 absolute time specification; zero is the beginning of the epoch
1140 (00:00:00 GMT, January 1, 1970).
1141
1142 This function is a cancellation point and therefore not marked with
1143 __THROW. */
1144# ifndef __USE_TIME64_REDIRECTS
1145extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1146 pthread_mutex_t *__restrict __mutex,
1147 const struct timespec *__restrict __abstime)
1148 __nonnull ((1, 2, 3));
1149# else
1150# ifdef __REDIRECT
1151extern int __REDIRECT (pthread_cond_timedwait,
1152 (pthread_cond_t *__restrict __cond,
1153 pthread_mutex_t *__restrict __mutex,
1154 const struct timespec *__restrict __abstime),
1155 __pthread_cond_timedwait64)
1156 __nonnull ((1, 2, 3));
1157# else
1158# define pthread_cond_timedwait __pthread_cond_timedwait64
1159# endif
1160# endif
1161
1162# ifdef __USE_GNU
1163/* Wait for condition variable COND to be signaled or broadcast until
1164 ABSTIME measured by the specified clock. MUTEX is assumed to be
1165 locked before. CLOCK is the clock to use. ABSTIME is an absolute
1166 time specification against CLOCK's epoch.
1167
1168 This function is a cancellation point and therefore not marked with
1169 __THROW. */
1170# ifndef __USE_TIME64_REDIRECTS
1171extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond,
1172 pthread_mutex_t *__restrict __mutex,
1173 __clockid_t __clock_id,
1174 const struct timespec *__restrict __abstime)
1175 __nonnull ((1, 2, 4));
1176# else
1177# ifdef __REDIRECT
1178extern int __REDIRECT (pthread_cond_clockwait,
1179 (pthread_cond_t *__restrict __cond,
1180 pthread_mutex_t *__restrict __mutex,
1181 __clockid_t __clock_id,
1182 const struct timespec *__restrict __abstime),
1183 __pthread_cond_clockwait64)
1184 __nonnull ((1, 2, 4));
1185# else
1186# define pthread_cond_clockwait __pthread_cond_clockwait64
1187# endif
1188# endif
1189# endif
1190
1191/* Functions for handling condition variable attributes. */
1192
1193/* Initialize condition variable attribute ATTR. */
1194extern int pthread_condattr_init (pthread_condattr_t *__attr)
1195 __THROW __nonnull ((1));
1196
1197/* Destroy condition variable attribute ATTR. */
1198extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1199 __THROW __nonnull ((1));
1200
1201/* Get the process-shared flag of the condition variable attribute ATTR. */
1202extern int pthread_condattr_getpshared (const pthread_condattr_t *
1203 __restrict __attr,
1204 int *__restrict __pshared)
1205 __THROW __nonnull ((1, 2));
1206
1207/* Set the process-shared flag of the condition variable attribute ATTR. */
1208extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1209 int __pshared) __THROW __nonnull ((1));
1210
1211#ifdef __USE_XOPEN2K
1212/* Get the clock selected for the condition variable attribute ATTR. */
1213extern int pthread_condattr_getclock (const pthread_condattr_t *
1214 __restrict __attr,
1215 __clockid_t *__restrict __clock_id)
1216 __THROW __nonnull ((1, 2));
1217
1218/* Set the clock selected for the condition variable attribute ATTR. */
1219extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1220 __clockid_t __clock_id)
1221 __THROW __nonnull ((1));
1222#endif
1223
1224
1225#ifdef __USE_XOPEN2K
1226/* Functions to handle spinlocks. */
1227
1228/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can
1229 be shared between different processes. */
1230extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1231 __THROW __nonnull ((1));
1232
1233/* Destroy the spinlock LOCK. */
1234extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1235 __THROW __nonnull ((1));
1236
1237/* Wait until spinlock LOCK is retrieved. */
1238extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1239 __THROWNL __nonnull ((1));
1240
1241/* Try to lock spinlock LOCK. */
1242extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1243 __THROWNL __nonnull ((1));
1244
1245/* Release spinlock LOCK. */
1246extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1247 __THROWNL __nonnull ((1));
1248
1249
1250/* Functions to handle barriers. */
1251
1252/* Initialize BARRIER with the attributes in ATTR. The barrier is
1253 opened when COUNT waiters arrived. */
1254extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1255 const pthread_barrierattr_t *__restrict
1256 __attr, unsigned int __count)
1257 __THROW __nonnull ((1));
1258
1259/* Destroy a previously dynamically initialized barrier BARRIER. */
1260extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1261 __THROW __nonnull ((1));
1262
1263/* Wait on barrier BARRIER. */
1264extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1265 __THROWNL __nonnull ((1));
1266
1267
1268/* Initialize barrier attribute ATTR. */
1269extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1270 __THROW __nonnull ((1));
1271
1272/* Destroy previously dynamically initialized barrier attribute ATTR. */
1273extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1274 __THROW __nonnull ((1));
1275
1276/* Get the process-shared flag of the barrier attribute ATTR. */
1277extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
1278 __restrict __attr,
1279 int *__restrict __pshared)
1280 __THROW __nonnull ((1, 2));
1281
1282/* Set the process-shared flag of the barrier attribute ATTR. */
1283extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1284 int __pshared)
1285 __THROW __nonnull ((1));
1286#endif
1287
1288
1289/* Functions for handling thread-specific data. */
1290
1291/* Create a key value identifying a location in the thread-specific
1292 data area. Each thread maintains a distinct thread-specific data
1293 area. DESTR_FUNCTION, if non-NULL, is called with the value
1294 associated to that key when the key is destroyed.
1295 DESTR_FUNCTION is not called if the value associated is NULL when
1296 the key is destroyed. */
1297extern int pthread_key_create (pthread_key_t *__key,
1298 void (*__destr_function) (void *))
1299 __THROW __nonnull ((1));
1300
1301/* Destroy KEY. */
1302extern int pthread_key_delete (pthread_key_t __key) __THROW;
1303
1304/* Return current value of the thread-specific data slot identified by KEY. */
1305extern void *pthread_getspecific (pthread_key_t __key) __THROW;
1306
1307/* Store POINTER in the thread-specific data slot identified by KEY. */
1308extern int pthread_setspecific (pthread_key_t __key,
1309 const void *__pointer)
1310 __THROW __attr_access_none (2);
1311
1312
1313#ifdef __USE_XOPEN2K
1314/* Get ID of CPU-time clock for thread THREAD_ID. */
1315extern int pthread_getcpuclockid (pthread_t __thread_id,
1316 __clockid_t *__clock_id)
1317 __THROW __nonnull ((2));
1318#endif
1319
1320#ifdef __USE_GNU
1321/* Return the Linux TID for THREAD_ID. Returns -1 on failure. */
1322extern pid_t pthread_gettid_np (pthread_t __thread_id);
1323#endif
1324
1325
1326/* Install handlers to be called when a new process is created with FORK.
1327 The PREPARE handler is called in the parent process just before performing
1328 FORK. The PARENT handler is called in the parent process just after FORK.
1329 The CHILD handler is called in the child process. Each of the three
1330 handlers can be NULL, meaning that no handler needs to be called at that
1331 point.
1332 PTHREAD_ATFORK can be called several times, in which case the PREPARE
1333 handlers are called in LIFO order (last added with PTHREAD_ATFORK,
1334 first called before FORK), and the PARENT and CHILD handlers are called
1335 in FIFO (first added, first called). */
1336
1337extern int pthread_atfork (void (*__prepare) (void),
1338 void (*__parent) (void),
1339 void (*__child) (void)) __THROW;
1340
1341
1342#ifdef __USE_EXTERN_INLINES
1343/* Optimizations. */
1344__extern_inline int
1345__NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2))
1346{
1347 return __thread1 == __thread2;
1348}
1349#endif
1350
1351__END_DECLS
1352
1353#endif /* pthread.h */
lib/libc/glibc/sysdeps/powerpc/powerpc32/dl-dtprocnum.h deleted-3
......@@ -1,3 +0,0 @@
1/* Number of extra dynamic section entries for this architecture. By
2 default there are none. */
3#define DT_THISPROCNUM DT_PPC_NUM
lib/libc/glibc/sysdeps/powerpc/powerpc32/symbol-hacks.h deleted-21
......@@ -1,21 +0,0 @@
1/* Hacks needed for symbol manipulation. powerpc version.
2 Copyright (C) 2017-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/wordsize-32/divdi3-symbol-hacks.h>
20
21#include_next "symbol-hacks.h"
lib/libc/glibc/sysdeps/powerpc/powerpc32/sysdep.h deleted-198
......@@ -1,198 +0,0 @@
1/* Assembly macros for 32-bit PowerPC.
2 Copyright (C) 1999-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdeps/powerpc/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23/* If compiled for profiling, call `_mcount' at the start of each
24 function. */
25#ifdef PROF
26/* The mcount code relies on a the return address being on the stack
27 to locate our caller and so it can restore it; so store one just
28 for its benefit. */
29# define CALL_MCOUNT \
30 mflr r0; \
31 stw r0,4(r1); \
32 cfi_offset (lr, 4); \
33 bl JUMPTARGET(_mcount);
34#else /* PROF */
35# define CALL_MCOUNT /* Do nothing. */
36#endif /* PROF */
37
38#define ENTRY(name) \
39 .globl C_SYMBOL_NAME(name); \
40 .type C_SYMBOL_NAME(name),@function; \
41 .align ALIGNARG(2); \
42 C_LABEL(name) \
43 cfi_startproc; \
44 CALL_MCOUNT
45
46#define ENTRY_TOCLESS(name) ENTRY(name)
47
48/* helper macro for accessing the 32-bit powerpc GOT. */
49
50#define SETUP_GOT_ACCESS(regname,GOT_LABEL) \
51 bcl 20,31,GOT_LABEL ; \
52GOT_LABEL: ; \
53 mflr (regname)
54
55#define EALIGN_W_0 /* No words to insert. */
56#define EALIGN_W_1 nop
57#define EALIGN_W_2 nop;nop
58#define EALIGN_W_3 nop;nop;nop
59#define EALIGN_W_4 EALIGN_W_3;nop
60#define EALIGN_W_5 EALIGN_W_4;nop
61#define EALIGN_W_6 EALIGN_W_5;nop
62#define EALIGN_W_7 EALIGN_W_6;nop
63
64/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
65 past a 2^align boundary. */
66#ifdef PROF
67# define EALIGN(name, alignt, words) \
68 .globl C_SYMBOL_NAME(name); \
69 .type C_SYMBOL_NAME(name),@function; \
70 .align ALIGNARG(2); \
71 C_LABEL(name) \
72 cfi_startproc; \
73 CALL_MCOUNT \
74 b 0f; \
75 .align ALIGNARG(alignt); \
76 EALIGN_W_##words; \
77 0:
78#else /* PROF */
79# define EALIGN(name, alignt, words) \
80 .globl C_SYMBOL_NAME(name); \
81 .type C_SYMBOL_NAME(name),@function; \
82 .align ALIGNARG(alignt); \
83 EALIGN_W_##words; \
84 C_LABEL(name) \
85 cfi_startproc;
86#endif
87
88#undef END
89#define END(name) \
90 cfi_endproc; \
91 ASM_SIZE_DIRECTIVE(name)
92
93#define DO_CALL(syscall) \
94 li 0,syscall; \
95 DO_CALL_SC
96
97#define DO_CALL_SC \
98 sc
99
100#undef JUMPTARGET
101#ifdef PIC
102# define JUMPTARGET(name) name##@plt
103#else
104# define JUMPTARGET(name) name
105#endif
106
107#define TAIL_CALL_NO_RETURN(__func) \
108 b __func@local
109
110#if defined SHARED && defined PIC && !defined NO_HIDDEN
111# undef HIDDEN_JUMPTARGET
112# define HIDDEN_JUMPTARGET(name) __GI_##name##@local
113#endif
114
115#define TAIL_CALL_SYSCALL_ERROR \
116 b __syscall_error@local
117
118#define PSEUDO(name, syscall_name, args) \
119 .section ".text"; \
120 ENTRY (name) \
121 DO_CALL (SYS_ify (syscall_name));
122
123#define RET_SC \
124 bnslr+;
125
126#define PSEUDO_RET \
127 RET_SC; \
128 TAIL_CALL_SYSCALL_ERROR
129#define ret PSEUDO_RET
130
131#undef PSEUDO_END
132#define PSEUDO_END(name) \
133 END (name)
134
135#define PSEUDO_NOERRNO(name, syscall_name, args) \
136 .section ".text"; \
137 ENTRY (name) \
138 DO_CALL (SYS_ify (syscall_name));
139
140#define PSEUDO_RET_NOERRNO \
141 blr
142#define ret_NOERRNO PSEUDO_RET_NOERRNO
143
144#undef PSEUDO_END_NOERRNO
145#define PSEUDO_END_NOERRNO(name) \
146 END (name)
147
148#define PSEUDO_ERRVAL(name, syscall_name, args) \
149 .section ".text"; \
150 ENTRY (name) \
151 DO_CALL (SYS_ify (syscall_name));
152
153#define PSEUDO_RET_ERRVAL \
154 blr
155#define ret_ERRVAL PSEUDO_RET_ERRVAL
156
157#undef PSEUDO_END_ERRVAL
158#define PSEUDO_END_ERRVAL(name) \
159 END (name)
160
161/* Local labels stripped out by the linker. */
162#undef L
163#define L(x) .L##x
164
165#define XGLUE(a,b) a##b
166#define GLUE(a,b) XGLUE (a,b)
167#define GENERATE_GOT_LABEL(name) GLUE (.got_label, name)
168
169/* Label in text section. */
170#define C_TEXT(name) name
171
172/* Read the value of member from rtld_global_ro. */
173#ifdef PIC
174# ifdef SHARED
175# if IS_IN (rtld)
176/* Inside ld.so we use the local alias to avoid runtime GOT
177 relocations. */
178# define __GLRO(rOUT, rGOT, member, offset) \
179 lwz rOUT,_rtld_local_ro@got(rGOT); \
180 lwz rOUT,offset(rOUT)
181# else
182# define __GLRO(rOUT, rGOT, member, offset) \
183 lwz rOUT,_rtld_global_ro@got(rGOT); \
184 lwz rOUT,offset(rOUT)
185# endif
186# else
187# define __GLRO(rOUT, rGOT, member, offset) \
188 lwz rOUT,member@got(rGOT); \
189 lwz rOUT,0(rOUT)
190# endif
191#else
192/* Position-dependent code does not require access to the GOT. */
193# define __GLRO(rOUT, rGOT, member, offset) \
194 lis rOUT,(member)@ha; \
195 lwz rOUT,(member)@l(rOUT)
196#endif /* PIC */
197
198#endif /* __ASSEMBLER__ */
lib/libc/glibc/sysdeps/powerpc/powerpc64/dl-dtprocnum.h deleted-21
......@@ -1,21 +0,0 @@
1/* Configuration of lookup functions. PowerPC64 version.
2 Copyright (C) 2002-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* Number of extra dynamic section entries for this architecture. By
20 default there are none. */
21#define DT_THISPROCNUM DT_PPC64_NUM
lib/libc/glibc/sysdeps/sparc/dl-dtprocnum.h deleted-21
......@@ -1,21 +0,0 @@
1/* Configuration of lookup functions. SPARC version.
2 Copyright (C) 2000-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* Number of extra dynamic section entries for this architecture. By
20 default there are none. */
21#define DT_THISPROCNUM DT_SPARC_NUM
lib/libc/glibc/sysdeps/unix/arm/sysdep.h deleted-29
......@@ -1,29 +0,0 @@
1/* Copyright (C) 1997-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sysdeps/unix/sysdep.h>
19#include <sysdeps/arm/sysdep.h>
20
21/* Some definitions to allow the assembler in sysdeps/unix/ to build
22 without needing ARM-specific versions of all the files. */
23
24#ifdef __ASSEMBLER__
25
26#define ret DO_RET (r14)
27#define MOVE(a,b) mov b,a
28
29#endif
lib/libc/glibc/sysdeps/unix/mips/mips32/sysdep.h deleted-55
......@@ -1,55 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sysdeps/unix/mips/sysdep.h>
19
20/* Note that while it's better structurally, going back to call __syscall_error
21 can make things confusing if you're debugging---it looks like it's jumping
22 backwards into the previous fn. */
23#ifdef __PIC__
24#define PSEUDO(name, syscall_name, args) \
25 .align 2; \
26 .set nomips16; \
27 cfi_startproc; \
28 99: la t9,__syscall_error; \
29 jr t9; \
30 cfi_endproc; \
31 ENTRY(name) \
32 .set noreorder; \
33 .cpload t9; \
34 li v0, SYS_ify(syscall_name); \
35 syscall; \
36 .set reorder; \
37 bne a3, zero, 99b; \
38L(syse1):
39#else
40#define PSEUDO(name, syscall_name, args) \
41 .set noreorder; \
42 .set nomips16; \
43 .align 2; \
44 cfi_startproc; \
45 99: j __syscall_error; \
46 nop; \
47 cfi_endproc; \
48 ENTRY(name) \
49 .set noreorder; \
50 li v0, SYS_ify(syscall_name); \
51 syscall; \
52 .set reorder; \
53 bne a3, zero, 99b; \
54L(syse1):
55#endif
lib/libc/glibc/sysdeps/unix/mips/mips64/sysdep.h deleted-64
......@@ -1,64 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sysdeps/unix/mips/sysdep.h>
19
20#ifdef __ASSEMBLER__
21#include <sys/asm.h>
22
23/* Note that while it's better structurally, going back to call __syscall_error
24 can make things confusing if you're debugging---it looks like it's jumping
25 backwards into the previous fn. */
26#ifdef __PIC__
27#define PSEUDO(name, syscall_name, args) \
28 .align 2; \
29 .set nomips16; \
30 cfi_startproc; \
31 99:; \
32 .set noat; \
33 .cpsetup t9, $1, name; \
34 cfi_register (gp, $1); \
35 .set at; \
36 PTR_LA t9,__syscall_error; \
37 .cpreturn; \
38 cfi_restore (gp); \
39 jr t9; \
40 cfi_endproc; \
41 ENTRY(name) \
42 li v0, SYS_ify(syscall_name); \
43 syscall; \
44 bne a3, zero, 99b; \
45L(syse1):
46#else
47#define PSEUDO(name, syscall_name, args) \
48 .set noreorder; \
49 .align 2; \
50 .set nomips16; \
51 cfi_startproc; \
52 99: j __syscall_error; \
53 nop; \
54 cfi_endproc; \
55 ENTRY(name) \
56 .set noreorder; \
57 li v0, SYS_ify(syscall_name); \
58 syscall; \
59 .set reorder; \
60 bne a3, zero, 99b; \
61L(syse1):
62#endif
63
64#endif
lib/libc/glibc/sysdeps/unix/mips/sysdep.h deleted-83
......@@ -1,83 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <isarev.h>
19#include <sgidefs.h>
20#include <sysdeps/unix/sysdep.h>
21
22
23#ifdef __ASSEMBLER__
24
25#include <regdef.h>
26
27#define ENTRY(name) \
28 .globl name; \
29 .align 2; \
30 .ent name,0; \
31 name##: \
32 cfi_startproc;
33
34#undef END
35#define END(function) \
36 cfi_endproc; \
37 .end function; \
38 .size function,.-function
39
40// zig patch: j <reg> -> jr <reg> for https://github.com/ziglang/zig/issues/21315
41#define ret jr ra ; nop
42
43#undef PSEUDO_END
44#define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
45
46#define PSEUDO_NOERRNO(name, syscall_name, args) \
47 .align 2; \
48 ENTRY(name) \
49 .set nomips16; \
50 .set noreorder; \
51 li v0, SYS_ify(syscall_name); \
52 syscall
53
54#undef PSEUDO_END_NOERRNO
55#define PSEUDO_END_NOERRNO(sym) cfi_endproc; .end sym; .size sym,.-sym
56
57#define ret_NOERRNO ret
58
59#define PSEUDO_ERRVAL(name, syscall_name, args) \
60 .align 2; \
61 ENTRY(name) \
62 .set nomips16; \
63 .set noreorder; \
64 li v0, SYS_ify(syscall_name); \
65 syscall
66
67#undef PSEUDO_END_ERRVAL
68#define PSEUDO_END_ERRVAL(sym) cfi_endproc; .end sym; .size sym,.-sym
69
70#define ret_ERRVAL ret
71
72#define r0 v0
73#define r1 v1
74/* The mips move insn is d,s. */
75#define MOVE(x,y) move y , x
76
77#if _MIPS_SIM == _ABIO32
78# define L(label) $L ## label
79#else
80# define L(label) .L ## label
81#endif
82
83#endif
lib/libc/glibc/sysdeps/unix/sh/sysdep.h deleted-28
......@@ -1,28 +0,0 @@
1/* Copyright (C) 1999-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#include <sysdeps/unix/sysdep.h>
19#include <sysdeps/sh/sysdep.h>
20
21#ifdef __ASSEMBLER__
22
23#define ret rts ; nop
24
25/* The sh move insn is s, d. */
26#define MOVE(x,y) mov x , y
27
28#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/aarch64/sys/elf.h deleted-26
......@@ -1,26 +0,0 @@
1/* Copyright (C) 1996-2026 Free Software Foundation, Inc.
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_ELF_H
20#define _SYS_ELF_H 1
21
22#warning "This header is obsolete; use <sys/procfs.h> instead."
23
24#include <sys/procfs.h>
25
26#endif /* sys/elf.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/kernel-features.h deleted-58
......@@ -1,58 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 2006-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
19
20#include <endian.h>
21#include_next <kernel-features.h>
22
23/* The ARM kernel before 3.14.3 may or may not support
24 futex_atomic_cmpxchg_inatomic, depending on kernel
25 configuration. */
26#if __LINUX_KERNEL_VERSION < 0x030E03
27# undef __ASSUME_SET_ROBUST_LIST
28#endif
29
30/* ARM fadvise64_64 reorganize the syscall arguments. */
31#define __ASSUME_FADVISE64_64_6ARG 1
32
33/* Define this if your 32-bit syscall API requires 64-bit register
34 pairs to start with an even-number register. */
35#define __ASSUME_ALIGNED_REGISTER_PAIRS 1
36
37/* ARM only has a syscall for fadvise64{_64} and it is defined with a
38 non-standard name. */
39#define __NR_fadvise64_64 __NR_arm_fadvise64_64
40
41#define __ASSUME_RECV_SYSCALL 1
42#define __ASSUME_SEND_SYSCALL 1
43
44/* Support for the mlock2 and copy_file_range syscalls was added to
45 the compat syscall table for 64-bit kernels in 4.7, although
46 present in 32-bit kernels from 4.4 and 4.5 respectively. */
47#if __LINUX_KERNEL_VERSION < 0x040700
48# undef __ASSUME_MLOCK2
49#endif
50
51#undef __ASSUME_CLONE_DEFAULT
52#define __ASSUME_CLONE_BACKWARDS 1
53
54#if __BYTE_ORDER == __BIG_ENDIAN
55# define __ASSUME_SYSVIPC_BROKEN_MODE_T
56#endif
57
58#undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sys/elf.h deleted-25
......@@ -1,25 +0,0 @@
1/* Copyright (C) 1996-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_ELF_H
19#define _SYS_ELF_H 1
20
21#warning "This header is obsolete; use <sys/procfs.h> instead."
22
23#include <sys/procfs.h>
24
25#endif /* sys/elf.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/arm/sysdep.h deleted-414
......@@ -1,414 +0,0 @@
1/* Copyright (C) 1992-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_ARM_SYSDEP_H
19#define _LINUX_ARM_SYSDEP_H 1
20
21/* There is some commonality. */
22#include <sysdeps/unix/sysv/linux/sysdep.h>
23#include <sysdeps/unix/arm/sysdep.h>
24
25/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
26#include <dl-sysdep.h>
27
28#include <tls.h>
29
30/* For Linux we can use the system call table in the header file
31 /usr/include/asm/unistd.h
32 of the kernel. But these symbols do not follow the SYS_* syntax
33 so we have to redefine the `SYS_ify' macro here. */
34#undef SYS_ify
35#define SYS_ify(syscall_name) (__NR_##syscall_name)
36
37#include <bits/hwcap.h>
38
39#ifdef __ASSEMBLER__
40
41#ifndef ARCH_HAS_HARD_TP
42/* Internal macro calling the linux kernel kuser_get_tls helper.
43 Note that in thumb mode, a constant pool break is often out of range, so
44 we always expand the constant inline. */
45# ifdef __thumb2__
46# define GET_TLS_BODY \
47 movw r0, #0x0fe0; \
48 movt r0, #0xffff; \
49 blx r0
50# else
51# define GET_TLS_BODY \
52 mov r0, #0xffff0fff; /* Point to the high page. */ \
53 mov lr, pc; /* Save our return address. */ \
54 sub pc, r0, #31 /* Jump to the TLS entry. */
55# endif
56
57/* Helper to get the TLS base pointer. Save LR in TMP, return in R0,
58 and no other registers clobbered. TMP may be LR itself to indicate
59 that no save is necessary. */
60# undef GET_TLS
61# define GET_TLS(TMP) \
62 .ifnc TMP, lr; \
63 mov TMP, lr; \
64 cfi_register (lr, TMP); \
65 GET_TLS_BODY; \
66 mov lr, TMP; \
67 cfi_restore (lr); \
68 .else; \
69 GET_TLS_BODY; \
70 .endif
71#endif /* ARCH_HAS_HARD_TP */
72
73/* Linux uses a negative return value to indicate syscall errors,
74 unlike most Unices, which use the condition codes' carry flag.
75
76 Since version 2.1 the return value of a system call might be
77 negative even if the call succeeded. E.g., the `lseek' system call
78 might return a large offset. Therefore we must not anymore test
79 for < 0, but test for a real error by making sure the value in R0
80 is a real error number. Linus said he will make sure the no syscall
81 returns a value in -1 .. -4095 as a valid result so we can safely
82 test with -4095. */
83
84#undef PSEUDO
85#define PSEUDO(name, syscall_name, args) \
86 .text; \
87 ENTRY (name); \
88 DO_CALL (syscall_name, args); \
89 cmn r0, $4096;
90
91#define PSEUDO_RET \
92 it cc; \
93 RETINSTR(cc, lr); \
94 b PLTJMP(SYSCALL_ERROR)
95#undef ret
96#define ret PSEUDO_RET
97
98#undef PSEUDO_END
99#define PSEUDO_END(name) \
100 SYSCALL_ERROR_HANDLER; \
101 END (name)
102
103#undef PSEUDO_NOERRNO
104#define PSEUDO_NOERRNO(name, syscall_name, args) \
105 .text; \
106 ENTRY (name); \
107 DO_CALL (syscall_name, args);
108
109#define PSEUDO_RET_NOERRNO \
110 DO_RET (lr);
111
112#undef ret_NOERRNO
113#define ret_NOERRNO PSEUDO_RET_NOERRNO
114
115#undef PSEUDO_END_NOERRNO
116#define PSEUDO_END_NOERRNO(name) \
117 END (name)
118
119/* The function has to return the error code. */
120#undef PSEUDO_ERRVAL
121#define PSEUDO_ERRVAL(name, syscall_name, args) \
122 .text; \
123 ENTRY (name) \
124 DO_CALL (syscall_name, args); \
125 rsb r0, r0, #0
126
127#undef PSEUDO_END_ERRVAL
128#define PSEUDO_END_ERRVAL(name) \
129 END (name)
130
131#define ret_ERRVAL PSEUDO_RET_NOERRNO
132
133#if !IS_IN (libc)
134# define SYSCALL_ERROR __local_syscall_error
135# if RTLD_PRIVATE_ERRNO
136# define SYSCALL_ERROR_HANDLER \
137__local_syscall_error: \
138 rsb r0, r0, #0; \
139 LDST_PCREL(str, r0, r1, C_SYMBOL_NAME(rtld_errno)); \
140 mvn r0, #0; \
141 DO_RET(lr)
142# else
143# if defined(__ARM_ARCH_4T__) && defined(__THUMB_INTERWORK__)
144# define POP_PC \
145 pop { lr }; \
146 cfi_adjust_cfa_offset (-4); \
147 cfi_restore (lr); \
148 bx lr
149# else
150# define POP_PC pop { pc }
151# endif
152# define SYSCALL_ERROR_HANDLER \
153__local_syscall_error: \
154 push { lr }; \
155 cfi_adjust_cfa_offset (4); \
156 cfi_rel_offset (lr, 0); \
157 push { r0 }; \
158 cfi_adjust_cfa_offset (4); \
159 bl PLTJMP(C_SYMBOL_NAME(__errno_location)); \
160 pop { r1 }; \
161 cfi_adjust_cfa_offset (-4); \
162 rsb r1, r1, #0; \
163 str r1, [r0]; \
164 mvn r0, #0; \
165 POP_PC;
166# endif
167#else
168# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
169# define SYSCALL_ERROR __syscall_error
170#endif
171
172/* The ARM EABI user interface passes the syscall number in r7, instead
173 of in the swi. This is more efficient, because the kernel does not need
174 to fetch the swi from memory to find out the number; which can be painful
175 with separate I-cache and D-cache. Make sure to use 0 for the SWI
176 argument; otherwise the (optional) compatibility code for APCS binaries
177 may be invoked. */
178
179/* Linux takes system call args in registers:
180 arg 1 r0
181 arg 2 r1
182 arg 3 r2
183 arg 4 r3
184 arg 5 r4 (this is different from the APCS convention)
185 arg 6 r5
186 arg 7 r6
187
188 The compiler is going to form a call by coming here, through PSEUDO, with
189 arguments
190 syscall number in the DO_CALL macro
191 arg 1 r0
192 arg 2 r1
193 arg 3 r2
194 arg 4 r3
195 arg 5 [sp]
196 arg 6 [sp+4]
197 arg 7 [sp+8]
198
199 We need to shuffle values between R4..R6 and the stack so that the
200 caller's v1..v3 and stack frame are not corrupted, and the kernel
201 sees the right arguments.
202
203*/
204
205/* We must save and restore r7 (call-saved) for the syscall number.
206 We never make function calls from inside here (only potentially
207 signal handlers), so we do not bother with doubleword alignment.
208
209 Just like the APCS syscall convention, the EABI syscall convention uses
210 r0 through r6 for up to seven syscall arguments. None are ever passed to
211 the kernel on the stack, although incoming arguments are on the stack for
212 syscalls with five or more arguments.
213
214 The assembler will convert the literal pool load to a move for most
215 syscalls. */
216
217#undef DO_CALL
218#define DO_CALL(syscall_name, args) \
219 DOARGS_##args; \
220 ldr r7, =SYS_ify (syscall_name); \
221 swi 0x0; \
222 UNDOARGS_##args
223
224#undef DOARGS_0
225#define DOARGS_0 \
226 .fnstart; \
227 push { r7 }; \
228 cfi_adjust_cfa_offset (4); \
229 cfi_rel_offset (r7, 0); \
230 .save { r7 }
231#undef DOARGS_1
232#define DOARGS_1 DOARGS_0
233#undef DOARGS_2
234#define DOARGS_2 DOARGS_0
235#undef DOARGS_3
236#define DOARGS_3 DOARGS_0
237#undef DOARGS_4
238#define DOARGS_4 DOARGS_0
239#undef DOARGS_5
240#define DOARGS_5 \
241 .fnstart; \
242 push {r4, r7}; \
243 cfi_adjust_cfa_offset (8); \
244 cfi_rel_offset (r4, 0); \
245 cfi_rel_offset (r7, 4); \
246 .save { r4, r7 }; \
247 ldr r4, [sp, #8]
248#undef DOARGS_6
249#define DOARGS_6 \
250 .fnstart; \
251 mov ip, sp; \
252 push {r4, r5, r7}; \
253 cfi_adjust_cfa_offset (12); \
254 cfi_rel_offset (r4, 0); \
255 cfi_rel_offset (r5, 4); \
256 cfi_rel_offset (r7, 8); \
257 .save { r4, r5, r7 }; \
258 ldmia ip, {r4, r5}
259#undef DOARGS_7
260#define DOARGS_7 \
261 .fnstart; \
262 mov ip, sp; \
263 push {r4, r5, r6, r7}; \
264 cfi_adjust_cfa_offset (16); \
265 cfi_rel_offset (r4, 0); \
266 cfi_rel_offset (r5, 4); \
267 cfi_rel_offset (r6, 8); \
268 cfi_rel_offset (r7, 12); \
269 .save { r4, r5, r6, r7 }; \
270 ldmia ip, {r4, r5, r6}
271
272#undef UNDOARGS_0
273#define UNDOARGS_0 \
274 pop {r7}; \
275 cfi_adjust_cfa_offset (-4); \
276 cfi_restore (r7); \
277 .fnend
278#undef UNDOARGS_1
279#define UNDOARGS_1 UNDOARGS_0
280#undef UNDOARGS_2
281#define UNDOARGS_2 UNDOARGS_0
282#undef UNDOARGS_3
283#define UNDOARGS_3 UNDOARGS_0
284#undef UNDOARGS_4
285#define UNDOARGS_4 UNDOARGS_0
286#undef UNDOARGS_5
287#define UNDOARGS_5 \
288 pop {r4, r7}; \
289 cfi_adjust_cfa_offset (-8); \
290 cfi_restore (r4); \
291 cfi_restore (r7); \
292 .fnend
293#undef UNDOARGS_6
294#define UNDOARGS_6 \
295 pop {r4, r5, r7}; \
296 cfi_adjust_cfa_offset (-12); \
297 cfi_restore (r4); \
298 cfi_restore (r5); \
299 cfi_restore (r7); \
300 .fnend
301#undef UNDOARGS_7
302#define UNDOARGS_7 \
303 pop {r4, r5, r6, r7}; \
304 cfi_adjust_cfa_offset (-16); \
305 cfi_restore (r4); \
306 cfi_restore (r5); \
307 cfi_restore (r6); \
308 cfi_restore (r7); \
309 .fnend
310
311#else /* not __ASSEMBLER__ */
312
313#if defined(__thumb__)
314/* We can not expose the use of r7 to the compiler. GCC (as
315 of 4.5) uses r7 as the hard frame pointer for Thumb - although
316 for Thumb-2 it isn't obviously a better choice than r11.
317 And GCC does not support asms that conflict with the frame
318 pointer.
319
320 This would be easier if syscall numbers never exceeded 255,
321 but they do. For the moment the LOAD_ARGS_7 is sacrificed.
322 We can't use push/pop inside the asm because that breaks
323 unwinding (i.e. thread cancellation) for this frame. We can't
324 locally save and restore r7, because we do not know if this
325 function uses r7 or if it is our caller's r7; if it is our caller's,
326 then unwinding will fail higher up the stack. So we move the
327 syscall out of line and provide its own unwind information. */
328# undef INTERNAL_SYSCALL_RAW
329# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
330 ({ \
331 register int _a1 asm ("a1"); \
332 int _nametmp = name; \
333 LOAD_ARGS_##nr (args) \
334 register int _name asm ("ip") = _nametmp; \
335 asm volatile ("bl __libc_do_syscall" \
336 : "=r" (_a1) \
337 : "r" (_name) ASM_ARGS_##nr \
338 : "memory", "lr"); \
339 _a1; })
340#else /* ARM */
341# undef INTERNAL_SYSCALL_RAW
342# define INTERNAL_SYSCALL_RAW(name, nr, args...) \
343 ({ \
344 register int _a1 asm ("r0"), _nr asm ("r7"); \
345 LOAD_ARGS_##nr (args) \
346 _nr = name; \
347 asm volatile ("swi 0x0 @ syscall " #name \
348 : "=r" (_a1) \
349 : "r" (_nr) ASM_ARGS_##nr \
350 : "memory"); \
351 _a1; })
352#endif
353
354#undef INTERNAL_SYSCALL
355#define INTERNAL_SYSCALL(name, nr, args...) \
356 INTERNAL_SYSCALL_RAW(SYS_ify(name), nr, args)
357
358#define VDSO_NAME "LINUX_2.6"
359#define VDSO_HASH 61765110
360
361/* List of system calls which are supported as vsyscalls. */
362#define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
363#define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
364#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
365#define HAVE_CLONE3_WRAPPER 1
366
367#define LOAD_ARGS_0()
368#define ASM_ARGS_0
369#define LOAD_ARGS_1(a1) \
370 int _a1tmp = (int) (a1); \
371 LOAD_ARGS_0 () \
372 _a1 = _a1tmp;
373#define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1)
374#define LOAD_ARGS_2(a1, a2) \
375 int _a2tmp = (int) (a2); \
376 LOAD_ARGS_1 (a1) \
377 register int _a2 asm ("a2") = _a2tmp;
378#define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2)
379#define LOAD_ARGS_3(a1, a2, a3) \
380 int _a3tmp = (int) (a3); \
381 LOAD_ARGS_2 (a1, a2) \
382 register int _a3 asm ("a3") = _a3tmp;
383#define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3)
384#define LOAD_ARGS_4(a1, a2, a3, a4) \
385 int _a4tmp = (int) (a4); \
386 LOAD_ARGS_3 (a1, a2, a3) \
387 register int _a4 asm ("a4") = _a4tmp;
388#define ASM_ARGS_4 ASM_ARGS_3, "r" (_a4)
389#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
390 int _v1tmp = (int) (a5); \
391 LOAD_ARGS_4 (a1, a2, a3, a4) \
392 register int _v1 asm ("v1") = _v1tmp;
393#define ASM_ARGS_5 ASM_ARGS_4, "r" (_v1)
394#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
395 int _v2tmp = (int) (a6); \
396 LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
397 register int _v2 asm ("v2") = _v2tmp;
398#define ASM_ARGS_6 ASM_ARGS_5, "r" (_v2)
399#ifndef __thumb__
400# define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7) \
401 int _v3tmp = (int) (a7); \
402 LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6) \
403 register int _v3 asm ("v3") = _v3tmp;
404# define ASM_ARGS_7 ASM_ARGS_6, "r" (_v3)
405#endif
406
407/* For EABI, non-constant syscalls are actually pretty easy... */
408#undef INTERNAL_SYSCALL_NCS
409#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
410 INTERNAL_SYSCALL_RAW (number, nr, args)
411
412#endif /* __ASSEMBLER__ */
413
414#endif /* linux/arm/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/bits/timex.h deleted-141
......@@ -1,141 +0,0 @@
1/* Copyright (C) 1995-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _BITS_TIMEX_H
19#define _BITS_TIMEX_H 1
20
21#include <bits/types.h>
22#include <bits/types/struct_timeval.h>
23
24/* These definitions from linux/timex.h as of 3.18. */
25
26struct timex
27{
28# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32)
29 unsigned int modes; /* mode selector */
30 int :32; /* pad */
31 long long offset; /* time offset (usec) */
32 long long freq; /* frequency offset (scaled ppm) */
33 long long maxerror; /* maximum error (usec) */
34 long long esterror; /* estimated error (usec) */
35 int status; /* clock command/status */
36 int :32; /* pad */
37 long long constant; /* pll time constant */
38 long long precision; /* clock precision (usec) (read only) */
39 long long tolerance; /* clock frequency tolerance (ppm) (ro) */
40 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
41 long long tick; /* (modified) usecs between clock ticks */
42 long long ppsfreq; /* pps frequency (scaled ppm) (ro) */
43 long long jitter; /* pps jitter (us) (ro) */
44 int shift; /* interval duration (s) (shift) (ro) */
45 int :32; /* pad */
46 long long stabil; /* pps stability (scaled ppm) (ro) */
47 long long jitcnt; /* jitter limit exceeded (ro) */
48 long long calcnt; /* calibration intervals (ro) */
49 long long errcnt; /* calibration errors (ro) */
50 long long stbcnt; /* stability limit exceeded (ro) */
51
52 int tai; /* TAI offset (ro) */
53
54 int :32; int :32; int :32; int :32;
55 int :32; int :32; int :32; int :32;
56 int :32; int :32; int :32;
57# else
58 unsigned int modes; /* mode selector */
59 __syscall_slong_t offset; /* time offset (usec) */
60 __syscall_slong_t freq; /* frequency offset (scaled ppm) */
61 __syscall_slong_t maxerror; /* maximum error (usec) */
62 __syscall_slong_t esterror; /* estimated error (usec) */
63 int status; /* clock command/status */
64 __syscall_slong_t constant; /* pll time constant */
65 __syscall_slong_t precision; /* clock precision (usec) (ro) */
66 __syscall_slong_t tolerance; /* clock frequency tolerance (ppm) (ro) */
67 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
68 __syscall_slong_t tick; /* (modified) usecs between clock ticks */
69 __syscall_slong_t ppsfreq; /* pps frequency (scaled ppm) (ro) */
70 __syscall_slong_t jitter; /* pps jitter (us) (ro) */
71 int shift; /* interval duration (s) (shift) (ro) */
72 __syscall_slong_t stabil; /* pps stability (scaled ppm) (ro) */
73 __syscall_slong_t jitcnt; /* jitter limit exceeded (ro) */
74 __syscall_slong_t calcnt; /* calibration intervals (ro) */
75 __syscall_slong_t errcnt; /* calibration errors (ro) */
76 __syscall_slong_t stbcnt; /* stability limit exceeded (ro) */
77
78 int tai; /* TAI offset (ro) */
79
80 /* ??? */
81 int :32; int :32; int :32; int :32;
82 int :32; int :32; int :32; int :32;
83 int :32; int :32; int :32;
84# endif
85};
86
87/* Mode codes (timex.mode) */
88#define ADJ_OFFSET 0x0001 /* time offset */
89#define ADJ_FREQUENCY 0x0002 /* frequency offset */
90#define ADJ_MAXERROR 0x0004 /* maximum time error */
91#define ADJ_ESTERROR 0x0008 /* estimated time error */
92#define ADJ_STATUS 0x0010 /* clock status */
93#define ADJ_TIMECONST 0x0020 /* pll time constant */
94#define ADJ_TAI 0x0080 /* set TAI offset */
95#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
96#define ADJ_MICRO 0x1000 /* select microsecond resolution */
97#define ADJ_NANO 0x2000 /* select nanosecond resolution */
98#define ADJ_TICK 0x4000 /* tick value */
99#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
100#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
101
102/* xntp 3.4 compatibility names */
103#define MOD_OFFSET ADJ_OFFSET
104#define MOD_FREQUENCY ADJ_FREQUENCY
105#define MOD_MAXERROR ADJ_MAXERROR
106#define MOD_ESTERROR ADJ_ESTERROR
107#define MOD_STATUS ADJ_STATUS
108#define MOD_TIMECONST ADJ_TIMECONST
109#define MOD_CLKB ADJ_TICK
110#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
111#define MOD_TAI ADJ_TAI
112#define MOD_MICRO ADJ_MICRO
113#define MOD_NANO ADJ_NANO
114
115
116/* Status codes (timex.status) */
117#define STA_PLL 0x0001 /* enable PLL updates (rw) */
118#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
119#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
120#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
121
122#define STA_INS 0x0010 /* insert leap (rw) */
123#define STA_DEL 0x0020 /* delete leap (rw) */
124#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
125#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
126
127#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
128#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
129#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
130#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
131
132#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
133#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
134#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
135#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
136
137/* Read-only bits */
138#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER \
139 | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
140
141#endif /* bits/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/csky/kernel_stat.h deleted-21
......@@ -1,21 +0,0 @@
1/* Internal definitions for stat functions. Linux/csky.
2 Copyright (C) 2011-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#define STAT_IS_KERNEL_STAT 1
20#define XSTAT_IS_XSTAT64 0
21#define STATFS_IS_STATFS64 0
lib/libc/glibc/sysdeps/unix/sysv/linux/fstat.c deleted-37
......@@ -1,37 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sys/stat.h>
20#include <kernel_stat.h>
21#include <fcntl.h>
22#include <errno.h>
23
24#if !XSTAT_IS_XSTAT64
25int
26__fstat (int fd, struct stat *buf)
27{
28 if (fd < 0)
29 {
30 __set_errno (EBADF);
31 return -1;
32 }
33 return __fstatat (fd, "", buf, AT_EMPTY_PATH);
34}
35
36weak_alias (__fstat, fstat)
37#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/fstat64.c deleted-100
......@@ -1,100 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#define __fstat __redirect___fstat
20#define fstat __redirect_fstat
21#include <sys/stat.h>
22#undef __fstat
23#undef fstat
24#include <fcntl.h>
25#include <internal-stat.h>
26#include <errno.h>
27
28int
29__fstat64_time64 (int fd, struct __stat64_t64 *buf)
30{
31#if !FSTATAT_USE_STATX
32# if XSTAT_IS_XSTAT64
33 /* The __NR_stat macro is defined for all ABIs that also define
34 XSTAT_IS_STAT64, so to correctly identify alpha and sparc check
35 __NR_newfstatat (similar to what fstatat64 does). */
36# ifdef __NR_newfstatat
37 /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and
38 x86_64. */
39 return INLINE_SYSCALL_CALL (fstat, fd, buf);
40# elif defined __NR_fstat64
41# if STAT64_IS_KERNEL_STAT64
42 /* 64-bit kABI outlier, e.g. alpha */
43 return INLINE_SYSCALL_CALL (fstat64, fd, buf);
44# else
45 /* 64-bit kABI outlier, e.g. sparc64. */
46 struct kernel_stat64 kst64;
47 int r = INLINE_SYSCALL_CALL (fstat64, fd, &kst64);
48 if (r == 0)
49 __cp_stat64_kstat64 (buf, &kst64);
50 return r;
51# endif /* STAT64_IS_KERNEL_STAT64 */
52# endif
53# else /* XSTAT_IS_XSTAT64 */
54 /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */
55 struct kernel_stat kst;
56 int r = INLINE_SYSCALL_CALL (fstat, fd, &kst);
57 if (r == 0)
58 __cp_kstat_stat64_t64 (&kst, buf);
59 return r;
60# endif
61#else /* !FSTATAT_USE_STATX */
62 /* All kABIs with non-LFS support and with old 32-bit time_t support
63 e.g. arm, csky, i386, hppa, m68k, microblaze, sh, powerpc32,
64 and sparc32. */
65 if (fd < 0)
66 {
67 __set_errno (EBADF);
68 return -1;
69 }
70 return __fstatat64_time64 (fd, "", buf, AT_EMPTY_PATH);
71#endif
72}
73#if __TIMESIZE != 64
74hidden_def (__fstat64_time64)
75
76int
77__fstat64 (int fd, struct stat64 *buf)
78{
79 if (fd < 0)
80 {
81 __set_errno (EBADF);
82 return -1;
83 }
84
85 struct __stat64_t64 st_t64;
86 return __fstat64_time64 (fd, &st_t64)
87 ?: __cp_stat64_t64_stat64 (&st_t64, buf);
88}
89#endif
90
91#undef __fstat
92#undef fstat
93
94hidden_def (__fstat64)
95weak_alias (__fstat64, fstat64)
96
97#if XSTAT_IS_XSTAT64
98strong_alias (__fstat64, __fstat)
99weak_alias (__fstat64, fstat)
100#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c deleted-83
......@@ -1,83 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* zig patch: fixes to make this file compile */
20
21#include <inttypes.h>
22#include <sys/stat.h>
23#include <kernel_stat.h>
24#include <sysdep.h>
25#include <string.h>
26
27#if !XSTAT_IS_XSTAT64
28
29static inline bool
30in_time_t_range (__time64_t t)
31{
32 time_t s = t;
33 return s == t;
34}
35
36static inline struct timespec
37valid_timespec64_to_timespec (const struct __timespec64 ts64)
38{
39 struct timespec ts;
40
41 ts.tv_sec = (time_t) ts64.tv_sec;
42 ts.tv_nsec = ts64.tv_nsec;
43
44 return ts;
45}
46
47int
48__fstatat (int fd, const char *file, struct stat *buf, int flag)
49{
50 struct __stat64_t64 st64;
51 int r = __fstatat64_time64 (fd, file, &st64, flag);
52 if (r == 0)
53 {
54 if (! in_ino_t_range (st64.st_ino)
55 || ! in_off_t_range (st64.st_size)
56 || ! in_blkcnt_t_range (st64.st_blocks)
57 || ! in_time_t_range (st64.st_atim.tv_sec)
58 || ! in_time_t_range (st64.st_mtim.tv_sec)
59 || ! in_time_t_range (st64.st_ctim.tv_sec))
60 return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW);
61
62 /* Clear internal pad and reserved fields. */
63 memset (buf, 0, sizeof (*buf));
64
65 buf->st_dev = st64.st_dev;
66 buf->st_ino = st64.st_ino;
67 buf->st_mode = st64.st_mode;
68 buf->st_nlink = st64.st_nlink;
69 buf->st_uid = st64.st_uid;
70 buf->st_gid = st64.st_gid;
71 buf->st_rdev = st64.st_rdev;
72 buf->st_size = st64.st_size;
73 buf->st_blksize = st64.st_blksize;
74 buf->st_blocks = st64.st_blocks;
75 buf->st_atim = valid_timespec64_to_timespec (st64.st_atim);
76 buf->st_mtim = valid_timespec64_to_timespec (st64.st_mtim);
77 buf->st_ctim = valid_timespec64_to_timespec (st64.st_ctim);
78 }
79 return r;
80}
81
82weak_alias (__fstatat, fstatat)
83#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c deleted-187
......@@ -1,187 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* zig patch: fixes to make this file compile */
20
21#define __fstatat __redirect___fstatat
22#define fstatat __redirect_fstatat
23#include <inttypes.h>
24#include <sys/stat.h>
25#include <fcntl.h>
26#include <string.h>
27#include <sysdep.h>
28#include <time.h>
29#include <sys/sysmacros.h>
30#include <internal-stat.h>
31
32#if FSTATAT_USE_STATX
33
34static inline int
35fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf,
36 int flag)
37{
38 /* 32-bit kABI with default 64-bit time_t, e.g. arc, riscv32. Also
39 64-bit time_t support is done through statx syscall. */
40 struct statx tmp;
41 int r = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag,
42 STATX_BASIC_STATS, &tmp);
43 if (r != 0)
44 return r;
45
46 *buf = (struct __stat64_t64) {
47 .st_dev = gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor),
48 .st_rdev = gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor),
49 .st_ino = tmp.stx_ino,
50 .st_mode = tmp.stx_mode,
51 .st_nlink = tmp.stx_nlink,
52 .st_uid = tmp.stx_uid,
53 .st_gid = tmp.stx_gid,
54 .st_atime = tmp.stx_atime.tv_sec,
55 .st_atim.tv_nsec = tmp.stx_atime.tv_nsec,
56 .st_mtime = tmp.stx_mtime.tv_sec,
57 .st_mtim.tv_nsec = tmp.stx_mtime.tv_nsec,
58 .st_ctime = tmp.stx_ctime.tv_sec,
59 .st_ctim.tv_nsec = tmp.stx_ctime.tv_nsec,
60 .st_size = tmp.stx_size,
61 .st_blocks = tmp.stx_blocks,
62 .st_blksize = tmp.stx_blksize,
63 };
64
65 return r;
66}
67#endif
68
69/* Only statx supports 64-bit timestamps for 32-bit architectures with
70 __ASSUME_STATX, so there is no point in building the fallback. */
71#if !FSTATAT_USE_STATX || (FSTATAT_USE_STATX && !defined __ASSUME_STATX)
72static inline struct __timespec64
73valid_timespec_to_timespec64 (const struct timespec ts)
74{
75 struct __timespec64 ts64;
76
77 ts64.tv_sec = ts.tv_sec;
78 ts64.tv_nsec = ts.tv_nsec;
79
80 return ts64;
81}
82
83static inline int
84fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf,
85 int flag)
86{
87 int r;
88
89#if XSTAT_IS_XSTAT64
90# ifdef __NR_newfstatat
91 /* 64-bit kABI, e.g. aarch64, powerpc64*, s390x, riscv64, and
92 x86_64. */
93 r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, buf, flag);
94# elif defined __NR_fstatat64
95# if STAT64_IS_KERNEL_STAT64
96 /* 64-bit kABI outlier, e.g. alpha */
97 r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, buf, flag);
98# else
99 /* 64-bit kABI outlier, e.g. sparc64. */
100 struct kernel_stat64 kst64;
101 r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &kst64, flag);
102 if (r == 0)
103 __cp_stat64_kstat64 (buf, &kst64);
104# endif
105# endif
106#else
107# ifdef __NR_fstatat64
108 /* All kABIs with non-LFS support and with old 32-bit time_t support
109 e.g. arm, csky, i386, hppa, m68k, microblaze, sh, powerpc32,
110 and sparc32. */
111 struct stat64 st64;
112 r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag);
113 if (r == 0)
114 {
115 /* Clear both pad and reserved fields. */
116 memset (buf, 0, sizeof (*buf));
117
118 buf->st_dev = st64.st_dev,
119 buf->st_ino = st64.st_ino;
120 buf->st_mode = st64.st_mode;
121 buf->st_nlink = st64.st_nlink;
122 buf->st_uid = st64.st_uid;
123 buf->st_gid = st64.st_gid;
124 buf->st_rdev = st64.st_rdev;
125 buf->st_size = st64.st_size;
126 buf->st_blksize = st64.st_blksize;
127 buf->st_blocks = st64.st_blocks;
128 buf->st_atim = valid_timespec_to_timespec64 (st64.st_atim);
129 buf->st_mtim = valid_timespec_to_timespec64 (st64.st_mtim);
130 buf->st_ctim = valid_timespec_to_timespec64 (st64.st_ctim);
131 }
132# else
133 /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */
134 struct kernel_stat kst;
135 r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
136 if (r == 0)
137 __cp_kstat_stat64_t64 (&kst, buf);
138# endif
139#endif
140
141 return r;
142}
143#endif
144
145int
146__fstatat64_time64 (int fd, const char *file, struct __stat64_t64 *buf,
147 int flag)
148{
149 int r;
150
151#if FSTATAT_USE_STATX
152 r = fstatat64_time64_statx (fd, file, buf, flag);
153# ifndef __ASSUME_STATX
154 if (r == -ENOSYS)
155 r = fstatat64_time64_stat (fd, file, buf, flag);
156# endif
157#else
158 r = fstatat64_time64_stat (fd, file, buf, flag);
159#endif
160
161 return INTERNAL_SYSCALL_ERROR_P (r)
162 ? INLINE_SYSCALL_ERROR_RETURN_VALUE (-r)
163 : 0;
164}
165#if __TIMESIZE != 64
166hidden_def (__fstatat64_time64)
167
168int
169__fstatat64 (int fd, const char *file, struct stat64 *buf, int flags)
170{
171 struct __stat64_t64 st_t64;
172 return __fstatat64_time64 (fd, file, &st_t64, flags)
173 ?: __cp_stat64_t64_stat64 (&st_t64, buf);
174}
175#endif
176
177#undef __fstatat
178#undef fstatat
179
180hidden_def (__fstatat64)
181weak_alias (__fstatat64, fstatat64)
182
183#if XSTAT_IS_XSTAT64
184strong_alias (__fstatat64, __fstatat)
185weak_alias (__fstatat64, fstatat)
186strong_alias (__fstatat64, __GI___fstatat);
187#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/include/sys/timex.h deleted-200
......@@ -1,200 +0,0 @@
1/* Internal declarations for sys/timex.h.
2 Copyright (C) 2014-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _INCLUDE_SYS_TIMEX_H
20#define _INCLUDE_SYS_TIMEX_H 1
21
22#include_next <sys/timex.h>
23
24# ifndef _ISOMAC
25
26extern int __adjtimex (struct timex *__ntx) __nonnull ((1));
27libc_hidden_proto (__adjtimex)
28
29# include <time.h>
30# include <struct___timeval64.h>
31/* Local definition of 64 bit time supporting timex struct */
32# if __TIMESIZE == 64
33# define __timex64 timex
34# define __clock_adjtime64 __clock_adjtime
35# define ___adjtimex64 ___adjtimex
36# define __ntptimeval64 ntptimeval
37# define __ntp_gettime64 __ntp_gettime
38# define __ntp_gettimex64 __ntp_gettimex
39# else
40
41struct __timex64
42{
43 unsigned int modes; /* mode selector */
44 int :32; /* pad */
45 long long int offset; /* time offset (usec) */
46 long long int freq; /* frequency offset (scaled ppm) */
47 long long int maxerror; /* maximum error (usec) */
48 long long int esterror; /* estimated error (usec) */
49 int status; /* clock command/status */
50 int :32; /* pad */
51 long long int constant; /* pll time constant */
52 long long int precision; /* clock precision (usec) (read only) */
53 long long int tolerance; /* clock frequency tolerance (ppm) (ro) */
54 struct __timeval64 time; /* (read only, except for ADJ_SETOFFSET) */
55 long long int tick; /* (modified) usecs between clock ticks */
56 long long int ppsfreq; /* pps frequency (scaled ppm) (ro) */
57 long long int jitter; /* pps jitter (us) (ro) */
58 int shift; /* interval duration (s) (shift) (ro) */
59 int :32; /* pad */
60 long long int stabil; /* pps stability (scaled ppm) (ro) */
61 long long int jitcnt; /* jitter limit exceeded (ro) */
62 long long int calcnt; /* calibration intervals (ro) */
63 long long int errcnt; /* calibration errors (ro) */
64 long long int stbcnt; /* stability limit exceeded (ro) */
65
66 int tai; /* TAI offset (ro) */
67
68 int :32;
69 int :32;
70 int :32;
71 int :32;
72 int :32;
73 int :32;
74 int :32;
75 int :32;
76 int :32;
77 int :32;
78 int :32;
79};
80extern int __clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64) __nonnull((2));
81libc_hidden_proto (__clock_adjtime64);
82extern int ___adjtimex64 (struct __timex64 *tx64) __nonnull ((1));
83libc_hidden_proto (___adjtimex64)
84
85struct __ntptimeval64
86{
87 struct __timeval64 time; /* current time (ro) */
88 long int maxerror; /* maximum error (us) (ro) */
89 long int esterror; /* estimated error (us) (ro) */
90 long int tai; /* TAI offset (ro) */
91
92 long int __glibc_reserved1;
93 long int __glibc_reserved2;
94 long int __glibc_reserved3;
95 long int __glibc_reserved4;
96};
97extern int __ntp_gettime64 (struct __ntptimeval64 *ntv) __nonnull ((1));
98libc_hidden_proto (__ntp_gettime64)
99extern int __ntp_gettimex64 (struct __ntptimeval64 *ntv) __nonnull ((1));
100libc_hidden_proto (__ntp_gettimex64)
101
102# endif
103
104/* Convert a known valid struct timex into a struct __timex64. */
105static inline struct __timex64
106valid_timex_to_timex64 (const struct timex tx)
107{
108 struct __timex64 tx64;
109
110 tx64.modes = tx.modes;
111 tx64.offset = tx.offset;
112 tx64.freq = tx.freq;
113 tx64.maxerror = tx.maxerror;
114 tx64.esterror = tx.esterror;
115 tx64.status = tx.status;
116 tx64.constant = tx.constant;
117 tx64.precision = tx.precision;
118 tx64.tolerance = tx.tolerance;
119 tx64.time = valid_timeval_to_timeval64 (tx.time);
120 tx64.tick = tx.tick;
121 tx64.ppsfreq = tx.ppsfreq;
122 tx64.jitter = tx.jitter;
123 tx64.shift = tx.shift;
124 tx64.stabil = tx.stabil;
125 tx64.jitcnt = tx.jitcnt;
126 tx64.calcnt = tx.calcnt;
127 tx64.errcnt = tx.errcnt;
128 tx64.stbcnt = tx.stbcnt;
129 tx64.tai = tx.tai;
130
131 return tx64;
132}
133
134/* Convert a known valid struct __timex64 into a struct timex. */
135static inline struct timex
136valid_timex64_to_timex (const struct __timex64 tx64)
137{
138 struct timex tx;
139
140 tx.modes = tx64.modes;
141 tx.offset = tx64.offset;
142 tx.freq = tx64.freq;
143 tx.maxerror = tx64.maxerror;
144 tx.esterror = tx64.esterror;
145 tx.status = tx64.status;
146 tx.constant = tx64.constant;
147 tx.precision = tx64.precision;
148 tx.tolerance = tx64.tolerance;
149 tx.time = valid_timeval64_to_timeval (tx64.time);
150 tx.tick = tx64.tick;
151 tx.ppsfreq = tx64.ppsfreq;
152 tx.jitter = tx64.jitter;
153 tx.shift = tx64.shift;
154 tx.stabil = tx64.stabil;
155 tx.jitcnt = tx64.jitcnt;
156 tx.calcnt = tx64.calcnt;
157 tx.errcnt = tx64.errcnt;
158 tx.stbcnt = tx64.stbcnt;
159 tx.tai = tx64.tai;
160
161 return tx;
162}
163
164/* Convert a known valid struct ntptimeval into a struct __ntptimeval64. */
165static inline struct __ntptimeval64
166valid_ntptimeval_to_ntptimeval64 (const struct ntptimeval ntv)
167{
168 struct __ntptimeval64 ntv64;
169
170 ntv64.time = valid_timeval_to_timeval64 (ntv.time);
171 ntv64.maxerror = ntv.maxerror;
172 ntv64.esterror = ntv.esterror;
173 ntv64.tai = ntv.tai;
174 ntv64.__glibc_reserved1 = 0;
175 ntv64.__glibc_reserved2 = 0;
176 ntv64.__glibc_reserved3 = 0;
177 ntv64.__glibc_reserved4 = 0;
178
179 return ntv64;
180}
181
182/* Convert a known valid struct __ntptimeval64 into a struct ntptimeval. */
183static inline struct ntptimeval
184valid_ntptimeval64_to_ntptimeval (const struct __ntptimeval64 ntp64)
185{
186 struct ntptimeval ntp;
187
188 ntp.time = valid_timeval64_to_timeval (ntp64.time);
189 ntp.maxerror = ntp64.maxerror;
190 ntp.esterror = ntp64.esterror;
191 ntp.tai = ntp64.tai;
192 ntp.__glibc_reserved1 = 0;
193 ntp.__glibc_reserved2 = 0;
194 ntp.__glibc_reserved3 = 0;
195 ntp.__glibc_reserved4 = 0;
196
197 return ntp;
198}
199# endif /* _ISOMAC */
200#endif /* sys/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/kernel_stat.h deleted-22
......@@ -1,22 +0,0 @@
1/* Internal definitions for stat functions.
2 Copyright (C) 2021-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* The default Linux ABI assumes only LFS support. */
20#define XSTAT_IS_XSTAT64 1
21#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64
22#define STAT_IS_KERNEL_STAT 1
lib/libc/glibc/sysdeps/unix/sysv/linux/lstat.c deleted-31
......@@ -1,31 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sys/stat.h>
20#include <fcntl.h>
21#include <kernel_stat.h>
22
23#if !XSTAT_IS_XSTAT64
24int
25__lstat (const char *file, struct stat *buf)
26{
27 return __fstatat (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
28}
29
30weak_alias (__lstat, lstat)
31#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/lstat64.c deleted-51
......@@ -1,51 +0,0 @@
1/* Get file status.
2 Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#define __lstat __redirect___lstat
20#define lstat __redirect_lstat
21#include <sys/stat.h>
22#include <fcntl.h>
23#include <kernel_stat.h>
24#include <stat_t64_cp.h>
25
26int
27__lstat64_time64 (const char *file, struct __stat64_t64 *buf)
28{
29 return __fstatat64_time64 (AT_FDCWD, file, buf, AT_SYMLINK_NOFOLLOW);
30}
31#if __TIMESIZE != 64
32hidden_def (__lstat64_time64)
33
34int
35__lstat64 (const char *file, struct stat64 *buf)
36{
37 struct __stat64_t64 st_t64;
38 return __lstat64_time64 (file, &st_t64)
39 ?: __cp_stat64_t64_stat64 (&st_t64, buf);
40}
41#endif
42hidden_def (__lstat64)
43weak_alias (__lstat64, lstat64)
44
45#undef __lstat
46#undef lstat
47
48#if XSTAT_IS_XSTAT64
49strong_alias (__lstat64, __lstat)
50weak_alias (__lstat64, lstat)
51#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/m68k/coldfire/sysdep.h deleted-29
......@@ -1,29 +0,0 @@
1/* Copyright (C) 2010-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_M68K_COLDFIRE_SYSDEP_H
19#define _LINUX_M68K_COLDFIRE_SYSDEP_H 1
20
21#include <sysdeps/unix/sysdep.h>
22#include <sysdeps/m68k/coldfire/sysdep.h>
23#include <sysdeps/unix/sysv/linux/m68k/sysdep.h>
24
25#define SYSCALL_ERROR_LOAD_GOT(reg) \
26 move.l &_GLOBAL_OFFSET_TABLE_@GOTPC, reg; \
27 lea (-6, %pc, reg), reg
28
29#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/kernel-features.h deleted-58
......@@ -1,58 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 1999-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <https://www.gnu.org/licenses/>. */
19
20#include <sgidefs.h>
21
22#include_next <kernel-features.h>
23
24/* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if
25 emulating LL/SC. */
26#if __mips == 1 || defined _MIPS_ARCH_R5900
27# undef __ASSUME_SET_ROBUST_LIST
28#endif
29
30/* Define this if your 32-bit syscall API requires 64-bit register
31 pairs to start with an even-number register. */
32#if _MIPS_SIM == _ABIO32
33# define __ASSUME_ALIGNED_REGISTER_PAIRS 1
34/* mips32 only supports ipc syscall before 5.1. */
35# if __LINUX_KERNEL_VERSION < 0x050100
36# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
37# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
38# else
39# endif
40
41/* The o32 MIPS fadvise64 syscall behaves as fadvise64_64. */
42# define __ASSUME_FADVISE64_AS_64_64 1
43
44/* mips32 support wire-up network syscalls. */
45# define __ASSUME_RECV_SYSCALL 1
46# define __ASSUME_SEND_SYSCALL 1
47#else
48# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
49#endif
50
51/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
52 pass 64-bits values through syscalls. */
53#if _MIPS_SIM == _ABIN32
54# define __ASSUME_WORDSIZE64_ILP32 1
55#endif
56
57#undef __ASSUME_CLONE_DEFAULT
58#define __ASSUME_CLONE_BACKWARDS 1
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h deleted-344
......@@ -1,344 +0,0 @@
1/* Copyright (C) 2000-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_MIPS_MIPS32_SYSDEP_H
19#define _LINUX_MIPS_MIPS32_SYSDEP_H 1
20
21/* mips32 have cancelable syscalls with 7 arguments (currently only
22 sync_file_range). */
23#define HAVE_CANCELABLE_SYSCALL_WITH_7_ARGS 1
24
25/* There is some commonality. */
26#include <sysdeps/unix/sysv/linux/mips/sysdep.h>
27#include <sysdeps/unix/sysv/linux/sysdep.h>
28#include <sysdeps/unix/mips/mips32/sysdep.h>
29
30#include <tls.h>
31
32/* For Linux we can use the system call table in the header file
33 /usr/include/asm/unistd.h
34 of the kernel. But these symbols do not follow the SYS_* syntax
35 so we have to redefine the `SYS_ify' macro here. */
36#undef SYS_ify
37#define SYS_ify(syscall_name) __NR_##syscall_name
38
39#ifdef __ASSEMBLER__
40
41/* We don't want the label for the error handler to be visible in the symbol
42 table when we define it here. */
43#ifdef __PIC__
44# undef SYSCALL_ERROR_LABEL
45# define SYSCALL_ERROR_LABEL 99b
46#endif
47
48#else /* ! __ASSEMBLER__ */
49
50#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
51#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
52
53/* Note that the original Linux syscall restart convention required the
54 instruction immediately preceding SYSCALL to initialize $v0 with the
55 syscall number. Then if a restart triggered, $v0 would have been
56 clobbered by the syscall interrupted, and needed to be reinititalized.
57 The kernel would decrement the PC by 4 before switching back to the
58 user mode so that $v0 had been reloaded before SYSCALL was executed
59 again. This implied the place $v0 was loaded from must have been
60 preserved across a syscall, e.g. an immediate, static register, stack
61 slot, etc.
62
63 The convention was relaxed in Linux with a change applied to the kernel
64 GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
65 first appeared in the 2.6.36 release. Since then the kernel has had
66 code that reloads $v0 upon syscall restart and resumes right at the
67 SYSCALL instruction, so no special arrangement is needed anymore.
68
69 For backwards compatibility with existing kernel binaries we support
70 the old convention by choosing the instruction preceding SYSCALL
71 carefully. This also means we have to force a 32-bit encoding of the
72 microMIPS MOVE instruction if one is used. */
73
74#ifdef __mips_micromips
75# define MOVE32 "move32"
76#else
77# define MOVE32 "move"
78#endif
79
80#undef INTERNAL_SYSCALL
81#undef INTERNAL_SYSCALL_NCS
82
83#define __nomips16 __attribute__ ((nomips16))
84
85union __mips_syscall_return
86 {
87 long long int val;
88 struct
89 {
90 long int v0;
91 long int v1;
92 }
93 reg;
94 };
95
96#ifdef __mips16
97/* There's no MIPS16 syscall instruction, so we go through out-of-line
98 standard MIPS wrappers. These do use inline snippets below though,
99 through INTERNAL_SYSCALL_MIPS16. Spilling the syscall number to
100 memory gives the best code in that case, avoiding the need to save
101 and restore a static register. */
102
103# include <mips16-syscall.h>
104
105# define INTERNAL_SYSCALL(name, nr, args...) \
106 INTERNAL_SYSCALL_NCS (SYS_ify (name), nr, args)
107
108# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
109({ \
110 union __mips_syscall_return _sc_ret; \
111 _sc_ret.val = __mips16_syscall##nr (args, number); \
112 _sc_ret.reg.v0; \
113})
114
115# define INTERNAL_SYSCALL_MIPS16(number, err, nr, args...) \
116 internal_syscall##nr ("lw\t%0, %2\n\t", \
117 "R" (number), \
118 number, err, args)
119
120#else /* !__mips16 */
121# define INTERNAL_SYSCALL(name, nr, args...) \
122 internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
123 "IK" (SYS_ify (name)), \
124 SYS_ify (name), err, args)
125
126# define INTERNAL_SYSCALL_NCS(number, nr, args...) \
127 internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
128 "r" (__s0), \
129 number, err, args)
130
131#endif /* !__mips16 */
132
133#define internal_syscall0(v0_init, input, number, err, dummy...) \
134({ \
135 long int _sys_result; \
136 \
137 { \
138 register long int __s0 asm ("$16") __attribute__ ((unused)) \
139 = (number); \
140 register long int __v0 asm ("$2"); \
141 register long int __a3 asm ("$7"); \
142 __asm__ volatile ( \
143 ".set\tnoreorder\n\t" \
144 v0_init \
145 "syscall\n\t" \
146 ".set reorder" \
147 : "=r" (__v0), "=r" (__a3) \
148 : input \
149 : __SYSCALL_CLOBBERS); \
150 _sys_result = __a3 != 0 ? -__v0 : __v0; \
151 } \
152 _sys_result; \
153})
154
155#define internal_syscall1(v0_init, input, number, err, arg1) \
156({ \
157 long int _sys_result; \
158 \
159 { \
160 long int _arg1 = (long int) (arg1); \
161 register long int __s0 asm ("$16") __attribute__ ((unused)) \
162 = (number); \
163 register long int __v0 asm ("$2"); \
164 register long int __a0 asm ("$4") = _arg1; \
165 register long int __a3 asm ("$7"); \
166 __asm__ volatile ( \
167 ".set\tnoreorder\n\t" \
168 v0_init \
169 "syscall\n\t" \
170 ".set reorder" \
171 : "=r" (__v0), "=r" (__a3) \
172 : input, "r" (__a0) \
173 : __SYSCALL_CLOBBERS); \
174 _sys_result = __a3 != 0 ? -__v0 : __v0; \
175 } \
176 _sys_result; \
177})
178
179#define internal_syscall2(v0_init, input, number, err, arg1, arg2) \
180({ \
181 long int _sys_result; \
182 \
183 { \
184 long int _arg1 = (long int) (arg1); \
185 long int _arg2 = (long int) (arg2); \
186 register long int __s0 asm ("$16") __attribute__ ((unused)) \
187 = (number); \
188 register long int __v0 asm ("$2"); \
189 register long int __a0 asm ("$4") = _arg1; \
190 register long int __a1 asm ("$5") = _arg2; \
191 register long int __a3 asm ("$7"); \
192 __asm__ volatile ( \
193 ".set\tnoreorder\n\t" \
194 v0_init \
195 "syscall\n\t" \
196 ".set\treorder" \
197 : "=r" (__v0), "=r" (__a3) \
198 : input, "r" (__a0), "r" (__a1) \
199 : __SYSCALL_CLOBBERS); \
200 _sys_result = __a3 != 0 ? -__v0 : __v0; \
201 } \
202 _sys_result; \
203})
204
205#define internal_syscall3(v0_init, input, number, err, \
206 arg1, arg2, arg3) \
207({ \
208 long int _sys_result; \
209 \
210 { \
211 long int _arg1 = (long int) (arg1); \
212 long int _arg2 = (long int) (arg2); \
213 long int _arg3 = (long int) (arg3); \
214 register long int __s0 asm ("$16") __attribute__ ((unused)) \
215 = (number); \
216 register long int __v0 asm ("$2"); \
217 register long int __a0 asm ("$4") = _arg1; \
218 register long int __a1 asm ("$5") = _arg2; \
219 register long int __a2 asm ("$6") = _arg3; \
220 register long int __a3 asm ("$7"); \
221 __asm__ volatile ( \
222 ".set\tnoreorder\n\t" \
223 v0_init \
224 "syscall\n\t" \
225 ".set\treorder" \
226 : "=r" (__v0), "=r" (__a3) \
227 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
228 : __SYSCALL_CLOBBERS); \
229 _sys_result = __a3 != 0 ? -__v0 : __v0; \
230 } \
231 _sys_result; \
232})
233
234#define internal_syscall4(v0_init, input, number, err, \
235 arg1, arg2, arg3, arg4) \
236({ \
237 long int _sys_result; \
238 \
239 { \
240 long int _arg1 = (long int) (arg1); \
241 long int _arg2 = (long int) (arg2); \
242 long int _arg3 = (long int) (arg3); \
243 long int _arg4 = (long int) (arg4); \
244 register long int __s0 asm ("$16") __attribute__ ((unused)) \
245 = (number); \
246 register long int __v0 asm ("$2"); \
247 register long int __a0 asm ("$4") = _arg1; \
248 register long int __a1 asm ("$5") = _arg2; \
249 register long int __a2 asm ("$6") = _arg3; \
250 register long int __a3 asm ("$7") = _arg4; \
251 __asm__ volatile ( \
252 ".set\tnoreorder\n\t" \
253 v0_init \
254 "syscall\n\t" \
255 ".set\treorder" \
256 : "=r" (__v0), "+r" (__a3) \
257 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
258 : __SYSCALL_CLOBBERS); \
259 _sys_result = __a3 != 0 ? -__v0 : __v0; \
260 } \
261 _sys_result; \
262})
263
264/* Standalone MIPS wrappers used for 5, 6, and 7 argument syscalls,
265 which require stack arguments. We rely on the compiler arranging
266 wrapper's arguments according to the MIPS o32 function calling
267 convention, which is reused by syscalls, except for the syscall
268 number passed and the error flag returned (taken care of in the
269 wrapper called). This relieves us from relying on non-guaranteed
270 compiler specifics required for the stack arguments to be pushed,
271 which would be the case if these syscalls were inlined. */
272
273long long int __nomips16 __mips_syscall5 (long int arg1, long int arg2,
274 long int arg3, long int arg4,
275 long int arg5,
276 long int number);
277libc_hidden_proto (__mips_syscall5, nomips16)
278
279#define internal_syscall5(v0_init, input, number, err, \
280 arg1, arg2, arg3, arg4, arg5) \
281({ \
282 union __mips_syscall_return _sc_ret; \
283 _sc_ret.val = __mips_syscall5 ((long int) (arg1), \
284 (long int) (arg2), \
285 (long int) (arg3), \
286 (long int) (arg4), \
287 (long int) (arg5), \
288 (long int) (number)); \
289 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
290})
291
292long long int __nomips16 __mips_syscall6 (long int arg1, long int arg2,
293 long int arg3, long int arg4,
294 long int arg5, long int arg6,
295 long int number);
296libc_hidden_proto (__mips_syscall6, nomips16)
297
298#define internal_syscall6(v0_init, input, number, err, \
299 arg1, arg2, arg3, arg4, arg5, arg6) \
300({ \
301 union __mips_syscall_return _sc_ret; \
302 _sc_ret.val = __mips_syscall6 ((long int) (arg1), \
303 (long int) (arg2), \
304 (long int) (arg3), \
305 (long int) (arg4), \
306 (long int) (arg5), \
307 (long int) (arg6), \
308 (long int) (number)); \
309 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
310})
311
312long long int __nomips16 __mips_syscall7 (long int arg1, long int arg2,
313 long int arg3, long int arg4,
314 long int arg5, long int arg6,
315 long int arg7,
316 long int number);
317libc_hidden_proto (__mips_syscall7, nomips16)
318
319#define internal_syscall7(v0_init, input, number, err, \
320 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
321({ \
322 union __mips_syscall_return _sc_ret; \
323 _sc_ret.val = __mips_syscall7 ((long int) (arg1), \
324 (long int) (arg2), \
325 (long int) (arg3), \
326 (long int) (arg4), \
327 (long int) (arg5), \
328 (long int) (arg6), \
329 (long int) (arg7), \
330 (long int) (number)); \
331 _sc_ret.reg.v1 != 0 ? -_sc_ret.reg.v0 : _sc_ret.reg.v0; \
332})
333
334#if __mips_isa_rev >= 6
335# define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
336 "$14", "$15", "$24", "$25", "memory"
337#else
338# define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
339 "$14", "$15", "$24", "$25", "hi", "lo", "memory"
340#endif
341
342#endif /* __ASSEMBLER__ */
343
344#endif /* linux/mips/mips32/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h deleted-73
......@@ -1,73 +0,0 @@
1/* Struct stat/stat64 to stat/stat64 conversion for Linux.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sys/stat.h>
20#include <kernel_stat.h>
21
22static inline long int
23__cp_kstat_stat (const struct kernel_stat *kst, struct stat *st)
24{
25 if (! in_ino_t_range (kst->st_ino)
26 || ! in_off_t_range (kst->st_size)
27 || ! in_blkcnt_t_range (kst->st_blocks))
28 return -EOVERFLOW;
29
30 st->st_dev = kst->st_dev;
31 memset (&st->st_pad1, 0, sizeof (st->st_pad1));
32 st->st_ino = kst->st_ino;
33 st->st_mode = kst->st_mode;
34 st->st_nlink = kst->st_nlink;
35 st->st_uid = kst->st_uid;
36 st->st_gid = kst->st_gid;
37 st->st_rdev = kst->st_rdev;
38 memset (&st->st_pad2, 0, sizeof (st->st_pad2));
39 st->st_size = kst->st_size;
40 st->st_pad3 = 0;
41 st->st_atim.tv_sec = kst->st_atime_sec;
42 st->st_atim.tv_nsec = kst->st_atime_nsec;
43 st->st_mtim.tv_sec = kst->st_mtime_sec;
44 st->st_mtim.tv_nsec = kst->st_mtime_nsec;
45 st->st_ctim.tv_sec = kst->st_ctime_sec;
46 st->st_ctim.tv_nsec = kst->st_ctime_nsec;
47 st->st_blksize = kst->st_blksize;
48 st->st_blocks = kst->st_blocks;
49 memset (&st->st_pad5, 0, sizeof (st->st_pad5));
50
51 return 0;
52}
53
54static inline void
55__cp_kstat_stat64_t64 (const struct kernel_stat *kst, struct __stat64_t64 *st)
56{
57 st->st_dev = kst->st_dev;
58 st->st_ino = kst->st_ino;
59 st->st_mode = kst->st_mode;
60 st->st_nlink = kst->st_nlink;
61 st->st_uid = kst->st_uid;
62 st->st_gid = kst->st_gid;
63 st->st_rdev = kst->st_rdev;
64 st->st_size = kst->st_size;
65 st->st_blksize = kst->st_blksize;
66 st->st_blocks = kst->st_blocks;
67 st->st_atim.tv_sec = kst->st_atime_sec;
68 st->st_atim.tv_nsec = kst->st_atime_nsec;
69 st->st_mtim.tv_sec = kst->st_mtime_sec;
70 st->st_mtim.tv_nsec = kst->st_mtime_nsec;
71 st->st_ctim.tv_sec = kst->st_ctime_sec;
72 st->st_ctim.tv_nsec = kst->st_ctime_nsec;
73}
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h deleted-295
......@@ -1,295 +0,0 @@
1/* Copyright (C) 2000-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library. If not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _LINUX_MIPS_SYSDEP_H
19#define _LINUX_MIPS_SYSDEP_H 1
20
21/* There is some commonality. */
22#include <sysdeps/unix/sysv/linux/mips/sysdep.h>
23#include <sysdeps/unix/sysv/linux/sysdep.h>
24#include <sysdeps/unix/mips/mips64/sysdep.h>
25
26#include <tls.h>
27
28/* For Linux we can use the system call table in the header file
29 /usr/include/asm/unistd.h
30 of the kernel. But these symbols do not follow the SYS_* syntax
31 so we have to redefine the `SYS_ify' macro here. */
32#undef SYS_ify
33#define SYS_ify(syscall_name) __NR_##syscall_name
34
35#ifdef __ASSEMBLER__
36
37/* We don't want the label for the error handler to be visible in the symbol
38 table when we define it here. */
39# undef SYSCALL_ERROR_LABEL
40# define SYSCALL_ERROR_LABEL 99b
41
42#else /* ! __ASSEMBLER__ */
43
44#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
45#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
46
47#include <syscall_types.h>
48
49/* Note that the original Linux syscall restart convention required the
50 instruction immediately preceding SYSCALL to initialize $v0 with the
51 syscall number. Then if a restart triggered, $v0 would have been
52 clobbered by the syscall interrupted, and needed to be reinititalized.
53 The kernel would decrement the PC by 4 before switching back to the
54 user mode so that $v0 had been reloaded before SYSCALL was executed
55 again. This implied the place $v0 was loaded from must have been
56 preserved across a syscall, e.g. an immediate, static register, stack
57 slot, etc.
58
59 The convention was relaxed in Linux with a change applied to the kernel
60 GIT repository as commit 96187fb0bc30cd7919759d371d810e928048249d, that
61 first appeared in the 2.6.36 release. Since then the kernel has had
62 code that reloads $v0 upon syscall restart and resumes right at the
63 SYSCALL instruction, so no special arrangement is needed anymore.
64
65 For backwards compatibility with existing kernel binaries we support
66 the old convention by choosing the instruction preceding SYSCALL
67 carefully. This also means we have to force a 32-bit encoding of the
68 microMIPS MOVE instruction if one is used. */
69
70#ifdef __mips_micromips
71# define MOVE32 "move32"
72#else
73# define MOVE32 "move"
74#endif
75
76#undef INTERNAL_SYSCALL
77#define INTERNAL_SYSCALL(name, nr, args...) \
78 internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \
79 "IK" (SYS_ify (name)), \
80 0, args)
81
82#undef INTERNAL_SYSCALL_NCS
83#define INTERNAL_SYSCALL_NCS(number, nr, args...) \
84 internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \
85 "r" (__s0), \
86 number, args)
87
88#define internal_syscall0(v0_init, input, number, dummy...) \
89({ \
90 long int _sys_result; \
91 \
92 { \
93 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
94 = (number); \
95 register __syscall_arg_t __v0 asm ("$2"); \
96 register __syscall_arg_t __a3 asm ("$7"); \
97 __asm__ volatile ( \
98 ".set\tnoreorder\n\t" \
99 v0_init \
100 "syscall\n\t" \
101 ".set reorder" \
102 : "=r" (__v0), "=r" (__a3) \
103 : input \
104 : __SYSCALL_CLOBBERS); \
105 _sys_result = __a3 != 0 ? -__v0 : __v0; \
106 } \
107 _sys_result; \
108})
109
110#define internal_syscall1(v0_init, input, number, arg1) \
111({ \
112 long int _sys_result; \
113 \
114 { \
115 __syscall_arg_t _arg1 = __SSC (arg1); \
116 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
117 = (number); \
118 register __syscall_arg_t __v0 asm ("$2"); \
119 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
120 register __syscall_arg_t __a3 asm ("$7"); \
121 __asm__ volatile ( \
122 ".set\tnoreorder\n\t" \
123 v0_init \
124 "syscall\n\t" \
125 ".set reorder" \
126 : "=r" (__v0), "=r" (__a3) \
127 : input, "r" (__a0) \
128 : __SYSCALL_CLOBBERS); \
129 _sys_result = __a3 != 0 ? -__v0 : __v0; \
130 } \
131 _sys_result; \
132})
133
134#define internal_syscall2(v0_init, input, number, arg1, arg2) \
135({ \
136 long int _sys_result; \
137 \
138 { \
139 __syscall_arg_t _arg1 = __SSC (arg1); \
140 __syscall_arg_t _arg2 = __SSC (arg2); \
141 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
142 = (number); \
143 register __syscall_arg_t __v0 asm ("$2"); \
144 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
145 register __syscall_arg_t __a1 asm ("$5") = _arg2; \
146 register __syscall_arg_t __a3 asm ("$7"); \
147 __asm__ volatile ( \
148 ".set\tnoreorder\n\t" \
149 v0_init \
150 "syscall\n\t" \
151 ".set\treorder" \
152 : "=r" (__v0), "=r" (__a3) \
153 : input, "r" (__a0), "r" (__a1) \
154 : __SYSCALL_CLOBBERS); \
155 _sys_result = __a3 != 0 ? -__v0 : __v0; \
156 } \
157 _sys_result; \
158})
159
160#define internal_syscall3(v0_init, input, number, arg1, arg2, arg3) \
161({ \
162 long int _sys_result; \
163 \
164 { \
165 __syscall_arg_t _arg1 = __SSC (arg1); \
166 __syscall_arg_t _arg2 = __SSC (arg2); \
167 __syscall_arg_t _arg3 = __SSC (arg3); \
168 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
169 = (number); \
170 register __syscall_arg_t __v0 asm ("$2"); \
171 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
172 register __syscall_arg_t __a1 asm ("$5") = _arg2; \
173 register __syscall_arg_t __a2 asm ("$6") = _arg3; \
174 register __syscall_arg_t __a3 asm ("$7"); \
175 __asm__ volatile ( \
176 ".set\tnoreorder\n\t" \
177 v0_init \
178 "syscall\n\t" \
179 ".set\treorder" \
180 : "=r" (__v0), "=r" (__a3) \
181 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
182 : __SYSCALL_CLOBBERS); \
183 _sys_result = __a3 != 0 ? -__v0 : __v0; \
184 } \
185 _sys_result; \
186})
187
188#define internal_syscall4(v0_init, input, number, arg1, arg2, arg3, \
189 arg4) \
190({ \
191 long int _sys_result; \
192 \
193 { \
194 __syscall_arg_t _arg1 = __SSC (arg1); \
195 __syscall_arg_t _arg2 = __SSC (arg2); \
196 __syscall_arg_t _arg3 = __SSC (arg3); \
197 __syscall_arg_t _arg4 = __SSC (arg4); \
198 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
199 = (number); \
200 register __syscall_arg_t __v0 asm ("$2"); \
201 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
202 register __syscall_arg_t __a1 asm ("$5") = _arg2; \
203 register __syscall_arg_t __a2 asm ("$6") = _arg3; \
204 register __syscall_arg_t __a3 asm ("$7") = _arg4; \
205 __asm__ volatile ( \
206 ".set\tnoreorder\n\t" \
207 v0_init \
208 "syscall\n\t" \
209 ".set\treorder" \
210 : "=r" (__v0), "+r" (__a3) \
211 : input, "r" (__a0), "r" (__a1), "r" (__a2) \
212 : __SYSCALL_CLOBBERS); \
213 _sys_result = __a3 != 0 ? -__v0 : __v0; \
214 } \
215 _sys_result; \
216})
217
218#define internal_syscall5(v0_init, input, number, arg1, arg2, arg3, \
219 arg4, arg5) \
220({ \
221 long int _sys_result; \
222 \
223 { \
224 __syscall_arg_t _arg1 = __SSC (arg1); \
225 __syscall_arg_t _arg2 = __SSC (arg2); \
226 __syscall_arg_t _arg3 = __SSC (arg3); \
227 __syscall_arg_t _arg4 = __SSC (arg4); \
228 __syscall_arg_t _arg5 = __SSC (arg5); \
229 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
230 = (number); \
231 register __syscall_arg_t __v0 asm ("$2"); \
232 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
233 register __syscall_arg_t __a1 asm ("$5") = _arg2; \
234 register __syscall_arg_t __a2 asm ("$6") = _arg3; \
235 register __syscall_arg_t __a3 asm ("$7") = _arg4; \
236 register __syscall_arg_t __a4 asm ("$8") = _arg5; \
237 __asm__ volatile ( \
238 ".set\tnoreorder\n\t" \
239 v0_init \
240 "syscall\n\t" \
241 ".set\treorder" \
242 : "=r" (__v0), "+r" (__a3) \
243 : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4) \
244 : __SYSCALL_CLOBBERS); \
245 _sys_result = __a3 != 0 ? -__v0 : __v0; \
246 } \
247 _sys_result; \
248})
249
250#define internal_syscall6(v0_init, input, number, arg1, arg2, arg3, \
251 arg4, arg5, arg6) \
252({ \
253 long int _sys_result; \
254 \
255 { \
256 __syscall_arg_t _arg1 = __SSC (arg1); \
257 __syscall_arg_t _arg2 = __SSC (arg2); \
258 __syscall_arg_t _arg3 = __SSC (arg3); \
259 __syscall_arg_t _arg4 = __SSC (arg4); \
260 __syscall_arg_t _arg5 = __SSC (arg5); \
261 __syscall_arg_t _arg6 = __SSC (arg6); \
262 register __syscall_arg_t __s0 asm ("$16") __attribute__ ((unused))\
263 = (number); \
264 register __syscall_arg_t __v0 asm ("$2"); \
265 register __syscall_arg_t __a0 asm ("$4") = _arg1; \
266 register __syscall_arg_t __a1 asm ("$5") = _arg2; \
267 register __syscall_arg_t __a2 asm ("$6") = _arg3; \
268 register __syscall_arg_t __a3 asm ("$7") = _arg4; \
269 register __syscall_arg_t __a4 asm ("$8") = _arg5; \
270 register __syscall_arg_t __a5 asm ("$9") = _arg6; \
271 __asm__ volatile ( \
272 ".set\tnoreorder\n\t" \
273 v0_init \
274 "syscall\n\t" \
275 ".set\treorder" \
276 : "=r" (__v0), "+r" (__a3) \
277 : input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4), \
278 "r" (__a5) \
279 : __SYSCALL_CLOBBERS); \
280 _sys_result = __a3 != 0 ? -__v0 : __v0; \
281 } \
282 _sys_result; \
283})
284
285#if __mips_isa_rev >= 6
286# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
287 "$14", "$15", "$24", "$25", "memory"
288#else
289# define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
290 "$14", "$15", "$24", "$25", "hi", "lo", "memory"
291#endif
292
293#endif /* __ASSEMBLER__ */
294
295#endif /* linux/mips/sysdep.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/mips/sysdep.h deleted-32
......@@ -1,32 +0,0 @@
1/* Syscall definitions, Linux MIPS generic version.
2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
18
19#include <sgidefs.h>
20
21#define VDSO_NAME "LINUX_2.6"
22#define VDSO_HASH 61765110
23
24/* List of system calls which are supported as vsyscalls. */
25#define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime"
26#if _MIPS_SIM != _ABI64
27# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime64"
28#endif
29#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday"
30#define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres"
31
32#define HAVE_CLONE3_WRAPPER 1
lib/libc/glibc/sysdeps/unix/sysv/linux/mknodat.c deleted-39
......@@ -1,39 +0,0 @@
1/* Create a special or ordinary file. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* zig patch: fixes to make this file compile */
20
21#include <inttypes.h>
22#include <sys/types.h>
23#include <sys/stat.h>
24#include <errno.h>
25#include <sysdep.h>
26
27int
28__mknodat (int fd, const char *path, mode_t mode, dev_t dev)
29{
30 /* The user-exported dev_t is 64-bit while the kernel interface is
31 32-bit. */
32 unsigned int k_dev = dev;
33 if (k_dev != dev)
34 return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
35
36 return INLINE_SYSCALL_CALL (mknodat, fd, path, mode, k_dev);
37}
38libc_hidden_def (__mknodat)
39weak_alias (__mknodat, mknodat)
lib/libc/glibc/sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h deleted-53
......@@ -1,53 +0,0 @@
1/* Definition of `struct stat' used in the kernel.
2 Copyright (C) 1997-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19struct kernel_stat
20 {
21 unsigned int st_dev;
22 unsigned int st_ino;
23 unsigned int st_mode;
24 unsigned short st_nlink;
25 unsigned int st_uid;
26 unsigned int st_gid;
27 unsigned int st_rdev;
28 unsigned long int st_size;
29 unsigned long int st_blksize;
30 unsigned long int st_blocks;
31 struct timespec st_atim;
32 struct timespec st_mtim;
33 struct timespec st_ctim;
34 unsigned long int __glibc_reserved4;
35#define _HAVE___UNUSED4
36 unsigned long int __glibc_reserved5;
37#define _HAVE___UNUSED5
38 };
39
40#define _HAVE_STAT___UNUSED4
41#define _HAVE_STAT___UNUSED5
42#define _HAVE_STAT___PAD1
43#define _HAVE_STAT___PAD2
44#define _HAVE_STAT_NSEC
45#define _HAVE_STAT64___UNUSED4
46#define _HAVE_STAT64___UNUSED5
47#define _HAVE_STAT64___PAD2
48#define _HAVE_STAT64_NSEC
49
50#define STAT_IS_KERNEL_STAT 0
51#define STAT64_IS_KERNEL_STAT64 1
52#define XSTAT_IS_XSTAT64 0
53#define STATFS_IS_STATFS64 0
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/kernel-features.h deleted-52
......@@ -1,52 +0,0 @@
1/* Set flags signalling availability of kernel features based on given
2 kernel version number. S/390 version.
3 Copyright (C) 1999-2026 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
19
20#include_next <kernel-features.h>
21
22#undef __ASSUME_ACCEPT_SYSCALL
23
24/* Direct socketcalls available with kernel 4.3. */
25#if __LINUX_KERNEL_VERSION < 0x040300
26# undef __ASSUME_ACCEPT4_SYSCALL
27# undef __ASSUME_RECVMMSG_SYSCALL
28# undef __ASSUME_SENDMMSG_SYSCALL
29# undef __ASSUME_SENDMSG_SYSCALL
30# undef __ASSUME_RECVMSG_SYSCALL
31# undef __ASSUME_CONNECT_SYSCALL
32# undef __ASSUME_RECVFROM_SYSCALL
33# undef __ASSUME_SENDTO_SYSCALL
34# undef __ASSUME_GETSOCKOPT_SYSCALL
35# undef __ASSUME_SETSOCKOPT_SYSCALL
36# undef __ASSUME_BIND_SYSCALL
37# undef __ASSUME_SOCKET_SYSCALL
38# undef __ASSUME_SOCKETPAIR_SYSCALL
39# undef __ASSUME_LISTEN_SYSCALL
40# undef __ASSUME_SHUTDOWN_SYSCALL
41# undef __ASSUME_GETSOCKNAME_SYSCALL
42# undef __ASSUME_GETPEERNAME_SYSCALL
43#endif
44
45/* s390 only supports ipc syscall before 5.1. */
46#if __LINUX_KERNEL_VERSION < 0x050100
47# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
48# undef __ASSUME_SYSVIPC_DEFAULT_IPC_64
49#endif
50
51#undef __ASSUME_CLONE_DEFAULT
52#define __ASSUME_CLONE_BACKWARDS2
lib/libc/glibc/sysdeps/unix/sysv/linux/s390/sys/elf.h deleted-25
......@@ -1,25 +0,0 @@
1/* Copyright (C) 2000-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_ELF_H
19#define _SYS_ELF_H 1
20
21#warning "This header is obsolete; use <sys/procfs.h> instead."
22
23#include <sys/procfs.h>
24
25#endif /* _SYS_ELF_H */
lib/libc/glibc/sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h deleted-44
......@@ -1,44 +0,0 @@
1/* Struct kernel_stat64 to stat64. Linux/SPARC version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <errno.h>
20
21static inline void
22__cp_stat64_kstat64 (struct stat64 *st64, const struct kernel_stat64 *kst64)
23{
24 st64->st_dev = kst64->st_dev;
25 st64->__pad1 = 0;
26 st64->st_ino = kst64->st_ino;
27 st64->st_mode = kst64->st_mode;
28 st64->st_nlink = kst64->st_nlink;
29 st64->st_uid = kst64->st_uid;
30 st64->st_gid = kst64->st_gid;
31 st64->st_rdev = kst64->st_rdev;
32 st64->__pad2 = 0;
33 st64->st_size = kst64->st_size;
34 st64->st_blksize = kst64->st_blksize;
35 st64->st_blocks = kst64->st_blocks;
36 st64->st_atim.tv_sec = kst64->st_atime_sec;
37 st64->st_atim.tv_nsec = kst64->st_atime_nsec;
38 st64->st_mtim.tv_sec = kst64->st_mtime_sec;
39 st64->st_mtim.tv_nsec = kst64->st_mtime_nsec;
40 st64->st_ctim.tv_sec = kst64->st_ctime_sec;
41 st64->st_ctim.tv_nsec = kst64->st_ctime_nsec;
42 st64->__glibc_reserved4 = 0;
43 st64->__glibc_reserved5 = 0;
44}
lib/libc/glibc/sysdeps/unix/sysv/linux/stat.c deleted-31
......@@ -1,31 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sys/stat.h>
20#include <fcntl.h>
21#include <kernel_stat.h>
22
23#if !XSTAT_IS_XSTAT64
24int
25__stat (const char *file, struct stat *buf)
26{
27 return __fstatat (AT_FDCWD, file, buf, 0);
28}
29
30weak_alias (__stat, stat)
31#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/stat64.c deleted-52
......@@ -1,52 +0,0 @@
1/* Get file status. Linux version.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#define __stat __redirect___stat
20#define stat __redirect_stat
21#include <sys/stat.h>
22#include <fcntl.h>
23#include <kernel_stat.h>
24#include <stat_t64_cp.h>
25
26int
27__stat64_time64 (const char *file, struct __stat64_t64 *buf)
28{
29 return __fstatat64_time64 (AT_FDCWD, file, buf, 0);
30}
31#if __TIMESIZE != 64
32hidden_def (__stat64_time64)
33
34int
35__stat64 (const char *file, struct stat64 *buf)
36{
37 struct __stat64_t64 st_t64;
38 return __stat64_time64 (file, &st_t64)
39 ?: __cp_stat64_t64_stat64 (&st_t64, buf);
40}
41#endif
42
43#undef __stat
44#undef stat
45
46hidden_def (__stat64)
47weak_alias (__stat64, stat64)
48
49#if XSTAT_IS_XSTAT64
50strong_alias (__stat64, __stat)
51weak_alias (__stat64, stat)
52#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.c deleted-56
......@@ -1,56 +0,0 @@
1/* Struct stat/stat64 to stat/stat64 conversion for Linux.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <stat_t64_cp.h>
20#include <string.h>
21#include <errno.h>
22#include <time.h>
23
24#if __TIMESIZE != 64
25int
26__cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64,
27 struct stat64 *st64)
28{
29 if (! in_time_t_range (st64_t64->st_atim.tv_sec)
30 || ! in_time_t_range (st64_t64->st_mtim.tv_sec)
31 || ! in_time_t_range (st64_t64->st_ctim.tv_sec))
32 {
33 __set_errno (EOVERFLOW);
34 return -1;
35 }
36
37 /* Clear both pad and reserved fields. */
38 memset (st64, 0, sizeof (*st64));
39
40 st64->st_dev = st64_t64->st_dev,
41 st64->st_ino = st64_t64->st_ino;
42 st64->st_mode = st64_t64->st_mode;
43 st64->st_nlink = st64_t64->st_nlink;
44 st64->st_uid = st64_t64->st_uid;
45 st64->st_gid = st64_t64->st_gid;
46 st64->st_rdev = st64_t64->st_rdev;
47 st64->st_size = st64_t64->st_size;
48 st64->st_blksize = st64_t64->st_blksize;
49 st64->st_blocks = st64_t64->st_blocks;
50 st64->st_atim = valid_timespec64_to_timespec (st64_t64->st_atim);
51 st64->st_mtim = valid_timespec64_to_timespec (st64_t64->st_mtim);
52 st64->st_ctim = valid_timespec64_to_timespec (st64_t64->st_ctim);
53
54 return 0;
55}
56#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/stat_t64_cp.h deleted-25
......@@ -1,25 +0,0 @@
1/* Copy to/from struct stat with and without 64-bit time_t support.
2 Copyright (C) 2020-2026 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sys/stat.h>
20
21#if __TIMESIZE != 64
22extern int __cp_stat64_t64_stat64 (const struct __stat64_t64 *st64_t64,
23 struct stat64 *st64)
24 attribute_hidden;
25#endif
lib/libc/glibc/sysdeps/unix/sysv/linux/sys/timex.h deleted-88
......@@ -1,88 +0,0 @@
1/* Copyright (C) 1995-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_TIMEX_H
19#define _SYS_TIMEX_H 1
20
21#include <features.h>
22#include <sys/time.h>
23
24/* These definitions from linux/timex.h as of 2.6.30. */
25
26#include <bits/timex.h>
27
28#define NTP_API 4 /* NTP API version */
29
30struct ntptimeval
31{
32 struct timeval time; /* current time (ro) */
33 long int maxerror; /* maximum error (us) (ro) */
34 long int esterror; /* estimated error (us) (ro) */
35 long int tai; /* TAI offset (ro) */
36
37 long int __glibc_reserved1;
38 long int __glibc_reserved2;
39 long int __glibc_reserved3;
40 long int __glibc_reserved4;
41};
42
43/* Clock states (time_state) */
44#define TIME_OK 0 /* clock synchronized, no leap second */
45#define TIME_INS 1 /* insert leap second */
46#define TIME_DEL 2 /* delete leap second */
47#define TIME_OOP 3 /* leap second in progress */
48#define TIME_WAIT 4 /* leap second has occurred */
49#define TIME_ERROR 5 /* clock not synchronized */
50#define TIME_BAD TIME_ERROR /* bw compat */
51
52/* Maximum time constant of the PLL. */
53#define MAXTC 6
54
55__BEGIN_DECLS
56
57#ifndef __USE_TIME64_REDIRECTS
58extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1));
59extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1));
60
61# ifdef __REDIRECT_NTH
62extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
63 ntp_gettimex) __nonnull ((1));
64# else
65# define ntp_gettime ntp_gettimex
66# endif
67extern int ntp_adjtime (struct timex *__tntx) __THROW __nonnull ((1));
68#else
69# ifdef __REDIRECT_NTH
70extern int __REDIRECT_NTH (adjtimex, (struct timex *__ntx),
71 ___adjtimex64) __nonnull ((1));
72extern int __REDIRECT_NTH (ntp_gettime, (struct ntptimeval *__ntv),
73 __ntp_gettime64) __nonnull ((1));
74extern int __REDIRECT_NTH (ntp_gettimex, (struct ntptimeval *__ntv),
75 __ntp_gettimex64) __nonnull ((1));
76extern int __REDIRECT_NTH (ntp_adjtime, (struct timex *__ntx),
77 ___adjtimex64) __nonnull ((1));
78# else
79# define adjtimex ___adjtimex64
80# define ntp_adjtime ___adjtimex64
81# define ntp_gettime __ntp_gettime64
82# define ntp_gettimex __ntp_gettimex64
83# endif
84#endif
85
86__END_DECLS
87
88#endif /* sys/timex.h */
lib/libc/glibc/sysdeps/unix/sysv/linux/x86/sys/elf.h deleted-29
......@@ -1,29 +0,0 @@
1/* Copyright (C) 1998-2026 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18#ifndef _SYS_ELF_H
19#define _SYS_ELF_H 1
20
21#ifdef __x86_64__
22# error This header is unsupported on x86-64.
23#else
24# warning "This header is obsolete; use <sys/procfs.h> instead."
25
26# include <sys/procfs.h>
27#endif
28
29#endif /* _SYS_ELF_H */
lib/libc/glibc/time/bits/types/struct_itimerspec.h deleted-14
......@@ -1,14 +0,0 @@
1#ifndef __itimerspec_defined
2#define __itimerspec_defined 1
3
4#include <bits/types.h>
5#include <bits/types/struct_timespec.h>
6
7/* POSIX.1b structure for timer start values and intervals. */
8struct itimerspec
9 {
10 struct timespec it_interval;
11 struct timespec it_value;
12 };
13
14#endif
lib/libc/glibc/time/bits/types/struct_tm.h deleted-28
......@@ -1,28 +0,0 @@
1#ifndef __struct_tm_defined
2#define __struct_tm_defined 1
3
4#include <bits/types.h>
5
6/* ISO C `broken-down time' structure. */
7struct tm
8{
9 int tm_sec; /* Seconds. [0-60] (1 leap second) */
10 int tm_min; /* Minutes. [0-59] */
11 int tm_hour; /* Hours. [0-23] */
12 int tm_mday; /* Day. [1-31] */
13 int tm_mon; /* Month. [0-11] */
14 int tm_year; /* Year - 1900. */
15 int tm_wday; /* Day of week. [0-6] */
16 int tm_yday; /* Days in year.[0-365] */
17 int tm_isdst; /* DST. [-1/0/1]*/
18
19# ifdef __USE_MISC
20 long int tm_gmtoff; /* Seconds east of UTC. */
21 const char *tm_zone; /* Timezone abbreviation. */
22# else
23 long int __tm_gmtoff; /* Seconds east of UTC. */
24 const char *__tm_zone; /* Timezone abbreviation. */
25# endif
26};
27
28#endif