[all-commits] [llvm/llvm-project] 89424a: [DWARF] Support new TAG DW_TAG_LLVM_annotation

yonghong-song via All-commits all-commits at lists.llvm.org
Tue Aug 31 19:22:38 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 89424a829f3c194177411c922c7050946891fff4
      https://github.com/llvm/llvm-project/commit/89424a829f3c194177411c922c7050946891fff4
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

  Changed paths:
    M llvm/include/llvm/BinaryFormat/Dwarf.def
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
    A llvm/test/DebugInfo/attr-btf_tag.ll

  Log Message:
  -----------
  [DWARF] Support new TAG DW_TAG_LLVM_annotation

A new LLVM specific TAG DW_TAG_LLVM_annotation is added.
The name is suggested by Paul Robinson ([1]).
Currently, this tag is used to output __attribute__((btf_tag("string")))
annotations in dwarf. The following is an example for a global
variable with two btf_tag attributes:
  0x0000002a:   DW_TAG_variable
                  DW_AT_name      ("g1")
                  DW_AT_type      (0x00000052 "int")
                  DW_AT_external  (true)
                  DW_AT_decl_file ("/tmp/home/yhs/work/tests/llvm/btf_tag/t.c")
                  DW_AT_decl_line (8)
                  DW_AT_location  (DW_OP_addr 0x0)

  0x0000003f:     DW_TAG_LLVM_annotation
                    DW_AT_name    ("btf_tag")
                    DW_AT_const_value     ("tag1")

  0x00000048:     DW_TAG_LLVM_annotation
                    DW_AT_name    ("btf_tag")
                    DW_AT_const_value     ("tag2")

  0x00000051:     NULL

In the future, DW_TAG_LLVM_annotation may encode other type
of non-string const value.

 [1] https://lists.llvm.org/pipermail/llvm-dev/2021-June/151250.html

Differential Revision: https://reviews.llvm.org/D106621




More information about the All-commits mailing list