This is an archive of the discontinued LLVM Phabricator instance.

DebugInfo: Add a driver flag for DWARF debug_ranges base address specifier use.
ClosedPublic

Authored by dblaikie on Nov 7 2018, 5:11 PM.

Details

Summary

This saves a lot of relocations in optimized object files (at the cost
of some cost/increase in linked executable bytes), but gold's 32 bit
gdb-index support has a bug (
https://sourceware.org/bugzilla/show_bug.cgi?id=21894 ) so we can't
switch to this unconditionally. (& even if it weren't for that bug, one
might argue that some users would want to optimize in one direction or
the other - prioritizing object size or linked executable size)

Mostly sending this for review to bikeshed the flag name. (let's
bikeshed the IR names in the LLVM code review)

-fdwarf-base-address is my first prototype. Issues:

  • Some existing flags (like -fdebug-types-section) use 'debug' rather than 'dwarf', but Clang supports formats other than dwarf, so perhaps names related to dwarf-specific features should have dwarf in the name, though it's unlikely GCC would ever be consistent with that goal?
  • base addresses are part of DWARF even beyond this change (eg: range lists are relative to the CU's base address - which is somewhat unrelated to the base address specifiers used in the range list). So should this specifically call out that it's related to ranges? that it's base address /specifiers/ that are in use?

Diff Detail

Repository
rL LLVM

Event Timeline

dblaikie created this revision.Nov 7 2018, 5:11 PM

I have no other bikeshed colors here. :)

This revision was not accepted when it landed; it landed in state Needs Review.Nov 13 2018, 12:11 PM
This revision was automatically updated to reflect the committed changes.

Settled on renaming the flag for consistency with, say, -fdebug-types-section, to -fdebug-ranges-base-address (though 'debug' is sort of ambiguous (Clang can produce non-DWARF debug info) but this driver (as opposed to clang-cl) is intended for DWARF emission, not PDB emission - and the "debug-ranges" part of the flag names the literal debug_ranges section (like debug-types refers to the debug_types section)).