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