Skip to content
  • Moritz Angermann's avatar
    [macOS] improved runpath handling · 4ff93292
    Moritz Angermann authored and Marge Bot's avatar Marge Bot committed
    In b592bd98 we started using
    -dead_strip_dylib on macOS when lining dynamic libraries and binaries.
    The underlying reason being the Load Command Size Limit in macOS
    Sierra (10.14) and later.
    
    GHC will produce @rpath/libHS... dependency entries together with a
    corresponding RPATH entry pointing to the location of the libHS...
    library. Thus for every library we produce two Load Commands.  One to
    specify the dependent library, and one with the path where to find it.
    This makes relocating libraries and binaries easier, as we just need to
    update the RPATH entry with the install_name_tool. The dynamic linker
    will then subsitute each @rpath with the RPATH entries it finds in the
    libraries load commands or the environement, when looking up @rpath
    relative libraries.
    
    -dead_strip_dylibs intructs the linker to drop unused libraries. This in
    turn help us reduce the number of referenced libraries, and subsequently
    the size of the load commands.  This h...
    4ff93292