finally move buildroot-ng to trunk
[openwrt/staging/jogo.git] / target / linux / generic-2.6 / patches / 005-gcc4_fix.patch
1 diff -ruN linux-2.6.15.1/include/asm-ppc/libgcc.h linux-2.6.15.1-openwrt/include/asm-ppc/libgcc.h
2 --- linux-2.6.15.1/include/asm-ppc/libgcc.h 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.15.1-openwrt/include/asm-ppc/libgcc.h 2006-02-01 15:47:53.000000000 +0100
4 @@ -0,0 +1,8 @@
5 +#ifndef __ASM_LIBGCC_H
6 +#define __ASM_LIBGCC_H
7 +
8 +#undef ARCH_NEEDS_ashldi3
9 +#undef ARCH_NEEDS_ashrdi3
10 +#undef ARCH_NEEDS_lshrdi3
11 +
12 +#endif /* __ASM_LIBGCC_H */
13 diff -ruN linux-2.6.15.1/include/asm-i386/libgcc.h linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h
14 --- linux-2.6.15.1/include/asm-i386/libgcc.h 1970-01-01 01:00:00.000000000 +0100
15 +++ linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h 2006-02-01 15:47:53.000000000 +0100
16 @@ -0,0 +1,8 @@
17 +#ifndef __ASM_LIBGCC_H
18 +#define __ASM_LIBGCC_H
19 +
20 +#undef ARCH_NEEDS_ashldi3
21 +#undef ARCH_NEEDS_ashrdi3
22 +#undef ARCH_NEEDS_lshrdi3
23 +
24 +#endif /* __ASM_LIBGCC_H */
25 diff -ruN linux-2.6.15.1/include/asm-um/libgcc.h linux-2.6.15.1-openwrt/include/asm-i386/libgcc.h
26 --- linux-2.6.15.1/include/asm-um/libgcc.h 1970-01-01 01:00:00.000000000 +0100
27 +++ linux-2.6.15.1-openwrt/include/asm-um/libgcc.h 2006-02-01 15:47:53.000000000 +0100
28 @@ -0,0 +1,8 @@
29 +#ifndef __ASM_LIBGCC_H
30 +#define __ASM_LIBGCC_H
31 +
32 +#undef ARCH_NEEDS_ashldi3
33 +#undef ARCH_NEEDS_ashrdi3
34 +#undef ARCH_NEEDS_lshrdi3
35 +
36 +#endif /* __ASM_LIBGCC_H */
37 diff -Nur linux-2.6.15.1/include/asm-mips/libgcc.h linux-2.6.15.1-openwrt/include/asm-mips/libgcc.h
38 --- linux-2.6.15.1/include/asm-mips/libgcc.h 1970-01-01 01:00:00.000000000 +0100
39 +++ linux-2.6.15.1-openwrt/include/asm-mips/libgcc.h 2006-01-20 10:32:28.000000000 +0100
40 @@ -0,0 +1,8 @@
41 +#ifndef __ASM_LIBGCC_H
42 +#define __ASM_LIBGCC_H
43 +
44 +#define ARCH_NEEDS_ashldi3
45 +#define ARCH_NEEDS_ashrdi3
46 +#define ARCH_NEEDS_lshrdi3
47 +
48 +#endif /* __ASM_LIBGCC_H */
49 diff -Nur linux-2.6.15.1/include/linux/libgcc.h linux-2.6.15.1-openwrt/include/linux/libgcc.h
50 --- linux-2.6.15.1/include/linux/libgcc.h 1970-01-01 01:00:00.000000000 +0100
51 +++ linux-2.6.15.1-openwrt/include/linux/libgcc.h 2006-01-20 10:33:38.000000000 +0100
52 @@ -0,0 +1,32 @@
53 +#ifndef __LINUX_LIBGCC_H
54 +#define __LINUX_LIBGCC_H
55 +
56 +#include <asm/byteorder.h>
57 +#include <asm/libgcc.h>
58 +
59 +typedef long long DWtype;
60 +typedef int Wtype;
61 +typedef unsigned int UWtype;
62 +typedef int word_type __attribute__ ((mode (__word__)));
63 +
64 +#define BITS_PER_UNIT 8
65 +
66 +#ifdef __BIG_ENDIAN
67 +struct DWstruct {
68 + Wtype high, low;
69 +};
70 +#elif defined(__LITTLE_ENDIAN)
71 +struct DWstruct {
72 + Wtype low, high;
73 +};
74 +#else
75 +#error I feel sick.
76 +#endif
77 +
78 +typedef union
79 +{
80 + struct DWstruct s;
81 + DWtype ll;
82 +} DWunion;
83 +
84 +#endif /* __LINUX_LIBGCC_H */
85 diff -Nur linux-2.6.15.1/lib/ashldi3.c linux-2.6.15.1-openwrt/lib/ashldi3.c
86 --- linux-2.6.15.1/lib/ashldi3.c 1970-01-01 01:00:00.000000000 +0100
87 +++ linux-2.6.15.1-openwrt/lib/ashldi3.c 2006-01-20 10:38:41.000000000 +0100
88 @@ -0,0 +1,32 @@
89 +#include <linux/libgcc.h>
90 +#include <linux/module.h>
91 +
92 +#ifdef ARCH_NEEDS_ashldi3
93 +
94 +DWtype __ashldi3(DWtype u, word_type b)
95 +{
96 + DWunion uu, w;
97 + word_type bm;
98 +
99 + if (b == 0)
100 + return u;
101 +
102 + uu.ll = u;
103 + bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
104 +
105 + if (bm <= 0) {
106 + w.s.low = 0;
107 + w.s.high = (UWtype) uu.s.low << -bm;
108 + } else {
109 + const UWtype carries = (UWtype) uu.s.low >> bm;
110 +
111 + w.s.low = (UWtype) uu.s.low << b;
112 + w.s.high = ((UWtype) uu.s.high << b) | carries;
113 + }
114 +
115 + return w.ll;
116 +}
117 +
118 +EXPORT_SYMBOL(__ashldi3);
119 +
120 +#endif /* ARCH_NEEDS_ashldi3 */
121 diff -Nur linux-2.6.15.1/lib/ashrdi3.c linux-2.6.15.1-openwrt/lib/ashrdi3.c
122 --- linux-2.6.15.1/lib/ashrdi3.c 1970-01-01 01:00:00.000000000 +0100
123 +++ linux-2.6.15.1-openwrt/lib/ashrdi3.c 2006-01-20 10:39:29.000000000 +0100
124 @@ -0,0 +1,36 @@
125 +#include <linux/libgcc.h>
126 +#include <linux/module.h>
127 +
128 +/* Unless shift functions are defined with full ANSI prototypes,
129 + parameter b will be promoted to int if word_type is smaller than an int. */
130 +#ifdef ARCH_NEEDS_ashrdi3
131 +
132 +DWtype __ashrdi3(DWtype u, word_type b)
133 +{
134 + DWunion uu, w;
135 + word_type bm;
136 +
137 + if (b == 0)
138 + return u;
139 +
140 + uu.ll = u;
141 + bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
142 +
143 + if (bm <= 0) {
144 + /* w.s.high = 1..1 or 0..0 */
145 + w.s.high =
146 + uu.s.high >> (sizeof(Wtype) * BITS_PER_UNIT - 1);
147 + w.s.low = uu.s.high >> -bm;
148 + } else {
149 + const UWtype carries = (UWtype) uu.s.high << bm;
150 +
151 + w.s.high = uu.s.high >> b;
152 + w.s.low = ((UWtype) uu.s.low >> b) | carries;
153 + }
154 +
155 + return w.ll;
156 +}
157 +
158 +EXPORT_SYMBOL(__ashrdi3);
159 +
160 +#endif /* ARCH_NEEDS_ashrdi3 */
161 diff -Nur linux-2.6.15.1/lib/lshrdi3.c linux-2.6.15.1-openwrt/lib/lshrdi3.c
162 --- linux-2.6.15.1/lib/lshrdi3.c 1970-01-01 01:00:00.000000000 +0100
163 +++ linux-2.6.15.1-openwrt/lib/lshrdi3.c 2006-01-20 10:40:10.000000000 +0100
164 @@ -0,0 +1,34 @@
165 +#include <linux/libgcc.h>
166 +#include <linux/module.h>
167 +
168 +/* Unless shift functions are defined with full ANSI prototypes,
169 + parameter b will be promoted to int if word_type is smaller than an int. */
170 +#ifdef ARCH_NEEDS_lshrdi3
171 +
172 +DWtype __lshrdi3(DWtype u, word_type b)
173 +{
174 + DWunion uu, w;
175 + word_type bm;
176 +
177 + if (b == 0)
178 + return u;
179 +
180 + uu.ll = u;
181 + bm = (sizeof(Wtype) * BITS_PER_UNIT) - b;
182 +
183 + if (bm <= 0) {
184 + w.s.high = 0;
185 + w.s.low = (UWtype) uu.s.high >> -bm;
186 + } else {
187 + const UWtype carries = (UWtype) uu.s.high << bm;
188 +
189 + w.s.high = (UWtype) uu.s.high >> b;
190 + w.s.low = ((UWtype) uu.s.low >> b) | carries;
191 + }
192 +
193 + return w.ll;
194 +}
195 +
196 +EXPORT_SYMBOL(__lshrdi3);
197 +
198 +#endif /* ARCH_NEEDS_lshrdi3 */
199 diff -Nur linux-2.6.15.1/lib/Makefile linux-2.6.15.1-openwrt/lib/Makefile
200 --- linux-2.6.15.1/lib/Makefile 2006-01-15 07:16:02.000000000 +0100
201 +++ linux-2.6.15.1-openwrt/lib/Makefile 2006-01-20 10:34:19.000000000 +0100
202 @@ -8,6 +8,7 @@
203 sha1.o
204
205 lib-y += kobject.o kref.o kobject_uevent.o klist.o
206 +obj-y += ashldi3.o ashrdi3.o lshrdi3.o
207
208 obj-y += sort.o parser.o halfmd4.o
209
210 diff -Nur linux-2.6.15.1/include/asm-arm/libgcc.h linux-2.6.15.1-openwrt/include/asm-arm/libgcc.h
211 --- linux-2.6.15.1/include/asm-arm/libgcc.h 1970-01-01 01:00:00.000000000 +0100
212 +++ linux-2.6.15.1-openwrt/include/asm-arm/libgcc.h 2006-04-12 23:01:18.000000000 +0200
213 @@ -0,0 +1,8 @@
214 +#ifndef __ASM_LIBGCC_H
215 +#define __ASM_LIBGCC_H
216 +
217 +#undef ARCH_NEEDS_ashldi3
218 +#undef ARCH_NEEDS_ashrdi3
219 +#undef ARCH_NEEDS_lshrdi3
220 +
221 +#endif /* __ASM_LIBGCC_H */