[llvm] r217222 - MC: correct DWARF header for PE/COFF assembly input
Saleem Abdulrasool
compnerd at compnerd.org
Thu Sep 4 21:15:01 PDT 2014
Author: compnerd
Date: Thu Sep 4 23:15:00 2014
New Revision: 217222
URL: http://llvm.org/viewvc/llvm-project?rev=217222&view=rev
Log:
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.
Modified:
llvm/trunk/lib/MC/MCDwarf.cpp
llvm/trunk/test/DebugInfo/X86/dbg-asm.s
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=217222&r1=217221&r2=217222&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Thu Sep 4 23:15:00 2014
@@ -693,11 +693,11 @@ static void EmitGenDwarfInfo(MCStreamer
// 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
Modified: llvm/trunk/test/DebugInfo/X86/dbg-asm.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-asm.s?rev=217222&r1=217221&r2=217222&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-asm.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-asm.s Thu Sep 4 23:15:00 2014
@@ -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: ]
More information about the llvm-commits
mailing list