diff options
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index e3ace265f9c..60041a45e2b 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -160,13 +160,9 @@ createRTDyldELFObject(MemoryBufferRef Buffer, const ObjectFile &SourceObject, // Iterate over all sections in the object. auto SI = SourceObject.section_begin(); for (const auto &Sec : Obj->sections()) { - Expected<StringRef> NameOrErr = Sec.getName(); - if (!NameOrErr) { - consumeError(NameOrErr.takeError()); - continue; - } - - if (*NameOrErr != "") { + StringRef SectionName; + Sec.getName(SectionName); + if (SectionName != "") { DataRefImpl ShdrRef = Sec.getRawDataRefImpl(); Elf_Shdr *shdr = const_cast<Elf_Shdr *>( reinterpret_cast<const Elf_Shdr *>(ShdrRef.p)); @@ -571,11 +567,10 @@ Error RuntimeDyldELF::findPPC64TOCSection(const ELFObjectFileBase &Obj, // The TOC consists of sections .got, .toc, .tocbss, .plt in that // order. The TOC starts where the first of these sections starts. - for (auto &Section : Obj.sections()) { - Expected<StringRef> NameOrErr = Section.getName(); - if (!NameOrErr) - return NameOrErr.takeError(); - StringRef SectionName = *NameOrErr; + for (auto &Section: Obj.sections()) { + StringRef SectionName; + if (auto EC = Section.getName(SectionName)) + return errorCodeToError(EC); if (SectionName == ".got" || SectionName == ".toc" @@ -610,10 +605,9 @@ Error RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj, if (RelSecI == Obj.section_end()) continue; - Expected<StringRef> NameOrErr = RelSecI->getName(); - if (!NameOrErr) - return NameOrErr.takeError(); - StringRef RelSectionName = *NameOrErr; + StringRef RelSectionName; + if (auto EC = RelSecI->getName(RelSectionName)) + return errorCodeToError(EC); if (RelSectionName != ".opd") continue; @@ -1885,14 +1879,8 @@ Error RuntimeDyldELF::finalizeLoad(const ObjectFile &Obj, ObjSectionToIDMap::iterator i, e; for (i = SectionMap.begin(), e = SectionMap.end(); i != e; ++i) { const SectionRef &Section = i->first; - StringRef Name; - Expected<StringRef> NameOrErr = Section.getName(); - if (NameOrErr) - Name = *NameOrErr; - else - consumeError(NameOrErr.takeError()); - + Section.getName(Name); if (Name == ".eh_frame") { UnregisteredEHFrameSections.push_back(i->second); break; |