}
void DWARFContext::parseCompileUnits() {
- CUs.parse(*this, getInfoSection().Data, getInfoSection().Relocs);
+ CUs.parse(*this, getInfoSection());
}
void DWARFContext::parseTypeUnits() {
return;
for (const auto &I : getTypesSections()) {
TUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
- TUs.back().parse(*this, I.second.Data, I.second.Relocs);
+ TUs.back().parse(*this, I.second);
}
}
void DWARFContext::parseDWOCompileUnits() {
- DWOCUs.parseDWO(*this, getInfoDWOSection().Data, getInfoDWOSection().Relocs);
+ DWOCUs.parseDWO(*this, getInfoDWOSection());
}
void DWARFContext::parseDWOTypeUnits() {
return;
for (const auto &I : getTypesDWOSections()) {
DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
- DWOTUs.back().parseDWO(*this, I.second.Data, I.second.Relocs);
+ DWOTUs.back().parseDWO(*this, I.second);
}
}
return true;
}
-DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
+DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj)
: IsLittleEndian(Obj.isLittleEndian()),
AddressSize(Obj.getBytesInAddress()) {
for (const SectionRef &Section : Obj.sections()) {
StringRef name;
Section.getName(name);
// Skip BSS and Virtual sections, they aren't interesting.
- bool IsBSS;
- Section.isBSS(IsBSS);
+ bool IsBSS = Section.isBSS();
if (IsBSS)
continue;
- bool IsVirtual;
- Section.isVirtual(IsVirtual);
+ bool IsVirtual = Section.isVirtual();
if (IsVirtual)
continue;
StringRef data;
}
if (Section.relocation_begin() != Section.relocation_end()) {
- uint64_t SectionSize;
- RelocatedSection->getSize(SectionSize);
+ uint64_t SectionSize = RelocatedSection->getSize();
for (const RelocationRef &Reloc : Section.relocations()) {
uint64_t Address;
Reloc.getOffset(Address);
uint64_t Type;
Reloc.getType(Type);
uint64_t SymAddr = 0;
- // ELF relocations may need the symbol address
- if (Obj.isELF()) {
- object::symbol_iterator Sym = Reloc.getSymbol();
+ object::symbol_iterator Sym = Reloc.getSymbol();
+ if (Sym != Obj.symbol_end())
Sym->getAddress(SymAddr);
- }
- object::RelocVisitor V(Obj.getFileFormatName());
- // The section address is always 0 for debug sections.
- object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr));
+ object::RelocVisitor V(Obj);
+ object::RelocToApply R(V.visit(Type, Reloc, SymAddr));
if (V.error()) {
SmallString<32> Name;
std::error_code ec(Reloc.getTypeName(Name));