Skip to content
  • Moritz Angermann's avatar
    linker: Nub rpaths · b803c406
    Moritz Angermann authored and Ben Gamari's avatar Ben Gamari committed
    When compiling and linking files in `ghci`, we keep adding rpath
    arguments to the linker command invoation.  If those are identical we
    should `nub` them out.  Otherwise we not only risk overflowing the
    argument limit, but also embed huge amounts of identical rpath values
    into the dynamic library, eventually leading to the overflow of the load
    command size limit, due to the number of rpath entries alone.
    
    A further improvement could be to pass `-Xlinker -dead_strip_dylibs`;
    that however might be stipping too aggressively, and potentially lead to
    missing symbols?
    
    For the time being I suggest to only do the nubbing and if need be to
    provide -Wl,-dead_strip_dylibs when invoking ghci.
    
    Test Plan: ./validate
    
    Reviewers: bgamari, hvr
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #15446
    
    Differential Revision: https://phabricator.haskell.org/D5021
    b803c406