Hadrian: include 'findPtr' via find-ptr cabal flag

Authored by harpocrates on Dec 1 2018, 9:01 PM.



This is the latest in the 'findPtr' saga. See

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

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
harpocrates created this revision.Dec 1 2018, 9:01 PM
alpmestan added a subscriber: Phyx.

Looks good to me, but it'd be good to have @Phyx confirm that this doesn't cause any breakage on Windows. Tamar, any chance you can fire up a build in the upcoming week?

Phyx accepted this revision.Dec 2 2018, 2:19 PM

@alpmestan @harpocrates Thanks, From looking at the harbormaster build logs none of the linker tests that failed last time failed, and also this change should be find in that regard. So if it's ok with you @alpmestan it's fine with me too :)

This revision is now accepted and ready to land.Dec 2 2018, 2:19 PM
alpmestan accepted this revision.Dec 2 2018, 3:31 PM

All good then! :-)

snowleopard accepted this revision.Dec 2 2018, 4:12 PM

And another thumb-up from me. Thanks @harpocrates!

This revision was automatically updated to reflect the committed changes.