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