[commit: ghc] master: Add Windows import library support to the Runtime Linker (97f2b16)

git at git.haskell.org git at git.haskell.org
Sun Apr 17 11:04:28 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/97f2b16483aae28dc8fd60b6d2e1e283618f2390/ghc

>---------------------------------------------------------------

commit 97f2b16483aae28dc8fd60b6d2e1e283618f2390
Author: Tamar Christina <tamar at zhox.com>
Date:   Sun Apr 17 13:03:17 2016 +0200

    Add Windows import library support to the Runtime Linker
    
    Summary:
    Import libraries are files ending in `.dll.a` and `.lib` depending on which
    compiler creates them (GCC, vs MSVC).
    
    Import Libraries are standard `archive` files that contain object files.
    These object files can have two different formats:
    
    1) The normal COFF Object format for object files
        (contains all ascii data and very little program code, so do not
         try to execute.)
    2) "short import" format which just contains a symbol name and
       the dll in which the symbol can be found.
    
    Import Libraries are useful for two things:
    
    1) Allowing applications that don't support dynamic linking to
       link against the import lib (non-short format) which then
       makes calls into the DLL by loading it at runtime.
    
    2) Allow linking of mutually recursive dlls. if `A.DLL` requires
       `B.DLL` and vice versa, import libs can be used to break the cycle
       as they can be created from the expected exports of the DLLs.
    
    A side effect of having these two capabilities is that Import libs are often
    used to hide specific versions of DLLs behind a non-versioned import lib.
    
    e.g. GCC_S.a (non-conventional import lib) will point to the correct
    `libGCC` DLL. With this support Windows Haskell files can now just link
    to `-lGCC_S` and not have to worry about what the actual name of libGCC is.
    
    Also third party libraries such as `icuuc` use import libs to forward to
    versioned DLLs. e.g. `icuuc.lib` points to `icuuc51.dll` etc.
    
    Test Plan:
    ./validate
    
    Two new tests added T11072gcc T11072msvc
    
    Two binary files have been added to the test folder because the "short"
    import library format doesn't seem to be creatable via `dlltool`
    and requires Microsoft's `lib.exe`.
    
    Reviewers: bgamari, RyanGlScott, erikd, goldfire, austin, hvr
    
    Reviewed By: RyanGlScott, erikd
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1696
    
    GHC Trac Issues: #11072


>---------------------------------------------------------------

97f2b16483aae28dc8fd60b6d2e1e283618f2390
 compiler/ghci/Linker.hs                            |  50 ++-
 rts/Linker.c                                       | 385 +++++++++++++--------
 rts/LinkerInternals.h                              | 125 ++++++-
 testsuite/tests/ghci/linking/dyn/Makefile          |  16 +
 .../ghci/linking/dyn/{T1407.script => T11072.hs}   |   5 +-
 .../linking/dyn/T11072gcc.stdout}                  |   0
 .../linking/dyn/T11072msvc.stdout}                 |   0
 testsuite/tests/ghci/linking/dyn/all.T             |  10 +
 testsuite/tests/ghci/linking/dyn/i686/libAS.lib    | Bin 0 -> 1698 bytes
 testsuite/tests/ghci/linking/dyn/libAS.def         |   3 +
 testsuite/tests/ghci/linking/dyn/x86_64/libAS.lib  | Bin 0 -> 1700 bytes
 11 files changed, 440 insertions(+), 154 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 97f2b16483aae28dc8fd60b6d2e1e283618f2390


More information about the ghc-commits mailing list