llvm.org GIT mirror llvm / 71eaa4f
Revert r360876 "[Object] Change object::SectionRef::getContents() to return Expected<StringRef>" It broke the Clang build, see llvm-commits thread. > 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@360878 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 3 months ago
25 changed file(s) with 141 addition(s) and 154 deletion(s). Raw diff Collapse all Expand all
9797 uint64_t getAddress() const;
9898 uint64_t getIndex() const;
9999 uint64_t getSize() const;
100 Expected getContents() const;
100 std::error_code getContents(StringRef &Result) 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 Expected SectionRef::getContents() const {
456 inline std::error_code SectionRef::getContents(StringRef &Result) const {
457457 Expected> Res =
458458 OwningObject->getSectionContents(SectionPimpl);
459459 if (!Res)
460 return Res.takeError();
461 return StringRef(reinterpret_cast(Res->data()), Res->size());
460 return errorToErrorCode(Res.takeError());
461 Result = StringRef(reinterpret_cast(Res->data()), Res->size());
462 return std::error_code();
462463 }
463464
464465 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 Expected E = Section.getContents();
1414 if (E)
1415 Data = *E;
1416 else
1417 // maybeDecompress below will error.
1418 consumeError(E.takeError());
1419 }
1412 if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data))
1413 Section.getContents(Data);
14201414
14211415 if (auto Err = maybeDecompress(Section, Name, Data)) {
14221416 ErrorPolicy EP = HandleError(createError(
5252 if (Obj->getArch() == Triple::ppc64) {
5353 for (section_iterator Section : Obj->sections()) {
5454 StringRef Name;
55 StringRef Data;
5556 if (auto EC = Section->getName(Name))
5657 return EC;
5758 if (Name == ".opd") {
58 Expected E = Section->getContents();
59 if (!E)
60 return errorToErrorCode(E.takeError());
61 OpdExtractor.reset(new DataExtractor(*E, Obj->isLittleEndian(),
59 if (auto EC = Section->getContents(Data))
60 return EC;
61 OpdExtractor.reset(new DataExtractor(Data, 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 Expected ContentsOrErr = Section.getContents();
224 if (!ContentsOrErr) {
225 consumeError(ContentsOrErr.takeError());
226 return false;
227 }
228 DataExtractor DE(*ContentsOrErr, Obj->isLittleEndian(), 0);
223 StringRef Data;
224 Section.getContents(Data);
225 DataExtractor DE(Data, Obj->isLittleEndian(), 0);
229226 uint32_t Offset = 0;
230227 if (const char *DebugNameStr = DE.getCStr(&Offset)) {
231228 // 4-byte align the offset.
135135
136136 if (!SecRef.isVirtual()) {
137137 // If this section has content then record it.
138 Expected Content = SecRef.getContents();
139 if (!Content)
140 return Content.takeError();
141 if (Content->size() != SecRef.getSize())
138 StringRef Content;
139 if (auto EC = SecRef.getContents(Content))
140 return errorCodeToError(EC);
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 (Expected E = Section.getContents())
795 data = *E;
796 else
797 return E.takeError();
794 if (auto EC = Section.getContents(data))
795 return errorCodeToError(EC);
798796 pData = data.data();
799797 }
800798
376376 }
377377 if (!Plt || !RelaPlt || !GotPlt)
378378 return {};
379 Expected PltContents = Plt->getContents();
380 if (!PltContents) {
381 consumeError(PltContents.takeError());
379 StringRef PltContents;
380 if (Plt->getContents(PltContents))
382381 return {};
383 }
384 auto PltEntries = MIA->findPltEntries(Plt->getAddress(),
385 arrayRefFromStringRef(*PltContents),
382 ArrayRef PltBytes((const uint8_t *)PltContents.data(),
383 Plt->getSize());
384 auto PltEntries = MIA->findPltEntries(Plt->getAddress(), PltBytes,
386385 GotPlt->getAddress(), Triple);
387386 // Build a map from GOT entry virtual address to PLT entry virtual address.
388387 DenseMap GotToPlt;
7373 IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) {
7474 for (const SectionRef &Sec : Obj.sections()) {
7575 if (Sec.isBitcode()) {
76 Expected Contents = Sec.getContents();
77 if (!Contents)
78 return Contents.takeError();
79 if (Contents->size() <= 1)
76 StringRef SecContents;
77 if (std::error_code EC = Sec.getContents(SecContents))
78 return errorCodeToError(EC);
79 if (SecContents.size() <= 1)
8080 return errorCodeToError(object_error::bitcode_section_not_found);
81 return MemoryBufferRef(*Contents, Obj.getFileName());
81 return MemoryBufferRef(SecContents, Obj.getFileName());
8282 }
8383 }
8484
246246 }
247247
248248 const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
249 if (Expected E = (*unwrap(SI))->getContents())
250 return E->data();
251 else
252 report_fatal_error(E.takeError());
249 StringRef ret;
250 if (std::error_code ec = (*unwrap(SI))->getContents(ret))
251 report_fatal_error(ec.message());
252 return ret.data();
253253 }
254254
255255 uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {
347347 }
348348
349349 Error InstrProfSymtab::create(SectionRef &Section) {
350 Expected DataOrErr = Section.getContents();
351 if (!DataOrErr)
352 return DataOrErr.takeError();
353 Data = *DataOrErr;
350 if (auto EC = Section.getContents(Data))
351 return errorCodeToError(EC);
354352 Address = Section.getAddress();
355353
356354 // If this is a linked PE/COFF file, then we have to skip over the null byte
688686 return E;
689687
690688 // Get the contents of the given sections.
691 if (Expected E = CoverageSection->getContents())
692 CoverageMapping = *E;
693 else
694 return E.takeError();
695
689 if (auto EC = CoverageSection->getContents(CoverageMapping))
690 return errorCodeToError(EC);
696691 if (Error E = ProfileNames.create(*NamesSection))
697692 return E;
698693
7777 "Failed to find XRay instrumentation map.",
7878 std::make_error_code(std::errc::executable_format_error));
7979
80 if (Expected E = I->getContents())
81 Contents = *E;
82 else
83 return E.takeError();
80 if (I->getContents(Contents))
81 return errorCodeToError(
82 std::make_error_code(std::errc::executable_format_error));
8483
8584 RelocMap Relocs;
8685 if (ObjFile.getBinary()->isELF()) {
435435 void DwarfLinker::RelocationManager::findValidRelocsMachO(
436436 const object::SectionRef &Section, const object::MachOObjectFile &Obj,
437437 const DebugMapObject &DMO) {
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);
438 StringRef Contents;
439 Section.getContents(Contents);
440 DataExtractor Data(Contents, Obj.isLittleEndian(), 0);
445441 bool SkipNext = false;
446442
447443 for (const object::RelocationRef &Reloc : Section.relocations()) {
666666
667667 static void emitSectionContents(const object::ObjectFile &Obj,
668668 StringRef SecName, MCStreamer *MS) {
669 if (auto Sec = getSectionByName(Obj, SecName)) {
670 if (Expected E = Sec->getContents())
671 MS->EmitBytes(*E);
672 else
673 consumeError(E.takeError());
674 }
669 StringRef Contents;
670 if (auto Sec = getSectionByName(Obj, SecName))
671 if (!Sec->getContents(Contents))
672 MS->EmitBytes(Contents);
675673 }
676674
677675 void DwarfStreamer::copyInvariantDebugSection(const object::ObjectFile &Obj) {
452452 if (!Section.getName(SectionName) && SectionName == ".plt")
453453 continue;
454454
455 Expected Contents = Section.getContents();
456 if (!Contents)
457 return Contents.takeError();
458 ArrayRef SectionBytes = arrayRefFromStringRef(*Contents);
459
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());
460462 parseSectionContents(SectionBytes,
461463 {Section.getAddress(), Section.getIndex()});
462464 }
6868 uint64_t ProfileNamesAddress = ProfileNames.getAddress();
6969 StringRef CoverageMappingData;
7070 StringRef ProfileNamesData;
71 if (Expected E = CoverageMapping.getContents())
72 CoverageMappingData = *E;
73 else {
74 consumeError(E.takeError());
71 if (CoverageMapping.getContents(CoverageMappingData) ||
72 ProfileNames.getContents(ProfileNamesData))
7573 return 1;
76 }
77 if (Expected E = ProfileNames.getContents())
78 ProfileNamesData = *E;
79 else {
80 consumeError(E.takeError());
81 return 1;
82 }
8374
8475 int FD;
8576 if (auto Err = sys::fs::openFileForWrite(OutputFilename, FD)) {
4747 exit(1);
4848 }
4949
50 LLVM_ATTRIBUTE_NORETURN static void error(Error Err) {
50 static void error(Error Err) {
51 if (!Err)
52 return;
5153 logAllUnhandledErrors(std::move(Err), WithColor::error(outs()),
5254 "reading file: ");
5355 outs().flush();
5456 exit(1);
55 }
56
57 template
58 T unwrapOrError(Expected EO) {
59 if (!EO)
60 error(EO.takeError());
61 return std::move(*EO);
6257 }
6358
6459 } // namespace llvm
199194 // Skip virtual or BSS sections.
200195 if (Sec.isBSS() || Sec.isVirtual())
201196 continue;
202 StringRef SecContents = unwrapOrError(Sec.getContents());
197 StringRef SecContents;
198 error(Sec.getContents(SecContents));
203199 Expected SymAddressOrErr = Sym.getAddress();
204200 error(errorToErrorCode(SymAddressOrErr.takeError()));
205201 uint64_t SymAddress = *SymAddressOrErr;
513509 else
514510 reportError(Arc->getFileName(), cxxdump_error::unrecognized_file_format);
515511 }
516 if (Err)
517 error(std::move(Err));
512 error(std::move(Err));
518513 }
519514
520515 static void dumpInput(StringRef File) {
409409 if (std::error_code Err = Section.getName(Name))
410410 return errorCodeToError(Err);
411411
412 Expected ContentsOrErr = Section.getContents();
413 if (!ContentsOrErr)
414 return ContentsOrErr.takeError();
415 StringRef Contents = *ContentsOrErr;
412 StringRef Contents;
413 if (auto Err = Section.getContents(Contents))
414 return errorCodeToError(Err);
416415
417416 if (auto Err = handleCompressedSection(UncompressedSections, Name, Contents))
418417 return Err;
14811481 section_type = Sec.flags & MachO::SECTION_TYPE;
14821482 }
14831483
1484 StringRef BytesStr = unwrapOrError(Sect->getContents(), O->getFileName());
1485
1484 StringRef BytesStr;
1485 Sect->getContents(BytesStr);
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 unwrapOrError(Section.getContents(), O->getFileName());
1699 StringRef BytesStr;
1700 Section.getContents(BytesStr);
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 unwrapOrError(Section.getContents(), O->getFileName());
1784 StringRef BytesStr;
1785 Section.getContents(BytesStr);
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 = unwrapOrError(
3197 ((*(info->Sections))[SectIdx]).getContents(), info->O->getFileName());
3196 StringRef SectContents;
3197 ((*(info->Sections))[SectIdx]).getContents(SectContents);
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 = unwrapOrError(S.getContents(), O->getFileName());
4000 StringRef BytesStr;
4001 S.getContents(BytesStr);
40014002 const char *Contents = reinterpret_cast(BytesStr.data());
40024003
40034004 for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint64_t)) {
40474048 StringRef SegName = O->getSectionFinalSegmentName(Ref);
40484049 outs() << "Contents of (" << SegName << "," << SectName << ") section\n";
40494050
4050 StringRef BytesStr = unwrapOrError(S.getContents(), O->getFileName());
4051 StringRef BytesStr;
4052 S.getContents(BytesStr);
40514053 const char *Contents = reinterpret_cast(BytesStr.data());
40524054
40534055 for (uint32_t i = 0; i < S.getSize(); i += sizeof(uint32_t)) {
72397241 if (SegmentName != DisSegName)
72407242 continue;
72417243
7242 StringRef BytesStr =
7243 unwrapOrError(Sections[SectIdx].getContents(), Filename);
7244 StringRef BytesStr;
7245 Sections[SectIdx].getContents(BytesStr);
72447246 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
72457247 uint64_t SectAddress = Sections[SectIdx].getAddress();
72467248
76937695 uint32_t PointerSize = Is64 ? sizeof(uint64_t) : sizeof(uint32_t);
76947696 uint32_t EntrySize = 3 * PointerSize + 2 * sizeof(uint32_t);
76957697
7696 StringRef Contents =
7697 unwrapOrError(CompactUnwind.getContents(), Obj->getFileName());
7698 StringRef Contents;
7699 CompactUnwind.getContents(Contents);
7700
76987701 SmallVector CompactUnwinds;
76997702
77007703 // First populate the initial raw offsets, encodings and so on from the entry.
78357838
78367839 outs() << "Contents of __unwind_info section:\n";
78377840
7838 StringRef Contents =
7839 unwrapOrError(UnwindInfo.getContents(), Obj->getFileName());
7841 StringRef Contents;
7842 UnwindInfo.getContents(Contents);
78407843 ptrdiff_t Pos = 0;
78417844
78427845 //===----------------------------------
11251125 SmallString<40> Comments;
11261126 raw_svector_ostream CommentStream(Comments);
11271127
1128 ArrayRef Bytes = arrayRefFromStringRef(
1129 unwrapOrError(Section.getContents(), Obj->getFileName()));
1128 StringRef BytesStr;
1129 error(Section.getContents(BytesStr));
1130 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
11301131
11311132 uint64_t VMAAdjustment = 0;
11321133 if (shouldAdjustVA(Section))
15591560 void printSectionContents(const ObjectFile *Obj) {
15601561 for (const SectionRef &Section : ToolSectionFilter(*Obj)) {
15611562 StringRef Name;
1563 StringRef Contents;
15621564 error(Section.getName(Name));
15631565 uint64_t BaseAddr = Section.getAddress();
15641566 uint64_t Size = Section.getSize();
15731575 continue;
15741576 }
15751577
1576 StringRef Contents = unwrapOrError(Section.getContents(), Obj->getFileName());
1578 error(Section.getContents(Contents));
15771579
15781580 // Dump out the content as hex and printable ascii characters.
15791581 for (std::size_t Addr = 0, End = Contents.size(); Addr < End; Addr += 16) {
17611763 if (!ClangASTSection)
17621764 return;
17631765
1764 StringRef ClangASTContents = unwrapOrError(
1765 ClangASTSection.getValue().getContents(), Obj->getFileName());
1766 StringRef ClangASTContents;
1767 error(ClangASTSection.getValue().getContents(ClangASTContents));
17661768 outs().write(ClangASTContents.data(), ClangASTContents.size());
17671769 }
17681770
17981800 return;
17991801 }
18001802
1801 StringRef FaultMapContents =
1802 unwrapOrError(FaultMapSection.getValue().getContents(), Obj->getFileName());
1803 StringRef FaultMapContents;
1804 error(FaultMapSection.getValue().getContents(FaultMapContents));
1805
18031806 FaultMapParser FMP(FaultMapContents.bytes_begin(),
18041807 FaultMapContents.bytes_end());
18051808
13751375 else
13761376 continue;
13771377
1378 Expected ContentsOrErr = S.getContents();
1379 if (!ContentsOrErr)
1380 return ContentsOrErr.takeError();
1378 StringRef Contents;
1379 if (auto EC = S.getContents(Contents))
1380 return errorCodeToError(EC);
13811381
13821382 uint32_t Magic;
1383 BinaryStreamReader Reader(*ContentsOrErr, llvm::support::little);
1383 BinaryStreamReader Reader(Contents, 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;
68 StringRef SectionName, Contents;
6969 if (Section.getName(SectionName))
7070 return false;
7171
7272 if (SectionName != Name)
7373 return false;
7474
75 Expected ContentsOrErr = Section.getContents();
76 if (!ContentsOrErr) {
77 consumeError(ContentsOrErr.takeError());
78 return false;
79 }
80
81 Reader = BinaryStreamReader(*ContentsOrErr, support::little);
75 if (Section.getContents(Contents))
76 return false;
77
78 Reader = BinaryStreamReader(Contents, support::little);
8279 uint32_t Magic;
8380 if (Reader.bytesRemaining() < sizeof(uint32_t))
8481 return false;
932932
933933 void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
934934 const SectionRef &Section) {
935 StringRef SectionContents = unwrapOrError(Section.getContents());
935 StringRef SectionContents;
936 error(Section.getContents(SectionContents));
936937 StringRef Data = SectionContents;
937938
938939 SmallVector FunctionNames;
12161217 StringRef SectionName;
12171218 error(S.getName(SectionName));
12181219 if (SectionName == ".debug$T") {
1219 StringRef Data = unwrapOrError(S.getContents());
1220 StringRef Data;
1221 error(S.getContents(Data));
12201222 uint32_t Magic;
12211223 error(consume(Data, Magic));
12221224 if (Magic != 4)
12521254 ListScope D(W, "CodeViewTypes");
12531255 W.printNumber("Section", SectionName, Obj->getSectionID(Section));
12541256
1255 StringRef Data = unwrapOrError(Section.getContents());
1257 StringRef Data;
1258 error(Section.getContents(Data));
12561259 if (opts::CodeViewSubsectionBytes)
12571260 W.printBinaryBlock("Data", Data);
12581261
13121315
13131316 if (opts::SectionData &&
13141317 !(Section->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)) {
1315 StringRef Data = unwrapOrError(Sec.getContents());
1318 StringRef Data;
1319 error(Sec.getContents(Data));
1320
13161321 W.printBinaryBlock("SectionData", Data);
13171322 }
13181323 }
16541659
16551660 void COFFDumper::printCOFFDirectives() {
16561661 for (const SectionRef &Section : Obj->sections()) {
1662 StringRef Contents;
16571663 StringRef Name;
16581664
16591665 error(Section.getName(Name));
16601666 if (Name != ".drectve")
16611667 continue;
16621668
1663 StringRef Contents = unwrapOrError(Section.getContents());
1669 error(Section.getContents(Contents));
1670
16641671 W.printString("Directive(s)", Contents);
16651672 }
16661673 }
16991706 if (!Name.startswith(".rsrc"))
17001707 continue;
17011708
1702 StringRef Ref = unwrapOrError(S.getContents());
1709 StringRef Ref;
1710 error(S.getContents(Ref));
17031711
17041712 if ((Name == ".rsrc") || (Name == ".rsrc$01")) {
17051713 ResourceSectionRef RSF(Ref);
18251833 if (StackMapSection == object::SectionRef())
18261834 return;
18271835
1828 StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
1836 StringRef StackMapContents;
1837 StackMapSection.getContents(StackMapContents);
18291838 ArrayRef StackMapContentsArray =
18301839 arrayRefFromStringRef(StackMapContents);
18311840
18511860 if (AddrsigSection == object::SectionRef())
18521861 return;
18531862
1854 StringRef AddrsigContents = unwrapOrError(AddrsigSection.getContents());
1863 StringRef AddrsigContents;
1864 AddrsigSection.getContents(AddrsigContents);
18551865 ArrayRef AddrsigContentsArray(AddrsigContents.bytes_begin(),
18561866 AddrsigContents.size());
18571867
482482 }
483483 }
484484
485 if (opts::SectionData && !Section.isBSS())
486 W.printBinaryBlock("SectionData", unwrapOrError(Section.getContents()));
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 }
487494 }
488495 }
489496
652659 if (StackMapSection == object::SectionRef())
653660 return;
654661
655 StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
662 StringRef StackMapContents;
663 StackMapSection.getContents(StackMapContents);
656664 ArrayRef StackMapContentsArray =
657665 arrayRefFromStringRef(StackMapContents);
658666
7272 error(E);
7373 W.startLine() << "String dump of section '" << SectionName << "':\n";
7474
75 StringRef SectionContent = unwrapOrError(Section.getContents());
75 StringRef SectionContent;
76 Section.getContents(SectionContent);
7677
7778 const uint8_t *SecContent = SectionContent.bytes_begin();
7879 const uint8_t *CurrentWord = SecContent;
105106 error(E);
106107 W.startLine() << "Hex dump of section '" << SectionName << "':\n";
107108
108 StringRef SectionContent = unwrapOrError(Section.getContents());
109 StringRef SectionContent;
110 Section.getContents(SectionContent);
109111 const uint8_t *SecContent = SectionContent.bytes_begin();
110112 const uint8_t *SecEnd = SecContent + SectionContent.size();
111113
840840 if (!SectSize)
841841 continue;
842842
843 Expected BytesStr = Section.getContents();
844 failIfError(BytesStr);
845 ArrayRef Bytes = arrayRefFromStringRef(*BytesStr);
843 StringRef BytesStr;
844 failIfError(Section.getContents(BytesStr));
845 ArrayRef Bytes = arrayRefFromStringRef(BytesStr);
846846
847847 for (uint64_t Index = 0, Size = 0; Index < Section.getSize();
848848 Index += Size) {