Kernel builds with gcc
The recommended compiler for building Linux 2.4 is gcc 2.95. New compilers upto gcc 3.3 have been used successfully to build the kernel however with gcc 3.4 there may be problems when certain configurations. With Linux 2.4 being in deep freeze mode we generally don't intend to fix such problems but rather recommend to use an older compiler for the kernel.
The latest "official" GCC 2 is version 2.95.3. The GCC 2.96 is unofficial massively patched version. It provides more efficient optimization with -O2, more strict syntax checkhing and supports more recent C++ standards. Unfortuntely the C++ ABI is not compatible with "official" 2.95.3 nor 3.0.
Kernels upto 2.6.15 require a gcc 2.95..4.0. Gcc 4.1 is still considered experimental at this point so not recommended where reliability matters. Kernels newer than 2.6.15 require at least gcc 3.2. See a related article on Kerneltrap.
Gcc 3.4.6 incorrectly inlines arch_mem_init().
GCC 4.7.1 and older code generation bug
A bug in these two compiler versions results in bad code for the kernel in such ways that could be taken for a hardware bug, for example error messages about lost interrupts or similar. It appears that kernels built with -O by modifying the kernel's main makefile are ok. A fix is included in 4.7.2.
GCC 4.7.0 and 4.7.1 code generation bug
A further code generation bug may also affect the kernel. A fix is included in 4.7.2.
- http://gcc.gnu.org/wiki The GCC wiki
- MIPS ABI Changes in GCC 3.4
- GCC Forum - hosted by Nabble archiving all gcc mailing lists into a searchable forum.
- GCC hacks in the Linux kernel