[PATCH] D99850: [WIP/RFC] lld LTO drops variables in namespaces from .debug_names

Jan Kratochvil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 4 15:29:28 PDT 2021


jankratochvil updated this revision to Diff 335180.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99850

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test
  llvm/test/DebugInfo/X86/unattached-global.ll


Index: llvm/test/DebugInfo/X86/unattached-global.ll
===================================================================
--- llvm/test/DebugInfo/X86/unattached-global.ll
+++ llvm/test/DebugInfo/X86/unattached-global.ll
@@ -5,14 +5,14 @@
 
 ; CHECK: DW_TAG_variable
 ; CHECK: DW_AT_name {{.*}}"a"
-; CHECK-NOT: DW_AT_location
+; CHECK: DW_AT_location{{ *}}()
 ; CHECK: DW_TAG
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !5, globals: !1, emissionKind: FullDebug)
 !1 = !{!2}
 !2 = !DIGlobalVariableExpression(var: !3, expr: !4)
 !3 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false, isDefinition: true, type: !6)
-!4 = !DIExpression(DW_OP_plus_uconst, 4)
+!4 = !DIExpression()
 !5 = !DIFile(filename: "<stdin>", directory: "/")
 !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
 
Index: llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/Generic/debug-names-namespace-lto.test
@@ -0,0 +1,10 @@
+RUN: echo 'namespace N { int varname; } extern "C" void _start(){}' | clang++ -Wall -Werror -gdwarf-5 -gpubnames -fuse-ld=lld -nostdlib -o %t -flto -x c++ -
+RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
+
+UNSUPPORTED: cygwin,windows-gnu,windows-msvc
+
+CHECK: String: 0x{{[0-9a-f]*}} "varname"
+CHECK-NEXT: Entry
+CHECK-NEXT: Abbrev:
+CHECK-NEXT: Tag: DW_TAG_variable
+CHECK-NEXT: DW_IDX_die_offset: 0x{{[0-9a-f]*}}
Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -227,10 +227,6 @@
     if (Global && Global->hasDLLImportStorageClass())
       continue;
 
-    // Nothing to describe without address or constant.
-    if (!Global && (!Expr || !Expr->isConstant()))
-      continue;
-
     if (Global && Global->isThreadLocal() &&
         !Asm->getObjFileLowering().supportDebugThreadLocalLocation())
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99850.335180.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210404/157d3506/attachment.bin>


More information about the llvm-commits mailing list