Page 1 of 2 12 LastLast
Results 1 to 10 of 30

Thread: Building Gentoo Linux With LLVM/Clang

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    14,812

    Default 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...

    http://www.phoronix.com/vr.php?view=MTE2NDE

  2. #2
    Join Date
    Dec 2009
    Posts
    275

    Default any advantage?

    Gerntoo user here. Does it provide any advantage to use LLVM/Clang yet?
    Anybody?

  3. #3
    Join Date
    Dec 2011
    Posts
    2,048

    Default Benchmarks

    Cool!
    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?

  4. #4
    Join Date
    Jun 2011
    Posts
    840

    Default

    Quote Originally Posted by uid313 View Post
    Cool!
    Linux on x86-64 now apparently compiles with LLVM according to that website.

    <...snip...>

    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

    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.

  5. #5

    Default

    Quote Originally Posted by ninez View Post
    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

    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 imagine that much of the popular out-of-tree code will receive testing by their respective Gentoo maintainers once people have Clang compiling kernels in Gentoo. The only exception to this would be the GRSecurity/PaX patches. They rely on GCC-specific functionality that does not currently exist in Clang.

    Anyway, it is unlikely that any of this will happen quickly. Developer time is limited. Patches are always welcome.
    Last edited by ryao; 08-21-2012 at 01:26 AM.

  6. #6
    Join Date
    Jun 2011
    Posts
    840

    Default

    Quote Originally Posted by ryao View Post
    I imagine that much of the popular out-of-tree code will receive testing by their respective Gentoo maintainers once people have Clang compiling kernels in Gentoo. The only exception to this would be the GRSecurity/PaX patches. They rely on GCC-specific functionality that does not currently exist in Clang.
    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

    Quote Originally Posted by energyman View Post
    I have this feeling that apart from Apple, FreeBSD and Phoronix nobody really cares about llvm. People toying around with it? Great, they toyed around with lots of c-compilers in the past. Most of them forgotten by now.
    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.

    Quote Originally Posted by energyman View Post
    and now try to assemble a list for gcc or icc and see that llvm isn't really such big news.
    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.

  7. #7
    Join Date
    Oct 2010
    Posts
    90

    Default

    Quote Originally Posted by dimko View Post
    Gerntoo user here. Does it provide any advantage to use LLVM/Clang yet?
    Anybody?
    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.

    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.)

  8. #8
    Join Date
    Dec 2011
    Posts
    2,048

    Default Third compiler

    I hope a third (and forth) compiler shows up.

    * Intel C Compiler
    * Open64
    * TCC
    * PCC

  9. #9
    Join Date
    Mar 2008
    Posts
    574

    Default

    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.

  10. #10
    Join Date
    Mar 2010
    Location
    Slovenia
    Posts
    389

    Default

    Who is migrating?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •