diff options
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 | ||||
-rw-r--r-- | test/DebugInfo/X86/block-capture.ll | 2 | ||||
-rw-r--r-- | test/DebugInfo/X86/op_deref.ll | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 2adbeb9f6b..c85d7b21c4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -1772,7 +1772,9 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) { unsigned Offset = DV.getDotDebugLocOffset(); if (Offset != ~0U) { - addLabel(VariableDie, dwarf::DW_AT_location, dwarf::DW_FORM_data4, + addLabel(VariableDie, dwarf::DW_AT_location, + DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset + : dwarf::DW_FORM_data4, Asm->GetTempSymbol("debug_loc", Offset)); DV.setDIE(VariableDie); return VariableDie; diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index f8b2609396..20e61cd4c9 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2118,7 +2118,7 @@ void DwarfDebug::emitDIE(DIE *Die, ArrayRef<DIEAbbrev *> Abbrevs) { case dwarf::DW_AT_location: { if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) { if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) - Asm->EmitLabelReference(L->getValue(), 4); + Asm->EmitSectionOffset(L->getValue(), DwarfDebugLocSectionSym); else Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4); } else { diff --git a/test/DebugInfo/X86/block-capture.ll b/test/DebugInfo/X86/block-capture.ll index a4acb10cd1..1853607f63 100644 --- a/test/DebugInfo/X86/block-capture.ll +++ b/test/DebugInfo/X86/block-capture.ll @@ -5,7 +5,7 @@ ; CHECK: DW_TAG_subprogram [3] ; CHECK: DW_TAG_variable [5] ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "block") -; CHECK: DW_AT_location [DW_FORM_data4] ({{.*}}) +; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}) %struct.__block_descriptor = type { i64, i64 } %struct.__block_literal_generic = type { i8*, i32, i32, i8*, %struct.__block_descriptor* } diff --git a/test/DebugInfo/X86/op_deref.ll b/test/DebugInfo/X86/op_deref.ll index 786737a63d..6cb44966d1 100644 --- a/test/DebugInfo/X86/op_deref.ll +++ b/test/DebugInfo/X86/op_deref.ll @@ -4,7 +4,7 @@ ; DW-CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla") ; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle ; DW_AT_location lists yet. -; DW-CHECK: DW_AT_location [DW_FORM_data4] (0x00000000) +; DW-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; Unfortunately llvm-dwarfdump can't unparse a list of DW_AT_locations ; right now, so we check the asm output: |