MC: correct DWARF header for PE/COFF assembly input

The header contains an offset to the DWARF line table for the CU.  The offset
must be section relative for COFF and absolute for others.  The non-assembly
code path for the DWARF header generation already has the correct emission for
the headers.  This corrects the assembly input path.

This was identified by BFD objecting to the LLVM generated DWARF information.

llvm-svn: 217222
This commit is contained in:
Saleem Abdulrasool 2014-09-05 04:15:00 +00:00
parent 1a486da543
commit 5c70de1072
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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: ]