Join GitHub today
Pass `ld-options` through to GHC #5451
Tentative. Fixes #4925
Based on #5446; that one should be merged first and then this one rebased.
To review, only review the top commits (this change is much smaller than it looks here).
Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!
This was referenced
Jul 20, 2018
Hmm, this isn't working yet. The flags are passed to the linker, but they appear to early in the
Since with linker flags later
I want them to appear at the end. Any hints?
Is this because of the position inside GHC flags as given in
I tried permuting the flags directly in the GHC invocation cabal makes, but the results are the same. So it seems like
I found a very hacky workaround: Pass
This makes the order unimportant: See https://linux.die.net/man/1/ld
I don't want to keep this as the final solution though, as it can make linking slower (and you lose the ability to specify which symbols exactly should be picked by exploiting the order; but this ability you lose anyway if GHC gives you only one location to put your symbols).
At least this workaround is independent from Cabal itself: It works with the current PR without modifications, only users would have to use it.
Urgh, trouble. You cannot pass
But you also can't pass
This problem is created by the fact that GHC uses
Why is that? From
I have researched how the various linkers do it: