Hacker News new | ask | show | jobs
by ComputerGuru 2303 days ago
It's unlikely as up until now it was the only compiler capable of building the Linux kernel (due to its reliance on some GCC extensions to the language).

It is primarily non-GPL platforms/systems/companies that are switching to clang for it's much friendlier license.

Edit: "~now" rather than "now"

3 comments

Building the kernel with clang has been possible or a while. https://releases.llvm.org/9.0.0/tools/clang/docs/ReleaseNote...:

"With support for asm goto, the mainline Linux kernel for x86_64 is now buildable (and bootable) with Clang 9. Other architectures that don’t require CONFIG_JUMP_LABEL=y such as arm, aarch64, ppc32, ppc64le, (and possibly mips) have been supported with older releases of Clang (Clang 4 was first used with aarch64).

The Android and ChromeOS Linux distributions have moved to building their Linux kernels with Clang, and Google is currently testing Clang built kernels for their production Linux kernels."

That was in September 2019

Yes, I consider within the past year to qualify as "now," but I've updated my post :)
Within the past year is more nuanced. Clang was building working kernels since clang-4. X86 developers decided to require asm goto around Linux 4.20, which regressed clang builds for one architecture, until clang-9 implemented it. You could still build LTS kernels without asm goto.
That's part of why I ask. As of late last year, clang can compile x86_64 Linux 5.x kernels.
Clang can't compile glibc which actually a bigger problem.
In my opinion it's also time to move on from glibc.