mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-01 21:03:54 +00:00
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
This commit is contained in:
parent
5a0fabae5a
commit
b1fcfbe89b
@ -328,6 +328,12 @@ namespace llvm {
|
||||
void EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
|
||||
const MCSymbol *Lo, unsigned Size) const;
|
||||
|
||||
/// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
|
||||
/// where the size in bytes of the directive is specified by Size and Label
|
||||
/// specifies the label. This implicitly uses .set if it is available.
|
||||
void EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
||||
unsigned Size) const;
|
||||
|
||||
//===------------------------------------------------------------------===//
|
||||
// Dwarf Emission Helper Routines
|
||||
//===------------------------------------------------------------------===//
|
||||
|
@ -259,6 +259,10 @@ namespace llvm {
|
||||
/// absolute label instead of offset.
|
||||
bool DwarfUsesAbsoluteLabelForStmtList; // Defaults to true;
|
||||
|
||||
// DwarfUsesLabelOffsetDifference - True if Dwarf2 output can
|
||||
// use EmitLabelOffsetDifference.
|
||||
bool DwarfUsesLabelOffsetForRanges;
|
||||
|
||||
//===--- CBE Asm Translation Table -----------------------------------===//
|
||||
|
||||
const char *const *AsmTransCBE; // Defaults to empty
|
||||
@ -424,6 +428,9 @@ namespace llvm {
|
||||
bool doesDwarfUsesAbsoluteLabelForStmtList() const {
|
||||
return DwarfUsesAbsoluteLabelForStmtList;
|
||||
}
|
||||
bool doesDwarfUsesLabelOffsetForRanges() const {
|
||||
return DwarfUsesLabelOffsetForRanges;
|
||||
}
|
||||
const char *const *getAsmCBE() const {
|
||||
return AsmTransCBE;
|
||||
}
|
||||
|
@ -1218,6 +1218,29 @@ void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
|
||||
OutStreamer.EmitSymbolValue(SetLabel, 4, 0/*AddrSpace*/);
|
||||
}
|
||||
}
|
||||
|
||||
/// EmitLabelPlusOffset - Emit something like ".long Label+Offset"
|
||||
/// where the size in bytes of the directive is specified by Size and Label
|
||||
/// specifies the label. This implicitly uses .set if it is available.
|
||||
void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
||||
unsigned Size)
|
||||
const {
|
||||
|
||||
// Emit Label+Offset
|
||||
const MCExpr *Plus =
|
||||
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Label, OutContext),
|
||||
MCConstantExpr::Create(Offset, OutContext),
|
||||
OutContext);
|
||||
|
||||
if (!MAI->hasSetDirective())
|
||||
OutStreamer.EmitValue(Plus, 4, 0/*AddrSpace*/);
|
||||
else {
|
||||
// Otherwise, emit with .set (aka assignment).
|
||||
MCSymbol *SetLabel = GetTempSymbol("set", SetCounter++);
|
||||
OutStreamer.EmitAssignment(SetLabel, Plus);
|
||||
OutStreamer.EmitSymbolValue(SetLabel, 4, 0/*AddrSpace*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -3130,10 +3130,17 @@ void DwarfDebug::emitDIE(DIE *Die) {
|
||||
case dwarf::DW_AT_ranges: {
|
||||
// DW_AT_range Value encodes offset in debug_range section.
|
||||
DIEInteger *V = cast<DIEInteger>(Values[i]);
|
||||
Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
|
||||
V->getValue(),
|
||||
DwarfDebugRangeSectionSym,
|
||||
4);
|
||||
|
||||
if (Asm->MAI->doesDwarfUsesLabelOffsetForRanges()) {
|
||||
Asm->EmitLabelPlusOffset(DwarfDebugRangeSectionSym,
|
||||
V->getValue(),
|
||||
4);
|
||||
} else {
|
||||
Asm->EmitLabelOffsetDifference(DwarfDebugRangeSectionSym,
|
||||
V->getValue(),
|
||||
DwarfDebugRangeSectionSym,
|
||||
4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case dwarf::DW_AT_location: {
|
||||
|
@ -70,6 +70,7 @@ MCAsmInfo::MCAsmInfo() {
|
||||
DwarfUsesInlineInfoSection = false;
|
||||
DwarfUsesAbsoluteLabelForStmtList = true;
|
||||
DwarfSectionOffsetDirective = 0;
|
||||
DwarfUsesLabelOffsetForRanges = true;
|
||||
HasMicrosoftFastStdCallMangling = false;
|
||||
|
||||
AsmTransCBE = 0;
|
||||
|
@ -46,5 +46,6 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
|
||||
HasNoDeadStrip = true;
|
||||
|
||||
DwarfUsesAbsoluteLabelForStmtList = false;
|
||||
DwarfUsesLabelOffsetForRanges = false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user