[PATCH] D82975: [DebugInfo] Allow GNU macro extension to be emitted

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 09:10:26 PDT 2020


dstenb created this revision.
dstenb added reviewers: SouraVX, dblaikie, ikudrin.
dstenb added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya, aprantl.
Herald added a project: LLVM.
dstenb added a parent revision: D82974: [DebugInfo] Allow GNU macro extension to be read.

Allow the GNU .debug_macro extension to be emitted for DWARF versions
earlier than 5. The extension is basically what became DWARF 5's format,
except that a DW_AT_GNU_macros attribute is emitted, and some entries
like the strx entries are missing. In this patch I emit GNU's indirect
entries, which are the same as DWARF 5's strp entries.

This patch adds the extension behind a hidden LLVM flag,
-use-gnu-debug-macro. If this can be landed, I would later want to
enable it by default when tuning for GDB and targeting DWARF versions
earlier than 5.

The size of a Clang 8.0 binary built with RelWithDebInfo and the flags
"-gdwarf-4 -fdebug-macro" reduces from 1533 MB to 1349 MB with
.debug_macro (compared to 1296 MB without -fdebug-macro).

One thing that I have not looked into yet is what to do in the DWO case
(when using -gsplit-dwarf). We can't use relocations in the
.debug_macro.dwo section, so the indirect strp entries are not viable
there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82975

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/X86/debug-macro-gnu.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82975.274833.patch
Type: text/x-patch
Size: 9254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200701/dfa273a0/attachment.bin>


More information about the llvm-commits mailing list