[GHC] #16045: improve dwarf support on OSX

#16045: improve dwarf support on OSX --------------------------------------+--------------------------------- Reporter: carter | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Keywords: | Operating System: MacOS X Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+--------------------------------- currently 1) we dont have stack unwinding support on OSX (libDwarf is ELF format only) 2) the current way dwarf data is generated on OSX / for macho triggers some segment issue when linking base into a libbase archive, when g1 or g2 is set , but not when g0 is set. that is, even if we had a macho unwinding library for use with GHC, currently we can't even unwind base if we wanted to 3) currently the stgcrun.c code for darwin/unix envs when build on OSX, can't be built with GCC, because of some mismatch in how llvm vs gcc flavored tools on osx handle dwarf. This means this file, IF we had unwinding support, would need to be built with clang (apple or llvm flavored). 3 a)HOWEVER: on OSX the threaded RTS (when built with clang) is ~15% slower than the same built with GCC. 3 b) so ideally, in a future world with unwinding on OSX, tweaking the build system to make sure that the STGCRUN.c code it always built with clang, or some other fix, that still permits a GCC built RTS OR otherwise does a fix to that GC rts perf issue, would be ideal Theres a few different action items here, and some of them are quite messy, but they all need to be done for decent perf and debugging experiences on OSX to be in the GHC future! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16045 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16045: improve dwarf support on OSX ---------------------------------+-------------------------------------- Reporter: carter | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by carter): the near term fix is to disable the dwarf annnotations in stgcrun.c so that the CI distro builds can have the nice RTS, when built on OSX with GCC (we should still test the clang + info path). longer term: we need to understand if theres a way to work around the section limits when base is built with -g1 / g2/ g3 with the machO object format. one option might be use dsym files instead of putting the data in the object files? lots to poke at to understand whats going on and if its an llvm/apple bug, a fundamental macho dwarf issue given the current macho object format, or if we just need to be more clever on OSX / macho targets longer long term: find a macho dwarf unwindingin stack walker code base we like! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16045#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16045: improve dwarf support on OSX ---------------------------------+-------------------------------------- Reporter: carter | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by adamse): * cc: adamse (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16045#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16045: improve dwarf support on OSX ---------------------------------+-------------------------------------- Reporter: carter | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by fghibellini): From recent communication with @bgamari
At the moment it's not even possible to compile GHC with debug symbols enabled due to apparent limitations in the MachO object format (we seem to generate more sections than MachO can represent).
It would be helpful if you could open a GHC ticket. ... it would be good to record the current status of DWARF on Darwin.
Currently https://ghc.haskell.org/trac/ghc/wiki/DWARF has a paragraph:
For Mac Os, debug information is kept separate from the binary, so we first have to package it using dsymutil: And from https://downloads.haskell.org/~ghc/latest/docs/html/users_guide /debug-info.html : Under Mac OS X debug information is kept apart from the executable. After compiling the executable you’ll need to use the dsymutil utility to extract the debugging information and place them in the debug archive,
Both pages make the user think that this is possible - I don't understand how the comments got there in the first place if there is no support for it. Would be nice to replace those comments with warnings so others don't spend time trying to understand why it doesn't work on their machine. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16045#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16045: improve dwarf support on OSX ---------------------------------+-------------------------------------- Reporter: carter | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 Resolution: | Keywords: DWARF Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bgamari): * keywords: => DWARF -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16045#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC