Difference between revisions of "GCC"

From LinuxMIPS
Jump to: navigation, search
m (External links)
m (Add references section.)
(9 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
The recommended compiler for [[Kernel_Build|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 recommended compiler for [[Kernel_Build|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" [http://gcc.gnu.org/ GCC 2] is version 2.95.3. The [http://gcc.gnu.org/gcc-2.96.html GCC 2.96] is unofficial massively patched version. It provides more efficient optimization with -O2, more strict syntax checkhing and supports more recent C++ standarts. Unfortuntely, C++ ABI is not compatible with "official" 2.95.3 nor 3.0.
+
The latest "official" [http://gcc.gnu.org/ GCC 2] is version 2.95.3. The [http://gcc.gnu.org/gcc-2.96.html 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.
 +
 
 +
[http://www.redhat.com/advice/speaks_gcc.html Red Hat Speaks on gcc 2.96-RH]
  
 
=== Linux 2.6 ===
 
=== Linux 2.6 ===
Any gcc version between 2.95 and 3.4 may be used and is fully supported.  Gcc 4.0 is still considered experimental at this point so not recommended where reliability.
+
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 [http://kerneltrap.org/node/5974 Kerneltrap].
 +
 
 +
Gcc 3.4.6 incorrectly inlines arch_mem_init().
 +
 
 +
[[SDE|SDE 5]] is based on gcc 2.96 and [[SDE|SDE 6]] is based on gcc 3.4.
 +
 
 +
=== GCC 4.7.1 and older code generation bug ===
 +
A bug<ref>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369</ref> 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.  As of 2012-09-05 the status is that apparently the code generation for <tt>__builtin_unreachable()</tt> is broken for MIPS and a fix has been checked in upstream but no releases based on that are out yet.  It ''appears'' that kernels built with <tt>-O</tt> by modifying the kernel's main makefile are ok.
 +
 
 +
=== GCC 4.7.0 and 4.7.1 code generation bug ===
 +
A further code generation bug<ref>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54494</ref> may also affect the kernel.  As of 2012-09-05 there is a proposed fix for this bug but no release version of GCC incorporates it yet.
  
 
== External links ==
 
== External links ==
Line 12: Line 24:
 
* [http://www.gnu.org/software/gcc/gcc-3.4/mips-abi.html MIPS ABI Changes in GCC 3.4]
 
* [http://www.gnu.org/software/gcc/gcc-3.4/mips-abi.html MIPS ABI Changes in GCC 3.4]
 
* [http://www.nabble.com/gcc-f1154.html GCC Forum] - hosted by [http://www.nabble.com Nabble] archiving all gcc mailing lists into a searchable forum.
 
* [http://www.nabble.com/gcc-f1154.html GCC Forum] - hosted by [http://www.nabble.com Nabble] archiving all gcc mailing lists into a searchable forum.
 +
* [http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/ GCC hacks in the Linux kernel]
 +
 +
== References ==
 +
<references/>

Revision as of 20:03, 5 September 2012

Kernel builds with gcc

Linux 2.4

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.

Red Hat Speaks on gcc 2.96-RH

Linux 2.6

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().

SDE 5 is based on gcc 2.96 and SDE 6 is based on gcc 3.4.

GCC 4.7.1 and older code generation bug

A bug[1] 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. As of 2012-09-05 the status is that apparently the code generation for __builtin_unreachable() is broken for MIPS and a fix has been checked in upstream but no releases based on that are out yet. It appears that kernels built with -O by modifying the kernel's main makefile are ok.

GCC 4.7.0 and 4.7.1 code generation bug

A further code generation bug[2] may also affect the kernel. As of 2012-09-05 there is a proposed fix for this bug but no release version of GCC incorporates it yet.

External links

References

  1. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54369
  2. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54494