Commit ffd45c50 authored by Matthew Pickering's avatar Matthew Pickering

Make `debug-info` >= 1 imply library/executable-stripping: False

Fixes #2702

If you enable `debug-info` then you also have to stop the libraries and
executables being stripped as otherwise the debug symbols are removed.
parent c241917a
......@@ -26,6 +26,8 @@
add default implementation in terms of `coerce` / `unsafeCoerce`.
* Implement support for response file arguments to defaultMain* and cabal-install.
* Uniformly provide 'Semigroup' instances for `base < 4.9` via `semigroups` package
* Setting `debug-info` now implies `library-stripping: False` and
`executable-stripping: False) ([#2702](https://github.com/haskell/cabal/issues/2702))
----
......
......@@ -706,6 +706,27 @@ configure (pkg_descr0, pbi) cfg = do
setCoverageLBI <- configureCoverage verbosity cfg comp
-- Turn off library and executable stripping when `debug-info` is set
-- to anything other than zero.
let
strip_libexe s f =
let defaultStrip = fromFlagOrDefault True (f cfg)
in case fromFlag (configDebugInfo cfg) of
NoDebugInfo -> return defaultStrip
_ -> case f cfg of
Flag True -> do
warn verbosity $ "Setting debug-info implies "
++ s ++ "-stripping: False"
return False
_ -> return False
strip_lib <- strip_libexe "library" configStripLibs
strip_exe <- strip_libexe "executable" configStripExes
let reloc = fromFlagOrDefault False $ configRelocatable cfg
let buildComponentsMap =
......@@ -747,8 +768,8 @@ configure (pkg_descr0, pbi) cfg = do
configGHCiLib cfg,
splitSections = split_sections,
splitObjs = split_objs,
stripExes = fromFlag $ configStripExes cfg,
stripLibs = fromFlag $ configStripLibs cfg,
stripExes = strip_exe,
stripLibs = strip_lib,
exeCoverage = False,
libCoverage = False,
withPackageDB = packageDbs,
......
......@@ -381,8 +381,8 @@ defaultConfigFlags progDb = emptyConfigFlags {
#endif
configSplitSections = Flag False,
configSplitObjs = Flag False, -- takes longer, so turn off by default
configStripExes = Flag True,
configStripLibs = Flag True,
configStripExes = NoFlag,
configStripLibs = NoFlag,
configTests = Flag False,
configBenchmarks = Flag False,
configCoverage = Flag False,
......
......@@ -1424,7 +1424,8 @@ Object code options
Not all Haskell implementations generate native binaries. For such
implementations this option has no effect.
(TODO: Check what happens if you combine this with ``debug-info``.)
If ``debug-info`` is set explicitly then ``executable-stripping`` is set
to ``False`` as otherwise all the debug symbols will be stripped.
The command line variant of this flag is
``--enable-executable-stripping`` and
......@@ -1440,6 +1441,9 @@ Object code options
binary, saving space on the file system. See also
``executable-stripping``.
If ``debug-info`` is set explicitly then ``library-stripping`` is set
to ``False`` as otherwise all the debug symbols will be stripped.
The command line variant of this flag is
``--enable-library-stripping`` and ``--disable-library-stripping``.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment