From its inception in 1991, the #Linux kernel has been developed in tandem with the #GNU toolchain, specifically the GNU Compiler Collection (GCC) and GNU Binutils. Linus Torvalds wrote early kernel code relying on features unavailable in the ISO C standard or in other compilers. Over time, GCC wasn’t just the compiler used for Linux; it effectively defined the C dialect of the Linux kernel.
1/4
The kernel’s Makefiles, header macros, and inline assembly conventions all assumed GCC semantics, and the kernel’s source is filled with GCC extensions such as:
__attribute__((...)) – custom attributes for alignment, sections, packing, etc.
Statement expressions (({ ... })) – used for inline, expression-like macros.
typeof – used to infer types in macros safely.
Inline assembly (asm volatile) – critical for low-level hardware control.
1/4
These are not part of the C standard, rather, they’re part of GNU C. In other words, the Linux kernel source cannot be compiled by a compiler that implements the ISO C standard only (e.g., #C99 or #C11) without the GNU extensions. The #Linux kernel doesn’t compile with “standard C”—it compiles with GNU C.
3/4
Even when Clang/LLVM was introduced as an alternative compiler in the 2010s, the #LLVM project had to re-implement GCC behaviour. In practice, Clang’s “GNU compatibility mode” exists largely because of Linux.
Via @unix_byte
4/4