[PATCH] D123534: [dwarf] Emit a DIGlobalVariable for constant strings.

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 15 14:33:38 PDT 2022


hctim added a comment.

In D123534#3454354 <https://reviews.llvm.org/D123534#3454354>, @dblaikie wrote:

> This seems like it would significantly introduce debug info size for at least some kinds of code - have you done any size measurements of this change?

With `-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=On`:

- Before the patch: `clang` was 1247264656 bytes
- After the patch: `clang` was 1270191696 bytes (or, a 1.84% increase)

> What does the resulting DWARF look like?

Each string DI ends up looking like a regular global variable (i.e. a `DW_TAG_variable` entry in `.debug_info`):

  $ llvm-dwarfdump --debug-info
  0x00000032:   DW_TAG_variable
                  DW_AT_name      (".str")
                  DW_AT_type      (0x0000003e ".str")
                  DW_AT_decl_file ("/tmp/file.c")
                  DW_AT_decl_line (3)
                  DW_AT_location  (DW_OP_addrx 0x1)
                  DW_AT_linkage_name      (".str")

(and obviously an entry in the `.debug_addr` referenced by the `DW_AT_location` at index `0x1`)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123534/new/

https://reviews.llvm.org/D123534



More information about the cfe-commits mailing list