[RuntimeDyld] Thread Error through some APIs, remove calls to report_fatal_error.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2016-05-18 05:31:24 +00:00
parent f673dcd8f1
commit 1c01e2defe
4 changed files with 18 additions and 58 deletions

View File

@ -46,23 +46,13 @@ public:
report_fatal_error("Unknown symbol in relocation"); report_fatal_error("Unknown symbol in relocation");
Expected<StringRef> TargetNameOrErr = Symbol->getName(); Expected<StringRef> TargetNameOrErr = Symbol->getName();
if (!TargetNameOrErr) { if (!TargetNameOrErr)
std::string Buf; return TargetNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(TargetNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
StringRef TargetName = *TargetNameOrErr; StringRef TargetName = *TargetNameOrErr;
auto SectionOrErr = Symbol->getSection(); auto SectionOrErr = Symbol->getSection();
if (!SectionOrErr) { if (!SectionOrErr)
std::string Buf; return SectionOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(SectionOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
auto Section = *SectionOrErr; auto Section = *SectionOrErr;
uint64_t RelType = RelI->getType(); uint64_t RelType = RelI->getType();

View File

@ -118,13 +118,8 @@ public:
if (Symbol == Obj.symbol_end()) if (Symbol == Obj.symbol_end())
report_fatal_error("Unknown symbol in relocation"); report_fatal_error("Unknown symbol in relocation");
auto SectionOrError = Symbol->getSection(); auto SectionOrError = Symbol->getSection();
if (!SectionOrError) { if (!SectionOrError)
std::string Buf; return SectionOrError.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(SectionOrError.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
section_iterator SecI = *SectionOrError; section_iterator SecI = *SectionOrError;
// If there is no section, this must be an external reference. // If there is no section, this must be an external reference.
const bool IsExtern = SecI == Obj.section_end(); const bool IsExtern = SecI == Obj.section_end();
@ -161,13 +156,8 @@ public:
} }
Expected<StringRef> TargetNameOrErr = Symbol->getName(); Expected<StringRef> TargetNameOrErr = Symbol->getName();
if (!TargetNameOrErr) { if (!TargetNameOrErr)
std::string Buf; return TargetNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(TargetNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
StringRef TargetName = *TargetNameOrErr; StringRef TargetName = *TargetNameOrErr;
DEBUG(dbgs() << "\t\tIn Section " << SectionID << " Offset " << Offset DEBUG(dbgs() << "\t\tIn Section " << SectionID << " Offset " << Offset

View File

@ -417,7 +417,7 @@ private:
addRelocationForSection(TargetRE, RE.SectionID); addRelocationForSection(TargetRE, RE.SectionID);
} }
relocation_iterator Expected<relocation_iterator>
processSubtractRelocation(unsigned SectionID, relocation_iterator RelI, processSubtractRelocation(unsigned SectionID, relocation_iterator RelI,
const ObjectFile &BaseObjT, const ObjectFile &BaseObjT,
ObjSectionToIDMap &ObjSectionToID) { ObjSectionToIDMap &ObjSectionToID) {
@ -432,13 +432,8 @@ private:
unsigned NumBytes = 1 << Size; unsigned NumBytes = 1 << Size;
Expected<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName(); Expected<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName();
if (!SubtrahendNameOrErr) { if (!SubtrahendNameOrErr)
std::string Buf; return SubtrahendNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(SubtrahendNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr); auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
unsigned SectionBID = SubtrahendI->second.getSectionID(); unsigned SectionBID = SubtrahendI->second.getSectionID();
uint64_t SectionBOffset = SubtrahendI->second.getOffset(); uint64_t SectionBOffset = SubtrahendI->second.getOffset();
@ -447,13 +442,8 @@ private:
++RelI; ++RelI;
Expected<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName(); Expected<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName();
if (!MinuendNameOrErr) { if (!MinuendNameOrErr)
std::string Buf; return MinuendNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(MinuendNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr); auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr);
unsigned SectionAID = MinuendI->second.getSectionID(); unsigned SectionAID = MinuendI->second.getSectionID();
uint64_t SectionAOffset = MinuendI->second.getOffset(); uint64_t SectionAOffset = MinuendI->second.getOffset();

View File

@ -155,7 +155,7 @@ private:
resolveRelocation(TargetRE, (uint64_t)Addr); resolveRelocation(TargetRE, (uint64_t)Addr);
} }
relocation_iterator Expected<relocation_iterator>
processSubtractRelocation(unsigned SectionID, relocation_iterator RelI, processSubtractRelocation(unsigned SectionID, relocation_iterator RelI,
const ObjectFile &BaseObjT, const ObjectFile &BaseObjT,
ObjSectionToIDMap &ObjSectionToID) { ObjSectionToIDMap &ObjSectionToID) {
@ -170,13 +170,8 @@ private:
unsigned NumBytes = 1 << Size; unsigned NumBytes = 1 << Size;
Expected<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName(); Expected<StringRef> SubtrahendNameOrErr = RelI->getSymbol()->getName();
if (!SubtrahendNameOrErr) { if (!SubtrahendNameOrErr)
std::string Buf; return SubtrahendNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(SubtrahendNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr); auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
unsigned SectionBID = SubtrahendI->second.getSectionID(); unsigned SectionBID = SubtrahendI->second.getSectionID();
uint64_t SectionBOffset = SubtrahendI->second.getOffset(); uint64_t SectionBOffset = SubtrahendI->second.getOffset();
@ -185,13 +180,8 @@ private:
++RelI; ++RelI;
Expected<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName(); Expected<StringRef> MinuendNameOrErr = RelI->getSymbol()->getName();
if (!MinuendNameOrErr) { if (!MinuendNameOrErr)
std::string Buf; return MinuendNameOrErr.takeError();
raw_string_ostream OS(Buf);
logAllUnhandledErrors(MinuendNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr); auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr);
unsigned SectionAID = MinuendI->second.getSectionID(); unsigned SectionAID = MinuendI->second.getSectionID();
uint64_t SectionAOffset = MinuendI->second.getOffset(); uint64_t SectionAOffset = MinuendI->second.getOffset();