summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-04-23 19:00:45 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-04-23 19:00:45 +0000
commit2f51176223f19dde7fd90e97c203649aefb35310 (patch)
tree44b2e8406a827ac26a78699d0eada5e1376be88f
parent867bc3951bff977f930ca2451e9d1d3548587522 (diff)
downloadbcm5719-llvm-2f51176223f19dde7fd90e97c203649aefb35310.tar.gz
bcm5719-llvm-2f51176223f19dde7fd90e97c203649aefb35310.zip
Reapply: "DebugInfo: Emit only one kind of accelerated access/name table""
Originally committed in r358931 Reverted in r358997 Seems this change made Apple accelerator tables miss names (because names started respecting the CU NameTableKind GNU & assuming that shouldn't produce accelerated names too), which is never correct (apple accelerator tables don't have separators or CU lists - if present, they must describe all names in all CUs). Original Description: Currently to opt in to debug_names in DWARFv5, the IR must contain 'nameTableKind: Default' which also enables debug_pubnames. Instead, only allow one of {debug_names, apple_names, debug_pubnames, debug_gnu_pubnames}. nameTableKind: Default gives debug_names in DWARFv5 and greater, debug_pubnames in v4 and earlier - and apple_names when tuning for lldb on MachO. nameTableKind: GNU always gives gnu_pubnames llvm-svn: 359026
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp2
-rw-r--r--llvm/test/DebugInfo/X86/accel-tables.ll14
-rw-r--r--llvm/test/DebugInfo/X86/gnu-names.ll78
5 files changed, 96 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
index c4eef7ad722..b5617f46ddd 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp
@@ -555,8 +555,8 @@ void llvm::emitDWARF5AccelTable(
SmallVector<unsigned, 1> CUIndex(CUs.size());
int Count = 0;
for (const auto &CU : enumerate(CUs)) {
- if (CU.value()->getCUNode()->getNameTableKind() ==
- DICompileUnit::DebugNameTableKind::None)
+ if (CU.value()->getCUNode()->getNameTableKind() !=
+ DICompileUnit::DebugNameTableKind::Default)
continue;
CUIndex[CU.index()] = Count++;
assert(CU.index() == CU.value()->getUniqueID());
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index c1e8ffec75a..0a06dfdae06 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1036,7 +1036,9 @@ bool DwarfCompileUnit::hasDwarfPubSections() const {
return true;
case DICompileUnit::DebugNameTableKind::Default:
return DD->tuneForGDB() && !includeMinimalInlineScopes() &&
- !CUNode->isDebugDirectivesOnly();
+ !CUNode->isDebugDirectivesOnly() &&
+ DD->getAccelTableKind() != AccelTableKind::Apple &&
+ DD->getDwarfVersion() < 5;
}
llvm_unreachable("Unhandled DICompileUnit::DebugNameTableKind enum");
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index b18ee18d7a3..816dd5b66e1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2761,7 +2761,7 @@ void DwarfDebug::addAccelNameImpl(const DICompileUnit &CU,
return;
if (getAccelTableKind() != AccelTableKind::Apple &&
- CU.getNameTableKind() == DICompileUnit::DebugNameTableKind::None)
+ CU.getNameTableKind() != DICompileUnit::DebugNameTableKind::Default)
return;
DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
diff --git a/llvm/test/DebugInfo/X86/accel-tables.ll b/llvm/test/DebugInfo/X86/accel-tables.ll
index 813b66f1aeb..1aef33c33e7 100644
--- a/llvm/test/DebugInfo/X86/accel-tables.ll
+++ b/llvm/test/DebugInfo/X86/accel-tables.ll
@@ -4,11 +4,11 @@
; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
-; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=PUB %s
; Linux does has debug_names tables only if we explicitly tune for lldb
; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
-; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=PUB %s
; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=DEBUG_NAMES %s
@@ -23,15 +23,25 @@
; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
; APPLE-NOT: debug_names
+; APPLE-NOT: debug{{.*}}pub
; APPLE: apple_names
; APPLE-NOT: debug_names
+; APPLE-NOT: debug{{.*}}pub
+
+; PUB-NOT: apple_names
+; PUB-NOT: debug_names
+; PUB: pubnames
+; PUB-NOT: apple_names
+; PUB-NOT: debug_names
; NONE-NOT: apple_names
; NONE-NOT: debug_names
; DEBUG_NAMES-NOT: apple_names
+; DEBUG_NAMES-NOT: pubnames
; DEBUG_NAMES: debug_names
; DEBUG_NAMES-NOT: apple_names
+; DEBUG_NAMES-NOT: pubnames
@var = thread_local global i32 0, align 4, !dbg !0
diff --git a/llvm/test/DebugInfo/X86/gnu-names.ll b/llvm/test/DebugInfo/X86/gnu-names.ll
new file mode 100644
index 00000000000..502d15d75ca
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/gnu-names.ll
@@ -0,0 +1,78 @@
+; Verify the emission of accelerator tables for various targets for the DWARF<=4 case
+
+; Darwin has the apple tables unless we specifically tune for gdb
+; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s > %t
+; RUN: llvm-readobj -sections %t | FileCheck --check-prefix=APPLE %s
+; RUN: llvm-dwarfdump -apple-names %t | FileCheck --check-prefix=APPLE-NAMES %s
+; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
+
+; Linux does has debug_names tables only if we explicitly tune for lldb
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=GNU %s
+
+; No accelerator tables if type units are enabled, as DWARF v4 type units are
+; not compatible with accelerator tables.
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units -debugger-tune=lldb < %s \
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=NONE %s
+
+; Debug types are ignored for non-ELF targets which means it shouldn't affect
+; accelerator table generation.
+; RUN: llc -mtriple=x86_64-apple-darwin12 -generate-type-units -filetype=obj < %s \
+; RUN: | llvm-readobj -sections - | FileCheck --check-prefix=APPLE %s
+
+; APPLE-NOT: debug_names
+; APPLE-NOT: debug{{.*}}pub
+; APPLE: apple_names
+; APPLE-NOT: debug_names
+; APPLE: debug{{.*}}pub
+
+; APPLE-NAMES: Hashes count: 3
+
+; GNU-NOT: apple_names
+; GNU-NOT: debug_names
+; GNU: gnu_pub
+; GNU-NOT: apple_names
+; GNU-NOT: debug_names
+
+; NONE-NOT: apple_names
+; NONE-NOT: debug_names
+; NONE: debug_gnu_pub
+
+@var = thread_local global i32 0, align 4, !dbg !0
+
+; Function Attrs: norecurse nounwind readnone uwtable
+define void @_Z3funv() local_unnamed_addr #0 !dbg !11 {
+ ret void, !dbg !14
+}
+
+; Function Attrs: norecurse uwtable
+define weak_odr hidden i32* @_ZTW3var() local_unnamed_addr #1 {
+ ret i32* @var
+}
+
+attributes #0 = { norecurse nounwind readnone uwtable }
+attributes #1 = { norecurse uwtable }
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!7, !8, !9}
+!llvm.ident = !{!10}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "var", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: GNU)
+!3 = !DIFile(filename: "debugger-tune.cpp", directory: "/tmp")
+!4 = !{}
+!5 = !{!0}
+!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!7 = !{i32 2, !"Dwarf Version", i32 4}
+!8 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{i32 1, !"wchar_size", i32 4}
+!10 = !{!"clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)"}
+!11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 2, type: !12, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
+!12 = !DISubroutineType(types: !13)
+!13 = !{null}
+!14 = !DILocation(line: 2, column: 13, scope: !11)
+
OpenPOWER on IntegriCloud