We've been compiling kernel modules for an embedded powerpc system for a few years now and generally things are ok with some rare unexplained stability problems. Recently a collegue pointed out that kernel modules should be compiled with the same compiler as the kernel. After doing a bit of digging i find that the kernel (montavista linux 2.4.20) was compiled with gcc3.4.1 and we've been using (denx eldk) gcc4.0.0. I've recently built gcc4.7.1 for our userspace code but loading kernel modules built with this version cause the system to crash. I then build gcc3.4.1 from source and some builds work and some don't - think i may have an issue with the make scripts but thats another story.
So my question: Is my collegue correct? And if so can anyone explain what is different in the resulting .o file that causes the incompatibility?