summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31bd14f)
raw | patch | inline | side by side (parent: 31bd14f)
author | David Blaikie <dblaikie@gmail.com> | |
Thu, 20 Mar 2014 17:05:45 +0000 (17:05 +0000) | ||
committer | David Blaikie <dblaikie@gmail.com> | |
Thu, 20 Mar 2014 17:05:45 +0000 (17:05 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204358 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfDebug.cpp | patch | blob | history | |
test/DebugInfo/lto-comp-dir.ll | patch | blob | history |
index 6925cb6bdde88e4e7e230bd3d46271822b01d90f..e8055d7cf7ca5990d55b3ced928a9bd7dea2bc68 100644 (file)
@@ -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);
index eeaf4c0a658f8ec92acc05d2c375bf4c4c2f3ab9..d272dff6ea82b17ed4015342894d313857c9d25a 100644 (file)
; 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
; 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"