LLVM/CL ANG Credit: https://clang.llvm.org
Clang-ing the kernel
Jonni Bidwell shows you how to configure a mainline kernel, then compile it, artisan-style, with LLVM/Clang.
OUR EXPERT Jonni Bidwell once was technical editor for a popular Linux tabloid. Nowadays, he dutifully passes what earnings he makes to the all-demanding Canal & River Trust.
L inux is full of virtual dials, switches and frobs that can tweak, monitor or break pretty much every aspect of the system. You can meddle with GPU settings in /sys/class/drm, run programs at higher priority with the nice command or find out (and change) anything and everything about a running system by rummaging around in the /proc directory. Just because you can do something doesn’t necessarily mean you should, though. As a beginner, in this case, you almost certainly shouldn’t. Distros go to considerable effort to ship with defaults that will work well for most people. And for the most part, work well they do.
What we’re going to do today, then, might be seen as irresponsible. Because we’re going to build a kernel from scratch and replace the one our distro (in this case, Ubuntu) shipped with. The kernel is the beating heart of any Linux install, where the most privileged operations run and where direct communication with hardware takes place. We couldn’t get any more lowlevel if we tried, so be in no doubt that this is not for everyone. You won’t see magical performance gains or double your free memory. But you will gain insight into the vast spectrum of kernel subsystems. And you will get to build it with LLVM and Clang instead of the GNU compiler (GCC). Something that has only been easy to do for a couple of years.