summaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/patches/005-gcc4_fix.patch
blob: 99489b94b3ad88c958580553bbaa8acfc32cea91 (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
diff -ruN linux-2.6.15.1/include/asm-ppc/libgcc.h linux-2.6.15.1-openwrt/include/asm-ppc/libgcc.h
--- linux-2.6.15.1/include/asm-ppc/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/asm-ppc/libgcc.h	2006-02-01 15:47:53.000000000 +0100
@@ -0,0 +1,8 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#undef ARCH_NEEDS_ashldi3
+#undef ARCH_NEEDS_ashrdi3
+#undef ARCH_NEEDS_lshrdi3
+
+#endif /* __ASM_LIBGCC_H */
diff -ruN linux-2.6.15.1/include/asm-i386/libgcc.h linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h
--- linux-2.6.15.1/include/asm-i386/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h	2006-02-01 15:47:53.000000000 +0100
@@ -0,0 +1,8 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#undef ARCH_NEEDS_ashldi3
+#undef ARCH_NEEDS_ashrdi3
+#undef ARCH_NEEDS_lshrdi3
+
+#endif /* __ASM_LIBGCC_H */
diff -ruN linux-2.6.15.1/include/asm-um/libgcc.h linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h
--- linux-2.6.15.1/include/asm-um/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/asm-um/libgcc.h	2006-02-01 15:47:53.000000000 +0100
@@ -0,0 +1,8 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#undef ARCH_NEEDS_ashldi3
+#undef ARCH_NEEDS_ashrdi3
+#undef ARCH_NEEDS_lshrdi3
+
+#endif /* __ASM_LIBGCC_H */
diff -Nur linux-2.6.15.1/include/asm-mips/libgcc.h linux-2.6.15.1-openwrt/include/asm-mips/libgcc.h
--- linux-2.6.15.1/include/asm-mips/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/asm-mips/libgcc.h	2006-01-20 10:32:28.000000000 +0100
@@ -0,0 +1,8 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#define ARCH_NEEDS_ashldi3
+#define ARCH_NEEDS_ashrdi3
+#define ARCH_NEEDS_lshrdi3
+
+#endif /* __ASM_LIBGCC_H */
diff -Nur linux-2.6.15.1/include/linux/libgcc.h linux-2.6.15.1-openwrt/include/linux/libgcc.h
--- linux-2.6.15.1/include/linux/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/linux/libgcc.h	2006-01-20 10:33:38.000000000 +0100
@@ -0,0 +1,32 @@
+#ifndef __LINUX_LIBGCC_H
+#define __LINUX_LIBGCC_H
+
+#include <asm/byteorder.h>
+#include <asm/libgcc.h>
+
+typedef long long DWtype;
+typedef int Wtype;
+typedef unsigned int UWtype;
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#define BITS_PER_UNIT 8
+
+#ifdef __BIG_ENDIAN
+struct DWstruct {
+       Wtype high, low;
+};
+#elif defined(__LITTLE_ENDIAN)
+struct DWstruct {
+       Wtype low, high;
+};
+#else
+#error I feel sick.
+#endif
+
+typedef union
+{
+       struct DWstruct s;
+       DWtype ll;
+} DWunion;
+
+#endif /* __LINUX_LIBGCC_H */
diff -Nur linux-2.6.15.1/lib/ashldi3.c linux-2.6.15.1-openwrt/lib/ashldi3.c
--- linux-2.6.15.1/lib/ashldi3.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/lib/ashldi3.c	2006-01-20 10:38:41.000000000 +0100
@@ -0,0 +1,32 @@
+#include <linux/libgcc.h>
+#include <linux/module.h>
+
+#ifdef ARCH_NEEDS_ashldi3
+
+DWtype __ashldi3(DWtype u, word_type b)
+{
+       DWunion uu, w;
+       word_type bm;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+       bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
+
+       if (bm <= 0) {
+               w.s.low = 0;
+               w.s.high = (UWtype) uu.s.low << -bm;
+       } else {
+               const UWtype carries = (UWtype) uu.s.low >> bm;
+
+               w.s.low = (UWtype) uu.s.low << b;
+               w.s.high = ((UWtype) uu.s.high << b) | carries;
+       }
+
+       return w.ll;
+}
+
+EXPORT_SYMBOL(__ashldi3);
+
+#endif /* ARCH_NEEDS_ashldi3 */
diff -Nur linux-2.6.15.1/lib/ashrdi3.c linux-2.6.15.1-openwrt/lib/ashrdi3.c
--- linux-2.6.15.1/lib/ashrdi3.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/lib/ashrdi3.c	2006-01-20 10:39:29.000000000 +0100
@@ -0,0 +1,36 @@
+#include <linux/libgcc.h>
+#include <linux/module.h>
+
+/* Unless shift functions are defined with full ANSI prototypes,
+   parameter b will be promoted to int if word_type is smaller than an int.  */
+#ifdef ARCH_NEEDS_ashrdi3
+
+DWtype __ashrdi3(DWtype u, word_type b)
+{
+       DWunion uu, w;
+       word_type bm;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+       bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
+
+       if (bm <= 0) {
+               /* w.s.high = 1..1 or 0..0 */
+               w.s.high =
+                   uu.s.high >> (sizeof(Wtype) * BITS_PER_UNIT - 1);
+               w.s.low = uu.s.high >> -bm;
+       } else {
+               const UWtype carries = (UWtype) uu.s.high << bm;
+
+               w.s.high = uu.s.high >> b;
+               w.s.low = ((UWtype) uu.s.low >> b) | carries;
+       }
+
+       return w.ll;
+}
+
+EXPORT_SYMBOL(__ashrdi3);
+
+#endif /* ARCH_NEEDS_ashrdi3 */
diff -Nur linux-2.6.15.1/lib/lshrdi3.c linux-2.6.15.1-openwrt/lib/lshrdi3.c
--- linux-2.6.15.1/lib/lshrdi3.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/lib/lshrdi3.c	2006-01-20 10:40:10.000000000 +0100
@@ -0,0 +1,34 @@
+#include <linux/libgcc.h>
+#include <linux/module.h>
+
+/* Unless shift functions are defined with full ANSI prototypes,
+   parameter b will be promoted to int if word_type is smaller than an int.  */
+#ifdef ARCH_NEEDS_lshrdi3
+
+DWtype __lshrdi3(DWtype u, word_type b)
+{
+       DWunion uu, w;
+       word_type bm;
+
+       if (b == 0)
+               return u;
+
+       uu.ll = u;
+       bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
+
+       if (bm <= 0) {
+               w.s.high = 0;
+               w.s.low = (UWtype) uu.s.high >> -bm;
+       } else {
+               const UWtype carries = (UWtype) uu.s.high << bm;
+
+               w.s.high = (UWtype) uu.s.high >> b;
+               w.s.low = ((UWtype) uu.s.low >> b) | carries;
+       }
+
+       return w.ll;
+}
+
+EXPORT_SYMBOL(__lshrdi3);
+
+#endif /* ARCH_NEEDS_lshrdi3 */
diff -Nur linux-2.6.15.1/lib/Makefile linux-2.6.15.1-openwrt/lib/Makefile
--- linux-2.6.15.1/lib/Makefile	2006-01-15 07:16:02.000000000 +0100
+++ linux-2.6.15.1-openwrt/lib/Makefile	2006-01-20 10:34:19.000000000 +0100
@@ -8,6 +8,7 @@
 	 sha1.o
 
 lib-y	+= kobject.o kref.o kobject_uevent.o klist.o
+obj-y	+= ashldi3.o ashrdi3.o lshrdi3.o
 
 obj-y += sort.o parser.o halfmd4.o
 
diff -Nur linux-2.6.15.1/include/asm-arm/libgcc.h linux-2.6.15.1-openwrt/include/asm-arm/libgcc.h
--- linux-2.6.15.1/include/asm-arm/libgcc.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15.1-openwrt/include/asm-arm/libgcc.h	2006-04-12 23:01:18.000000000 +0200
@@ -0,0 +1,8 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#undef ARCH_NEEDS_ashldi3
+#undef ARCH_NEEDS_ashrdi3
+#undef ARCH_NEEDS_lshrdi3
+
+#endif /* __ASM_LIBGCC_H */