Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to compile Linux kernel with something other than gcc

Tags:

I wonder if someone managed to compile the Linux kernel with some other compiler than gcc. Or if someone have ever tried? Question may seem to be silly or academic, but it arose when I thought about answers to: Are C++ int operations atomic on the mips architecture

It seems that the atomicity of some operations depends not only on the cpu architecture, but also on used compiler. So, I wonder if in Linux world some compiler other than gcc even exists.

like image 246
oo_olo_oo Avatar asked Mar 27 '09 11:03

oo_olo_oo


People also ask

Can you compile Linux kernel on windows?

WSL 2 not only loads a native Linux Kernel, the image of the Linux Kernel is in the directory C:\WINDOWS\System32\lxss\tools\kernel, but it also gives us the option of loading a customized Linux kernel. That's right, we can compile and customize our own kernel to be loaded into WSL 2.

Is GCC compiler only for C?

GCC, formerly for "GNU C Compiler", has grown over times to support many languages such as C ( gcc ), C++ ( g++ ), Objective-C, Objective-C++, Java ( gcj ), Fortran ( gfortran ), Ada ( gnat ), Go ( gccgo ), OpenMP, Cilk Plus, and OpenAcc. It is now referred to as "GNU Compiler Collection".

Which compiler is used for Linux?

GCC is an Acronym for “GNU Compiler Collection”. It is a collection of compilers for C, C++, Fortran and other tools. GCC compiler is also used for building the Linux kernel and the same one is ships as standard on most GNU/Linux based systems.


2 Answers

Linux explicitly depends on some gcc extensions, so any other compiler must be compatible with the needed extensions, in that case.

This is not a "no", since it's of course not impossible for a separate compiler vendor/developer to track gcc's extensions, just a data point that might help you search.

like image 140
unwind Avatar answered Sep 21 '22 17:09

unwind


At some point tcc would process and run the linux kernel source. SO that would be a yes, I guess.

::Hat tip to ephemient in the comments.::

like image 30
dmckee --- ex-moderator kitten Avatar answered Sep 21 '22 17:09

dmckee --- ex-moderator kitten