Lines Matching refs:sec

112   for (OutputSection *sec : outputSections)  in removeEmptyPTLoad()
113 if (removed.count(sec->ptLoad)) in removeEmptyPTLoad()
114 sec->ptLoad = nullptr; in removeEmptyPTLoad()
141 static Defined *addOptionalRegular(StringRef name, SectionBase *sec, in addOptionalRegular() argument
149 /*size=*/0, sec}); in addOptionalRegular()
252 for (auto [i, sec] : llvm::enumerate(sym.file->getSections())) in demoteDefined()
253 map.try_emplace(sec, i); in demoteDefined()
314 for (OutputSection *sec : outputSections) in run()
315 sec->maybeCompress<ELFT>(); in run()
459 SectionBase *sec = d->section; in includeInSymtab() local
460 if (!sec) in includeInSymtab()
462 assert(sec->isLive()); in includeInSymtab()
464 if (auto *s = dyn_cast<MergeInputSection>(sec)) in includeInSymtab()
544 static bool isRelroSection(const OutputSection *sec) { in isRelroSection() argument
547 if (sec->relro) in isRelroSection()
550 uint64_t flags = sec->flags; in isRelroSection()
573 uint32_t type = sec->type; in isRelroSection()
581 if (in.got && sec == in.got->getParent()) in isRelroSection()
589 if (sec->name == ".toc") in isRelroSection()
596 if (sec == in.gotPlt->getParent()) in isRelroSection()
599 if (in.relroPadding && sec == in.relroPadding->getParent()) in isRelroSection()
605 if (sec->name == ".dynamic") in isRelroSection()
612 StringRef s = sec->name; in isRelroSection()
780 void PhdrEntry::add(OutputSection *sec) { in add() argument
781 lastSec = sec; in add()
783 firstSec = sec; in add()
784 p_align = std::max(p_align, sec->addralign); in add()
786 sec->ptLoad = this; in add()
817 InputSection *sec = in.gotPlt.get(); in setReservedSymbolSections() local
819 sec = in.mipsGot ? cast<InputSection>(in.mipsGot.get()) in setReservedSymbolSections()
821 ElfSym::globalOffsetTable->section = sec; in setReservedSymbolSections()
939 OutputSection *sec = &cast<OutputDesc>(*e)->osec; in findOrphanPos() local
940 if (!(sec->flags & SHF_ALLOC)) in findOrphanPos()
945 if (in.relroPadding && sec == in.relroPadding->getParent()) { in findOrphanPos()
964 int p = getRankProximity(sec, *j); in findOrphanPos()
966 (p == maxP && cast<OutputDesc>(*j)->osec.sortRank <= sec->sortRank)) { in findOrphanPos()
988 if (cast<OutputDesc>(*i)->osec.sortRank <= sec->sortRank || mustAfter) { in findOrphanPos()
992 if (getRankProximity(sec, *j) != maxP) in findOrphanPos()
1024 for (InputSectionBase *sec : sections) in maybeShuffle()
1025 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1026 matched.push_back(sec); in maybeShuffle()
1039 for (InputSectionBase *&sec : sections) in maybeShuffle()
1040 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1041 sec = matched[i++]; in maybeShuffle()
1047 for (InputSectionBase *sec : sections) { in maybeShuffle()
1048 if (order.try_emplace(sec, prio).second) in maybeShuffle()
1087 if (auto *sec = dyn_cast_or_null<InputSectionBase>(d->section)) { in buildSectionOrder() local
1088 int &priority = sectionOrder[cast<InputSectionBase>(sec)]; in buildSectionOrder()
1369 for (OutputSection *sec : outputSections) { in resolveShfLinkOrder()
1370 if (!(sec->flags & SHF_LINK_ORDER)) in resolveShfLinkOrder()
1376 sec->type == SHT_ARM_EXIDX) in resolveShfLinkOrder()
1383 for (SectionCommand *cmd : sec->commands) { in resolveShfLinkOrder()
1410 static void finalizeSynthetic(SyntheticSection *sec) { in finalizeSynthetic() argument
1411 if (sec && sec->isNeeded() && sec->getParent()) { in finalizeSynthetic()
1412 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name); in finalizeSynthetic()
1413 sec->finalizeContents(); in finalizeSynthetic()
1534 for (OutputSection *sec : outputSections) in finalizeAddressDependentContent()
1535 sec->addr = 0; in finalizeAddressDependentContent()
1564 const SectionBase *sec = def->section; in fixSymbolsAfterShrinking() local
1565 if (!sec) in fixSymbolsAfterShrinking()
1568 const InputSectionBase *inputSec = dyn_cast<InputSectionBase>(sec); in fixSymbolsAfterShrinking()
1621 InputSection &sec = *sections[i]; in optimizeBasicBlockJumps() local
1622 numDeleted += target->deleteFallThruJmpInsn(sec, sec.file, next); in optimizeBasicBlockJumps()
1663 auto *sec = cast<SyntheticSection>(s); in removeUnusedSyntheticSections() local
1664 if (sec->getParent() && sec->isNeeded()) in removeUnusedSyntheticSections()
1671 if (auto *relSec = dyn_cast<RelocationBaseSection>(sec)) in removeUnusedSyntheticSections()
1674 unused.insert(sec); in removeUnusedSyntheticSections()
1681 for (auto *sec : unused) in removeUnusedSyntheticSections() local
1682 if (OutputSection *osec = cast<SyntheticSection>(sec)->getParent()) in removeUnusedSyntheticSections()
1688 llvm::erase_if(script->orphanSections, [&](const InputSectionBase *sec) { in removeUnusedSyntheticSections() argument
1689 return unused.count(sec); in removeUnusedSyntheticSections()
1729 OutputSection *sec = findSection(".sdata"); in finalizeSections() local
1731 "__global_pointer$", sec ? sec : Out::elfHeader, 0x800, STV_DEFAULT); in finalizeSections()
1897 for (OutputSection *sec : outputSections) { in finalizeSections()
1898 auto i = config->sectionStartMap.find(sec->name); in finalizeSections()
1900 sec->addrExpr = [=] { return i->second; }; in finalizeSections()
2056 for (OutputSection *sec : outputSections) in finalizeSections()
2057 sec->finalize(); in finalizeSections()
2111 if (OutputSection *sec = findSection(".ARM.exidx")) in addStartEndSymbols() local
2112 define("__exidx_start", "__exidx_end", sec); in addStartEndSymbols()
2133 static bool needsPtLoad(OutputSection *sec) { in needsPtLoad() argument
2134 if (!(sec->flags & SHF_ALLOC)) in needsPtLoad()
2140 if ((sec->flags & SHF_TLS) && sec->type == SHT_NOBITS) in needsPtLoad()
2202 for (OutputSection *sec : outputSections) { in createPhdrs()
2203 if (sec->partition != partNo || !needsPtLoad(sec)) in createPhdrs()
2205 if (isRelroSection(sec)) { in createPhdrs()
2208 relRo->add(sec); in createPhdrs()
2210 error("section: " + sec->name + " is not contiguous with other relro" + in createPhdrs()
2214 relroEnd = sec; in createPhdrs()
2219 for (OutputSection *sec : outputSections) { in createPhdrs()
2220 if (!needsPtLoad(sec)) in createPhdrs()
2229 if (sec->partition != partNo) { in createPhdrs()
2230 if (isMain && sec->partition == 255) in createPhdrs()
2231 addHdr(PT_LOAD, computeFlags(sec->getPhdrFlags()))->add(sec); in createPhdrs()
2251 uint64_t newFlags = computeFlags(sec->getPhdrFlags()); in createPhdrs()
2260 load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion; in createPhdrs()
2261 if (load && sec != relroEnd && in createPhdrs()
2262 sec->memRegion == load->firstSec->memRegion && in createPhdrs()
2264 (script->hasSectionsCommand || sec->type == SHT_NOBITS || in createPhdrs()
2272 load->add(sec); in createPhdrs()
2277 for (OutputSection *sec : outputSections) in createPhdrs()
2278 if (sec->partition == partNo && sec->flags & SHF_TLS) in createPhdrs()
2279 tlsHdr->add(sec); in createPhdrs()
2284 if (OutputSection *sec = part.dynamic->getParent()) in createPhdrs() local
2285 addHdr(PT_DYNAMIC, sec->getPhdrFlags())->add(sec); in createPhdrs()
2337 for (OutputSection *sec : outputSections) { in createPhdrs()
2338 if (sec->partition != partNo) in createPhdrs()
2340 if (sec->type == SHT_NOTE && (sec->flags & SHF_ALLOC)) { in createPhdrs()
2341 if (!note || sec->lmaExpr || note->lastSec->addralign != sec->addralign) in createPhdrs()
2343 note->add(sec); in createPhdrs()
2462 auto needsOffset = [](OutputSection &sec) { in assignFileOffsetsBinary() argument
2463 return sec.type != SHT_NOBITS && (sec.flags & SHF_ALLOC) && sec.size > 0; in assignFileOffsetsBinary()
2466 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2467 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2468 sec->offset = sec->getLMA(); in assignFileOffsetsBinary()
2469 minAddr = std::min(minAddr, sec->offset); in assignFileOffsetsBinary()
2474 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2475 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2476 sec->offset -= minAddr; in assignFileOffsetsBinary()
2477 fileSize = std::max(fileSize, sec->offset + sec->size); in assignFileOffsetsBinary()
2498 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2499 if (!(sec->flags & SHF_ALLOC)) in assignFileOffsets()
2501 off = computeFileOffset(sec, off); in assignFileOffsets()
2502 sec->offset = off; in assignFileOffsets()
2503 if (sec->type != SHT_NOBITS) in assignFileOffsets()
2504 off += sec->size; in assignFileOffsets()
2510 lastRX->lastSec == sec) in assignFileOffsets()
2532 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2533 if (sec->type == SHT_NOBITS) in assignFileOffsets()
2535 if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize)) in assignFileOffsets()
2536 error("unable to place section " + sec->name + " at file offset " + in assignFileOffsets()
2537 rangeToString(sec->offset, sec->size) + in assignFileOffsets()
2589 OutputSection *sec; member
2607 if (b.offset >= a.offset + a.sec->size) in checkOverlap()
2612 if (isVirtualAddr && a.sec->inOverlay && b.sec->inOverlay) in checkOverlap()
2615 errorOrWarn("section " + a.sec->name + " " + name + in checkOverlap()
2616 " range overlaps with " + b.sec->name + "\n>>> " + a.sec->name + in checkOverlap()
2617 " range is " + rangeToString(a.offset, a.sec->size) + "\n>>> " + in checkOverlap()
2618 b.sec->name + " range is " + in checkOverlap()
2619 rangeToString(b.offset, b.sec->size)); in checkOverlap()
2643 for (OutputSection *sec : outputSections) in checkSections()
2644 if (sec->size > 0 && sec->type != SHT_NOBITS && in checkSections()
2645 (!config->oFormatBinary || (sec->flags & SHF_ALLOC))) in checkSections()
2646 fileOffs.push_back({sec, sec->offset}); in checkSections()
2661 for (OutputSection *sec : outputSections) in checkSections()
2662 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2663 vmas.push_back({sec, sec->addr}); in checkSections()
2670 for (OutputSection *sec : outputSections) in checkSections()
2671 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2672 lmas.push_back({sec, sec->getLMA()}); in checkSections()
2741 for (OutputSection *sec : outputSections) in writeHeader()
2742 sec->writeHeaderTo<ELFT>(++sHdrs); in writeHeader()
2779 for (OutputSection *sec : outputSections) in writeSectionsBinary()
2780 if (sec->flags & SHF_ALLOC) in writeSectionsBinary()
2781 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSectionsBinary()
2829 for (OutputSection *sec : outputSections) in writeSections()
2830 if (isStaticRelSecType(sec->type)) in writeSections()
2831 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
2835 for (OutputSection *sec : outputSections) in writeSections()
2836 if (!isStaticRelSecType(sec->type)) in writeSections()
2837 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
2842 for (OutputSection *sec : outputSections) in writeSections()
2843 if (isStaticRelSecType(sec->type)) in writeSections()
2844 sec->checkDynRelAddends(Out::bufferStart); in writeSections()