[GHC] #14031: Linker paths carry substantial N*M overhead when many libaries are used

GHC ghc-devs at haskell.org
Tue Jul 25 22:18:10 UTC 2017


#14031: Linker paths carry substantial N*M overhead when many libaries are used
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11587            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nh2):

 There is more info from `sphalerite` on `#nixos` on the topic of dynamic
 linking.

 Apparently it ''is'' possible to give "default locations" for .so files,
 instead of using RPATHs:

 {{{
 sphalerite[m]: I opened an issue about that (linking through absolute
 paths rather than rpath) a couple of months back
 https://github.com/NixOS/nixpkgs/issues/24844 it's possible, just not
 implemented
 sphalerite[m]: on linux that is -- on macOS it's already done through
 absolute paths
 nh2:           that's excellent news, can you give me a short summary of
 what I have to do to give it an explicit path? Also, will the resulting
 link just be a "hint", so still be overridable with LD_LIBRARY_PATH?
 sphalerite[m]: It's not implemented in nixpkgs's machinery yet, so you'd
 need to pass absolute paths to the linker manually instead of using
 `-l<library>`
 sphalerite[m]: and no, it would not be overridable using LD_LIBRARY_PATH
 at that point. LD_PRELOAD would still work though.
 sphalerite[m]: That stuff is all discussed in the issue comments though
 nh2:           I'm getting a bit lost in the amount of comments; what
 feature/flags to ld is the magic that has this effect?
 sphalerite[m]: passing absolute paths instead of -lXYZ
 sphalerite[m]: so rather than -lreadline,
 /nix/store/...-readline-1.2.3/lib/libreadline.so.12345
 nh2:           ah, so passing explicit .so to `ld` doesn't do the same as
 `-l` does, but instead makes it do this "default path link"? I always
 assumed `-l` just finds files and then passes them normally (or so at
 least `man ld` suggests)
 sphalerite[m]: Yeah no, it's not the same
 sphalerite[m]: Huh, actually they seem to be producing the same result for
 me in a test I did just now
 }}}

 [https://github.com/NixOS/nixpkgs/issues/24844 This nix issue] discusses
 the mentioned approach.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14031#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list