views:

139

answers:

2

Hello.

Linux kernel is written for compiling with gcc and uses a lot of small and ugly gcc-hacks. Which compilers can compile linux kernel except gcc?

The one, which can, is the Intel Compiler. What minimal version of it is needed for kernel compiling?

There also was a Tiny C compiler, but it was able to compile only reduced and specially edited version of the kernel.

Is there other compilers capable of building kernel?

+1  A: 

In short, you cannot, because the kernel code was written to take advantage of the gcc's compiler semantics...and between the kernel and the compiled code, the relationship is a very strong one, i.e. must be compiled with gcc...Since gcc uses 'ELF' (Embedded Linking Format) object files, the kernel must be built using the object code format. Unless you can hack it up to work with another compiler - it may well compile but may not work, as the compilers under Windows produces PE code, there could be unexpected results, meaning the kernel may not boot at all!

Hope this helps, Best regards, Tom.

tommieb75
the are a lot of os and compilers besides windows pe.There are elf compilers in many unixes, there are also a lot of commercial compilers for linux (especailly for embedded platforms).Many compilers work with ELF, and SOME of them support a part of gcc extensions.
osgx
I named 2 compilers, which really was able to compile the kernel at some point in past - Intel CC and Tiny CC. I want to hear here the current state of linux kernel compiling support.E.g. Can "Sun Pro compiler" build the kernel?
osgx
There are many compilers that can produce ELF object code; this is just incorrect. This is not why GCC is required.
Eric Seppanen
@Eric: fair enough - your comment is duly noted, the crucial point is that linux was built using gnu toolchain from day 1 ever since...
tommieb75
tommy, almost entire linux 2.6 branch can be build now with Intel CC. For current kernels the patch for such building is smaller than 100 lines.Also, LLVM tries to build kernel, and patch for it is rather small.Gcc is not the best compiler, even it is not a good compiler (sometimes).
osgx
+2  A: 

An outdatet information: you need to patch the kernel in order to compile using the Intel CC Download Linux kernel patch for Intel® Compiler

See also http://stackoverflow.com/questions/689327/is-it-possible-to-compile-linux-kernel-with-something-other-than-gcc for further links and information

On of the most recent sources :http://forums.fedoraforum.org/showthread.php?p=1328718

stacker
The 689327 question is a bit outdated too (almost a year). Is there some new information or even a list of non-gcc comiplers for kernel?
osgx
And I want to know any compiler other than gcc, icc, tinycc, which are capable of kernel building.
osgx