summaryrefslogtreecommitdiffstats
path: root/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch')
-rw-r--r--target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch522
1 files changed, 522 insertions, 0 deletions
diff --git a/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch b/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch
new file mode 100644
index 000000000..4034d1b48
--- /dev/null
+++ b/target/linux/linux-2.4/patches/generic/006-gcc4_fixes.patch
@@ -0,0 +1,522 @@
+diff -rupN linux-2.4.32/Makefile linux-2.4.32.gcc4-fixes-v12/Makefile
+--- linux-2.4.32/Makefile 2005-11-17 13:27:30.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -93,11 +93,17 @@ CPPFLAGS := -D__KERNEL__ -I$(HPATH)
+
+ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
+ -fno-strict-aliasing -fno-common
++CFLAGS += -fno-builtin-sprintf
+ ifndef CONFIG_FRAME_POINTER
+ CFLAGS += -fomit-frame-pointer
+ endif
+ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
+
++check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
++
++# disable pointer signedness warnings in gcc 4.0
++CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
++
+ #
+ # ROOT_DEV specifies the default root-device when making the image.
+ # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
+diff -rupN linux-2.4.32/arch/i386/Makefile linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile
+--- linux-2.4.32/arch/i386/Makefile 2004-11-17 18:36:41.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -23,8 +23,6 @@ LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinu
+
+ CFLAGS += -pipe
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ # prevent gcc from keeping the stack 16 byte aligned
+ CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
+
+diff -rupN linux-2.4.32/arch/mips/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile
+--- linux-2.4.32/arch/mips/Makefile 2005-01-19 18:00:52.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -30,8 +30,6 @@ endif
+
+ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ #
+ #
+ # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
+diff -rupN linux-2.4.32/arch/mips64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile
+--- linux-2.4.32/arch/mips64/Makefile 2005-01-19 18:00:52.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -26,7 +26,6 @@ ifdef CONFIG_CROSSCOMPILE
+ CROSS_COMPILE = $(tool-prefix)
+ endif
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+ 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)
+
+ #
+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
+--- linux-2.4.32/arch/ppc/kernel/open_pic_defs.h 2003-06-14 13:30:19.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/arch/ppc/kernel/open_pic_defs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -172,9 +172,6 @@ struct OpenPIC {
+ OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
+ };
+
+-extern volatile struct OpenPIC *OpenPIC;
+-
+-
+ /*
+ * Current Task Priority Register
+ */
+diff -rupN linux-2.4.32/arch/x86_64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile
+--- linux-2.4.32/arch/x86_64/Makefile 2004-04-14 20:22:20.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -38,8 +38,6 @@ OBJCOPY=$(CROSS_COMPILE)objcopy -O binar
+ LDFLAGS=-e stext
+ LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ CFLAGS += -mno-red-zone
+ CFLAGS += -mcmodel=kernel
+ CFLAGS += -pipe
+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
+--- linux-2.4.32/arch/x86_64/ia32/ia32entry.S 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/ia32/ia32entry.S 2005-11-17 13:32:13.000000000 +0100
+@@ -113,9 +113,18 @@ quiet_ni_syscall:
+ PTREGSCALL stub32_fork, sys32_fork
+ PTREGSCALL stub32_clone, sys32_clone
+ PTREGSCALL stub32_vfork, sys32_vfork
+- PTREGSCALL stub32_iopl, sys_iopl
+ PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend
+
++ .macro PTREGSCALL3 label, func, arg
++ .globl \label
++\label:
++ leaq \func(%rip),%rax
++ leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
++ jmp ia32_ptregs_common
++ .endm
++
++ PTREGSCALL3 stub32_iopl, sys_iopl, %rsi
++
+ ENTRY(ia32_ptregs_common)
+ popq %r11
+ SAVE_REST
+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
+--- linux-2.4.32/arch/x86_64/kernel/entry.S 2003-11-29 00:28:11.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/entry.S 2005-11-17 13:32:13.000000000 +0100
+@@ -249,7 +249,16 @@ intret_signal_test:
+ PTREGSCALL stub_vfork, sys_vfork
+ PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend
+ PTREGSCALL stub_sigaltstack, sys_sigaltstack
+- PTREGSCALL stub_iopl, sys_iopl
++
++ .macro PTREGSCALL3 label,func,arg
++ .globl \label
++\label:
++ leaq \func(%rip),%rax
++ leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
++ jmp ptregscall_common
++ .endm
++
++ PTREGSCALL3 stub_iopl, sys_iopl, %rsi
+
+ ENTRY(ptregscall_common)
+ popq %r11
+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
+--- linux-2.4.32/arch/x86_64/kernel/ioport.c 2003-11-29 00:28:11.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/ioport.c 2005-11-17 13:32:13.000000000 +0100
+@@ -81,9 +81,9 @@ asmlinkage long sys_ioperm(unsigned long
+ * code.
+ */
+
+-asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs)
++asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
+ {
+- unsigned int old = (regs.eflags >> 12) & 3;
++ unsigned int old = (regs->eflags >> 12) & 3;
+
+ if (level > 3)
+ return -EINVAL;
+@@ -92,6 +92,6 @@ asmlinkage long sys_iopl(unsigned int le
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ }
+- regs.eflags = (regs.eflags & 0xffffffffffffcfff) | (level << 12);
++ regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12);
+ return 0;
+ }
+diff -rupN linux-2.4.32/drivers/acpi/bus.c linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c
+--- linux-2.4.32/drivers/acpi/bus.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c 2005-11-17 13:32:13.000000000 +0100
+@@ -623,7 +623,7 @@ acpi_bus_generate_event (
+ int data)
+ {
+ struct acpi_bus_event *event = NULL;
+- u32 flags = 0;
++ unsigned long flags = 0;
+
+ ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
+
+@@ -656,7 +656,7 @@ int
+ acpi_bus_receive_event (
+ struct acpi_bus_event *event)
+ {
+- u32 flags = 0;
++ unsigned long flags = 0;
+ struct acpi_bus_event *entry = NULL;
+
+ DECLARE_WAITQUEUE(wait, current);
+diff -rupN linux-2.4.32/drivers/sound/sound_firmware.c linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c
+--- linux-2.4.32/drivers/sound/sound_firmware.c 2001-02-22 15:23:46.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c 2005-11-17 13:32:13.000000000 +0100
+@@ -4,10 +4,11 @@
+ #include <linux/fs.h>
+ #include <linux/mm.h>
+ #include <linux/slab.h>
+-#include <linux/unistd.h>
++static int my_errno;
++#define errno my_errno
++#include <asm/unistd.h>
+ #include <asm/uaccess.h>
+
+-static int errno;
+ static int do_mod_firmware_load(const char *fn, char **fp)
+ {
+ int fd;
+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
+--- linux-2.4.32/drivers/usb/host/ehci-q.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/host/ehci-q.c 2005-11-17 13:32:13.000000000 +0100
+@@ -199,8 +199,6 @@ ehci_urb_done (struct ehci_hcd *ehci, st
+ #ifdef INTR_AUTOMAGIC
+ struct urb *resubmit = 0;
+ struct usb_device *dev = 0;
+-
+- static int ehci_urb_enqueue (struct usb_hcd *, struct urb *, int);
+ #endif
+
+ if (likely (urb->hcpriv != 0)) {
+diff -rupN linux-2.4.32/drivers/usb/inode.c linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c
+--- linux-2.4.32/drivers/usb/inode.c 2004-02-18 15:16:23.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c 2005-11-17 13:32:13.000000000 +0100
+@@ -41,6 +41,9 @@
+ #include <linux/usbdevice_fs.h>
+ #include <asm/uaccess.h>
+
++static struct inode_operations usbdevfs_bus_inode_operations;
++static struct file_operations usbdevfs_bus_file_operations;
++
+ /* --------------------------------------------------------------------- */
+
+ /*
+diff -rupN linux-2.4.32/fs/hfs/trans.c linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c
+--- linux-2.4.32/fs/hfs/trans.c 2001-02-22 15:23:47.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c 2005-11-17 13:32:13.000000000 +0100
+@@ -33,6 +33,7 @@
+ #include <linux/hfs_fs_sb.h>
+ #include <linux/hfs_fs_i.h>
+ #include <linux/hfs_fs.h>
++#include <linux/compiler.h>
+
+ /*================ File-local variables ================*/
+
+@@ -78,7 +79,7 @@ static unsigned char mac2latin_map[128]
+ *
+ * Given a hexadecimal digit in ASCII, return the integer representation.
+ */
+-static inline const unsigned char dehex(char c) {
++static inline __attribute_const__ unsigned char dehex(char c) {
+ if ((c>='0')&&(c<='9')) {
+ return c-'0';
+ }
+diff -rupN linux-2.4.32/include/asm-i386/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h
+--- linux-2.4.32/include/asm-i386/byteorder.h 2003-06-14 13:30:27.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,6 +2,7 @@
+ #define _I386_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+
+@@ -10,7 +11,7 @@
+ #include <linux/config.h>
+ #endif
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+ {
+ #ifdef CONFIG_X86_BSWAP
+ __asm__("bswap %0" : "=r" (x) : "0" (x));
+@@ -26,7 +27,7 @@ static __inline__ __const__ __u32 ___arc
+
+ /* gcc should generate this for open coded C now too. May be worth switching to
+ it because inline assembly cannot be scheduled. -AK */
+-static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
++static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
+ {
+ __asm__("xchgb %b0,%h0" /* swap bytes */
+ : "=q" (x)
+diff -rupN linux-2.4.32/include/asm-i386/processor.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h
+--- linux-2.4.32/include/asm-i386/processor.h 2004-02-18 15:16:24.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h 2005-11-17 13:32:13.000000000 +0100
+@@ -72,7 +72,6 @@ struct cpuinfo_x86 {
+ */
+
+ extern struct cpuinfo_x86 boot_cpu_data;
+-extern struct tss_struct init_tss[NR_CPUS];
+
+ #ifdef CONFIG_SMP
+ extern struct cpuinfo_x86 cpu_data[];
+@@ -357,6 +356,8 @@ struct tss_struct {
+ unsigned long __cacheline_filler[5];
+ };
+
++extern struct tss_struct init_tss[NR_CPUS];
++
+ struct thread_struct {
+ unsigned long esp0;
+ unsigned long eip;
+diff -rupN linux-2.4.32/include/asm-i386/string.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h
+--- linux-2.4.32/include/asm-i386/string.h 2001-08-12 11:35:53.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h 2005-11-17 13:32:13.000000000 +0100
+@@ -337,7 +337,7 @@ extern void __struct_cpy_bug (void);
+ #define struct_cpy(x,y) \
+ ({ \
+ if (sizeof(*(x)) != sizeof(*(y))) \
+- __struct_cpy_bug; \
++ __struct_cpy_bug(); \
+ memcpy(x, y, sizeof(*(x))); \
+ })
+
+diff -rupN linux-2.4.32/include/asm-m68k/setup.h linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h
+--- linux-2.4.32/include/asm-m68k/setup.h 2000-01-29 13:07:40.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h 2005-11-17 13:32:13.000000000 +0100
+@@ -361,12 +361,13 @@ extern int m68k_is040or060;
+ #ifndef __ASSEMBLY__
+ extern int m68k_num_memory; /* # of memory blocks found (and used) */
+ extern int m68k_realnum_memory; /* real # of memory blocks found */
+-extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
+
+ struct mem_info {
+ unsigned long addr; /* physical address of memory chunk */
+ unsigned long size; /* length of memory chunk (in bytes) */
+ };
++
++extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
+ #endif
+
+ #endif /* __KERNEL__ */
+diff -rupN linux-2.4.32/include/asm-ppc/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h
+--- linux-2.4.32/include/asm-ppc/byteorder.h 2003-06-14 13:30:28.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,6 +2,7 @@
+ #define _PPC_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+ #ifdef __KERNEL__
+@@ -50,7 +51,7 @@ extern __inline__ void st_le64(volatile
+ __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (taddr+4));
+ }
+
+-static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
++static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
+ {
+ __u16 result;
+
+@@ -58,7 +59,7 @@ static __inline__ __const__ __u16 ___arc
+ return result;
+ }
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
+ {
+ __u32 result;
+
+diff -rupN linux-2.4.32/include/asm-ppc/time.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h
+--- linux-2.4.32/include/asm-ppc/time.h 2003-08-25 20:07:49.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h 2005-11-17 13:32:13.000000000 +0100
+@@ -12,6 +12,7 @@
+ #include <linux/config.h>
+ #include <linux/mc146818rtc.h>
+ #include <linux/threads.h>
++#include <linux/compiler.h>
+
+ #include <asm/processor.h>
+
+@@ -57,7 +58,7 @@ static __inline__ void set_dec(unsigned
+ /* Accessor functions for the timebase (RTC on 601) registers. */
+ /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
+ #ifdef CONFIG_6xx
+-extern __inline__ int const __USE_RTC(void) {
++extern __inline__ int __attribute_const__ __USE_RTC(void) {
+ return (mfspr(SPRN_PVR)>>16) == 1;
+ }
+ #else
+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
+--- linux-2.4.32/include/asm-x86_64/byteorder.h 2002-11-30 17:12:31.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,16 +2,17 @@
+ #define _X86_64_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+
+-static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
++static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
+ {
+ __asm__("bswapq %0" : "=r" (x) : "0" (x));
+ return x;
+ }
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+ {
+ __asm__("bswapl %0" : "=r" (x) : "0" (x));
+ return x;
+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
+--- linux-2.4.32/include/asm-x86_64/processor.h 2005-11-17 13:27:30.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/processor.h 2005-11-17 13:32:13.000000000 +0100
+@@ -68,7 +68,6 @@ struct cpuinfo_x86 {
+ #define X86_VENDOR_UNKNOWN 0xff
+
+ extern struct cpuinfo_x86 boot_cpu_data;
+-extern struct tss_struct init_tss[NR_CPUS];
+
+ #ifdef CONFIG_SMP
+ extern struct cpuinfo_x86 cpu_data[];
+@@ -300,6 +299,8 @@ struct tss_struct {
+ u32 io_bitmap[IO_BITMAP_SIZE];
+ } __attribute__((packed)) ____cacheline_aligned;
+
++extern struct tss_struct init_tss[NR_CPUS];
++
+ struct thread_struct {
+ unsigned long rsp0;
+ unsigned long rip;
+diff -rupN linux-2.4.32/include/linux/byteorder/swab.h linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h
+--- linux-2.4.32/include/linux/byteorder/swab.h 2002-11-30 17:12:31.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h 2005-11-17 13:32:13.000000000 +0100
+@@ -15,6 +15,8 @@
+ *
+ */
+
++#include <linux/compiler.h>
++
+ /* casts are necessary for constants, because we never know how for sure
+ * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
+ */
+@@ -156,7 +158,7 @@
+ #endif /* OPTIMIZE */
+
+
+-static __inline__ __const__ __u16 __fswab16(__u16 x)
++static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
+ {
+ return __arch__swab16(x);
+ }
+@@ -169,7 +171,7 @@ static __inline__ void __swab16s(__u16 *
+ __arch__swab16s(addr);
+ }
+
+-static __inline__ __const__ __u32 __fswab24(__u32 x)
++static __inline__ __attribute_const__ __u32 __fswab24(__u32 x)
+ {
+ return __arch__swab24(x);
+ }
+@@ -182,7 +184,7 @@ static __inline__ void __swab24s(__u32 *
+ __arch__swab24s(addr);
+ }
+
+-static __inline__ __const__ __u32 __fswab32(__u32 x)
++static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
+ {
+ return __arch__swab32(x);
+ }
+@@ -196,7 +198,7 @@ static __inline__ void __swab32s(__u32 *
+ }
+
+ #ifdef __BYTEORDER_HAS_U64__
+-static __inline__ __const__ __u64 __fswab64(__u64 x)
++static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
+ {
+ # ifdef __SWAB_64_THRU_32__
+ __u32 h = x >> 32;
+diff -rupN linux-2.4.32/include/linux/compiler.h linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h
+--- linux-2.4.32/include/linux/compiler.h 2004-11-17 18:36:42.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h 2005-11-17 13:32:13.000000000 +0100
+@@ -27,6 +27,12 @@
+ #define __attribute_used__ /* not implemented */
+ #endif /* __GNUC__ */
+
++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
++#define __attribute_const__ __attribute__((__const__))
++#else
++#define __attribute_const__ /* unimplemented */
++#endif
++
+ #if __GNUC__ == 3
+ #if __GNUC_MINOR__ >= 1
+ # define inline __inline__ __attribute__((always_inline))
+diff -rupN linux-2.4.32/include/linux/fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h
+--- linux-2.4.32/include/linux/fs.h 2005-04-04 19:56:05.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -1559,7 +1559,6 @@ static inline int is_mounted(kdev_t dev)
+ unsigned long generate_cluster(kdev_t, int b[], int);
+ unsigned long generate_cluster_swab32(kdev_t, int b[], int);
+ extern kdev_t ROOT_DEV;
+-extern char root_device_name[];
+
+
+ extern void show_buffers(void);
+diff -rupN linux-2.4.32/include/linux/ufs_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h
+--- linux-2.4.32/include/linux/ufs_fs.h 2001-11-23 22:40:15.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -555,7 +555,6 @@ extern struct buffer_head * ufs_bread (s
+ extern struct file_operations ufs_dir_operations;
+
+ /* super.c */
+-extern struct file_system_type ufs_fs_type;
+ extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+ extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+ extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+diff -rupN linux-2.4.32/include/linux/usbdevice_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h
+--- linux-2.4.32/include/linux/usbdevice_fs.h 2003-11-29 00:28:14.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -185,8 +185,6 @@ extern struct file_operations usbdevfs_d
+ extern struct file_operations usbdevfs_devices_fops;
+ extern struct file_operations usbdevfs_device_file_operations;
+ extern struct inode_operations usbdevfs_device_inode_operations;
+-extern struct inode_operations usbdevfs_bus_inode_operations;
+-extern struct file_operations usbdevfs_bus_file_operations;
+ extern void usbdevfs_conn_disc_event(void);
+
+ #endif /* __KERNEL__ */
+diff -rupN linux-2.4.32/include/net/icmp.h linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h
+--- linux-2.4.32/include/net/icmp.h 2001-04-28 12:35:26.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h 2005-11-17 13:32:13.000000000 +0100
+@@ -23,6 +23,7 @@
+
+ #include <net/sock.h>
+ #include <net/protocol.h>
++#include <net/snmp.h>
+
+ struct icmp_err {
+ int errno;
+diff -rupN linux-2.4.32/include/net/ipv6.h linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h
+--- linux-2.4.32/include/net/ipv6.h 2004-11-17 18:36:43.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h 2005-11-17 13:32:13.000000000 +0100
+@@ -101,6 +101,7 @@ struct frag_hdr {
+ #ifdef __KERNEL__
+
+ #include <net/sock.h>
++#include <net/snmp.h>
+
+ /* sysctls */
+ extern int sysctl_ipv6_bindv6only;