llvm.org GIT mirror llvm / b1fcfbe
Fix .debug_range for linux. Patch by Krister Wombell. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112830 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 10 years ago
6 changed file(s) with 49 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
327327 void EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
328328 const MCSymbol *Lo, unsigned Size) const;
329329
330 /// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
331 /// where the size in bytes of the directive is specified by Size and Label
332 /// specifies the label. This implicitly uses .set if it is available.
333 void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
334 unsigned Size) const;
335
330336 //===------------------------------------------------------------------===//
331337 // Dwarf Emission Helper Routines
332338 //===------------------------------------------------------------------===//
258258 /// absolute label instead of offset.
259259 bool DwarfUsesAbsoluteLabelForStmtList; // Defaults to true;
260260
261 // DwarfUsesLabelOffsetDifference - True if Dwarf2 output can
262 // use EmitLabelOffsetDifference.
263 bool DwarfUsesLabelOffsetForRanges;
264
261265 //===--- CBE Asm Translation Table -----------------------------------===//
262266
263267 const char *const *AsmTransCBE; // Defaults to empty
423427 bool doesDwarfUsesAbsoluteLabelForStmtList() const {
424428 return DwarfUsesAbsoluteLabelForStmtList;
425429 }
430 bool doesDwarfUsesLabelOffsetForRanges() const {
431 return DwarfUsesLabelOffsetForRanges;
432 }
426433 const char *const *getAsmCBE() const {
427434 return AsmTransCBE;
428435 }
12171217 OutStreamer.EmitSymbolValue(SetLabel, 4, 0/*AddrSpace*/);
12181218 }
12191219 }
1220
1221 /// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
1222 /// where the size in bytes of the directive is specified by Size and Label
1223 /// specifies the label. This implicitly uses .set if it is available.
1224 void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
1225 unsigned Size)
1226 const {
1227
1228 // Emit Label+Offset
1229 const MCExpr *Plus =
1230 MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Label, OutContext),
1231 MCConstantExpr::Create(Offset, OutContext),
1232 OutContext);
1233
1234 if (!MAI->hasSetDirective())
1235 OutStreamer.EmitValue(Plus, 4, 0/*AddrSpace*/);
1236 else {
1237 // Otherwise, emit with .set (aka assignment).
1238 MCSymbol *SetLabel = GetTempSymbol("set", SetCounter++);
1239 OutStreamer.EmitAssignment(SetLabel, Plus);
1240 OutStreamer.EmitSymbolValue(SetLabel, 4, 0/*AddrSpace*/);
1241 }
1242 }
12201243
12211244
12221245 //===----------------------------------------------------------------------===//
31293129 case dwarf::DW_AT_ranges: {
31303130 // DW_AT_range Value encodes offset in debug_range section.
31313131 DIEInteger *V = cast(Values[i]);
3132 Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
3133 V->getValue(),
3134 DwarfDebugRangeSectionSym,
3135 4);
3132
3133 if (Asm->MAI->doesDwarfUsesLabelOffsetForRanges()) {
3134 Asm->EmitLabelPlusOffset(DwarfDebugRangeSectionSym,
3135 V->getValue(),
3136 4);
3137 } else {
3138 Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
3139 V->getValue(),
3140 DwarfDebugRangeSectionSym,
3141 4);
3142 }
31363143 break;
31373144 }
31383145 case dwarf::DW_AT_location: {
6969 DwarfUsesInlineInfoSection = false;
7070 DwarfUsesAbsoluteLabelForStmtList = true;
7171 DwarfSectionOffsetDirective = 0;
72 DwarfUsesLabelOffsetForRanges = true;
7273 HasMicrosoftFastStdCallMangling = false;
7374
7475 AsmTransCBE = 0;
4545 HasNoDeadStrip = true;
4646
4747 DwarfUsesAbsoluteLabelForStmtList = false;
48 DwarfUsesLabelOffsetForRanges = false;
4849 }
4950