Skip to content

Commit 11257c5

Browse files
committed
Add documentation
1 parent 8f2f962 commit 11257c5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

changelog.d/pr-8717

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
synopsis: Always pass `ghc-options` to GHC
2+
packages: Cabal
3+
prs: #8717
4+
issues:
5+
6+
description: {
7+
8+
Previously, options set in the package field `ghc-options` would not be passed
9+
to GHC during the link phase for shared objects (where multiple `.o` or
10+
`.dyn_o` files are merged into a single object file). This made it impossible
11+
to use `ghc-options` to use a different linker by setting (for example)
12+
`ghc-options: -optl-fuse-ld=mold -optlm-fuse-ld=mold`; the options would be
13+
dropped in the link phase, falling back to the default linker.
14+
15+
It was possible to work around this by duplicating the `ghc-options` to
16+
`ghc-shared-options`, which _are_ passed in the shared link phase, but that had
17+
the (undocumented and unfortunate) side-effect of disabling the GHC
18+
`-dynamic-too` flag, effectively doubling compilation times when
19+
`ghc-shared-options` are set.
20+
21+
Now, `ghc-options` are combined with `ghc-shared-options` (to accurately
22+
reflect the documentation on this feature) and the fact that
23+
`ghc-shared-options` disables `-dynamic-too` is documented.
24+
25+
}

doc/cabal-package.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,6 +2045,11 @@ system-dependent values for these fields.
20452045
ones specified via :pkg-field:`ghc-options`, and are passed to GHC during
20462046
both the compile and link phases.
20472047

2048+
Note that if any :pkg-field:`ghc-shared-options` are set, the
2049+
``-dynamic-too` option will never be passed to GHC, leading to all modules
2050+
being compiled twice (once to generate the ``.o`` files and another to
2051+
generate the ``.dyn_o`` files).
2052+
20482053
.. pkg-field:: ghcjs-options: token list
20492054

20502055
Like :pkg-field:`ghc-options` but applies to GHCJS

0 commit comments

Comments
 (0)