Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,361
    • Issues 5,361
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 567
    • Merge requests 567
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !2380

nativeGen: Produce local symbols for module-internal functions (approach B)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Ben Gamari requested to merge wip/local-symbols-2 into master Dec 27, 2019
  • Overview 14
  • Commits 4
  • Pipelines 26
  • Changes 12

This is another approach to !2378 (closed) which provides slightly more informative (e.g. module-qualified) local labels along with slightly less implementation impact

It turns out that some important native debugging/profiling tools (e.g. perf) rely solely 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). As a result, 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 (closed)).

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-all-symbols flag.

With this perf record can finally be used against Haskell executables. Even more, with -g3 perf annotate provides inline source code.

Edited Dec 27, 2019 by Ben Gamari
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/local-symbols-2