finally move buildroot-ng to trunk
[openwrt/staging/jogo.git] / target / linux / generic-2.4 / patches / 006-gcc4_fixes.patch
1 diff -rupN linux-2.4.32/Makefile linux-2.4.32.gcc4-fixes-v12/Makefile
2 --- linux-2.4.32/Makefile 2005-11-17 13:27:30.000000000 +0100
3 +++ linux-2.4.32.gcc4-fixes-v12/Makefile 2005-11-17 13:32:13.000000000 +0100
4 @@ -93,11 +93,17 @@ CPPFLAGS := -D__KERNEL__ -I$(HPATH)
5
6 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
7 -fno-strict-aliasing -fno-common
8 +CFLAGS += -fno-builtin-sprintf
9 ifndef CONFIG_FRAME_POINTER
10 CFLAGS += -fomit-frame-pointer
11 endif
12 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
13
14 +check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
15 +
16 +# disable pointer signedness warnings in gcc 4.0
17 +CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
18 +
19 #
20 # ROOT_DEV specifies the default root-device when making the image.
21 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
22 diff -rupN linux-2.4.32/arch/i386/Makefile linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile
23 --- linux-2.4.32/arch/i386/Makefile 2004-11-17 18:36:41.000000000 +0100
24 +++ linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile 2005-11-17 13:32:13.000000000 +0100
25 @@ -23,8 +23,6 @@ LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinu
26
27 CFLAGS += -pipe
28
29 -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
30 -
31 # prevent gcc from keeping the stack 16 byte aligned
32 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
33
34 diff -rupN linux-2.4.32/arch/mips/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile
35 --- linux-2.4.32/arch/mips/Makefile 2005-01-19 18:00:52.000000000 +0100
36 +++ linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile 2005-11-17 13:32:13.000000000 +0100
37 @@ -30,8 +30,6 @@ endif
38
39 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
40
41 -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
42 -
43 #
44 #
45 # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
46 diff -rupN linux-2.4.32/arch/mips64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile
47 --- linux-2.4.32/arch/mips64/Makefile 2005-01-19 18:00:52.000000000 +0100
48 +++ linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile 2005-11-17 13:32:13.000000000 +0100
49 @@ -26,7 +26,6 @@ ifdef CONFIG_CROSSCOMPILE
50 CROSS_COMPILE = $(tool-prefix)
51 endif
52
53 -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
54 check_gas = $(shell if $(CC) $(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
55
56 #
57 diff -rupN linux-2.4.32/arch/ppc/kernel/open_pic_defs.h linux-2.4.32.gcc4-fixes-v12/arch/ppc/kernel/open_pic_defs.h
58 --- linux-2.4.32/arch/ppc/kernel/open_pic_defs.h 2003-06-14 13:30:19.000000000 +0200
59 +++ linux-2.4.32.gcc4-fixes-v12/arch/ppc/kernel/open_pic_defs.h 2005-11-17 13:32:13.000000000 +0100
60 @@ -172,9 +172,6 @@ struct OpenPIC {
61 OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
62 };
63
64 -extern volatile struct OpenPIC *OpenPIC;
65 -
66 -
67 /*
68 * Current Task Priority Register
69 */
70 diff -rupN linux-2.4.32/arch/x86_64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile
71 --- linux-2.4.32/arch/x86_64/Makefile 2004-04-14 20:22:20.000000000 +0200
72 +++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile 2005-11-17 13:32:13.000000000 +0100
73 @@ -38,8 +38,6 @@ OBJCOPY=$(CROSS_COMPILE)objcopy -O binar
74 LDFLAGS=-e stext
75 LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
76
77 -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then echo "$(1)"; else echo "$(2)"; fi)
78 -
79 CFLAGS += -mno-red-zone
80 CFLAGS += -mcmodel=kernel
81 CFLAGS += -pipe
82 diff -rupN linux-2.4.32/arch/x86_64/ia32/ia32entry.S linux-2.4.32.gcc4-fixes-v12/arch/x86_64/ia32/ia32entry.S
83 --- linux-2.4.32/arch/x86_64/ia32/ia32entry.S 2005-01-19 18:00:53.000000000 +0100
84 +++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/ia32/ia32entry.S 2005-11-17 13:32:13.000000000 +0100
85 @@ -113,9 +113,18 @@ quiet_ni_syscall:
86 PTREGSCALL stub32_fork, sys32_fork
87 PTREGSCALL stub32_clone, sys32_clone
88 PTREGSCALL stub32_vfork, sys32_vfork
89 - PTREGSCALL stub32_iopl, sys_iopl
90 PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend
91
92 + .macro PTREGSCALL3 label, func, arg
93 + .globl \label
94 +\label:
95 + leaq \func(%rip),%rax
96 + leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
97 + jmp ia32_ptregs_common
98 + .endm
99 +
100 + PTREGSCALL3 stub32_iopl, sys_iopl, %rsi
101 +
102 ENTRY(ia32_ptregs_common)
103 popq %r11
104 SAVE_REST
105 diff -rupN linux-2.4.32/arch/x86_64/kernel/entry.S linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/entry.S
106 --- linux-2.4.32/arch/x86_64/kernel/entry.S 2003-11-29 00:28:11.000000000 +0100
107 +++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/entry.S 2005-11-17 13:32:13.000000000 +0100
108 @@ -249,7 +249,16 @@ intret_signal_test:
109 PTREGSCALL stub_vfork, sys_vfork
110 PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend
111 PTREGSCALL stub_sigaltstack, sys_sigaltstack
112 - PTREGSCALL stub_iopl, sys_iopl
113 +
114 + .macro PTREGSCALL3 label,func,arg
115 + .globl \label
116 +\label:
117 + leaq \func(%rip),%rax
118 + leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
119 + jmp ptregscall_common
120 + .endm
121 +
122 + PTREGSCALL3 stub_iopl, sys_iopl, %rsi
123
124 ENTRY(ptregscall_common)
125 popq %r11
126 diff -rupN linux-2.4.32/arch/x86_64/kernel/ioport.c linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/ioport.c
127 --- linux-2.4.32/arch/x86_64/kernel/ioport.c 2003-11-29 00:28:11.000000000 +0100
128 +++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/ioport.c 2005-11-17 13:32:13.000000000 +0100
129 @@ -81,9 +81,9 @@ asmlinkage long sys_ioperm(unsigned long
130 * code.
131 */
132
133 -asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs)
134 +asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
135 {
136 - unsigned int old = (regs.eflags >> 12) & 3;
137 + unsigned int old = (regs->eflags >> 12) & 3;
138
139 if (level > 3)
140 return -EINVAL;
141 @@ -92,6 +92,6 @@ asmlinkage long sys_iopl(unsigned int le
142 if (!capable(CAP_SYS_RAWIO))
143 return -EPERM;
144 }
145 - regs.eflags = (regs.eflags & 0xffffffffffffcfff) | (level << 12);
146 + regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12);
147 return 0;
148 }
149 diff -rupN linux-2.4.32/drivers/acpi/bus.c linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c
150 --- linux-2.4.32/drivers/acpi/bus.c 2005-01-19 18:00:53.000000000 +0100
151 +++ linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c 2005-11-17 13:32:13.000000000 +0100
152 @@ -623,7 +623,7 @@ acpi_bus_generate_event (
153 int data)
154 {
155 struct acpi_bus_event *event = NULL;
156 - u32 flags = 0;
157 + unsigned long flags = 0;
158
159 ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
160
161 @@ -656,7 +656,7 @@ int
162 acpi_bus_receive_event (
163 struct acpi_bus_event *event)
164 {
165 - u32 flags = 0;
166 + unsigned long flags = 0;
167 struct acpi_bus_event *entry = NULL;
168
169 DECLARE_WAITQUEUE(wait, current);
170 diff -rupN linux-2.4.32/drivers/sound/sound_firmware.c linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c
171 --- linux-2.4.32/drivers/sound/sound_firmware.c 2001-02-22 15:23:46.000000000 +0100
172 +++ linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c 2005-11-17 13:32:13.000000000 +0100
173 @@ -4,10 +4,11 @@
174 #include <linux/fs.h>
175 #include <linux/mm.h>
176 #include <linux/slab.h>
177 -#include <linux/unistd.h>
178 +static int my_errno;
179 +#define errno my_errno
180 +#include <asm/unistd.h>
181 #include <asm/uaccess.h>
182
183 -static int errno;
184 static int do_mod_firmware_load(const char *fn, char **fp)
185 {
186 int fd;
187 diff -rupN linux-2.4.32/drivers/usb/host/ehci-q.c linux-2.4.32.gcc4-fixes-v12/drivers/usb/host/ehci-q.c
188 --- linux-2.4.32/drivers/usb/host/ehci-q.c 2005-01-19 18:00:53.000000000 +0100
189 +++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/host/ehci-q.c 2005-11-17 13:32:13.000000000 +0100
190 @@ -199,8 +199,6 @@ ehci_urb_done (struct ehci_hcd *ehci, st
191 #ifdef INTR_AUTOMAGIC
192 struct urb *resubmit = 0;
193 struct usb_device *dev = 0;
194 -
195 - static int ehci_urb_enqueue (struct usb_hcd *, struct urb *, int);
196 #endif
197
198 if (likely (urb->hcpriv != 0)) {
199 diff -rupN linux-2.4.32/drivers/usb/inode.c linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c
200 --- linux-2.4.32/drivers/usb/inode.c 2004-02-18 15:16:23.000000000 +0100
201 +++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c 2005-11-17 13:32:13.000000000 +0100
202 @@ -41,6 +41,9 @@
203 #include <linux/usbdevice_fs.h>
204 #include <asm/uaccess.h>
205
206 +static struct inode_operations usbdevfs_bus_inode_operations;
207 +static struct file_operations usbdevfs_bus_file_operations;
208 +
209 /* --------------------------------------------------------------------- */
210
211 /*
212 diff -rupN linux-2.4.32/fs/hfs/trans.c linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c
213 --- linux-2.4.32/fs/hfs/trans.c 2001-02-22 15:23:47.000000000 +0100
214 +++ linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c 2005-11-17 13:32:13.000000000 +0100
215 @@ -33,6 +33,7 @@
216 #include <linux/hfs_fs_sb.h>
217 #include <linux/hfs_fs_i.h>
218 #include <linux/hfs_fs.h>
219 +#include <linux/compiler.h>
220
221 /*================ File-local variables ================*/
222
223 @@ -78,7 +79,7 @@ static unsigned char mac2latin_map[128]
224 *
225 * Given a hexadecimal digit in ASCII, return the integer representation.
226 */
227 -static inline const unsigned char dehex(char c) {
228 +static inline __attribute_const__ unsigned char dehex(char c) {
229 if ((c>='0')&&(c<='9')) {
230 return c-'0';
231 }
232 diff -rupN linux-2.4.32/include/asm-i386/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h
233 --- linux-2.4.32/include/asm-i386/byteorder.h 2003-06-14 13:30:27.000000000 +0200
234 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h 2005-11-17 13:32:13.000000000 +0100
235 @@ -2,6 +2,7 @@
236 #define _I386_BYTEORDER_H
237
238 #include <asm/types.h>
239 +#include <linux/compiler.h>
240
241 #ifdef __GNUC__
242
243 @@ -10,7 +11,7 @@
244 #include <linux/config.h>
245 #endif
246
247 -static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
248 +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
249 {
250 #ifdef CONFIG_X86_BSWAP
251 __asm__("bswap %0" : "=r" (x) : "0" (x));
252 @@ -26,7 +27,7 @@ static __inline__ __const__ __u32 ___arc
253
254 /* gcc should generate this for open coded C now too. May be worth switching to
255 it because inline assembly cannot be scheduled. -AK */
256 -static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
257 +static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
258 {
259 __asm__("xchgb %b0,%h0" /* swap bytes */
260 : "=q" (x)
261 diff -rupN linux-2.4.32/include/asm-i386/processor.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h
262 --- linux-2.4.32/include/asm-i386/processor.h 2004-02-18 15:16:24.000000000 +0100
263 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h 2005-11-17 13:32:13.000000000 +0100
264 @@ -72,7 +72,6 @@ struct cpuinfo_x86 {
265 */
266
267 extern struct cpuinfo_x86 boot_cpu_data;
268 -extern struct tss_struct init_tss[NR_CPUS];
269
270 #ifdef CONFIG_SMP
271 extern struct cpuinfo_x86 cpu_data[];
272 @@ -357,6 +356,8 @@ struct tss_struct {
273 unsigned long __cacheline_filler[5];
274 };
275
276 +extern struct tss_struct init_tss[NR_CPUS];
277 +
278 struct thread_struct {
279 unsigned long esp0;
280 unsigned long eip;
281 diff -rupN linux-2.4.32/include/asm-i386/string.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h
282 --- linux-2.4.32/include/asm-i386/string.h 2001-08-12 11:35:53.000000000 +0200
283 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h 2005-11-17 13:32:13.000000000 +0100
284 @@ -337,7 +337,7 @@ extern void __struct_cpy_bug (void);
285 #define struct_cpy(x,y) \
286 ({ \
287 if (sizeof(*(x)) != sizeof(*(y))) \
288 - __struct_cpy_bug; \
289 + __struct_cpy_bug(); \
290 memcpy(x, y, sizeof(*(x))); \
291 })
292
293 diff -rupN linux-2.4.32/include/asm-m68k/setup.h linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h
294 --- linux-2.4.32/include/asm-m68k/setup.h 2000-01-29 13:07:40.000000000 +0100
295 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h 2005-11-17 13:32:13.000000000 +0100
296 @@ -361,12 +361,13 @@ extern int m68k_is040or060;
297 #ifndef __ASSEMBLY__
298 extern int m68k_num_memory; /* # of memory blocks found (and used) */
299 extern int m68k_realnum_memory; /* real # of memory blocks found */
300 -extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
301
302 struct mem_info {
303 unsigned long addr; /* physical address of memory chunk */
304 unsigned long size; /* length of memory chunk (in bytes) */
305 };
306 +
307 +extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
308 #endif
309
310 #endif /* __KERNEL__ */
311 diff -rupN linux-2.4.32/include/asm-ppc/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h
312 --- linux-2.4.32/include/asm-ppc/byteorder.h 2003-06-14 13:30:28.000000000 +0200
313 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h 2005-11-17 13:32:13.000000000 +0100
314 @@ -2,6 +2,7 @@
315 #define _PPC_BYTEORDER_H
316
317 #include <asm/types.h>
318 +#include <linux/compiler.h>
319
320 #ifdef __GNUC__
321 #ifdef __KERNEL__
322 @@ -50,7 +51,7 @@ extern __inline__ void st_le64(volatile
323 __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (taddr+4));
324 }
325
326 -static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
327 +static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
328 {
329 __u16 result;
330
331 @@ -58,7 +59,7 @@ static __inline__ __const__ __u16 ___arc
332 return result;
333 }
334
335 -static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
336 +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
337 {
338 __u32 result;
339
340 diff -rupN linux-2.4.32/include/asm-ppc/time.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h
341 --- linux-2.4.32/include/asm-ppc/time.h 2003-08-25 20:07:49.000000000 +0200
342 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h 2005-11-17 13:32:13.000000000 +0100
343 @@ -12,6 +12,7 @@
344 #include <linux/config.h>
345 #include <linux/mc146818rtc.h>
346 #include <linux/threads.h>
347 +#include <linux/compiler.h>
348
349 #include <asm/processor.h>
350
351 @@ -57,7 +58,7 @@ static __inline__ void set_dec(unsigned
352 /* Accessor functions for the timebase (RTC on 601) registers. */
353 /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
354 #ifdef CONFIG_6xx
355 -extern __inline__ int const __USE_RTC(void) {
356 +extern __inline__ int __attribute_const__ __USE_RTC(void) {
357 return (mfspr(SPRN_PVR)>>16) == 1;
358 }
359 #else
360 diff -rupN linux-2.4.32/include/asm-x86_64/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/byteorder.h
361 --- linux-2.4.32/include/asm-x86_64/byteorder.h 2002-11-30 17:12:31.000000000 +0100
362 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/byteorder.h 2005-11-17 13:32:13.000000000 +0100
363 @@ -2,16 +2,17 @@
364 #define _X86_64_BYTEORDER_H
365
366 #include <asm/types.h>
367 +#include <linux/compiler.h>
368
369 #ifdef __GNUC__
370
371 -static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
372 +static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
373 {
374 __asm__("bswapq %0" : "=r" (x) : "0" (x));
375 return x;
376 }
377
378 -static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
379 +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
380 {
381 __asm__("bswapl %0" : "=r" (x) : "0" (x));
382 return x;
383 diff -rupN linux-2.4.32/include/asm-x86_64/processor.h linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/processor.h
384 --- linux-2.4.32/include/asm-x86_64/processor.h 2005-11-17 13:27:30.000000000 +0100
385 +++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/processor.h 2005-11-17 13:32:13.000000000 +0100
386 @@ -68,7 +68,6 @@ struct cpuinfo_x86 {
387 #define X86_VENDOR_UNKNOWN 0xff
388
389 extern struct cpuinfo_x86 boot_cpu_data;
390 -extern struct tss_struct init_tss[NR_CPUS];
391
392 #ifdef CONFIG_SMP
393 extern struct cpuinfo_x86 cpu_data[];
394 @@ -300,6 +299,8 @@ struct tss_struct {
395 u32 io_bitmap[IO_BITMAP_SIZE];
396 } __attribute__((packed)) ____cacheline_aligned;
397
398 +extern struct tss_struct init_tss[NR_CPUS];
399 +
400 struct thread_struct {
401 unsigned long rsp0;
402 unsigned long rip;
403 diff -rupN linux-2.4.32/include/linux/byteorder/swab.h linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h
404 --- linux-2.4.32/include/linux/byteorder/swab.h 2002-11-30 17:12:31.000000000 +0100
405 +++ linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h 2005-11-17 13:32:13.000000000 +0100
406 @@ -15,6 +15,8 @@
407 *
408 */
409
410 +#include <linux/compiler.h>
411 +
412 /* casts are necessary for constants, because we never know how for sure
413 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
414 */
415 @@ -156,7 +158,7 @@
416 #endif /* OPTIMIZE */
417
418
419 -static __inline__ __const__ __u16 __fswab16(__u16 x)
420 +static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
421 {
422 return __arch__swab16(x);
423 }
424 @@ -169,7 +171,7 @@ static __inline__ void __swab16s(__u16 *
425 __arch__swab16s(addr);
426 }
427
428 -static __inline__ __const__ __u32 __fswab24(__u32 x)
429 +static __inline__ __attribute_const__ __u32 __fswab24(__u32 x)
430 {
431 return __arch__swab24(x);
432 }
433 @@ -182,7 +184,7 @@ static __inline__ void __swab24s(__u32 *
434 __arch__swab24s(addr);
435 }
436
437 -static __inline__ __const__ __u32 __fswab32(__u32 x)
438 +static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
439 {
440 return __arch__swab32(x);
441 }
442 @@ -196,7 +198,7 @@ static __inline__ void __swab32s(__u32 *
443 }
444
445 #ifdef __BYTEORDER_HAS_U64__
446 -static __inline__ __const__ __u64 __fswab64(__u64 x)
447 +static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
448 {
449 # ifdef __SWAB_64_THRU_32__
450 __u32 h = x >> 32;
451 diff -rupN linux-2.4.32/include/linux/compiler.h linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h
452 --- linux-2.4.32/include/linux/compiler.h 2004-11-17 18:36:42.000000000 +0100
453 +++ linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h 2005-11-17 13:32:13.000000000 +0100
454 @@ -27,6 +27,12 @@
455 #define __attribute_used__ /* not implemented */
456 #endif /* __GNUC__ */
457
458 +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
459 +#define __attribute_const__ __attribute__((__const__))
460 +#else
461 +#define __attribute_const__ /* unimplemented */
462 +#endif
463 +
464 #if __GNUC__ == 3
465 #if __GNUC_MINOR__ >= 1
466 # define inline __inline__ __attribute__((always_inline))
467 diff -rupN linux-2.4.32/include/linux/fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h
468 --- linux-2.4.32/include/linux/fs.h 2005-04-04 19:56:05.000000000 +0200
469 +++ linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h 2005-11-17 13:32:13.000000000 +0100
470 @@ -1559,7 +1559,6 @@ static inline int is_mounted(kdev_t dev)
471 unsigned long generate_cluster(kdev_t, int b[], int);
472 unsigned long generate_cluster_swab32(kdev_t, int b[], int);
473 extern kdev_t ROOT_DEV;
474 -extern char root_device_name[];
475
476
477 extern void show_buffers(void);
478 diff -rupN linux-2.4.32/include/linux/ufs_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h
479 --- linux-2.4.32/include/linux/ufs_fs.h 2001-11-23 22:40:15.000000000 +0100
480 +++ linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h 2005-11-17 13:32:13.000000000 +0100
481 @@ -555,7 +555,6 @@ extern struct buffer_head * ufs_bread (s
482 extern struct file_operations ufs_dir_operations;
483
484 /* super.c */
485 -extern struct file_system_type ufs_fs_type;
486 extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
487 extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
488 extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
489 diff -rupN linux-2.4.32/include/linux/usbdevice_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h
490 --- linux-2.4.32/include/linux/usbdevice_fs.h 2003-11-29 00:28:14.000000000 +0100
491 +++ linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h 2005-11-17 13:32:13.000000000 +0100
492 @@ -185,8 +185,6 @@ extern struct file_operations usbdevfs_d
493 extern struct file_operations usbdevfs_devices_fops;
494 extern struct file_operations usbdevfs_device_file_operations;
495 extern struct inode_operations usbdevfs_device_inode_operations;
496 -extern struct inode_operations usbdevfs_bus_inode_operations;
497 -extern struct file_operations usbdevfs_bus_file_operations;
498 extern void usbdevfs_conn_disc_event(void);
499
500 #endif /* __KERNEL__ */
501 diff -rupN linux-2.4.32/include/net/icmp.h linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h
502 --- linux-2.4.32/include/net/icmp.h 2001-04-28 12:35:26.000000000 +0200
503 +++ linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h 2005-11-17 13:32:13.000000000 +0100
504 @@ -23,6 +23,7 @@
505
506 #include <net/sock.h>
507 #include <net/protocol.h>
508 +#include <net/snmp.h>
509
510 struct icmp_err {
511 int errno;
512 diff -rupN linux-2.4.32/include/net/ipv6.h linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h
513 --- linux-2.4.32/include/net/ipv6.h 2004-11-17 18:36:43.000000000 +0100
514 +++ linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h 2005-11-17 13:32:13.000000000 +0100
515 @@ -101,6 +101,7 @@ struct frag_hdr {
516 #ifdef __KERNEL__
517
518 #include <net/sock.h>
519 +#include <net/snmp.h>
520
521 /* sysctls */
522 extern int sysctl_ipv6_bindv6only;