It is also possible that the code is not compatible with gcc 4.1. I remember all kind of strange things happening when I was trying to build the kernel with an unsupported version of gcc.
In my experience, a few things can happen when you get a compilation error with code that compiles fine in a different environment:
- compiler bug;
- the compiler doesn't like the code;
- the wrong header gets included because of the order of the -I options;
- a real bug in the compiled code masked by features of the compiler used for the original build;
I don't think it is a bug as the code compiles fine with both gcc 3.3.3 and gcc 4.0.
I am quite sure that I have seen the recommendation not to use gcc 4.1 to build the Linux kernel. They considered that version experimental and buggy. Moreover, the fact that a version of gcc works fine on a platform, it doesn't necessarily mean that it will work on another platforms. I have seen comments on
http://www.linux-mips.org about bugs in gcc for mips. They have recommendations about the toolchain to use. I chose ELDK because I am sure that lots of people use it to compile both U-Boot and the Linux kernel. I also like the fact that it comes with a native environment which I can use as nfs root.
What I can suggest at this time is that you download ELDK 4.0 and try it. Depending on the speed of your Internet connection, it shouldn't take more than 30 min to download and install ELDK. You can always delete the installation if you don't like it.