Lines Matching defs:NSec
91 bool MachOLinkGraphBuilder::isDebugSection(const NormalizedSection &NSec) {
92 return (NSec.Flags & MachO::S_ATTR_DEBUG &&
93 strcmp(NSec.SegName, "__DWARF") == 0);
96 bool MachOLinkGraphBuilder::isZeroFillSection(const NormalizedSection &NSec) {
97 switch (NSec.Flags & MachO::SECTION_TYPE) {
121 NormalizedSection NSec;
130 memcpy(&NSec.SectName, &Sec64.sectname, 16);
131 NSec.SectName[16] = '\0';
132 memcpy(&NSec.SegName, Sec64.segname, 16);
133 NSec.SegName[16] = '\0';
135 NSec.Address = orc::ExecutorAddr(Sec64.addr);
136 NSec.Size = Sec64.size;
137 NSec.Alignment = 1ULL << Sec64.align;
138 NSec.Flags = Sec64.flags;
143 memcpy(&NSec.SectName, &Sec32.sectname, 16);
144 NSec.SectName[16] = '\0';
145 memcpy(&NSec.SegName, Sec32.segname, 16);
146 NSec.SegName[16] = '\0';
148 NSec.Address = orc::ExecutorAddr(Sec32.addr);
149 NSec.Size = Sec32.size;
150 NSec.Alignment = 1ULL << Sec32.align;
151 NSec.Flags = Sec32.flags;
156 dbgs() << " " << NSec.SegName << "," << NSec.SectName << ": "
157 << formatv("{0:x16}", NSec.Address) << " -- "
158 << formatv("{0:x16}", NSec.Address + NSec.Size)
159 << ", align: " << NSec.Alignment << ", index: " << SecIndex
164 if (!isZeroFillSection(NSec)) {
165 if (DataOffset + NSec.Size > Obj.getData().size())
169 NSec.Data = Obj.getData().data() + DataOffset;
176 if (NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS)
182 G->allocateContent(StringRef(NSec.SegName) + "," + NSec.SectName);
183 NSec.GraphSection = &G->createSection(
187 if (NSec.Flags & MachO::S_ATTR_DEBUG)
188 NSec.GraphSection->setMemLifetime(orc::MemLifetime::NoAlloc);
190 IndexToSection.insert(std::make_pair(SecIndex, std::move(NSec)));
292 auto NSec = findSectionByIndex(Sect - 1);
293 if (!NSec)
294 return NSec.takeError();
296 if (orc::ExecutorAddr(Value) < NSec->Address ||
297 orc::ExecutorAddr(Value) > NSec->Address + NSec->Size)
302 if (!NSec->GraphSection) {
304 dbgs() << " Skipping: Symbol is in section " << NSec->SegName << "/"
305 << NSec->SectName
330 auto &NSec = SecI->second;
331 assert(!NSec.CanonicalSymbols.count(Sym.getAddress()) &&
333 NSec.CanonicalSymbols[Sym.getAddress()] = &Sym;
405 auto &NSec = KV.second;
407 if (!NSec.GraphSection) {
409 dbgs() << " " << NSec.SegName << "/" << NSec.SectName
416 if (CustomSectionParserFunctions.count(NSec.GraphSection->getName())) {
418 dbgs() << " Skipping section " << NSec.GraphSection->getName()
422 } else if ((NSec.Flags & MachO::SECTION_TYPE) ==
425 NSec, std::move(SecIndexToSymbols[SecIndex])))
431 << NSec.GraphSection->getName() << "...\n";
434 bool SectionIsNoDeadStrip = NSec.Flags & MachO::S_ATTR_NO_DEAD_STRIP;
435 bool SectionIsText = NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
442 if (NSec.Size > 0) {
446 << formatv("{0:x16}", NSec.Address) << " -- "
447 << formatv("{0:x16}", NSec.Address + NSec.Size) << "\n";
449 addSectionStartSymAndBlock(SecIndex, *NSec.GraphSection, NSec.Address,
450 NSec.Data, NSec.Size, NSec.Alignment,
476 "First symbol in " + NSec.GraphSection->getName() + " is alt-entry");
480 if (orc::ExecutorAddr(SecNSymStack.back()->Value) != NSec.Address) {
482 orc::ExecutorAddr(SecNSymStack.back()->Value) - NSec.Address;
485 << "Creating anonymous block to cover [ " << NSec.Address
486 << " -- " << (NSec.Address + AnonBlockSize) << " ]\n";
488 addSectionStartSymAndBlock(SecIndex, *NSec.GraphSection, NSec.Address,
489 NSec.Data, AnonBlockSize, NSec.Alignment,
519 SecNSymStack.empty() ? NSec.Address + NSec.Size
521 orc::ExecutorAddrDiff BlockOffset = BlockStart - NSec.Address;
527 << NSec.GraphSection->getName() << " + "
533 NSec.Data
535 *NSec.GraphSection,
536 ArrayRef<char>(NSec.Data + BlockOffset, BlockSize),
537 BlockStart, NSec.Alignment, BlockStart % NSec.Alignment)
538 : G->createZeroFillBlock(*NSec.GraphSection, BlockSize,
539 BlockStart, NSec.Alignment,
540 BlockStart % NSec.Alignment);
606 auto &NSec = KV.second;
609 if (!NSec.GraphSection)
612 auto HI = CustomSectionParserFunctions.find(NSec.GraphSection->getName());
615 if (auto Err = Parse(NSec))
624 NormalizedSection &NSec, std::vector<NormalizedSymbol *> NSyms) {
625 assert(NSec.GraphSection && "C string literal section missing graph section");
626 assert(NSec.Data && "C string literal section has no data");
630 << NSec.GraphSection->getName() << "\n";
633 if (NSec.Data[NSec.Size - 1] != '\0')
635 NSec.GraphSection->getName() +
655 bool SectionIsNoDeadStrip = NSec.Flags & MachO::S_ATTR_NO_DEAD_STRIP;
656 bool SectionIsText = NSec.Flags & MachO::S_ATTR_PURE_INSTRUCTIONS;
660 for (size_t I = 0; I != NSec.Size; ++I) {
661 if (NSec.Data[I] == '\0') {
664 auto &B = G->createContentBlock(*NSec.GraphSection,
665 {NSec.Data + BlockStart, BlockSize},
666 NSec.Address + BlockStart, NSec.Alignment,
667 BlockStart % NSec.Alignment);
689 setCanonicalSymbol(NSec, S);
729 assert(llvm::all_of(NSec.GraphSection->blocks(),