[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");
Expected<StringRef> TargetNameOrErr = Symbol->getName();
if (!TargetNameOrErr) {
std::string Buf;
raw_string_ostream OS(Buf);
logAllUnhandledErrors(TargetNameOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
if (!TargetNameOrErr)
return TargetNameOrErr.takeError();
StringRef TargetName = *TargetNameOrErr;
auto SectionOrErr = Symbol->getSection();
if (!SectionOrErr) {
std::string Buf;
raw_string_ostream OS(Buf);
logAllUnhandledErrors(SectionOrErr.takeError(), OS, "");
OS.flush();
report_fatal_error(Buf);
}
if (!SectionOrErr)
return SectionOrErr.takeError();
auto Section = *SectionOrErr;
uint64_t RelType = RelI->getType();

View File

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

View File

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

View File

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