mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
In Dwarf 3 (and Dwarf 2) attributes whose value are offsets into a
section use the form DW_FORM_data4 whilst in Dwarf 4 and later they use the form DW_FORM_sec_offset. This patch updates the places where such attributes are generated to use the appropriate form depending on the Dwarf version. The DIE entries affected have the following tags: DW_AT_stmt_list, DW_AT_ranges, DW_AT_location, DW_AT_GNU_pubnames, DW_AT_GNU_pubtypes, DW_AT_GNU_addr_base, DW_AT_GNU_ranges_base It also adds a hidden command line option "--dwarf-version=<uint>" to llc which allows the version of Dwarf to be generated to override what is specified in the metadata; this makes it possible to update existing tests to check the debugging information generated for both Dwarf 4 (the default) and Dwarf 3 using the same metadata. Patch (slightly modified) by Keith Walker! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195391 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -245,6 +245,26 @@ void CompileUnit::addLabel(DIEBlock *Die, dwarf::Form Form,
|
||||
addLabel(Die, (dwarf::Attribute)0, Form, Label);
|
||||
}
|
||||
|
||||
/// addSectionLabel - Add a Dwarf section label attribute data and value.
|
||||
///
|
||||
void CompileUnit::addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Label) {
|
||||
if (DD->getDwarfVersion() >= 4)
|
||||
addLabel(Die, Attribute, dwarf::DW_FORM_sec_offset, Label);
|
||||
else
|
||||
addLabel(Die, Attribute, dwarf::DW_FORM_data4, Label);
|
||||
}
|
||||
|
||||
/// addSectionOffset - Add an offset into a section attribute data and value.
|
||||
///
|
||||
void CompileUnit::addSectionOffset(DIE *Die, dwarf::Attribute Attribute,
|
||||
uint64_t Integer) {
|
||||
if (DD->getDwarfVersion() >= 4)
|
||||
addUInt(Die, Attribute, dwarf::DW_FORM_sec_offset, Integer);
|
||||
else
|
||||
addUInt(Die, Attribute, dwarf::DW_FORM_data4, Integer);
|
||||
}
|
||||
|
||||
/// addLabelAddress - Add a dwarf label attribute data and value using
|
||||
/// DW_FORM_addr or DW_FORM_GNU_addr_index.
|
||||
///
|
||||
@@ -282,13 +302,15 @@ void CompileUnit::addOpAddress(DIEBlock *Die, const MCSymbol *Sym) {
|
||||
}
|
||||
}
|
||||
|
||||
/// addDelta - Add a label delta attribute data and value.
|
||||
/// addSectionDelta - Add a section label delta attribute data and value.
|
||||
///
|
||||
void CompileUnit::addDelta(DIE *Die, dwarf::Attribute Attribute,
|
||||
dwarf::Form Form, const MCSymbol *Hi,
|
||||
const MCSymbol *Lo) {
|
||||
void CompileUnit::addSectionDelta(DIE *Die, dwarf::Attribute Attribute,
|
||||
const MCSymbol *Hi, const MCSymbol *Lo) {
|
||||
DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);
|
||||
Die->addValue(Attribute, Form, Value);
|
||||
if (DD->getDwarfVersion() >= 4)
|
||||
Die->addValue(Attribute, dwarf::DW_FORM_sec_offset, Value);
|
||||
else
|
||||
Die->addValue(Attribute, dwarf::DW_FORM_data4, Value);
|
||||
}
|
||||
|
||||
/// addDIEEntry - Add a DIE attribute data and value.
|
||||
@@ -1814,10 +1836,8 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable &DV, bool isScopeAbstract) {
|
||||
|
||||
unsigned Offset = DV.getDotDebugLocOffset();
|
||||
if (Offset != ~0U) {
|
||||
addLabel(VariableDie, dwarf::DW_AT_location,
|
||||
DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
|
||||
: dwarf::DW_FORM_data4,
|
||||
Asm->GetTempSymbol("debug_loc", Offset));
|
||||
addSectionLabel(VariableDie, dwarf::DW_AT_location,
|
||||
Asm->GetTempSymbol("debug_loc", Offset));
|
||||
DV.setDIE(VariableDie);
|
||||
return VariableDie;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user