Lines Matching defs:NSec

88 bool MachOLinkGraphBuilder::isDebugSection(const NormalizedSection &NSec) {
89 return (NSec.Flags & MachO::S_ATTR_DEBUG &&
90 strcmp(NSec.SegName, "__DWARF") == 0);
93 bool MachOLinkGraphBuilder::isZeroFillSection(const NormalizedSection &NSec) {
94 switch (NSec.Flags & MachO::SECTION_TYPE) {
129 NormalizedSection NSec;
138 memcpy(&NSec.SectName, &Sec64.sectname, 16);
139 NSec.SectName[16] = '\0';
140 memcpy(&NSec.SegName, Sec64.segname, 16);
141 NSec.SegName[16] = '\0';
143 NSec.Address = orc::ExecutorAddr(Sec64.addr);
144 NSec.Size = Sec64.size;
145 NSec.Alignment = 1ULL << Sec64.align;
146 NSec.Flags = Sec64.flags;
151 memcpy(&NSec.SectName, &Sec32.sectname, 16);
152 NSec.SectName[16] = '\0';
153 memcpy(&NSec.SegName, Sec32.segname, 16);
154 NSec.SegName[16] = '\0';
156 NSec.Address = orc::ExecutorAddr(Sec32.addr);
157 NSec.Size = Sec32.size;
158 NSec.Alignment = 1ULL << Sec32.align;
159 NSec.Flags = Sec32.flags;
164 dbgs() << " " << NSec.SegName << "," << NSec.SectName << ": "
165 << formatv("{0:x16}", NSec.Address) << " -- "
166 << formatv("{0:x16}", NSec.Address + NSec.Size)
167 << ", align: " << NSec.Alignment << ", index: " << SecIndex
172 if (!isZeroFillSection(NSec)) {
173 if (DataOffset + NSec.Size > Obj.getData().size())
177 NSec.Data = Obj.getData().data() + DataOffset;
184 if (NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS)
190 G->allocateContent(StringRef(NSec.SegName) + "," + NSec.SectName);
191 NSec.GraphSection = &G->createSection(
195 if (NSec.Flags & MachO::S_ATTR_DEBUG)
196 NSec.GraphSection->setMemLifetime(orc::MemLifetime::NoAlloc);
198 IndexToSection.insert(std::make_pair(SecIndex, std::move(NSec)));
300 auto NSec = findSectionByIndex(Sect - 1);
301 if (!NSec)
302 return NSec.takeError();
304 if (orc::ExecutorAddr(Value) < NSec->Address ||
305 orc::ExecutorAddr(Value) > NSec->Address + NSec->Size)
310 if (!NSec->GraphSection) {
312 dbgs() << " Skipping: Symbol is in section " << NSec->SegName << "/"
313 << NSec->SectName
339 auto &NSec = SecI->second;
340 assert(!NSec.CanonicalSymbols.count(Sym.getAddress()) &&
342 NSec.CanonicalSymbols[Sym.getAddress()] = &Sym;
414 auto &NSec = KV.second;
416 if (!NSec.GraphSection) {
418 dbgs() << " " << NSec.SegName << "/" << NSec.SectName
425 if (CustomSectionParserFunctions.count(NSec.GraphSection->getName())) {
427 dbgs() << " Skipping section " << NSec.GraphSection->getName()
431 } else if ((NSec.Flags & MachO::SECTION_TYPE) ==
434 NSec, std::move(SecIndexToSymbols[SecIndex])))
440 << NSec.GraphSection->getName() << "...\n";
443 bool SectionIsNoDeadStrip = NSec.Flags & MachO::S_ATTR_NO_DEAD_STRIP;
444 bool SectionIsText = NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
451 if (NSec.Size > 0) {
455 << formatv("{0:x16}", NSec.Address) << " -- "
456 << formatv("{0:x16}", NSec.Address + NSec.Size) << "\n";
458 addSectionStartSymAndBlock(SecIndex, *NSec.GraphSection, NSec.Address,
459 NSec.Data, NSec.Size, NSec.Alignment,
485 "First symbol in " + NSec.GraphSection->getName() + " is alt-entry");
489 if (orc::ExecutorAddr(SecNSymStack.back()->Value) != NSec.Address) {
491 orc::ExecutorAddr(SecNSymStack.back()->Value) - NSec.Address;
494 << "Creating anonymous block to cover [ " << NSec.Address
495 << " -- " << (NSec.Address + AnonBlockSize) << " ]\n";
497 addSectionStartSymAndBlock(SecIndex, *NSec.GraphSection, NSec.Address,
498 NSec.Data, AnonBlockSize, NSec.Alignment,
528 SecNSymStack.empty() ? NSec.Address + NSec.Size
530 orc::ExecutorAddrDiff BlockOffset = BlockStart - NSec.Address;
536 << NSec.GraphSection->getName() << " + "
542 NSec.Data
544 *NSec.GraphSection,
545 ArrayRef<char>(NSec.Data + BlockOffset, BlockSize),
546 BlockStart, NSec.Alignment, BlockStart % NSec.Alignment)
547 : G->createZeroFillBlock(*NSec.GraphSection, BlockSize,
548 BlockStart, NSec.Alignment,
549 BlockStart % NSec.Alignment);
615 auto &NSec = KV.second;
618 if (!NSec.GraphSection)
621 auto HI = CustomSectionParserFunctions.find(NSec.GraphSection->getName());
624 if (auto Err = Parse(NSec))
633 NormalizedSection &NSec, std::vector<NormalizedSymbol *> NSyms) {
634 assert(NSec.GraphSection && "C string literal section missing graph section");
635 assert(NSec.Data && "C string literal section has no data");
639 << NSec.GraphSection->getName() << "\n";
642 if (NSec.Data[NSec.Size - 1] != '\0')
644 NSec.GraphSection->getName() +
664 bool SectionIsNoDeadStrip = NSec.Flags & MachO::S_ATTR_NO_DEAD_STRIP;
665 bool SectionIsText = NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
669 for (size_t I = 0; I != NSec.Size; ++I) {
670 if (NSec.Data[I] == '\0') {
673 auto &B = G->createContentBlock(*NSec.GraphSection,
674 {NSec.Data + BlockStart, BlockSize},
675 NSec.Address + BlockStart, NSec.Alignment,
676 BlockStart % NSec.Alignment);
698 setCanonicalSymbol(NSec, S);
738 assert(llvm::all_of(NSec.GraphSection->blocks(),