Announcement

Collapse
No announcement yet.

Fedora 29 Might Make Change To Eliminate Unnecessary Linking

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

  • Fedora 29 Might Make Change To Eliminate Unnecessary Linking

    Phoronix: Fedora 29 Might Make Change To Eliminate Unnecessary Linking

    Yet another notable change proposal for Fedora 29 is to "remove excessive linking", which could help program start-up times, but may be too late for happening with the current Fedora Linux release cycle...

    http://www.phoronix.com/scan.php?pag...nker-As-Needed

  • #2
    Alternatively, have it in Gentoo's /etc/portage/make.conf:

    Code:
    LDFLAGS="${LDFLAGS} -Wl,--as-needed"

    Comment


    • #3
      I'm extremely surprised this isn't yet done by ALL major distributions...

      Comment


      • #4
        The problem with `-Wl,--as-needed` is that it only applies to shared libraries found after it. I had to patch libtool to shunt this argument to the front of the list.

        Comment


        • #5
          Actually it has been default on Gentoo for years. No need to set it in your make.conf

          Comment


          • #6
            Originally posted by timofonic View Post
            I'm extremely surprised this isn't yet done by ALL major distributions...
            The problem is that if A links with B but needs symbols from C without linking with C and B links with C without using any symbols from C then it all works, but if you then link B with --as-needed then out of the blue A breaks.

            Yes this means that A is built wrong and should be fixed but with 100k packages this is quite a bit to go over and fix for a major distribution, also there will likely exist 3:d party software that are built wrong here and that will break if the distribution decides to compile with --as-needed all of a sudden.

            Which is why you see Fedora introduce this but not RHEL.

            Comment


            • #7
              Originally posted by RayDonnelly View Post
              The problem with `-Wl,--as-needed` is that it only applies to shared libraries found after it. I had to patch libtool to shunt this argument to the front of the list.
              Gentoo and Debian applies patch to ltmain.sh

              Comment


              • #8
                Originally posted by F.Ultra View Post

                The problem is that if A links with B but needs symbols from C without linking with C and B links with C without using any symbols from C then it all works, but if you then link B with --as-needed then out of the blue A breaks.

                Yes this means that A is built wrong and should be fixed but with 100k packages this is quite a bit to go over and fix for a major distribution, also there will likely exist 3:d party software that are built wrong here and that will break if the distribution decides to compile with --as-needed all of a sudden.

                Which is why you see Fedora introduce this but not RHEL.
                The stupidity in Linux userland never ceases to amaze me.

                "Import a symbol from a library but don't link to it", WTF? That's not even possible on Windows DLLs since symbols are part of the imports from a library. And rightfully so.

                Comment


                • #9
                  Originally posted by Weasel View Post
                  The stupidity in Linux userland never ceases to amaze me.

                  "Import a symbol from a library but don't link to it", WTF? That's not even possible on Windows DLLs since symbols are part of the imports from a library. And rightfully so.
                  Unless of the of course you directly dll open during runtime and getprocaddress or whatever it was. But then you know you're operating on thin ice

                  Comment


                  • #10
                    Originally posted by Weasel View Post
                    The stupidity in Linux userland never ceases to amaze me.

                    "Import a symbol from a library but don't link to it", WTF? That's not even possible on Windows DLLs since symbols are part of the imports from a library. And rightfully so.
                    Windows have their own hell here since you there can link with two different DLL:s that each link to different versions of a third library with all the ugliness that this can cause.

                    On Linux the symbols are a shared namespace per process so if your application links with say OpenSSL and you then start to use Zlib functions but forget to link with it (-lz) you can still access the exposes symbols from zlib that OpenSSL links.

                    However there are some hoops that you have to jump over for this to work because out of the box gcc will refuse to build, exactly how you enable this is not something that I remember any more but I've seen it in the past.

                    Comment

                    Working...
                    X