[commit: ghc] ghc-8.0: Add and use a new dynamic-library-dirs field in the ghc-pkg info (9448e62)

git at git.haskell.org git at git.haskell.org
Sat Oct 22 20:37:46 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/9448e62740ca03aeb915bf0ecf8b16e54a52798a/ghc

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

commit 9448e62740ca03aeb915bf0ecf8b16e54a52798a
Author: Duncan Coutts <duncan at well-typed.com>
Date:   Sat Oct 22 13:52:40 2016 -0400

    Add and use a new dynamic-library-dirs field in the ghc-pkg info
    
    Build systems / package managers want to be able to control the file
    layout of installed libraries. In general they may want/need to be able
    to put the static libraries and dynamic libraries in different places.
    The ghc-pkg library regisrtation needs to be able to handle this.
    
    This is already possible in principle by listing both a static lib dir
    and a dynamic lib dir in the library-dirs field (indeed some previous
    versions of Cabal did this for shared libs on ELF platforms).
    
    The downside of listing both dirs is twofold. There is a lack of
    precision, if we're not careful with naming then we could end up
    picking up the wrong library. The more immediate problem however is
    that if we list both directories then both directories get included
    into the ELF and Mach-O shared object runtime search paths. On ELF this
    merely slows down loading of shared libs (affecting prog startup time).
    On the latest OSX versions this provokes a much more serious problem:
    that there is a rather low limit on the total size of the section
    containing the runtime search path (and lib names and related) and thus
    listing any unnecessary directories wastes the limited space.
    
    So the solution in this patch is fairly straightforward: split the
    static and dynamic library search paths in the ghc-pkg db and its use
    within ghc. This is a traditional solution: pkg-config has the same
    static / dynamic split (though it describes in in terms of private and
    public, but it translates into different behaviour for static and
    dynamic linking).
    
    Indeed it would make perfect sense to also have a static/dynamic split
    for the list of the libraries to use i.e. to have dynamic variants of
    the hs-libraries and extra-libraries fields. These are not immediately
    required so this patch does not add it, but it is a reasonable
    direction to follow.
    
    To handle compatibility, if the new dynamic-library-dirs field is not
    specified then its value is taken from the library-dirs field.
    
    Contains Cabal submodule update.
    
    Test Plan:
    Run ./validate
    
    Get christiaanb and carter to test it on OSX Sierra, in combination
    with Cabal/cabal-install changes to the default file layout for
    libraries.
    
    Reviewers: carter, bgamari, hvr, austin, christiaanb
    
    Subscribers: thomie, Phyx, ezyang
    
    Differential Revision: https://phabricator.haskell.org/D2625
    
    GHC Trac Issues: #12479


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

9448e62740ca03aeb915bf0ecf8b16e54a52798a
 compiler/ghci/Linker.hs             |  3 ++-
 compiler/main/DriverPipeline.hs     |  2 +-
 compiler/main/PackageConfig.hs      |  1 +
 compiler/main/Packages.hs           | 33 +++++++++++++++++++++++++++++----
 compiler/main/SysTools.hs           |  2 +-
 libraries/Cabal                     |  2 +-
 libraries/ghc-boot/GHC/PackageDb.hs | 10 ++++++++--
 utils/ghc-cabal/Main.hs             |  4 ++++
 utils/ghc-pkg/Main.hs               |  4 +++-
 9 files changed, 50 insertions(+), 11 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 9448e62740ca03aeb915bf0ecf8b16e54a52798a


More information about the ghc-commits mailing list