diff options
author | Devang Patel <dpatel@apple.com> | 2010-12-03 00:10:48 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-12-03 00:10:48 +0000 |
commit | 5eed2e63f829c9aa437aca7ee014df17711205e3 (patch) | |
tree | c268859bd4c3bcf563fba548fe36687f8489400f /llvm/lib/MC/MCDwarf.cpp | |
parent | 8c4c74f4fb2495dfd28c4b613ce5ec5a29587b94 (diff) | |
download | bcm5719-llvm-5eed2e63f829c9aa437aca7ee014df17711205e3.tar.gz bcm5719-llvm-5eed2e63f829c9aa437aca7ee014df17711205e3.zip |
It may not be an option to skip .debug_line if there are file reference in already emitted debug info. So, for now, emit dummy line table entry to make older linker and assemblers happy. This is not a new behavior, original AsmPrinter emitted similar line table entries.
llvm-svn: 120760
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 0daf2959e33..5fe73e2810a 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -241,7 +241,8 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS, void MCDwarfFileTable::Emit(MCStreamer *MCOS, const MCSection *DwarfLineSection, MCSectionData *DLS, - int PointerSize) { + int PointerSize, + const MCSection *TextSection) { // Switch to the section where the table will be emitted into. MCOS->SwitchSection(DwarfLineSection); @@ -339,6 +340,23 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS, delete Line; } + if (TextSection && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) { + // Emit dummy entry if line table is empty. + + MCOS->SwitchSection(TextSection); + MCSymbol *SectionEnd = MCOS->getContext().CreateTempSymbol(); + // Set the value of the symbol, as we are at the end of the section. + MCOS->EmitLabel(SectionEnd); + + // Switch back the the dwarf line section. + MCOS->SwitchSection(DwarfLineSection); + + // emit the sequence to set the address + EmitDwarfSetAddress(MCOS, SectionEnd, PointerSize); + // emit the sequence for the LineDelta (from 1) and a zero address delta. + MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0); + } + // This is the end of the section, so set the value of the symbol at the end // of this section (that was used in a previous expression). MCOS->EmitLabel(LineEndSym); |