-
Notifications
You must be signed in to change notification settings - Fork 4
/
0011-Define-bits-endian.h-instead-of-generating-it.patch
149 lines (140 loc) · 5.73 KB
/
0011-Define-bits-endian.h-instead-of-generating-it.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <[email protected]>
Date: Tue, 31 Aug 2021 02:16:50 +0300
Subject: [PATCH] Define bits/endian.h instead of generating it
---
bits/endian.h | 15 +++++------
bits/errno.h | 68 ++++++++++++++++++++++++++++++++++---------------
bits/wordsize.h | 10 +++-----
3 files changed, 57 insertions(+), 36 deletions(-)
diff --git a/bits/endian.h b/bits/endian.h
index 45afd4ae47708c0c1953a06ed95aa6f3a8da302f..f49f6ab1c9b3a108fad08e80063cb534ae79b049 100644
--- a/bits/endian.h
+++ b/bits/endian.h
@@ -1,13 +1,10 @@
-/* This file should define __BYTE_ORDER as appropriate for the machine
- in question. See string/endian.h for how to define it.
-
- If only the stub bits/endian.h applies to a particular configuration,
- bytesex.h is generated by running a program on the host machine.
- So if cross-compiling to a machine with a different byte order,
- the bits/endian.h file for that machine must exist. */
-
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
-#error Machine byte order unknown.
+/* ARM can be either big or little endian. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
diff --git a/bits/errno.h b/bits/errno.h
index 05bf7a44c56c4df7c3f49147f7c0c0c9c7fea56e..7bf15c3545d2e89ef40e6a90883278b7029929c8 100644
--- a/bits/errno.h
+++ b/bits/errno.h
@@ -25,26 +25,52 @@
# error "Never include <bits/errno.h> directly; use <errno.h> instead."
#endif
-#error "Generic bits/errno.h included -- port is incomplete."
-
-/* Authors of new ports of the GNU C Library must override this file
- with their own bits/errno.h in an appropriate subdirectory of
- sysdeps/. Its function is to define all of the error constants
- from C2011 and POSIX.1-2008, with values appropriate to the
- operating system, and any additional OS-specific error constants.
-
- C2011 requires all error constants to be object-like macros that
- expand to "integer constant expressions with type int, positive
- values, and suitable for use in #if directives". Moreover, all of
- their names must begin with a capital E, followed immediately by
- either another capital letter, or a digit. It is OK to define
- macros that are not error constants, but only in the implementation
- namespace.
-
- errno.h is sometimes included from assembly language. Therefore,
- when __ASSEMBLER__ is defined, bits/errno.h may only define macros;
- it may not make any other kind of C declaration or definition.
- Also, the error constants should, if at all possible, expand to
- simple decimal or hexadecimal numbers. */
+#ifdef _ERRNO_H
+
+# include <linux/errno.h>
+
+/* Older Linux headers do not define these constants. */
+# ifndef ENOTSUP
+# define ENOTSUP EOPNOTSUPP
+# endif
+
+/* Older Linux versions also had no ECANCELED error code. */
+# ifndef ECANCELED
+# define ECANCELED 125
+# endif
+
+/* Support for error codes to support robust mutexes was added later, too. */
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 130
+# define ENOTRECOVERABLE 131
+# endif
+
+# ifndef ERFKILL
+# define ERFKILL 132
+# endif
+
+# ifndef EHWPOISON
+# define EHWPOISON 133
+# endif
+
+# ifndef __ASSEMBLER__
+/* Function to get address of global `errno' variable. */
+extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+
+# if !defined _LIBC || defined _LIBC_REENTRANT
+/* When using threads, errno is a per-thread value. */
+# define errno (*__errno_location ())
+# endif
+# endif /* !__ASSEMBLER__ */
+#endif /* _ERRNO_H */
+
+#if !defined _ERRNO_H && defined __need_Emath
+/* This is ugly but the kernel header is not clean enough. We must
+ define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
+ defined. */
+# define EDOM 33 /* Math argument out of domain of function. */
+# define EILSEQ 84 /* Illegal byte sequence. */
+# define ERANGE 34 /* Math result not representable. */
+#endif /* !_ERRNO_H && __need_Emath */
#endif /* bits/errno.h. */
diff --git a/bits/wordsize.h b/bits/wordsize.h
index 14edae3a11d01c9714172d9dd6b78b38b086c36c..46ac7fd204a2ae26ccfaf75cecf413aa91f9ad48 100644
--- a/bits/wordsize.h
+++ b/bits/wordsize.h
@@ -1,27 +1,25 @@
-#error "This file must be written based on the data type sizes of the target"
-
/* The following entries are a template for what defines should be in the
wordsize.h header file for a target. */
/* Size in bits of the 'long int' and pointer types. */
-#define __WORDSIZE
+#define __WORDSIZE 32
/* This should be set to 1 if __WORDSIZE is 32 and size_t is type
'unsigned long' instead of type 'unsigned int'. This will ensure
that SIZE_MAX is defined as an unsigned long constant instead of an
unsigned int constant. Set to 0 if __WORDSIZE is 32 and size_t is
'unsigned int' and leave undefined if __WORDSIZE is 64. */
-#define __WORDSIZE32_SIZE_ULONG
+#define __WORDSIZE32_SIZE_ULONG 0
/* This should be set to 1 if __WORDSIZE is 32 and ptrdiff_t is type 'long'
instead of type 'int'. This will ensure that PTRDIFF_MIN and PTRDIFF_MAX
are defined as long constants instead of int constants. Set to 0 if
__WORDSIZE is 32 and ptrdiff_t is type 'int' and leave undefined if
__WORDSIZE is 64. */
-#define __WORDSIZE32_PTRDIFF_LONG
+#define __WORDSIZE32_PTRDIFF_LONG 0
/* Set to 1 in order to force time types to be 32 bits instead of 64 bits in
struct lastlog and struct utmp{,x} on 64-bit ports. This may be done in
order to make 64-bit ports compatible with 32-bit ports. Set to 0 for
64-bit ports where the time types are 64-bits or for any 32-bit ports. */
-#define __WORDSIZE_TIME64_COMPAT32
+#define __WORDSIZE_TIME64_COMPAT32 0