Announcement

Collapse
No announcement yet.

Building The Linux Kernel With Clang Is Becoming Popular Again

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Building The Linux Kernel With Clang Is Becoming Popular Again

    Phoronix: Building The Linux Kernel With Clang Is Becoming Popular Again

    Years ago there was much interest in the ability to build the mainline Linux kernel with the LLVM Clang compiler as an alternative to using the GCC compiler in order to ensure better code portability, shaking out GCC'isms, possible build speed improvements, and other benefits. But in recent years it seems to have waned in interest but now things are heating up again...

    http://www.phoronix.com/scan.php?pag...ng-Kernel-2018

  • #2
    "shaking out GCC'isms" you mean supporting a shit compiler half-implementing GCC, cute. Long live GCC and GNU C

    Comment


    • #3
      Originally posted by Redfoxmoon View Post
      "shaking out GCC'isms" you mean supporting a shit compiler half-implementing GCC, cute. Long live GCC and GNU C
      Oh wow. You better back those strong words.

      Comment


      • #4
        I present for those interested https://github.com/ClangBuiltLinux/linux

        Comment


        • #5
          The real issue with LLVM is that when you turn the optimiser up, it seems to generate faulty code quite often. This is one of the drivers in the Rust world in an alternate no-undefined-behaviour compiler. I ran into it with my own projects where debug compliling would deliver a working executable, but when enabling basic optimisation it has an ICE.
          Not that GCC is invulnerable to it, they just seem to take ICEs much more seriously.

          Comment


          • #6
            Originally posted by grigi View Post
            The real issue with LLVM is that when you turn the optimiser up, it seems to generate faulty code quite often. This is one of the drivers in the Rust world in an alternate no-undefined-behaviour compiler. I ran into it with my own projects where debug compliling would deliver a working executable, but when enabling basic optimisation it has an ICE.
            Not that GCC is invulnerable to it, they just seem to take ICEs much more seriously.
            Funny, I have the exact opposite experience. btw you refer to both faulty code and ICE (internal compiler errors which will stop compilation), it can be only one of them?

            Comment


            • #7
              Building The Linux Kernel With Clang Is Becoming Popular Again
              It is not again, but no one care there about short term releases, so i would say - cos of annual building & longterm interests

              Distros shipping Clang built kernels:

              Android
              Pixel 2 - Oct 2017 (Clang)
              Pixel 3 - Oct 2018 (Clang+LTO+CFI)
              Expect a LOT more Android devices, soon.

              CrOS
              New devices with 4.19, 4.14, and 4.4 based kernels.
              Minie kernels, blobie drivers... you know and things works fine

              The Clang compiler has been quite popular with the ARM vendors and LLVM's more liberal license has also been attractive to them.
              More bloberal
              Last edited by dungeon; 11-21-2018, 08:06 AM.

              Comment


              • #8
                ICE is when the compiler generates invalid code? I could have the terminology wrong. That is the one I refered to.

                The undefined behaviour issue of LLVM is a big enough issue https://github.com/rust-lang/rust/issues/28728 that Cretonne is actually a thing now.

                I feel you may be confusing CLANG with LLVM, as CLANG is actually good. LLVM I have my doubts on. Read up on the issues that Unladen Swallow had with the LLVM core team.

                Comment


                • #9
                  Originally posted by grigi View Post
                  ICE is when the compiler generates invalid code? I could have the terminology wrong. That is the one I refered to.

                  The undefined behaviour issue of LLVM is a big enough issue https://github.com/rust-lang/rust/issues/28728 that Cretonne is actually a thing now.

                  I feel you may be confusing CLANG with LLVM, as CLANG is actually good. LLVM I have my doubts on. Read up on the issues that Unladen Swallow had with the LLVM core team.
                  ICE: https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide

                  Sorry, but this a topic thats about clang / gcc, so I naturally assumed you where talking about this.

                  The issue you linked seems more like the rust frontend should mark the code as having sideeffects. What Clang/LLVM does (and gcc doesnt) is typically pick the worst outcome for undefined behavior. eg. returning from a function that's marked as no_return will work in gcc, but either trap or corrupt the stack with clang (if any optimization is active).
                  Contrary, clangs LTO just-works, wheres gcc has different quirks every release (gcc8 now often botches debugging information bad enough to crash gdb).

                  Dont see why you can blame for LLVM when it works fine for other languages, most likely rust needs to fix there frontend and/or bug LLVM to add some features they need for rust.

                  Comment


                  • #10
                    I have not done lots of LTO-ing with either. But I have had tons of bizzare broken releases that just disappeared when we changed back to GCC.
                    And yes, I'm soured on LLVM.

                    Comment

                    Working...
                    X