1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[DebugInfo] Use a common method to determine a suitable form for section offsts (6/19).

This is mostly an NFC patch because the involved methods are used when
emitting DWO files, which is incompatible with DWARFv3, or for platforms
where DWARF64 is not supported yet.

Differential Revision: https://reviews.llvm.org/D87015
This commit is contained in:
Igor Kudrin 2020-09-15 11:30:38 +07:00
parent a68bb0aa01
commit 4a475ed16e
3 changed files with 6 additions and 6 deletions

View File

@ -550,6 +550,8 @@ unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {
switch (Form) {
case dwarf::DW_FORM_data4:
return 4;
case dwarf::DW_FORM_data8:
return 8;
case dwarf::DW_FORM_sec_offset:
return AP->getDwarfOffsetByteSize();
default:

View File

@ -300,10 +300,7 @@ void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {
void DwarfUnit::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);
addUInt(Die, Attribute, DD->getDwarfSectionOffsetForm(), Integer);
}
unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) {
@ -1750,8 +1747,7 @@ DIE::value_iterator
DwarfUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
const MCSymbol *Hi, const MCSymbol *Lo) {
return Die.addValue(DIEValueAllocator, Attribute,
DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset
: dwarf::DW_FORM_data4,
DD->getDwarfSectionOffsetForm(),
new (DIEValueAllocator) DIEDelta(Hi, Lo));
}

View File

@ -162,8 +162,10 @@ INSTANTIATE_TEST_CASE_P(
DIETestParams, DIEDeltaFixture,
testing::Values(
DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_data4, 4u},
DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_data8, 8u},
DIETestParams{4, dwarf::DWARF32, dwarf::DW_FORM_sec_offset, 4u},
DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_data4, 4u},
DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_data8, 8u},
DIETestParams{4, dwarf::DWARF64, dwarf::DW_FORM_sec_offset, 8u}), );
struct DIELocListFixture : public DIEFixtureBase {