Announcement

Collapse
No announcement yet.

Clang LTO Support Looks Like It Could Land For Linux 5.12

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

  • Clang LTO Support Looks Like It Could Land For Linux 5.12

    Phoronix: Clang LTO Support Looks Like It Could Land For Linux 5.12

    The support for Clang LTO of the Linux kernel for link-time optimizations when using that GCC alternative compiler looks like it will land with Linux 5.12...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    For anyone who wants to try Clang LTO on x86-64, just download the Kernel from Sami's clang-lto Kernel branch: https://github.com/samitolvanen/linux/tree/clang-lto

    Make sure to use make LLVM=1 LLVM_IAS=1 to get to see these options while configuring your Kernel. Also, some Kernel options are known to cause problems, Retpolines and trimming unused symbols will lead to objtool or modprobe errors. Only the latter are fatal for the build to finish.

    I hope we will see this series land sooner rather than later, it would also be a first for LLVM/clang to support a major Kernel feature before GCC. And speaking of GCC, I hope Andi Kleen and the Microsoft guys will follow up on getting GCC LTO support eventually in a shape to merge in a not too distant future, too.

    Comment


    • #3
      So GCC cannot do LTO on the Linux kernel yet?

      Comment


      • #4
        Originally posted by MastaG View Post
        So GCC cannot do LTO on the Linux kernel yet?
        Not on mainline yet.
        Michael Larabel
        https://www.michaellarabel.com/

        Comment


        • #5
          ms178 how do you avoid the objtool errors in practice ? I've been trying to x86_64 LTO for a while, at each new patch version, and the kernel compilation doesn't succeeded and I get a shit ton of objtool errors. I compile linux with the tkg patchset. Do I need to keep -02 or something ?

          Comment


          • #6
            As someone who doens't use modules, I'm hoping this will just work for me when it lands

            Comment


            • #7
              I'm already dreaming of an AOCC LTO'ed Xanmod Kernel 5.12 build for my ryzen....

              Comment


              • #8
                Originally posted by AdelKS View Post
                ms178 how do you avoid the objtool errors in practice ? I've been trying to x86_64 LTO for a while, at each new patch version, and the kernel compilation doesn't succeeded and I get a shit ton of objtool errors. I compile linux with the tkg patchset. Do I need to keep -02 or something ?
                I saw one to three objtool errors but they weren't fatal for my build. Have you tried to disable Retpolines? I use a minimal config for my system and disable most stuff I don't need. I use -O3 -march=native and aggressive compiler flags (polly) and could get it working on my machine (Haswell-EP + Vega 56) with LLVM/Clang 11.

                Comment


                • #9
                  Originally posted by CochainComplex View Post
                  I'm already dreaming of an AOCC LTO'ed Xanmod Kernel 5.12 build for my ryzen....
                  I've tried it with Clang 11, but if I remember correctly I couldn't get it to compile with Sami's Kernel, but that was a couple of weeks ago. You could try to patch Xanmod changes over Sami's sources and see if it works.

                  By the way the new Intel C/C++ compiler (icx/icpx) is also clang based, but I haven't tried to build the Kernel with it yet.

                  Comment


                  • #10
                    Originally posted by ms178 View Post

                    I've tried it with Clang 11, but if I remember correctly I couldn't get it to compile with Sami's Kernel, but that was a couple of weeks ago. You could try to patch Xanmod changes over Sami's sources and see if it works.

                    By the way the new Intel C/C++ compiler (icx/icpx) is also clang based, but I haven't tried to build the Kernel with it yet.
                    Thx for the valuable input ! I need some time to experiement. AOCC instead of pure clang might also be already a obstacle.

                    Comment

                    Working...
                    X