llvm.org GIT mirror llvm / 5113cdb
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 Devang Patel 8 years ago
4 changed file(s) with 23 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
178178
179179 bool hasDwarfFiles() const {
180180 return !MCDwarfFiles.empty();
181 }
182 bool hasDwarfLines() const {
183 return !MCLineSectionOrder.empty();
184181 }
185182
186183 const std::vector &getMCDwarfFiles() {
208208 // This emits the Dwarf file and the line tables.
209209 //
210210 static void Emit(MCStreamer *MCOS, const MCSection *DwarfLineSection,
211 MCSectionData *DLS, int PointerSize);
211 MCSectionData *DLS, int PointerSize,
212 const MCSection *TextSection = NULL);
212213 };
213214
214215 class MCDwarfLineAddr {
884884
885885 void MCAsmStreamer::Finish() {
886886 // Dump out the dwarf file & directory tables and line tables.
887 if (getContext().hasDwarfFiles() && getContext().hasDwarfLines() && TLOF) {
887 if (getContext().hasDwarfFiles() && TLOF) {
888888 MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(), NULL,
889 PointerSize);
889 PointerSize, TLOF->getTextSection());
890890 }
891891 }
892892
240240 void MCDwarfFileTable::Emit(MCStreamer *MCOS,
241241 const MCSection *DwarfLineSection,
242242 MCSectionData *DLS,
243 int PointerSize) {
243 int PointerSize,
244 const MCSection *TextSection) {
244245 // Switch to the section where the table will be emitted into.
245246 MCOS->SwitchSection(DwarfLineSection);
246247
338339 delete Line;
339340 }
340341
342 if (TextSection && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) {
343 // Emit dummy entry if line table is empty.
344
345 MCOS->SwitchSection(TextSection);
346 MCSymbol *SectionEnd = MCOS->getContext().CreateTempSymbol();
347 // Set the value of the symbol, as we are at the end of the section.
348 MCOS->EmitLabel(SectionEnd);
349
350 // Switch back the the dwarf line section.
351 MCOS->SwitchSection(DwarfLineSection);
352
353 // emit the sequence to set the address
354 EmitDwarfSetAddress(MCOS, SectionEnd, PointerSize);
355 // emit the sequence for the LineDelta (from 1) and a zero address delta.
356 MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0);
357 }
358
341359 // This is the end of the section, so set the value of the symbol at the end
342360 // of this section (that was used in a previous expression).
343361 MCOS->EmitLabel(LineEndSym);