From 151f6f6f7bafa30a9e0f768d5ab187c6cbe35520 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 18 Mar 2020 15:54:35 -0400 Subject: Enable -fexpose-internal-symbols when debug level >=2 This seems like a reasonable default as the object file size increases by around 5%. --- compiler/GHC/Driver/Session.hs | 8 +++++++- docs/users_guide/debug-info.rst | 1 + docs/users_guide/phases.rst | 7 ++++--- 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 ` 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: -- cgit v1.2.1