summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-12-27 12:38:27 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-11 03:20:00 -0500
commitc6264a2d652517954b7cd076c7bc4487ed17c97d (patch)
treebd11c475186c63a147f5b58958458c9fc4eef68e /docs/users_guide
parent6e23695e7d84aa248e7ca20bdb8d133f9b356548 (diff)
downloadhaskell-c6264a2d652517954b7cd076c7bc4487ed17c97d.tar.gz
codeGen: Produce local symbols for module-internal functions
It turns out that some important native debugging/profiling tools (e.g. perf) rely only on symbol tables for function name resolution (as opposed to using DWARF DIEs). However, previously GHC would emit temporary symbols (e.g. `.La42b`) to identify module-internal entities. Such symbols are dropped during linking and therefore not visible to runtime tools (in addition to having rather un-helpful unique names). For instance, `perf report` would often end up attributing all cost to the libc `frame_dummy` symbol since Haskell code was no covered by any proper symbol (see #17605). We now rather follow the model of C compilers and emit descriptively-named local symbols for module internal things. Since this will increase object file size this behavior can be disabled with the `-fno-expose-internal-symbols` flag. With this `perf record` can finally be used against Haskell executables. Even more, with `-g3` `perf annotate` provides inline source code.
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/phases.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst
index 1d22372889..88b6659a05 100644
--- a/docs/users_guide/phases.rst
+++ b/docs/users_guide/phases.rst
@@ -720,6 +720,19 @@ Options affecting code generation
all target platforms. See the :ghc-flag:`--print-object-splitting-supported`
flag to check whether your GHC supports object splitting.
+.. ghc-flag:: -fexpose-internal-symbols
+ :shortdesc: Produce symbols for all functions, including internal functions.
+ :type: dynamic
+ :category: codegen
+
+ 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.
+
+ :ghc-flag:`-fno-expose-internal-symbols` suppresses all non-global symbol
+ table entries, resulting in smaller object file sizes at the expense of
+ debuggability.
+
.. _options-linker:
Options affecting linking