Building Gentoo Linux With LLVM/Clang
Phoronix: Building Gentoo Linux With LLVM/Clang
Following this weekend's news about Link-Time Optimization support for the Linux kernel, in the discussion that spawned, building the Linux kernel with the LLVM/Clang compiler was once again brought up...
Gerntoo user here. Does it provide any advantage to use LLVM/Clang yet?
Linux on x86-64 now apparently compiles with LLVM according to that website.
I look forward to seeing benchmarks of the Linux kernel compiled with GCC and LLVM.
Even if I am convinced that GCC will perform much faster.
It is still nice, because it allegedly improves code quality.
Are much patches needed to compile the Linux kernel under LLVM/Clang?
Why even ask this, when you have already visited the website, which provides details, including where to grab the tools/patches required? if you are really that curious, wouldn't it makes sense to have a look? ; git clone http://git.linuxfoundation.org/llvm-setup.git
Originally Posted by uid313
this git branch takes 2 seconds to download, and shows you what patches are required (not only for the kernel, but also Clang and LLVM). it also provides a README that explains how to use llvm-setup for building an Clang/LLVM-compiled kernel....as for patches required;
51 patches for x86_64 (itself)
7 patches for LLVM
2 patches for Clang
plus other scripts / tools such as wrappers to allow clang/LLVM to substitute for GCC (not unlike the initial patches from LinuxDNA for Intel's C compiler, ICC - from a few years ago).... Now, i would imagine the second you tried to compile a more custom kernel, ie: patched for other things ...or started enabling features that have been disabled in their 'test' configs ~ you would probably run into a lot of other problems.
I wasn't only talking about the out-of-tree code, but also in-tree-code (with my comment on the 'default' kernel config, anyway.) But i agree once people start making use of this (clang/llvm kernel) stuff, testing will find it's way into the out-of-tree stuff. After all, the work has to begin somewhere
Originally Posted by ryao
Aside from the link russofris listed, there seem to be lots of people using clang/llvm not necessarily as their 'target' compiler, but in helping to debug code via tools that use the llvm infrastructure (Coverity, Clang's analyzer, etc), as they do seem to pick up on bugs gcc may miss ~ which is a good thing. LLVM also seems to have it's niches, where it is better than gcc for certain things, or provides something that gcc does not... The fact is whether you, myself or anyone may or may not like LLVM ~ llvm has gained a lot of traction and does seem to be useful and is being used in the real world, not as a 'toy'.... I also think that if you look at who is using LLVM and what they are using it for, it's really hard to come to the conclusion that you have above, imo.
Originally Posted by energyman
this just seems like you're trying to have a pissing contest, to me. It's obvious to anyone that gcc is more popular than llvm and also has been around much, much longer ~ so don't you think that comment is a bit silly? Also, ICC comes with crappy licensing and while some companies may use it, I don't think it is comparable to GCC (in usage) nor hugely more popular (if even) than LLVM is these days.
Originally Posted by energyman
Yes and no. The resulting binaries are comparably fast; sometimes faster and sometimes slower than gcc. As an end user you're unlikely to notice the difference except in some rare edge cases.
Originally Posted by dimko
What is different is that clang compiles faster than gcc - if you build from source with portage it should save you a fair bit of time. It also produces much better error messages and warnings, which is rather nice if you're a developer. Finally, it's always smart to make sure you've got alternatives - if any political/personal/legal/technical issues show up for either compiler, there's a fallback (and the work done to make the code compile on both is probably beneficial if a third compiler shows up.)
I hope a third (and forth) compiler shows up.
* Intel C Compiler
With all the problems Linux has both on desktop and server side, someone should now please explain to me why is migrating to clang such an important and high priority task.
This is all a political bullshit story, someone doesn't like the GNU GPL license anymore.