Linux Kernel Working Towards GNU11/C11 Compatibility

Written by Michael Larabel in Linux Kernel on 20 October 2014 at 09:50 AM EDT. 3 Comments
LINUX KERNEL
For now it looks like the Linux kernel is going to explicitly declare itself as using the GNU89 dialect of the C89 standard but over time the code is being made to compile under C11.

With GCC 5 switching to use GNU11 by default over the GNU89 C standard (and Clang also moving to GNU11 by default), a patch was proposed on the Linux kernel mailing list this weekend for explicitly using GNU89 as up to now the -std=gnu89 compiler switch wasn't set by default so if using GCC 5 it will try to compile the kernel against GNU11.

Sasha Levin who proposed the initial patch explained that when trying to compile the Linux kernel right now in C11 mode it makes "[the] kernel build unhappy." Linus Torvalds immediately followed-up asking why not make the Linux kernel C11 happy or what sort of changes are needed to make the kernel compatible with the latest C standard.

One of the incompatibilities right now in GNU11 deals with it lacking cast with initializer support, but that was fixed in GCC upstream as of yesterday. There's also still some outstanding issues with semantic differences for extern inlines between GNU89 and GNU99/GNU11. Sasha Levin also expressed concerns just not about the kernel building without errors under C11 but the generated code being correct. "The build breakage is easy to fix. I'm worried about the stuff that won't show upon build. Different behaviours that go unnoticed and maybe issues inside gcc's code generation that weren't uncovered until now."

There's patches being worked on to let the Linux kernel compile under C11/GNU11, but based on the feel of the mailing list thread right now, it looks like that GNU89 could still be forced for the Linux kernel in the near term to ensure that no other compatibility issues are uncovered for its massive code-base using the newest C standard.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week