aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-12-03 00:10:48 +0000
committerDevang Patel <dpatel@apple.com>2010-12-03 00:10:48 +0000
commit5113cdbfff7df4c7a79a92e5aa971126254202c6 (patch)
treebb4a12f7f5324158308fbb6b3db9b7636ad2a2aa /lib
parent3fda44f276647bc43c283268907bac605a8f7eb5 (diff)
downloadexternal_llvm-5113cdbfff7df4c7a79a92e5aa971126254202c6.zip
external_llvm-5113cdbfff7df4c7a79a92e5aa971126254202c6.tar.gz
external_llvm-5113cdbfff7df4c7a79a92e5aa971126254202c6.tar.bz2
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/MC/MCAsmStreamer.cpp4
-rw-r--r--lib/MC/MCDwarf.cpp20
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp
index 30a3105..49bcc93 100644
--- a/lib/MC/MCAsmStreamer.cpp
+++ b/lib/MC/MCAsmStreamer.cpp
@@ -885,9 +885,9 @@ void MCAsmStreamer::EmitRawText(StringRef String) {
void MCAsmStreamer::Finish() {
// Dump out the dwarf file & directory tables and line tables.
- if (getContext().hasDwarfFiles() && getContext().hasDwarfLines() && TLOF) {
+ if (getContext().hasDwarfFiles() && TLOF) {
MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(), NULL,
- PointerSize);
+ PointerSize, TLOF->getTextSection());
}
}
diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp
index 0daf295..5fe73e2 100644
--- a/lib/MC/MCDwarf.cpp
+++ b/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);