Announcement

Collapse
No announcement yet.

The Mold Linker Is Great & Set To Become Even Better

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

  • The Mold Linker Is Great & Set To Become Even Better

    Phoronix: The Mold Linker Is Great & Set To Become Even Better

    When it comes to open-source compiler toolchain components and more broadly often unsung heroes in the low-level open-source space, one of the most interesting successes in recent years has been the Mold linker that has proven itself a viable alternative to GNU ld and Gold or LLVM's lld linkers. Mold is already in great shape and typically proving itself well while moving ahead they are working toward kernel/embedded programming support as one of the last grounds to tackle...

    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
    I wonder if mold can be used for the final builds or is it only for quick debug builds? Does it produce binaries that are running as fast as if when built using legacy linkers? Can LTO be performed when using mold? I couldn't find this information on the internet.

    Comment


    • #3
      I've recently seen Mold suggested as a way to speed up the rapid development cycle of Rust programs, considering it can take a while to compile larger projects (for me, just relying on SurrealDB alone is adding a good minute on to my builds). It's a shame I'm developing on Windows and can't take advantage of it, feels like even more of an example of Microsoft's total disregard of their desktop market these days.

      Comment


      • #4
        I've been using mold as my main linker on my Gentoo system for a couple of years. I've only had problems with 3-4 packages, and it's simple to force them to use ld instead. It's been working great.

        Comment


        • #5
          Originally posted by dumb ways to code View Post
          I wonder if mold can be used for the final builds or is it only for quick debug builds? Does it produce binaries that are running as fast as if when built using legacy linkers? Can LTO be performed when using mold? I couldn't find this information on the internet.
          See my previous post. As far as I know, it does all of that. There are some packages where LTO causes linker errors, but they have been very few, one or two.
          You can follow the mold tracker bug-report on Gentoo if you want, to see the state of it: https://bugs.gentoo.org/830404
          There you also have a link to an excel sheet from the mold maintainer listing the packages that cause issues.

          Gentoo wiki on mold:
          https://wiki.gentoo.org/wiki/Mold - "LTO (Link-time optimization) support has been added since mold-1.1.1"

          Comment


          • #6
            Soooo. Given that production code is LTO'ed, mold has no benefits, right?

            Comment


            • #7
              Originally posted by rene View Post
              Soooo. Given that production code is LTO'ed, mold has no benefits, right?
              I don't understand the premise of the question.

              Comment


              • #8
                Originally posted by Azpegath View Post
                I've been using mold as my main linker on my Gentoo system for a couple of years. I've only had problems with 3-4 packages, and it's simple to force them to use ld instead. It's been working great.
                Same but a couple months, the only problems I had is for packages that don’t correctly pass linker-plugin flags (at least with LTO), so Mold errors out saying that as it was not specified for the compiled objects, it doesn’t know what to do with the LTO object.

                Comment


                • #9
                  Originally posted by Ironmask View Post
                  I've recently seen Mold suggested as a way to speed up the rapid development cycle of Rust programs, considering it can take a while to compile larger projects (for me, just relying on SurrealDB alone is adding a good minute on to my builds). It's a shame I'm developing on Windows and can't take advantage of it, feels like even more of an example of Microsoft's total disregard of their desktop market these days.
                  There are plans to extend the commercial version of mold (sold) from only supporting macOS/iOS to also supporting Windows, if you're OK with paying for a linker. I'm not sure if their "We are considering relicensing the sold linker as free software rather than as a commercial product, given the recent developments with the official Apple linker. Since Apple's linker has gained speed, it's difficult to obtain a sufficient number of users to sustain this project." applies to that too.

                  (mold currently operates under a "make people using paid operating systems pay for their linker to subsidize development of the version for free platforms" model. Note that the sold README is currently a bit stale in that it still says mold is AGPLed rather than MITed.)

                  Comment


                  • #10
                    Originally posted by Azpegath View Post

                    I don't understand the premise of the question.
                    When performing LTO, mold fallback to using llvm/gcc to do the LTO, because LTO means the object files contains intermediate compiler-internal IR instead of binary code, and you have to pass them into a compiler to optimize and generate machine code, so using mold with LTO makes no sense.

                    Comment

                    Working...
                    X