[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
Showing
- llvm/include/llvm/BinaryFormat/Dwarf.def 3 additions, 0 deletionsllvm/include/llvm/BinaryFormat/Dwarf.def
- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp 5 additions, 1 deletionllvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp 23 additions, 0 deletionsllvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h 3 additions, 0 deletionsllvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
- llvm/test/DebugInfo/attr-btf_tag.ll 135 additions, 0 deletionsllvm/test/DebugInfo/attr-btf_tag.ll
Loading
Please register or sign in to comment