Compiling the Linux Kernel with clang/llvm

According to e.g. phoronix, it should be easy to build the mainline kernel with llvm/clang now. How would I go about trying this in nixpkgs / has anybody tried this already?

1 Like

Not sure if that Clang and/or LLVM are available yet somewhere. But if it would be, and it is the default clang version in nixpkgs, you would be able to test using:

let pkgs = import <nixpkgs> {}; in pkgs.linux.override {stdenv = pkgs.clangStdenv; }

Building the kernel does indeed work :slightly_smiling_face:
Building the whole of kernelPackages (with linuxPackagesFor) does not yet. It fails to build cpupower. I opened for fixing this.

I tried to build linux.override { stdenv = clangStdenv; } on your branch, and it failed complaining that asm-goto wasn’t supported :confused:

Ah should’ve mentioned that: you need llvmPackages_latest.stdenv (version 9) at the moment.