llvm.org GIT mirror llvm / a625bff
Remove the last use of report_fatal_error from ELF.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285955 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 3 years ago
4 changed file(s) with 21 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
116116 return getSectionContentsAsArray(Sec);
117117 }
118118
119 Elf_Rela_Range relas(const Elf_Shdr *Sec) const {
120 auto V = getSectionContentsAsArray(Sec);
121 if (!V)
122 report_fatal_error(V.getError().message());
123 return *V;
124 }
125
126 Elf_Rel_Range rels(const Elf_Shdr *Sec) const {
127 auto V = getSectionContentsAsArray(Sec);
128 if (!V)
129 report_fatal_error(V.getError().message());
130 return *V;
119 ErrorOr relas(const Elf_Shdr *Sec) const {
120 return getSectionContentsAsArray(Sec);
121 }
122
123 ErrorOr rels(const Elf_Shdr *Sec) const {
124 return getSectionContentsAsArray(Sec);
131125 }
132126
133127 /// \brief Iterate over program header table.
386386 error(SymTabOrErr.getError());
387387 const Elf_Shdr *SymTab = *SymTabOrErr;
388388
389 for (const Elf_Rel &R : ELF->rels(&Sec)) {
389 for (const Elf_Rel &R : unwrapOrError(ELF->rels(&Sec))) {
390390 if (R.r_offset != static_cast(IndexTableOffset))
391391 continue;
392392
20662066
20672067 switch (PLTRelShdr->sh_type) {
20682068 case ELF::SHT_REL:
2069 for (const Elf_Rel &Rel : Obj->rels(PLTRelShdr)) {
2069 for (const Elf_Rel &Rel : unwrapOrError(Obj->rels(PLTRelShdr))) {
20702070 const Elf_Sym *Sym =
20712071 unwrapOrError(Obj->getRelocationSymbol(&Rel, SymTable));
20722072 printPLTEntry(PLTShdr->sh_addr, PLTBegin, It, StrTable, Sym);
20752075 }
20762076 break;
20772077 case ELF::SHT_RELA:
2078 for (const Elf_Rela &Rel : Obj->relas(PLTRelShdr)) {
2078 for (const Elf_Rela &Rel : unwrapOrError(Obj->relas(PLTRelShdr))) {
20792079 const Elf_Sym *Sym =
20802080 unwrapOrError(Obj->getRelocationSymbol(&Rel, SymTable));
20812081 printPLTEntry(PLTShdr->sh_addr, PLTBegin, It, StrTable, Sym);
25302530 printRelocHeader(OS, ELFT::Is64Bits, (Sec.sh_type == ELF::SHT_RELA));
25312531 const Elf_Shdr *SymTab = unwrapOrError(Obj->getSection(Sec.sh_link));
25322532 if (Sec.sh_type == ELF::SHT_REL) {
2533 for (const auto &R : Obj->rels(&Sec)) {
2533 for (const auto &R : unwrapOrError(Obj->rels(&Sec))) {
25342534 Elf_Rela Rela;
25352535 Rela.r_offset = R.r_offset;
25362536 Rela.r_info = R.r_info;
25382538 printRelocation(Obj, SymTab, Rela, false);
25392539 }
25402540 } else {
2541 for (const auto &R : Obj->relas(&Sec))
2541 for (const auto &R : unwrapOrError(Obj->relas(&Sec)))
25422542 printRelocation(Obj, SymTab, R, true);
25432543 }
25442544 }
33873387
33883388 switch (Sec->sh_type) {
33893389 case ELF::SHT_REL:
3390 for (const Elf_Rel &R : Obj->rels(Sec)) {
3390 for (const Elf_Rel &R : unwrapOrError(Obj->rels(Sec))) {
33913391 Elf_Rela Rela;
33923392 Rela.r_offset = R.r_offset;
33933393 Rela.r_info = R.r_info;
33963396 }
33973397 break;
33983398 case ELF::SHT_RELA:
3399 for (const Elf_Rela &R : Obj->relas(Sec))
3399 for (const Elf_Rela &R : unwrapOrError(Obj->relas(Sec)))
34003400 printRelocation(Obj, R, SymTab);
34013401 break;
34023402 }
294294 return EC;
295295 const Elf_Shdr *SymTab = *SymTabOrErr;
296296
297 for (const Elf_Rel &Rel : Obj.rels(Shdr)) {
297 auto Rels = Obj.rels(Shdr);
298 if (std::error_code EC = Rels.getError())
299 return EC;
300 for (const Elf_Rel &Rel : *Rels) {
298301 ELFYAML::Relocation R;
299302 if (std::error_code EC = dumpRelocation(&Rel, SymTab, R))
300303 return EC;
318321 return EC;
319322 const Elf_Shdr *SymTab = *SymTabOrErr;
320323
321 for (const Elf_Rela &Rel : Obj.relas(Shdr)) {
324 auto Rels = Obj.relas(Shdr);
325 if (std::error_code EC = Rels.getError())
326 return EC;
327 for (const Elf_Rela &Rel : *Rels) {
322328 ELFYAML::Relocation R;
323329 if (std::error_code EC = dumpRelocation(&Rel, SymTab, R))
324330 return EC;