Linux Kernel contains only C code?

Greg KH greg at kroah.com
Mon Jan 29 12:33:45 EST 2018


On Mon, Jan 29, 2018 at 12:16:19PM -0500, Jeffrey Walton wrote:
> On Mon, Jan 29, 2018 at 10:41 AM, Augusto Mecking Caringi
> <augustocaringi at gmail.com> wrote:
> > On Fri, Jan 26, 2018 at 2:12 PM,  <valdis.kletnieks at vt.edu> wrote:
> >> On Fri, 26 Jan 2018 05:53:20 -0500, Ruben Safir said:
> >>> Its not even really C, at least not as a normal application developer
> >>> thinks of it.  This is systems programming with a lot of kernel specific
> >>> libraries.
> >>
> >> It's C.  The fact that things like stdio aren't available inside the kernel
> >> doesn't mean it's not C.
> >
> > I would say that is C with GNU extensions [1]... Not plain/pure (ANSI/ISO) C.
> >
> > That's why it's not so easy to build the Linux Kernel with any other C compiler.
> >
> > There is a ongoing effort to build it with Clang [2].
> >
> > I'm not sure how is the current status regarding the Intel C Compiler.
> 
> Yeah, the kernel has too much undefined behavior and implementation
> defined behavior to build with other compilers at the moment.

What other compilers do you suggest we use?

Clang works great with the kernel, a few million phones are shipping
with kernels built with it.  icc has worked with the kernel for over a
decade now, for anyone still stuck using that beast.

What else is there?

> It would be nice if they moved away from UB and implementation defined
> behvior, but sometimes the political problems are heavier than the
> technical solutions.

What do you mean by this?  What "UB" does the kernel rely on that
prevents compilers from properly building it?  We do have some pretty
strict requirements in the kernel for a compiler, but anything "odd" is
usually just a bug and we are always willing to take patches to fix
them.

thanks,

greg k-h



More information about the Kernelnewbies mailing list