diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index a592c094655..5bc0e43f59d 100644 --- a/lib/MC/MCDwarf.cpp +++ b/lib/MC/MCDwarf.cpp @@ -693,11 +693,11 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS, // DW_AT_stmt_list, a 4 byte offset from the start of the .debug_line section, // which is at the start of that section so this is zero. - if (LineSectionSymbol) { - MCOS->EmitSymbolValue(LineSectionSymbol, 4); - } else { + if (LineSectionSymbol) + MCOS->EmitSymbolValue(LineSectionSymbol, 4, + AsmInfo.needsDwarfSectionOffsetDirective()); + else MCOS->EmitIntValue(0, 4); - } if (RangesSectionSymbol) { // There are multiple sections containing code, so we must use the diff --git a/test/DebugInfo/X86/dbg-asm.s b/test/DebugInfo/X86/dbg-asm.s index 66a0292461d..de4e8e4a97b 100644 --- a/test/DebugInfo/X86/dbg-asm.s +++ b/test/DebugInfo/X86/dbg-asm.s @@ -12,11 +12,13 @@ _a: # CHECK-COFF: Relocations [ # CHECK-COFF: Section {{.*}} .debug_info { # CHECK-COFF: 0x6 IMAGE_REL_I386_SECREL .debug_abbrev +# CHECK-COFF: 0xC IMAGE_REL_I386_SECREL .debug_line # CHECK-COFF: } # CHECK-COFF: ] # CHECK-ELF: Relocations [ # CHECK-ELF: Section {{.*}} .rel.debug_info { # CHECK-ELF: 0x6 R_386_32 .debug_abbrev +# CHECK-ELF: 0xC R_386_32 .debug_line # CHECK-ELF: } # CHECK-ELF: ]