summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-03-18 15:54:35 -0400
committerBen Gamari <ben@smart-cactus.org>2020-11-09 20:59:15 -0500
commit151f6f6f7bafa30a9e0f768d5ab187c6cbe35520 (patch)
tree6d6b1f6ea249b64c8d53e185ca253141a267c3bd
parent90e5fbf24d504d6a7b1f4fb1831662eb5f9cba43 (diff)
downloadhaskell-wip/local-symbols-2.tar.gz
Enable -fexpose-internal-symbols when debug level >=2wip/local-symbols-2
This seems like a reasonable default as the object file size increases by around 5%.
-rw-r--r--compiler/GHC/Driver/Session.hs8
-rw-r--r--docs/users_guide/debug-info.rst1
-rw-r--r--docs/users_guide/phases.rst7
3 files changed, 12 insertions, 4 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 4c53e56f3d..80edddb828 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -4419,7 +4419,13 @@ setVerbosity :: Maybe Int -> DynP ()
setVerbosity mb_n = upd (\dfs -> dfs{ verbosity = mb_n `orElse` 3 })
setDebugLevel :: Maybe Int -> DynP ()
-setDebugLevel mb_n = upd (\dfs -> dfs{ debugLevel = mb_n `orElse` 2 })
+setDebugLevel mb_n =
+ upd (\dfs -> exposeSyms $ dfs{ debugLevel = n })
+ where
+ n = mb_n `orElse` 2
+ exposeSyms
+ | n > 2 = setGeneralFlag' Opt_ExposeInternalSymbols
+ | otherwise = id
data PkgDbRef
= GlobalPkgDb
diff --git a/docs/users_guide/debug-info.rst b/docs/users_guide/debug-info.rst
index 351446fa58..b1636bb81f 100644
--- a/docs/users_guide/debug-info.rst
+++ b/docs/users_guide/debug-info.rst
@@ -14,6 +14,7 @@ useable by most UNIX debugging tools.
:category: debugging
:since: 7.10, numeric levels since 8.0
+ :implies: :ghc-flag:`-fexpose-internal-symbols` when ⟨n⟩ >= 2.
Emit debug information in object code. Currently only DWARF debug
information is supported on x86-64 and i386. Currently debug levels 0
diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst
index 88b6659a05..2b156d7328 100644
--- a/docs/users_guide/phases.rst
+++ b/docs/users_guide/phases.rst
@@ -728,10 +728,11 @@ Options affecting code generation
Request that GHC emits verbose symbol tables which include local symbols
for module-internal functions. These can be useful for tools like
:ref:`perf <https://perf.wiki.kernel.org/>` but increase object file sizes.
+ This is implied by :ghc-flag:`-g2 <-g>` and above.
- :ghc-flag:`-fno-expose-internal-symbols` suppresses all non-global symbol
- table entries, resulting in smaller object file sizes at the expense of
- debuggability.
+ :ghc-flag:`-fno-expose-internal-symbols <-fexpose-internal-symbols>`
+ suppresses all non-global symbol table entries, resulting in smaller object
+ file sizes at the expense of debuggability.
.. _options-linker: