Always pass ghc-options
(backport #8717)
#10350
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The documentation for
ghc-shared-options
states that they arecombined with
ghc-options
:However, only
ghc-shared-options
and notghc-options
are passed in many cases.This is an issue because it requires setting
ghc-shared-options
even if the shared (dynamic) parts of the build don't actually need different options; this has the unpleasant side-effect of causing modules to be compiled twice, effectively doubling compile time! See here, where any non-emptyghc-shared-options
causes Cabal to not set-dynamic-too
:cabal/Cabal/src/Distribution/Simple/GHC.hs
Lines 1466 to 1469 in acbc0f3
This issue was discovered while integrating the
mold
linker with a Haskell project; whenghc-shared-options
wasn't set to the same value asghc-options
, thegold
linker would be used instead ofmold
for various links during the build.Please include the following checklist in your PR:
Please also shortly describe how you tested your change. Bonus points for added tests!
I've tested this by using Cabal with this patch applied to build a large commercial Haskell project (the mercury.com backend) and saw that the
ghc-options
were correctly applied (in this case, that meant observing that no links were performed withgold
and all links were correctly performed withmold
, as the options requested, with the exception of the single link described in #4439).Possibly related issues:
This is an automatic backport of pull request #8717 done by [Mergify](https://mergify.com).