Announcement

Collapse
No announcement yet.

GCC 12 Adds Support For Using The Mold Linker

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

  • GCC 12 Adds Support For Using The Mold Linker

    Phoronix: GCC 12 Adds Support For Using The Mold Linker

    A small but noteworthy change that landed today for the GCC 12 compiler itself is support for using the Mold linker...

    https://www.phoronix.com/scan.php?pa...12-Mold-Linker

  • #2
    But first declining the patch ... But yeah, its good that it got merged.

    Comment


    • #3
      Question, is GNU ld the same thing as Gold?

      Comment


      • #4
        Originally posted by tildearrow View Post
        Question, is GNU ld the same thing as Gold?
        No. GNU ld AKA the BFD linker AKA ld.bfd is different from the Gold linker AKA ld.gold. An operating system typically has an ld symlink to the linker (.e.g. ld.bfd, ld.gold, ld.lld. ld.mold, etc.)

        Comment


        • #5
          Originally posted by tildearrow View Post
          Question, is GNU ld the same thing as Gold?
          Code:
          $ ls -hlL /usr/bin/ld.*
          -rwxr-xr-x 2 root root 4.3M Sep 21 17:22 /usr/bin/ld.bfd
          -rwxr-xr-x 1 root root 12M  Sep 21 17:22 /usr/bin/ld.gold
          -rwxr-xr-x 1 root root 65k  Nov  6 15:48 /usr/bin/ld.lld
          -rwxr-xr-x 1 root root 9.5M Dec 20 21:08 /usr/bin/ld.mold
          
          $ ld.bfd --version
          GNU ld 2.37
          
          $ ld.gold --version
          GNU gold 1.16

          Comment


          • #6
            Originally posted by atomsymbol View Post

            Code:
            $ ls -hlL /usr/bin/ld.*
            -rwxr-xr-x 2 root root 4.3M Sep 21 17:22 /usr/bin/ld.bfd
            -rwxr-xr-x 1 root root 12M Sep 21 17:22 /usr/bin/ld.gold
            -rwxr-xr-x 1 root root 65k Nov 6 15:48 /usr/bin/ld.lld
            -rwxr-xr-x 1 root root 9.5M Dec 20 21:08 /usr/bin/ld.mold
            
            $ ld.bfd --version
            GNU ld 2.37
            
            $ ld.gold --version
            GNU gold 1.16
            Interesting your size difference.
            Code:
            [FONT=monospace][COLOR=#b218b2]❯[/COLOR][COLOR=#000000] [/COLOR][COLOR=#005fd7]ls[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00afff]-hlL[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00afff]/usr/bin/ld.[/COLOR][COLOR=#00a6b2]*[/COLOR][COLOR=#000000] [/COLOR]
            -rwxr-xr-x 2 root root 2.8M Dec 28 19:04 [COLOR=#54ff54][B]/usr/bin/ld.bfd[/B][/COLOR][COLOR=#000000] [/COLOR]
            -rwxr-xr-x 1 root root 3.8M Dec 28 19:04 [COLOR=#54ff54][B]/usr/bin/ld.gold[/B][/COLOR][COLOR=#000000] [/COLOR]
            -rwxr-xr-x 1 root root 5.8M Dec 28 19:48 [COLOR=#54ff54][B]/usr/bin/ld.lld[/B][/COLOR][COLOR=#000000] [/COLOR]
            -rwxr-xr-x 1 root root 3.6M Dec 29 19:59 [COLOR=#54ff54][B]/usr/bin/ld.mold[/B][/COLOR][/FONT]

            Comment


            • #7
              This tests of speed are a little subjective, and to do a honest test, it would take quite a lot of work..
              The linker also has dependencies...at runtime.

              Depending on the distribution some library dependencies could be compiled statically, and so the linker will be faster to launch, since it has less dynamic linker activities to be done, and that will of-course influence the speed..

              In my case, I have small linker binaries, which means tons of shared libraries to link, when the linker runs(so will be slower, but uses less space in disk..):
              Code:
              $ ls -lhH /usr/bin/ld.*
              -rwxr-xr-x 1 root root 1,7M fev 20 2021 /usr/bin/ld.bfd
              -rwxr-xr-x 1 root root 2,2M fev 20 2021 /usr/bin/ld.gold

              Comment


              • #8
                Does the use of different linkers influence the performance of the resulting binary when not using LTO?

                Comment


                • #9
                  Oh no, yet another attack on freedom! I can't wait to hear Stallman's tantrum on this one.

                  Comment


                  • #10
                    Originally posted by atomsymbol View Post

                    Code:
                    -rwxr-xr-x 2 root root 4.3M Sep 21 17:22 /usr/bin/ld.bfd
                    -rwxr-xr-x 1 root root  12M Sep 21 17:22 /usr/bin/ld.gold
                    -rwxr-xr-x 1 root root  65k Nov  6 15:48 /usr/bin/ld.lld
                    -rwxr-xr-x 1 root root 9.5M Dec 20 21:08 /usr/bin/ld.mold
                    Originally posted by ptr1337 View Post

                    Interesting your size difference.
                    Code:
                    -rwxr-xr-x 2 root root 2.8M Dec 28 19:04 /usr/bin/ld.bfd
                    -rwxr-xr-x 1 root root 3.8M Dec 28 19:04 /usr/bin/ld.gold
                    -rwxr-xr-x 1 root root 5.8M Dec 28 19:48 /usr/bin/ld.lld
                    -rwxr-xr-x 1 root root 3.6M Dec 29 19:59 /usr/bin/ld.mold
                    The different size of binaries is probably caused by me having "-g1 -gz" in CFLAGS when compiling all Gentoo packages.

                    Comment

                    Working...
                    X