diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-03-20 17:05:45 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-03-20 17:05:45 +0000 |
| commit | 7ac51493d6b892e8e27df8109b7855176c9d0246 (patch) | |
| tree | 01f8e4513591bb667aafaf951b1a9364a33231f0 | |
| parent | 99395fa98fa3246cfe301e50e810b4cb95f6ebb2 (diff) | |
| download | bcm5719-llvm-7ac51493d6b892e8e27df8109b7855176c9d0246.tar.gz bcm5719-llvm-7ac51493d6b892e8e27df8109b7855176c9d0246.zip | |
Add comments from Eric's review of r204094.
llvm-svn: 204358
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/lto-comp-dir.ll | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 6925cb6bdde..e8055d7cf7c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -688,6 +688,11 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) { DwarfCompileUnit *NewCU = new DwarfCompileUnit( InfoHolder.getUnits().size(), Die, DIUnit, Asm, this, &InfoHolder); InfoHolder.addUnit(NewCU); + + // LTO with assembly output shares a single line table amongst multiple CUs. + // To avoid the compilation directory being ambiguous, let the line table + // explicitly describe the directory of all files, never relying on the + // compilation directory. if (!Asm->OutStreamer.hasRawTextSupport() || SingleCU) Asm->OutStreamer.getContext().setMCLineTableCompilationDir( NewCU->getUniqueID(), CompilationDir); diff --git a/llvm/test/DebugInfo/lto-comp-dir.ll b/llvm/test/DebugInfo/lto-comp-dir.ll index eeaf4c0a658..d272dff6ea8 100644 --- a/llvm/test/DebugInfo/lto-comp-dir.ll +++ b/llvm/test/DebugInfo/lto-comp-dir.ll @@ -3,6 +3,10 @@ ; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-dump=line - | FileCheck %s ; RUN: %llc_dwarf < %s -filetype=asm | FileCheck --check-prefix=ASM %s +; If multiple line tables are emitted, one per CU, those line tables can +; unambiguously rely on the comp_dir of their owning CU and use directory '0' +; to refer to it. + ; CHECK: .debug_line contents: ; CHECK-NEXT: Line table prologue: ; CHECK-NOT: include_directories @@ -14,6 +18,11 @@ ; CHECK: file_names[ 1] 0 {{.*}} b.cpp ; CHECK-NOT: file_names +; However, if a single line table is emitted and shared between CUs, the +; comp_dir is ambiguous and relying on it would lead to different path +; interpretations depending on which CU lead to the table - so ensure that +; full paths are always emitted in this case, never comp_dir relative. + ; ASM: .file 1 "/tmp/dbginfo/a{{[/\\]+}}a.cpp" ; ASM: .file 2 "/tmp/dbginfo/b{{[/\\]+}}b.cpp" |

