[BOLT][NFC] Remove RewriteInstance::EHFrame

(cherry picked from FBD27915725)
This commit is contained in:
Maksim Panchenko 2021-04-21 11:24:15 -07:00
parent f84f451a54
commit 3355936e14
2 changed files with 7 additions and 6 deletions

View File

@ -1603,13 +1603,15 @@ void RewriteInstance::readSpecialSections() {
<< "relocation mode\n";
}
// Process debug sections.
EHFrame = cantFail(BC->DwCtx->getEHFrame());
// Read EH frame for function boundaries info.
Expected<const DWARFDebugFrame *> EHFrameOrError = BC->DwCtx->getEHFrame();
if (!EHFrameOrError)
report_error("expected valid eh_frame section", EHFrameOrError.takeError());
if (opts::DumpEHFrame) {
outs() << "BOLT-INFO: Dumping original binary .eh_frame\n";
EHFrame->dump(outs(), DIDumpOptions(), &*BC->MRI, NoneType());
EHFrameOrError.get()->dump(outs(), DIDumpOptions(), &*BC->MRI, NoneType());
}
CFIRdWrt.reset(new CFIReaderWriter(*EHFrame));
CFIRdWrt.reset(new CFIReaderWriter(*EHFrameOrError.get()));
// Parse build-id
parseBuildID();
@ -5014,7 +5016,7 @@ void RewriteInstance::rewriteFile() {
if (auto *E = dyn_cast<ELFObjectFileBase>(&Binary)) {
std::unique_ptr<DWARFContext> DwCtx = DWARFContext::create(*E);
const DWARFDebugFrame *const &EHFrame = cantFail(DwCtx->getEHFrame());
const DWARFDebugFrame *EHFrame = cantFail(DwCtx->getEHFrame());
outs() << "BOLT-INFO: Dumping rewritten .eh_frame\n";
EHFrame->dump(outs(), DIDumpOptions(), &*BC->MRI, NoneType());
}

View File

@ -446,7 +446,6 @@ private:
/// Exception handling and stack unwinding information in this binary.
ErrorOr<BinarySection &> LSDASection{std::errc::bad_address};
const llvm::DWARFDebugFrame *EHFrame{nullptr};
ErrorOr<BinarySection &> EHFrameSection{std::errc::bad_address};
/// .plt section.