[GHC] #10352: Properly link Haskell shared libs on ELF systems

GHC ghc-devs at haskell.org
Mon Jul 4 19:29:12 UTC 2016


#10352: Properly link Haskell shared libs on ELF systems
-------------------------------------+-------------------------------------
        Reporter:  duncan            |                Owner:
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.11
  (Linking)                          |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by Phyx-):

 * os:  Linux => Unknown/Multiple


Comment:

 I think this would work for Windows as well and would solve some issues
 with Dynamic linking there.

 For this to work on Windows we need a few things:

 name all the rts variants the same. e.g. `ghc-rts.dll` but place them in
 different folders:

 {{{
 rts
    \ normal   \ ghc-rts.dll
    \ threaded \ ghc-rts.dll
    \ profiled \ ghc-rts.dll
 }}}

 etc. We can then delay load the rts library.
 All the RTS versions should have the same ABI so that shouldn't be an
 issue.

 During compilation of a `.exe` we can then set the search path using
 `AddDllDirectory` to allow the loader to pick the correct `RTS` variants
 for the `.exe`
 and all the DLLs since they are all in the same process space as the `exe`
 and so will inherit the search path.

 For dynamic libraries we can override the `hs_init` function and do the
 same. I think we can use ld's `--wrap symbol` for this so existing code
 don't need any changing:
 http://ftp.gnu.org/pub/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html

 So I will re-classify this as being multiple platforms.

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


More information about the ghc-tickets mailing list