llvm.org GIT mirror llvm / 7287acf
Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef> r360876 didn't fix 2 call sites in clang. Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now. Follow-up of D61781. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360892 91177308-0d34-0410-b5e6-96231b3b80d8 Fangrui Song 3 months ago
25 changed file(s) with 154 addition(s) and 141 deletion(s). Raw diff Collapse all Expand all
9797 uint64_t getAddress() const;
9898 uint64_t getIndex() const;
9999 uint64_t getSize() const;
100 std::error_code getContents(StringRef &Result) const;
100 Expected getContents() const;
101101
102102 /// Get the alignment of this section as the actual value (not log 2).
103103 uint64_t getAlignment() const;
453453 return OwningObject->getSectionSize(SectionPimpl);
454454 }
455455
456 inline std::error_code SectionRef::getContents(StringRef &Result) const {
456 inline Expected SectionRef::getContents() const {
457457 Expected> Res =
458458 OwningObject->getSectionContents(SectionPimpl);
459459 if (!Res)
460 return errorToErrorCode(Res.takeError());
461 Result = StringRef(reinterpret_cast(Res->data()), Res->size());
462 return std::error_code();
460 return Res.takeError();
461 return StringRef(reinterpret_cast(Res->data()), Res->size());
463462 }
464463
465464 inline uint64_t SectionRef::getAlignment() const {
14091409 // Try to obtain an already relocated version of this section.
14101410 // Else use the unrelocated section from the object file. We'll have to
14111411 // apply relocations ourselves later.
1412 if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data))
1413 Section.getContents(Data);
1412 if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data)) {
1413 Expected E = Section.getContents();
1414 if (E)
1415 Data = *E;
1416 else
1417 // maybeDecompress below will error.
1418 consumeError(E.takeError());
1419 }
14141420
14151421 if (auto Err = maybeDecompress(Section, Name, Data)) {
14161422 ErrorPolicy EP = HandleError(createError(
5252 if (Obj->getArch() == Triple::ppc64) {
5353 for (section_iterator Section : Obj->sections()) {
5454 StringRef Name;
55 StringRef Data;
5655 if (auto EC = Section->getName(Name))
5756 return EC;
5857 if (Name == ".opd") {
59 if (auto EC = Section->getContents(Data))
60 return EC;
61 OpdExtractor.reset(new DataExtractor(Data, Obj->isLittleEndian(),
58 Expected E = Section->getContents();
59 if (!E)
60 return errorToErrorCode(E.takeError());
61 OpdExtractor.reset(new DataExtractor(*E, Obj->isLittleEndian(),
6262 Obj->getBytesInAddress()));
6363 OpdAddress = Section->getAddress();
6464 break;
220220 Section.getName(Name);
221221 Name = Name.substr(Name.find_first_not_of("._"));
222222 if (Name == "gnu_debuglink") {
223 StringRef Data;
224 Section.getContents(Data);
225 DataExtractor DE(Data, Obj->isLittleEndian(), 0);
223 Expected ContentsOrErr = Section.getContents();
224 if (!ContentsOrErr) {
225 consumeError(ContentsOrErr.takeError());
226 return false;
227 }
228 DataExtractor DE(*ContentsOrErr, Obj->isLittleEndian(), 0);
226229 uint32_t Offset = 0;
227230 if (const char *DebugNameStr = DE.getCStr(&Offset)) {
228231 // 4-byte align the offset.
135135
136136 if (!SecRef.isVirtual()) {
137137 // If this section has content then record it.
138 StringRef Content;
139 if (auto EC = SecRef.getContents(Content))
140 return errorCodeToError(EC);
141 if (Content.size() != SecRef.getSize())
138 Expected Content = SecRef.getContents();
139 if (!Content)
140 return Content.takeError();
141 if (Content->size() != SecRef.getSize())
142142 return make_error("Section content size does not match "
143143 "declared size for " +
144144 Name);
145 MachOSec.setContent(Content);
145 MachOSec.setContent(*Content);
146146 } else {
147147 // If this is a zero-fill section then just record the size.
148148 MachOSec.setZeroFill(SecRef.getSize());
791791 if (!IsVirtual && !IsZeroInit) {
792792 // In either case, set the location of the unrelocated section in memory,
793793 // since we still process relocations for it even if we're not applying them.
794 if (auto EC = Section.getContents(data))
795 return errorCodeToError(EC);
794 if (Expected E = Section.getContents())
795 data = *E;
796 else
797 return E.takeError();
796798 pData = data.data();
797799 }
798800
376376 }
377377 if (!Plt || !RelaPlt || !GotPlt)
378378 return {};
379 StringRef PltContents;
380 if (Plt->getContents(PltContents))
379 Expected PltContents = Plt->getContents();
380 if (!PltContents) {
381 consumeError(PltContents.takeError());
381382 return {};
382 ArrayRef PltBytes((const uint8_t *)PltContents.data(),
383 Plt->getSize());
384 auto PltEntries = MIA->findPltEntries(Plt->getAddress(), PltBytes,
383 }
384 auto PltEntries = MIA->findPltEntries(Plt->getAddress(),
385 arrayRefFromStringRef(*PltContents),
385386 GotPlt->getAddress(), Triple);
386387 // Build a map from GOT entry virtual address to PLT entry virtual address.
387388 DenseMap GotToPlt;
7373 IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) {
7474 for (const SectionRef &Sec : Obj.sections()) {
7575 if (Sec.isBitcode()) {
76 StringRef SecContents;
77 if (std::error_code EC = Sec.getContents(SecContents))
78 return errorCodeToError(EC);
79 if (SecContents.size() <= 1)
76 Expected Contents = Sec.getContents();
77 if (!Contents)
78 return Contents.takeError();
79 if (Contents->size() <= 1)
8080 return errorCodeToError(object_error::bitcode_section_not_found);
81 return MemoryBufferRef(SecContents, Obj.getFileName());
81 return MemoryBufferRef(*Contents, Obj.getFileName());
8282 }
8383 }
8484
246246 }
247247
248248 const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
249 StringRef ret;
250 if (std::error_code ec = (*unwrap(SI))->getContents(ret))
251 report_fatal_error(ec.message());
252 return ret.data();
249 if (Expected E = (*unwrap(SI))->getContents())
250 return E->data();
251 else
252 report_fatal_error(E.takeError());
253253 }
254254
255255 uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {
347347 }
348348
349349 Error InstrProfSymtab::create(SectionRef &Section) {
350 if (auto EC = Section.getContents(Data))
351 return errorCodeToError(EC);
350 Expected DataOrErr = Section.getContents();
351 if (!DataOrErr)
352 return DataOrErr.takeError();
353 Data = *DataOrErr;
352354 Address = Section.getAddress();
353355
354356 // If this is a linked PE/COFF file, then we have to skip over the null byte
686688 return E;
687689
688690 // Get the contents of the given sections.
689 if (auto EC = CoverageSection->getContents(CoverageMapping))
690 return errorCodeToError(EC);
691 if (Expected E = CoverageSection->getContents())
692 CoverageMapping = *E;
693 else
694 return E.takeError();
695
691696 if (Error E = ProfileNames.create(*NamesSection))
692697 return E;
693698
7777 "Failed to find XRay instrumentation map.",
7878 std::make_error_code(std::errc::executable_format_error));
7979
80 if (I->getContents(Contents))
81 return errorCodeToError(
82 std::make_error_code(std::errc::executable_format_error));
80 if (Expected E = I->getContents())
81 Contents = *E;
82 else
83 return E.takeError();
8384
8485 RelocMap Relocs;
8586 if (ObjFile.getBinary()->isELF()) {
435435 void DwarfLinker::RelocationManager::findValidRelocsMachO(
436436 const object::SectionRef &Section, const object::MachOObjectFile &Obj,
437437 const DebugMapObject &DMO) {
438 StringRef Contents;
439 Section.getContents(Contents);
440 DataExtractor Data(Contents, Obj.isLittleEndian(), 0);
438 Expected ContentsOrErr = Section.getContents();
439 if (!ContentsOrErr) {
440 consumeError(ContentsOrErr.takeError());
441 Linker.reportWarning("error reading section", DMO);
442 return;
443 }
444 DataExtractor Data(*ContentsOrErr, Obj.isLittleEndian(), 0);
441445 bool SkipNext = false;
442446
443447 for (const object::RelocationRef &Reloc : Section.relocations()) {
666666
667667 static void emitSectionContents(const object::ObjectFile &Obj,
668668 StringRef SecName, MCStreamer *MS) {
669 StringRef Contents;
670 if (auto Sec = getSectionByName(Obj, SecName))
671 if (!Sec->getContents(Contents))
672 MS->EmitBytes(Contents);
669 if (auto Sec = getSectionByName(Obj, SecName)) {
670 if (Expected E = Sec->getContents())
671 MS->EmitBytes(*E);
672 else
673 consumeError(E.takeError());
674 }
673675 }
674676
675677 void DwarfStreamer::copyInvariantDebugSection(const object::ObjectFile &Obj) {
452452 if (!Section.getName(SectionName) && SectionName == ".plt")
453453 continue;
454454
455 StringRef SectionContents;
456 if (Section.getContents(SectionContents))
457 return make_error("Failed to retrieve section contents",
458 inconvertibleErrorCode());
459
460 ArrayRef SectionBytes((const uint8_t *)SectionContents.data(),
461 Section.getSize());
455 Expected Contents = Section.getContents();
456 if (!Contents)
457 return Contents.takeError();
458 ArrayRef SectionBytes = arrayRefFromStringRef(*Contents);
459
462460 parseSectionContents(SectionBytes,
463461 {Section.getAddress(), Section.getIndex()});
464462 }
6868 uint64_t ProfileNamesAddress = ProfileNames.getAddress();
6969 StringRef CoverageMappingData;
7070 StringRef ProfileNamesData;
71 if (CoverageMapping.getContents(CoverageMappingData) ||
72 ProfileNames.getContents(ProfileNamesData))
71 if (Expected E = CoverageMapping.getContents())
72 CoverageMappingData = *E;
73 else {
74 consumeError(E.takeError());
7375 return 1;
76 }
77 if (Expected E = ProfileNames.getContents())
78 ProfileNamesData = *E;
79 else {
80 consumeError(E.takeError());
81 return 1;
82 }
7483
7584 int FD;
7685 if (auto Err = sys::fs::openFileForWrite(OutputFilename, FD)) {
4747 exit(1);
4848 }
4949
50 static void error(Error Err) {
51 if (!Err)
52 return;
50 LLVM_ATTRIBUTE_NORETURN static void error(Error Err) {
5351 logAllUnhandledErrors(std::move(Err), WithColor::error(outs()),
5452 "reading file: ");
5553 outs().flush();
5654 exit(1);
55 }
56
57 template
58 T unwrapOrError(Expected EO) {
59 if (!EO)
60 error(EO.takeError());
61 return std::move(*EO);
5762 }
5863
5964 } // namespace llvm
194199 // Skip virtual or BSS sections.
195200 if (Sec.isBSS() || Sec.isVirtual())
196201 continue;
197 StringRef SecContents;
198 error(Sec.getContents(SecContents));
202 StringRef SecContents = unwrapOrError(Sec.getContents());
199203 Expected SymAddressOrErr = Sym.getAddress();
200204 error(errorToErrorCode(SymAddressOrErr.takeError()));
201205 uint64_t SymAddress = *SymAddressOrErr;
509513 else
510514 reportError(Arc->getFileName(), cxxdump_error::unrecognized_file_format);
511515 }
512 error(std::move(Err));
516 if (Err)
517 error(std::move(Err));
513518 }
514519
515520 static void dumpInput(StringRef File) {
409409 if (std::error_code Err = Section.getName(Name))
410410 return errorCodeToError(Err);
411411
412 StringRef Contents;
413 if (auto Err = Section.getContents(Contents))
414 return errorCodeToError(Err);
412 Expected ContentsOrErr = Section.getContents();
413 if (!ContentsOrErr)
414 return ContentsOrErr.takeError();
415 StringRef Contents = *ContentsOrErr;
415416
416417 if (auto Err = handleCompressedSection(UncompressedSections, Name, Contents))
417418 return Err;
14811481 section_type = Sec.flags & MachO::SECTION_TYPE;
14821482 }
14831483
1484 StringRef BytesStr;
1485 Sect->getContents(BytesStr);
1484 StringRef BytesStr = unwrapOrError(Sect->getContents(), O->getFileName());
1485
14861486 const char *Contents = reinterpret_cast(BytesStr.data());
14871487
14881488 switch (section_type) {
16961696 }
16971697 uint32_t section_type = section_flags & MachO::SECTION_TYPE;
16981698
1699 StringRef BytesStr;
1700 Section.getContents(BytesStr);
1699 StringRef BytesStr =
1700 unwrapOrError(Section.getContents(), O->getFileName());
17011701 const char *sect = reinterpret_cast(BytesStr.data());
17021702 uint32_t sect_size = BytesStr.size();
17031703 uint64_t sect_addr = Section.getAddress();
17811781 if (SegName == "__TEXT" && SectName == "__info_plist") {
17821782 if (!NoLeadingHeaders)
17831783 outs() << "Contents of (" << SegName << "," << SectName << ") section\n";
1784 StringRef BytesStr;
1785 Section.getContents(BytesStr);
1784 StringRef BytesStr =
1785 unwrapOrError(Section.getContents(), O->getFileName());
17861786 const char *sect = reinterpret_cast(BytesStr.data());
17871787 outs() << format("%.*s", BytesStr.size(), sect) << "\n";
17881788 return;
31933193 S = (*(info->Sections))[SectIdx];
31943194 offset = Address - SectAddress;
31953195 left = SectSize - offset;
3196 StringRef SectContents;
3197 ((*(info->Sections))[SectIdx]).getContents(SectContents);
3196 StringRef SectContents = unwrapOrError(
3197 ((*(info->Sections))[SectIdx]).getContents(), info->O->getFileName());
31983198 return SectContents.data() + offset;
31993199 }
32003200 }
39973997 StringRef SegName = O->getSectionFinalSegmentName(Ref);
39983998 outs() << "Contents of (" << SegName << "," << SectName << ") section\n";
39993999
4000 StringRef BytesStr;
4001 S.getContents(BytesStr);
4000 StringRef BytesStr = unwrapOrError(S.getContents(), O->getFileName());
40024001 const char *Contents = reinterpret_cast(BytesStr.data());
40034002
40044003 for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint64_t)) {
40484047 StringRef SegName = O->getSectionFinalSegmentName(Ref);
40494048 outs() << "Contents of (" << SegName << "," << SectName << ") section\n";
40504049
4051 StringRef BytesStr;
4052 S.getContents(BytesStr);
4050 StringRef BytesStr = unwrapOrError(S.getContents(), O->getFileName());
40534051 const char *Contents = reinterpret_cast(BytesStr.data());
40544052
40554053 for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint32_t)) {
72417239 if (SegmentName != DisSegName)
72427240 continue;
72437241
7244 StringRef BytesStr;
7245 Sections[SectIdx].getContents(BytesStr);
7242 StringRef BytesStr =
7243 unwrapOrError(Sections[SectIdx].getContents(), Filename);
72467244 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
72477245 uint64_t SectAddress = Sections[SectIdx].getAddress();
72487246
76957693 uint32_t PointerSize = Is64 ? sizeof(uint64_t) : sizeof(uint32_t);
76967694 uint32_t EntrySize = 3 * PointerSize + 2 * sizeof(uint32_t);
76977695
7698 StringRef Contents;
7699 CompactUnwind.getContents(Contents);
7700
7696 StringRef Contents =
7697 unwrapOrError(CompactUnwind.getContents(), Obj->getFileName());
77017698 SmallVector CompactUnwinds;
77027699
77037700 // First populate the initial raw offsets, encodings and so on from the entry.
78387835
78397836 outs() << "Contents of __unwind_info section:\n";
78407837
7841 StringRef Contents;
7842 UnwindInfo.getContents(Contents);
7838 StringRef Contents =
7839 unwrapOrError(UnwindInfo.getContents(), Obj->getFileName());
78437840 ptrdiff_t Pos = 0;
78447841
78457842 //===----------------------------------
11251125 SmallString<40> Comments;
11261126 raw_svector_ostream CommentStream(Comments);
11271127
1128 StringRef BytesStr;
1129 error(Section.getContents(BytesStr));
1130 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
1128 ArrayRef Bytes = arrayRefFromStringRef(
1129 unwrapOrError(Section.getContents(), Obj->getFileName()));
11311130
11321131 uint64_t VMAAdjustment = 0;
11331132 if (shouldAdjustVA(Section))
15601559 void printSectionContents(const ObjectFile *Obj) {
15611560 for (const SectionRef &Section : ToolSectionFilter(*Obj)) {
15621561 StringRef Name;
1563 StringRef Contents;
15641562 error(Section.getName(Name));
15651563 uint64_t BaseAddr = Section.getAddress();
15661564 uint64_t Size = Section.getSize();
15751573 continue;
15761574 }
15771575
1578 error(Section.getContents(Contents));
1576 StringRef Contents = unwrapOrError(Section.getContents(), Obj->getFileName());
15791577
15801578 // Dump out the content as hex and printable ascii characters.
15811579 for (std::size_t Addr = 0, End = Contents.size(); Addr < End; Addr += 16) {
17631761 if (!ClangASTSection)
17641762 return;
17651763
1766 StringRef ClangASTContents;
1767 error(ClangASTSection.getValue().getContents(ClangASTContents));
1764 StringRef ClangASTContents = unwrapOrError(
1765 ClangASTSection.getValue().getContents(), Obj->getFileName());
17681766 outs().write(ClangASTContents.data(), ClangASTContents.size());
17691767 }
17701768
18001798 return;
18011799 }
18021800
1803 StringRef FaultMapContents;
1804 error(FaultMapSection.getValue().getContents(FaultMapContents));
1805
1801 StringRef FaultMapContents =
1802 unwrapOrError(FaultMapSection.getValue().getContents(), Obj->getFileName());
18061803 FaultMapParser FMP(FaultMapContents.bytes_begin(),
18071804 FaultMapContents.bytes_end());
18081805
13751375 else
13761376 continue;
13771377
1378 StringRef Contents;
1379 if (auto EC = S.getContents(Contents))
1380 return errorCodeToError(EC);
1378 Expected ContentsOrErr = S.getContents();
1379 if (!ContentsOrErr)
1380 return ContentsOrErr.takeError();
13811381
13821382 uint32_t Magic;
1383 BinaryStreamReader Reader(Contents, llvm::support::little);
1383 BinaryStreamReader Reader(*ContentsOrErr, llvm::support::little);
13841384 if (auto EC = Reader.readInteger(Magic))
13851385 return EC;
13861386 if (Magic != COFF::DEBUG_SECTION_MAGIC)
6565 static inline bool isCodeViewDebugSubsection(object::SectionRef Section,
6666 StringRef Name,
6767 BinaryStreamReader &Reader) {
68 StringRef SectionName, Contents;
68 StringRef SectionName;
6969 if (Section.getName(SectionName))
7070 return false;
7171
7272 if (SectionName != Name)
7373 return false;
7474
75 if (Section.getContents(Contents))
76 return false;
77
78 Reader = BinaryStreamReader(Contents, support::little);
75 Expected ContentsOrErr = Section.getContents();
76 if (!ContentsOrErr) {
77 consumeError(ContentsOrErr.takeError());
78 return false;
79 }
80
81 Reader = BinaryStreamReader(*ContentsOrErr, support::little);
7982 uint32_t Magic;
8083 if (Reader.bytesRemaining() < sizeof(uint32_t))
8184 return false;
932932
933933 void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
934934 const SectionRef &Section) {
935 StringRef SectionContents;
936 error(Section.getContents(SectionContents));
935 StringRef SectionContents = unwrapOrError(Section.getContents());
937936 StringRef Data = SectionContents;
938937
939938 SmallVector FunctionNames;
12171216 StringRef SectionName;
12181217 error(S.getName(SectionName));
12191218 if (SectionName == ".debug$T") {
1220 StringRef Data;
1221 error(S.getContents(Data));
1219 StringRef Data = unwrapOrError(S.getContents());
12221220 uint32_t Magic;
12231221 error(consume(Data, Magic));
12241222 if (Magic != 4)
12541252 ListScope D(W, "CodeViewTypes");
12551253 W.printNumber("Section", SectionName, Obj->getSectionID(Section));
12561254
1257 StringRef Data;
1258 error(Section.getContents(Data));
1255 StringRef Data = unwrapOrError(Section.getContents());
12591256 if (opts::CodeViewSubsectionBytes)
12601257 W.printBinaryBlock("Data", Data);
12611258
13151312
13161313 if (opts::SectionData &&
13171314 !(Section->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)) {
1318 StringRef Data;
1319 error(Sec.getContents(Data));
1320
1315 StringRef Data = unwrapOrError(Sec.getContents());
13211316 W.printBinaryBlock("SectionData", Data);
13221317 }
13231318 }
16591654
16601655 void COFFDumper::printCOFFDirectives() {
16611656 for (const SectionRef &Section : Obj->sections()) {
1662 StringRef Contents;
16631657 StringRef Name;
16641658
16651659 error(Section.getName(Name));
16661660 if (Name != ".drectve")
16671661 continue;
16681662
1669 error(Section.getContents(Contents));
1670
1663 StringRef Contents = unwrapOrError(Section.getContents());
16711664 W.printString("Directive(s)", Contents);
16721665 }
16731666 }
17061699 if (!Name.startswith(".rsrc"))
17071700 continue;
17081701
1709 StringRef Ref;
1710 error(S.getContents(Ref));
1702 StringRef Ref = unwrapOrError(S.getContents());
17111703
17121704 if ((Name == ".rsrc") || (Name == ".rsrc$01")) {
17131705 ResourceSectionRef RSF(Ref);
18331825 if (StackMapSection == object::SectionRef())
18341826 return;
18351827
1836 StringRef StackMapContents;
1837 StackMapSection.getContents(StackMapContents);
1828 StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
18381829 ArrayRef StackMapContentsArray =
18391830 arrayRefFromStringRef(StackMapContents);
18401831
18601851 if (AddrsigSection == object::SectionRef())
18611852 return;
18621853
1863 StringRef AddrsigContents;
1864 AddrsigSection.getContents(AddrsigContents);
1854 StringRef AddrsigContents = unwrapOrError(AddrsigSection.getContents());
18651855 ArrayRef AddrsigContentsArray(AddrsigContents.bytes_begin(),
18661856 AddrsigContents.size());
18671857
482482 }
483483 }
484484
485 if (opts::SectionData) {
486 bool IsBSS = Section.isBSS();
487 if (!IsBSS) {
488 StringRef Data;
489 error(Section.getContents(Data));
490
491 W.printBinaryBlock("SectionData", Data);
492 }
493 }
485 if (opts::SectionData && !Section.isBSS())
486 W.printBinaryBlock("SectionData", unwrapOrError(Section.getContents()));
494487 }
495488 }
496489
659652 if (StackMapSection == object::SectionRef())
660653 return;
661654
662 StringRef StackMapContents;
663 StackMapSection.getContents(StackMapContents);
655 StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
664656 ArrayRef StackMapContentsArray =
665657 arrayRefFromStringRef(StackMapContents);
666658
7272 error(E);
7373 W.startLine() << "String dump of section '" << SectionName << "':\n";
7474
75 StringRef SectionContent;
76 Section.getContents(SectionContent);
75 StringRef SectionContent = unwrapOrError(Section.getContents());
7776
7877 const uint8_t *SecContent = SectionContent.bytes_begin();
7978 const uint8_t *CurrentWord = SecContent;
106105 error(E);
107106 W.startLine() << "Hex dump of section '" << SectionName << "':\n";
108107
109 StringRef SectionContent;
110 Section.getContents(SectionContent);
108 StringRef SectionContent = unwrapOrError(Section.getContents());
111109 const uint8_t *SecContent = SectionContent.bytes_begin();
112110 const uint8_t *SecEnd = SecContent + SectionContent.size();
113111
840840 if (!SectSize)
841841 continue;
842842
843 StringRef BytesStr;
844 failIfError(Section.getContents(BytesStr));
845 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
843 Expected BytesStr = Section.getContents();
844 failIfError(BytesStr);
845 ArrayRef Bytes = arrayRefFromStringRef(*BytesStr);
846846
847847 for (uint64_t Index = 0, Size = 0; Index < Section.getSize();
848848 Index += Size) {