This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Generating per-function DWARF line number sections


Hi Guys,

  Attached is an experimental GAS patch to enable the generation of
  separate, per-function DWARF line number sections.  The idea is to
  compliment GCC's -ffunction-sections command line option by creating
  .debug_line sections to match the code sections.  So for example if
  GAS is told to produce line number information for a section called
  .text.func it will put the information into a section called
  .debug_line.text.func.

  The patch also includes an enhancement to the linker so that if
  section garbage collection decides that a particular code section is
  not needed (eg .text.func) then it will look for and discard the
  corresponding line number section (ie .debug_line.text.func).

  The feature is disabled by default, but can be enabled via the use of
  the new gas command line option: --gdwarf-sections.

  One problem with this feature is that the DWARF standard expects a one
  to one correspondence between compilation units described in the
  .debug_info section and line numbers described in the .debug_line
  section.  Since the patch does not affect the generation of
  .debug_info sections this means that it has to maintain the one-to-one
  relationship.  Thus the .debug_line.text.<foo> sections are
  *fragments* of a proper .debug_line section containing just the line
  number table and nothing else.  The linker, with suitably updated
  linker scripts, takes care of reassembling these fragmentary sections
  into a single, complete .debug_line section.  But the
  .debug_line.text.<foo> sections when examined in object files will
  appear to be malformed according to the DWARF spec.  The patch takes
  care of this problem by tweaking the DWARF dumping code to allow for
  fragmentary sections.

  Note - this is not a full solution to the problem of deleting
  redundant debug information when a section of code is discarded, but
  it is a step along the way.  Still to come are fragmentary .debug_info
  sections and grouped sections of code and debug information.

  So - does anyone have any comments or questions ?

  I have tested the feature with a large number of toolchains with no
  regressions so far.  I have not checked the patch into the sources
  yet, as I am hoping for some feedback first.

Cheers
  Nick

Attachment: gdwarf-sections.patch.xz
Description: application/xz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]