llvm.org GIT mirror llvm / 1c01e2d
[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 Lang Hames 4 years ago
4 changed file(s) with 18 addition(s) and 58 deletion(s). Raw diff Collapse all Expand all
4545 report_fatal_error("Unknown symbol in relocation");
4646
4747 Expected TargetNameOrErr = Symbol->getName();
48 if (!TargetNameOrErr) {
49 std::string Buf;
50 raw_string_ostream OS(Buf);
51 logAllUnhandledErrors(TargetNameOrErr.takeError(), OS, "");
52 OS.flush();
53 report_fatal_error(Buf);
54 }
48 if (!TargetNameOrErr)
49 return TargetNameOrErr.takeError();
5550 StringRef TargetName = *TargetNameOrErr;
5651
5752 auto SectionOrErr = Symbol->getSection();
58 if (!SectionOrErr) {
59 std::string Buf;
60 raw_string_ostream OS(Buf);
61 logAllUnhandledErrors(SectionOrErr.takeError(), OS, "");
62 OS.flush();
63 report_fatal_error(Buf);
64 }
53 if (!SectionOrErr)
54 return SectionOrErr.takeError();
6555 auto Section = *SectionOrErr;
6656
6757 uint64_t RelType = RelI->getType();
117117 if (Symbol == Obj.symbol_end())
118118 report_fatal_error("Unknown symbol in relocation");
119119 auto SectionOrError = Symbol->getSection();
120 if (!SectionOrError) {
121 std::string Buf;
122 raw_string_ostream OS(Buf);
123 logAllUnhandledErrors(SectionOrError.takeError(), OS, "");
124 OS.flush();
125 report_fatal_error(Buf);
126 }
120 if (!SectionOrError)
121 return SectionOrError.takeError();
127122 section_iterator SecI = *SectionOrError;
128123 // If there is no section, this must be an external reference.
129124 const bool IsExtern = SecI == Obj.section_end();
160155 }
161156
162157 Expected TargetNameOrErr = Symbol->getName();
163 if (!TargetNameOrErr) {
164 std::string Buf;
165 raw_string_ostream OS(Buf);
166 logAllUnhandledErrors(TargetNameOrErr.takeError(), OS, "");
167 OS.flush();
168 report_fatal_error(Buf);
169 }
158 if (!TargetNameOrErr)
159 return TargetNameOrErr.takeError();
170160 StringRef TargetName = *TargetNameOrErr;
171161
172162 DEBUG(dbgs() << "\t\tIn Section " << SectionID << " Offset " << Offset
416416 addRelocationForSection(TargetRE, RE.SectionID);
417417 }
418418
419 relocation_iterator
419 Expected
420420 processSubtractRelocation(unsigned SectionID, relocation_iterator RelI,
421421 const ObjectFile &BaseObjT,
422422 ObjSectionToIDMap &ObjSectionToID) {
431431 unsigned NumBytes = 1 << Size;
432432
433433 Expected SubtrahendNameOrErr = RelI->getSymbol()->getName();
434 if (!SubtrahendNameOrErr) {
435 std::string Buf;
436 raw_string_ostream OS(Buf);
437 logAllUnhandledErrors(SubtrahendNameOrErr.takeError(), OS, "");
438 OS.flush();
439 report_fatal_error(Buf);
440 }
434 if (!SubtrahendNameOrErr)
435 return SubtrahendNameOrErr.takeError();
441436 auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
442437 unsigned SectionBID = SubtrahendI->second.getSectionID();
443438 uint64_t SectionBOffset = SubtrahendI->second.getOffset();
446441
447442 ++RelI;
448443 Expected MinuendNameOrErr = RelI->getSymbol()->getName();
449 if (!MinuendNameOrErr) {
450 std::string Buf;
451 raw_string_ostream OS(Buf);
452 logAllUnhandledErrors(MinuendNameOrErr.takeError(), OS, "");
453 OS.flush();
454 report_fatal_error(Buf);
455 }
444 if (!MinuendNameOrErr)
445 return MinuendNameOrErr.takeError();
456446 auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr);
457447 unsigned SectionAID = MinuendI->second.getSectionID();
458448 uint64_t SectionAOffset = MinuendI->second.getOffset();
154154 resolveRelocation(TargetRE, (uint64_t)Addr);
155155 }
156156
157 relocation_iterator
157 Expected
158158 processSubtractRelocation(unsigned SectionID, relocation_iterator RelI,
159159 const ObjectFile &BaseObjT,
160160 ObjSectionToIDMap &ObjSectionToID) {
169169 unsigned NumBytes = 1 << Size;
170170
171171 Expected SubtrahendNameOrErr = RelI->getSymbol()->getName();
172 if (!SubtrahendNameOrErr) {
173 std::string Buf;
174 raw_string_ostream OS(Buf);
175 logAllUnhandledErrors(SubtrahendNameOrErr.takeError(), OS, "");
176 OS.flush();
177 report_fatal_error(Buf);
178 }
172 if (!SubtrahendNameOrErr)
173 return SubtrahendNameOrErr.takeError();
179174 auto SubtrahendI = GlobalSymbolTable.find(*SubtrahendNameOrErr);
180175 unsigned SectionBID = SubtrahendI->second.getSectionID();
181176 uint64_t SectionBOffset = SubtrahendI->second.getOffset();
184179
185180 ++RelI;
186181 Expected MinuendNameOrErr = RelI->getSymbol()->getName();
187 if (!MinuendNameOrErr) {
188 std::string Buf;
189 raw_string_ostream OS(Buf);
190 logAllUnhandledErrors(MinuendNameOrErr.takeError(), OS, "");
191 OS.flush();
192 report_fatal_error(Buf);
193 }
182 if (!MinuendNameOrErr)
183 return MinuendNameOrErr.takeError();
194184 auto MinuendI = GlobalSymbolTable.find(*MinuendNameOrErr);
195185 unsigned SectionAID = MinuendI->second.getSectionID();
196186 uint64_t SectionAOffset = MinuendI->second.getOffset();