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