finally move buildroot-ng to trunk
[openwrt.git] / target / linux / generic-2.4 / patches / 113-even_more_gcc4_stuff.patch
1 diff -Nur linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
2 --- linux.old/arch/mips/kernel/mips_ksyms.c     2004-02-18 14:36:30.000000000 +0100
3 +++ linux.dev/arch/mips/kernel/mips_ksyms.c     2005-10-24 14:21:53.702396250 +0200
4 @@ -30,6 +30,10 @@
5  #include <asm/floppy.h>
6  #endif
7  
8 +asmlinkage long long __ashldi3 (long long, int);
9 +asmlinkage long long __ashrdi3 (long long, int);
10 +asmlinkage long long __lshrdi3 (long long, int);
11 +asmlinkage long long __muldi3 (long long, long long);
12  extern void *__bzero(void *__s, size_t __count);
13  extern long __strncpy_from_user_nocheck_asm(char *__to,
14                                              const char *__from, long __len);
15 @@ -78,6 +82,13 @@
16  EXPORT_SYMBOL_NOVERS(__strnlen_user_asm);
17  
18  
19 +/* Compiler stuff */
20 +EXPORT_SYMBOL_NOVERS(__ashldi3);
21 +EXPORT_SYMBOL_NOVERS(__ashrdi3);
22 +EXPORT_SYMBOL_NOVERS(__lshrdi3);
23 +EXPORT_SYMBOL_NOVERS(__muldi3);
24 +
25 +
26  /* Networking helper routines. */
27  EXPORT_SYMBOL(csum_partial_copy);
28  
29 diff -Nur linux.old/arch/mips/lib/Makefile linux.dev/arch/mips/lib/Makefile
30 --- linux.old/arch/mips/lib/Makefile    2004-02-18 14:36:30.000000000 +0100
31 +++ linux.dev/arch/mips/lib/Makefile    2005-10-24 14:21:53.774400750 +0200
32 @@ -9,7 +9,8 @@
33  obj-y                          += csum_partial.o csum_partial_copy.o \
34                                    promlib.o rtc-std.o rtc-no.o memcpy.o \
35                                    memset.o watch.o strlen_user.o \
36 -                                  strncpy_user.o strnlen_user.o
37 +                                  strncpy_user.o strnlen_user.o \
38 +                                  ashldi3.o ashrdi3.o lshrdi3.o muldi3.o
39  
40  export-objs                    := rtc-std.o rtc-no.o
41  
42 diff -Nur linux.old/arch/mips/lib/ashldi3.c linux.dev/arch/mips/lib/ashldi3.c
43 --- linux.old/arch/mips/lib/ashldi3.c   1970-01-01 01:00:00.000000000 +0100
44 +++ linux.dev/arch/mips/lib/ashldi3.c   2005-10-24 14:21:53.774400750 +0200
45 @@ -0,0 +1,62 @@
46 +/* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
47 +/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
48 +
49 +This file is part of GNU CC.
50 +
51 +GNU CC is free software; you can redistribute it and/or modify
52 +it under the terms of the GNU General Public License as published by
53 +the Free Software Foundation; either version 2, or (at your option)
54 +any later version.
55 +
56 +GNU CC is distributed in the hope that it will be useful,
57 +but WITHOUT ANY WARRANTY; without even the implied warranty of
58 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
59 +GNU General Public License for more details.
60 +
61 +You should have received a copy of the GNU General Public License
62 +along with GNU CC; see the file COPYING.  If not, write to
63 +the Free Software Foundation, 59 Temple Place - Suite 330,
64 +Boston, MA 02111-1307, USA.  */
65 +
66 +#define BITS_PER_UNIT 8
67 +
68 +typedef         int SItype     __attribute__ ((mode (SI)));
69 +typedef unsigned int USItype   __attribute__ ((mode (SI)));
70 +typedef                 int DItype     __attribute__ ((mode (DI)));
71 +typedef int word_type __attribute__ ((mode (__word__)));
72 +
73 +struct DIstruct {SItype high, low;};
74 +
75 +typedef union
76 +{
77 +  struct DIstruct s;
78 +  DItype ll;
79 +} DIunion;
80 +
81 +DItype
82 +__ashldi3 (DItype u, word_type b)
83 +{
84 +  DIunion w;
85 +  word_type bm;
86 +  DIunion uu;
87 +
88 +  if (b == 0)
89 +    return u;
90 +
91 +  uu.ll = u;
92 +
93 +  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
94 +  if (bm <= 0)
95 +    {
96 +      w.s.low = 0;
97 +      w.s.high = (USItype)uu.s.low << -bm;
98 +    }
99 +  else
100 +    {
101 +      USItype carries = (USItype)uu.s.low >> bm;
102 +      w.s.low = (USItype)uu.s.low << b;
103 +      w.s.high = ((USItype)uu.s.high << b) | carries;
104 +    }
105 +
106 +  return w.ll;
107 +}
108 diff -Nur linux.old/arch/mips/lib/ashrdi3.c linux.dev/arch/mips/lib/ashrdi3.c
109 --- linux.old/arch/mips/lib/ashrdi3.c   1970-01-01 01:00:00.000000000 +0100
110 +++ linux.dev/arch/mips/lib/ashrdi3.c   2005-10-24 14:21:53.774400750 +0200
111 @@ -0,0 +1,63 @@
112 +/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
113 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
114 +
115 +This file is part of GNU CC.
116 +
117 +GNU CC is free software; you can redistribute it and/or modify
118 +it under the terms of the GNU General Public License as published by
119 +the Free Software Foundation; either version 2, or (at your option)
120 +any later version.
121 +
122 +GNU CC is distributed in the hope that it will be useful,
123 +but WITHOUT ANY WARRANTY; without even the implied warranty of
124 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
125 +GNU General Public License for more details.
126 +
127 +You should have received a copy of the GNU General Public License
128 +along with GNU CC; see the file COPYING.  If not, write to
129 +the Free Software Foundation, 59 Temple Place - Suite 330,
130 +Boston, MA 02111-1307, USA.  */
131 +
132 +#define BITS_PER_UNIT 8
133 +
134 +typedef         int SItype     __attribute__ ((mode (SI)));
135 +typedef unsigned int USItype   __attribute__ ((mode (SI)));
136 +typedef                 int DItype     __attribute__ ((mode (DI)));
137 +typedef int word_type __attribute__ ((mode (__word__)));
138 +
139 +struct DIstruct {SItype high, low;};
140 +
141 +typedef union
142 +{
143 +  struct DIstruct s;
144 +  DItype ll;
145 +} DIunion;
146 +
147 +DItype
148 +__ashrdi3 (DItype u, word_type b)
149 +{
150 +  DIunion w;
151 +  word_type bm;
152 +  DIunion uu;
153 +
154 +  if (b == 0)
155 +    return u;
156 +
157 +  uu.ll = u;
158 +
159 +  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
160 +  if (bm <= 0)
161 +    {
162 +      /* w.s.high = 1..1 or 0..0 */
163 +      w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
164 +      w.s.low = uu.s.high >> -bm;
165 +    }
166 +  else
167 +    {
168 +      USItype carries = (USItype)uu.s.high << bm;
169 +      w.s.high = uu.s.high >> b;
170 +      w.s.low = ((USItype)uu.s.low >> b) | carries;
171 +    }
172 +
173 +  return w.ll;
174 +}
175 diff -Nur linux.old/arch/mips/lib/lshrdi3.c linux.dev/arch/mips/lib/lshrdi3.c
176 --- linux.old/arch/mips/lib/lshrdi3.c   1970-01-01 01:00:00.000000000 +0100
177 +++ linux.dev/arch/mips/lib/lshrdi3.c   2005-10-24 14:21:53.774400750 +0200
178 @@ -0,0 +1,62 @@
179 +/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
180 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
181 +
182 +This file is part of GNU CC.
183 +
184 +GNU CC is free software; you can redistribute it and/or modify
185 +it under the terms of the GNU General Public License as published by
186 +the Free Software Foundation; either version 2, or (at your option)
187 +any later version.
188 +
189 +GNU CC is distributed in the hope that it will be useful,
190 +but WITHOUT ANY WARRANTY; without even the implied warranty of
191 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
192 +GNU General Public License for more details.
193 +
194 +You should have received a copy of the GNU General Public License
195 +along with GNU CC; see the file COPYING.  If not, write to
196 +the Free Software Foundation, 59 Temple Place - Suite 330,
197 +Boston, MA 02111-1307, USA.  */
198 +
199 +#define BITS_PER_UNIT 8
200 +
201 +typedef         int SItype     __attribute__ ((mode (SI)));
202 +typedef unsigned int USItype   __attribute__ ((mode (SI)));
203 +typedef                 int DItype     __attribute__ ((mode (DI)));
204 +typedef int word_type __attribute__ ((mode (__word__)));
205 +
206 +struct DIstruct {SItype high, low;};
207 +
208 +typedef union
209 +{
210 +  struct DIstruct s;
211 +  DItype ll;
212 +} DIunion;
213 +
214 +DItype
215 +__lshrdi3 (DItype u, word_type b)
216 +{
217 +  DIunion w;
218 +  word_type bm;
219 +  DIunion uu;
220 +
221 +  if (b == 0)
222 +    return u;
223 +
224 +  uu.ll = u;
225 +
226 +  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
227 +  if (bm <= 0)
228 +    {
229 +      w.s.high = 0;
230 +      w.s.low = (USItype)uu.s.high >> -bm;
231 +    }
232 +  else
233 +    {
234 +      USItype carries = (USItype)uu.s.high << bm;
235 +      w.s.high = (USItype)uu.s.high >> b;
236 +      w.s.low = ((USItype)uu.s.low >> b) | carries;
237 +    }
238 +
239 +  return w.ll;
240 +}
241 diff -Nur linux.old/arch/mips/lib/muldi3.c linux.dev/arch/mips/lib/muldi3.c
242 --- linux.old/arch/mips/lib/muldi3.c    1970-01-01 01:00:00.000000000 +0100
243 +++ linux.dev/arch/mips/lib/muldi3.c    2005-10-24 14:21:53.774400750 +0200
244 @@ -0,0 +1,63 @@
245 +/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 
246 +                          gcc-2.7.2.3/longlong.h which is: */
247 +/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
248 +
249 +This file is part of GNU CC.
250 +
251 +GNU CC is free software; you can redistribute it and/or modify
252 +it under the terms of the GNU General Public License as published by
253 +the Free Software Foundation; either version 2, or (at your option)
254 +any later version.
255 +
256 +GNU CC is distributed in the hope that it will be useful,
257 +but WITHOUT ANY WARRANTY; without even the implied warranty of
258 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
259 +GNU General Public License for more details.
260 +
261 +You should have received a copy of the GNU General Public License
262 +along with GNU CC; see the file COPYING.  If not, write to
263 +the Free Software Foundation, 59 Temple Place - Suite 330,
264 +Boston, MA 02111-1307, USA.  */
265 +
266 +#define BITS_PER_UNIT 8
267 +
268 +#define umul_ppmm(w1, w0, u, v) \
269 +  __asm__ ("multu %2,%3"                                               \
270 +           : "=l" ((USItype)(w0)),                                     \
271 +             "=h" ((USItype)(w1))                                      \
272 +           : "d" ((USItype)(u)),                                       \
273 +             "d" ((USItype)(v)))
274 +
275 +#define __umulsidi3(u, v) \
276 +  ({DIunion __w;                                                       \
277 +    umul_ppmm (__w.s.high, __w.s.low, u, v);                           \
278 +    __w.ll; })
279 +
280 +typedef         int SItype     __attribute__ ((mode (SI)));
281 +typedef unsigned int USItype   __attribute__ ((mode (SI)));
282 +typedef                 int DItype     __attribute__ ((mode (DI)));
283 +typedef int word_type __attribute__ ((mode (__word__)));
284 +
285 +struct DIstruct {SItype high, low;};
286 +
287 +typedef union
288 +{
289 +  struct DIstruct s;
290 +  DItype ll;
291 +} DIunion;
292 +
293 +DItype
294 +__muldi3 (DItype u, DItype v)
295 +{
296 +  DIunion w;
297 +  DIunion uu, vv;
298 +
299 +  uu.ll = u,
300 +  vv.ll = v;
301 +
302 +  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
303 +  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
304 +              + (USItype) uu.s.high * (USItype) vv.s.low);
305 +
306 +  return w.ll;
307 +}
308 diff -Nur linux.old/fs/cifs/cifsfs.c linux.dev/fs/cifs/cifsfs.c
309 --- linux.old/fs/cifs/cifsfs.c  2005-10-24 13:48:27.599659000 +0200
310 +++ linux.dev/fs/cifs/cifsfs.c  2005-10-24 14:25:06.526447000 +0200
311 @@ -50,8 +50,6 @@
312  static struct quotactl_ops cifs_quotactl_ops;
313  #endif
314  
315 -extern struct file_system_type cifs_fs_type;
316 -
317  int cifsFYI = 0;
318  int cifsERROR = 1;
319  int traceSMB = 0;
320 diff -Nur linux.old/include/asm-mips/uaccess.h linux.dev/include/asm-mips/uaccess.h
321 --- linux.old/include/asm-mips/uaccess.h        2005-01-19 15:10:12.000000000 +0100
322 +++ linux.dev/include/asm-mips/uaccess.h        2005-10-24 14:11:48.563214250 +0200
323 @@ -149,7 +149,7 @@
324   * Returns zero on success, or -EFAULT on error.
325   */
326  #define put_user(x,ptr)        \
327 -       __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
328 +       __put_user_check((x),(ptr),sizeof(*(ptr)))
329  
330  /*
331   * get_user: - Get a simple variable from user space.
332 @@ -169,7 +169,7 @@
333   * On error, the variable @x is set to zero.
334   */
335  #define get_user(x,ptr) \
336 -       __get_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
337 +       __get_user_check((x),(ptr),sizeof(*(ptr)))
338  
339  /*
340   * __put_user: - Write a simple value into user space, with less checking.
341 @@ -191,7 +191,7 @@
342   * Returns zero on success, or -EFAULT on error.
343   */
344  #define __put_user(x,ptr) \
345 -       __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
346 +       __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
347  
348  /*
349   * __get_user: - Get a simple variable from user space, with less checking.
350 @@ -214,7 +214,7 @@
351   * On error, the variable @x is set to zero.
352   */
353  #define __get_user(x,ptr) \
354 -       __get_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
355 +       __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
356  
357  struct __large_struct { unsigned long buf[100]; };
358  #define __m(x) (*(struct __large_struct *)(x))
359 @@ -232,7 +232,7 @@
360  #define __get_user_nocheck(x,ptr,size)                                 \
361  ({                                                                     \
362         long __gu_err = 0;                                              \
363 -       __typeof(*(ptr)) __gu_val = 0;                                  \
364 +       __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0;                                       \
365         long __gu_addr;                                                 \
366         __gu_addr = (long) (ptr);                                       \
367         switch (size) {                                                 \