diff options
| author | Pavel Labath <labath@google.com> | 2018-01-17 11:52:13 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2018-01-17 11:52:13 +0000 |
| commit | 67530e478baefc0fcbdf3f553d2b13f765e967c8 (patch) | |
| tree | 8be676abf0e91ab08a235eb138079b15a07c9604 /llvm | |
| parent | e6269e3509348602f356b308c9be450cd34f2d55 (diff) | |
| download | bcm5719-llvm-67530e478baefc0fcbdf3f553d2b13f765e967c8.tar.gz bcm5719-llvm-67530e478baefc0fcbdf3f553d2b13f765e967c8.zip | |
Don't emit apple accelerator tables on non-darwin targets
Summary:
Currently -glldb turns on emission of apple tables on all targets, but
lldb is only really capable of consuming them on darwin. Furthermore,
making lldb consume these tables is not straight-forward because of the
differences in how the debug info is distributed on darwin vs. elf
targets.
The darwin debug model assumes that the debug info (along with
accelerator tables) will either remain in the .o files or it will be
linked into a dsym bundle by a linker that knows how to merge these
tables. In the elf world, all present linkers will simply concatenate
these accelerator tables into the shared object. Since the tables are
not self-terminating, this renders the tables unusable, as the debugger
cannot pry the individual tables apart anymore.
It might theoretically be possible to make the tables work with split
dwarf, as that is somewhat similar to the apple .o model, but
unfortunately right now the combination of -glldb and -gsplit-dwarf
produces broken object files.
Until these issues are resolved there is no point in emitting the apple
tables for these targets. At best, it wastes space; at worst, it breaks
compilation and prevents the user from getting other benefits of -glldb.
Reviewers: probinson, aprantl, dblaikie
Subscribers: emaste, dim, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D41986
llvm-svn: 322633
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 6 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/accel-tables.ll | 49 |
2 files changed, 53 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index bd40c9ed720..1e098ccfbc9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -288,9 +288,11 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M) else DebuggerTuning = DebuggerKind::GDB; - // Turn on accelerator tables for LLDB by default. + // Turn on accelerator tables by default, if tuning for LLDB and the target is + // supported. if (DwarfAccelTables == Default) - HasDwarfAccelTables = tuneForLLDB(); + HasDwarfAccelTables = + tuneForLLDB() && A->TM.getTargetTriple().isOSBinFormatMachO(); else HasDwarfAccelTables = DwarfAccelTables == Enable; diff --git a/llvm/test/DebugInfo/X86/accel-tables.ll b/llvm/test/DebugInfo/X86/accel-tables.ll new file mode 100644 index 00000000000..ae9de037ee8 --- /dev/null +++ b/llvm/test/DebugInfo/X86/accel-tables.ll @@ -0,0 +1,49 @@ +; Verify the emission of accelerator tables for various targets. + +; Darwin has the tables unless we specifically tune for gdb +; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s | llvm-readobj -sections - | FileCheck --check-prefix=CHECK1 %s +; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s | llvm-readobj -sections - | FileCheck --check-prefix=CHECK2 %s + +; Linux does not have the tables even if we explicitly tune for lldb +; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s | llvm-readobj -sections - | FileCheck --check-prefix=CHECK2 %s +; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s | llvm-readobj -sections - | FileCheck --check-prefix=CHECK2 %s + +; CHECK1: apple_names + +; CHECK2-NOT: apple_names + +@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) +!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, variables: !4) +!12 = !DISubroutineType(types: !13) +!13 = !{null} +!14 = !DILocation(line: 2, column: 13, scope: !11) + |

