Skip to content
  • Alec Theriault's avatar
    Hadrian: include 'findPtr' via find-ptr cabal flag · 924026e0
    Alec Theriault authored and Tamar Christina's avatar Tamar Christina committed
    Summary:
    This is the latest in the 'findPtr' saga. See
    
      * 900c47f8
      * 561748cb
    
    for the previous attempts. The problem with re-using the 'debug'
    cabal flag for the purpose of forcing inclusion of 'findPtr' occurs
    when 'debug' is one of the RTS ways, but RTS is not being compiled
    with '-DDEBUG':
    
      * the 'debug' flag gets passed to cabal, signalling to build
        'rts' with the debug flavour, but also forcing inclusion of
        the 'findPtr'/'_findPtr' symbol
    
      * since '-DDEBUG' isn't enabled, that symbol doesn't show up in
        the libraries, so executable that depend on 'rts' (everything)
        will end up always requiring 'findPtr'/'_findPtr' but 'rts' won'y
        provide it!
    
    The fix is simple: create a a new 'find-ptr' cabal-flag whose only
    purpose is forcing '-Wl,-u,findPtr'/'-Wl,-u,_findPtr'. Then, enable that
    flag when the RTS is being compiled with '-DDEBUG'
    
    Test Plan: ./hadrian/build.sh -c # on mac
    
    Reviewers: alpmestan, snowleopard, bgamari, erikd, simonmar, Phyx
    
    Reviewed By: alpmestan, snowleopard, Phyx
    
    Subscribers: Phyx, rwbarton, carter
    
    GHC Trac Issues: #15956
    
    Differential Revision: https://phabricator.haskell.org/D5404
    924026e0