Lines Matching refs:sec
116 for (OutputSection *sec : outputSections) in removeEmptyPTLoad()
117 if (removed.count(sec->ptLoad)) in removeEmptyPTLoad()
118 sec->ptLoad = nullptr; in removeEmptyPTLoad()
145 static Defined *addOptionalRegular(StringRef name, SectionBase *sec, in addOptionalRegular() argument
152 /*size=*/0, sec}); in addOptionalRegular()
275 InputSection *sec = createInterpSection(); in createSyntheticSections() local
276 sec->partition = i; in createSyntheticSections()
277 ctx.inputSections.push_back(sec); in createSyntheticSections()
281 auto add = [](SyntheticSection &sec) { ctx.inputSections.push_back(&sec); }; in createSyntheticSections() argument
323 auto add = [&](SyntheticSection &sec) { in createSyntheticSections() argument
324 sec.partition = part.getNumber(); in createSyntheticSections()
325 ctx.inputSections.push_back(&sec); in createSyntheticSections()
543 for (OutputSection *sec : outputSections) in run()
544 sec->maybeCompress<ELFT>(); in run()
672 SectionBase *sec = d->section; in includeInSymtab() local
673 if (!sec) in includeInSymtab()
676 if (auto *s = dyn_cast<MergeInputSection>(sec)) in includeInSymtab()
678 return sec->isLive(); in includeInSymtab()
755 static bool isRelroSection(const OutputSection *sec) { in isRelroSection() argument
758 if (sec->relro) in isRelroSection()
761 uint64_t flags = sec->flags; in isRelroSection()
784 uint32_t type = sec->type; in isRelroSection()
792 if (in.got && sec == in.got->getParent()) in isRelroSection()
800 if (sec->name.equals(".toc")) in isRelroSection()
807 if (sec == in.gotPlt->getParent()) in isRelroSection()
817 if (sec->name == ".dynamic") in isRelroSection()
824 StringRef s = sec->name; in isRelroSection()
1002 void PhdrEntry::add(OutputSection *sec) { in add() argument
1003 lastSec = sec; in add()
1005 firstSec = sec; in add()
1006 p_align = std::max(p_align, sec->addralign); in add()
1008 sec->ptLoad = this; in add()
1043 InputSection *sec = in.gotPlt.get(); in setReservedSymbolSections() local
1045 sec = in.mipsGot ? cast<InputSection>(in.mipsGot.get()) in setReservedSymbolSections()
1047 ElfSym::globalOffsetTable->section = sec; in setReservedSymbolSections()
1158 OutputSection *sec = &cast<OutputDesc>(*e)->osec; in findOrphanPos() local
1162 return getRankProximity(sec, a) < getRankProximity(sec, b); in findOrphanPos()
1171 int proximity = getRankProximity(sec, *i); in findOrphanPos()
1172 unsigned sortRank = sec->sortRank; in findOrphanPos()
1185 if (getRankProximity(sec, curSecDesc) != proximity || in findOrphanPos()
1222 for (InputSectionBase *sec : sections) in maybeShuffle()
1223 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1224 matched.push_back(sec); in maybeShuffle()
1237 for (InputSectionBase *&sec : sections) in maybeShuffle()
1238 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1239 sec = matched[i++]; in maybeShuffle()
1245 for (InputSectionBase *sec : sections) { in maybeShuffle()
1246 if (order.try_emplace(sec, prio).second) in maybeShuffle()
1285 if (auto *sec = dyn_cast_or_null<InputSectionBase>(d->section)) { in buildSectionOrder() local
1286 int &priority = sectionOrder[cast<InputSectionBase>(sec)]; in buildSectionOrder()
1571 for (OutputSection *sec : outputSections) { in resolveShfLinkOrder()
1572 if (!(sec->flags & SHF_LINK_ORDER)) in resolveShfLinkOrder()
1578 sec->type == SHT_ARM_EXIDX) in resolveShfLinkOrder()
1585 for (SectionCommand *cmd : sec->commands) { in resolveShfLinkOrder()
1612 static void finalizeSynthetic(SyntheticSection *sec) { in finalizeSynthetic() argument
1613 if (sec && sec->isNeeded() && sec->getParent()) { in finalizeSynthetic()
1614 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name); in finalizeSynthetic()
1615 sec->finalizeContents(); in finalizeSynthetic()
1693 for (OutputSection *sec : outputSections) in finalizeAddressDependentContent()
1694 sec->addr = 0; in finalizeAddressDependentContent()
1719 const SectionBase *sec = def->section; in fixSymbolsAfterShrinking() local
1720 if (!sec) in fixSymbolsAfterShrinking()
1723 const InputSectionBase *inputSec = dyn_cast<InputSectionBase>(sec); in fixSymbolsAfterShrinking()
1776 InputSection &sec = *sections[i]; in optimizeBasicBlockJumps() local
1777 numDeleted += target->deleteFallThruJmpInsn(sec, sec.file, next); in optimizeBasicBlockJumps()
1818 auto *sec = cast<SyntheticSection>(s); in removeUnusedSyntheticSections() local
1819 if (sec->getParent() && sec->isNeeded()) in removeUnusedSyntheticSections()
1821 unused.insert(sec); in removeUnusedSyntheticSections()
1828 for (auto *sec : unused) in removeUnusedSyntheticSections() local
1829 if (OutputSection *osec = cast<SyntheticSection>(sec)->getParent()) in removeUnusedSyntheticSections()
1835 llvm::erase_if(script->orphanSections, [&](const InputSectionBase *sec) { in removeUnusedSyntheticSections() argument
1836 return unused.count(sec); in removeUnusedSyntheticSections()
1874 OutputSection *sec = findSection(".sdata"); in finalizeSections() local
1875 addOptionalRegular("__global_pointer$", sec ? sec : Out::elfHeader, 0x800, in finalizeSections()
2016 for (OutputSection *sec : outputSections) { in finalizeSections()
2017 auto i = config->sectionStartMap.find(sec->name); in finalizeSections()
2019 sec->addrExpr = [=] { return i->second; }; in finalizeSections()
2161 for (OutputSection *sec : outputSections) in finalizeSections()
2162 sec->finalize(); in finalizeSections()
2219 if (OutputSection *sec = findSection(".ARM.exidx")) in addStartEndSymbols() local
2220 define("__exidx_start", "__exidx_end", sec); in addStartEndSymbols()
2239 static bool needsPtLoad(OutputSection *sec) { in needsPtLoad() argument
2240 if (!(sec->flags & SHF_ALLOC)) in needsPtLoad()
2246 if ((sec->flags & SHF_TLS) && sec->type == SHT_NOBITS) in needsPtLoad()
2313 for (OutputSection *sec : outputSections) { in createPhdrs()
2314 if (sec->partition != partNo || !needsPtLoad(sec)) in createPhdrs()
2316 if (isRelroSection(sec)) { in createPhdrs()
2319 relRo->add(sec); in createPhdrs()
2321 error("section: " + sec->name + " is not contiguous with other relro" + in createPhdrs()
2325 relroEnd = sec; in createPhdrs()
2329 for (OutputSection *sec : outputSections) { in createPhdrs()
2330 if (!needsPtLoad(sec)) in createPhdrs()
2339 if (sec->partition != partNo) { in createPhdrs()
2340 if (isMain && sec->partition == 255) in createPhdrs()
2341 addHdr(PT_LOAD, computeFlags(sec->getPhdrFlags()))->add(sec); in createPhdrs()
2352 uint64_t newFlags = computeFlags(sec->getPhdrFlags()); in createPhdrs()
2354 load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion; in createPhdrs()
2355 if (!(load && newFlags == flags && sec != relroEnd && in createPhdrs()
2356 sec->memRegion == load->firstSec->memRegion && in createPhdrs()
2362 load->add(sec); in createPhdrs()
2367 for (OutputSection *sec : outputSections) in createPhdrs()
2368 if (sec->partition == partNo && sec->flags & SHF_TLS) in createPhdrs()
2369 tlsHdr->add(sec); in createPhdrs()
2374 if (OutputSection *sec = part.dynamic->getParent()) in createPhdrs() local
2375 addHdr(PT_DYNAMIC, sec->getPhdrFlags())->add(sec); in createPhdrs()
2431 for (OutputSection *sec : outputSections) { in createPhdrs()
2432 if (sec->partition != partNo) in createPhdrs()
2434 if (sec->type == SHT_NOTE && (sec->flags & SHF_ALLOC)) { in createPhdrs()
2435 if (!note || sec->lmaExpr || note->lastSec->addralign != sec->addralign) in createPhdrs()
2437 note->add(sec); in createPhdrs()
2581 auto needsOffset = [](OutputSection &sec) { in assignFileOffsetsBinary() argument
2582 return sec.type != SHT_NOBITS && (sec.flags & SHF_ALLOC) && sec.size > 0; in assignFileOffsetsBinary()
2585 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2586 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2587 sec->offset = sec->getLMA(); in assignFileOffsetsBinary()
2588 minAddr = std::min(minAddr, sec->offset); in assignFileOffsetsBinary()
2593 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2594 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2595 sec->offset -= minAddr; in assignFileOffsetsBinary()
2596 fileSize = std::max(fileSize, sec->offset + sec->size); in assignFileOffsetsBinary()
2617 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2618 if (!(sec->flags & SHF_ALLOC)) in assignFileOffsets()
2620 off = computeFileOffset(sec, off); in assignFileOffsets()
2621 sec->offset = off; in assignFileOffsets()
2622 if (sec->type != SHT_NOBITS) in assignFileOffsets()
2623 off += sec->size; in assignFileOffsets()
2629 lastRX->lastSec == sec) in assignFileOffsets()
2650 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2651 if (sec->type == SHT_NOBITS) in assignFileOffsets()
2653 if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize)) in assignFileOffsets()
2654 error("unable to place section " + sec->name + " at file offset " + in assignFileOffsets()
2655 rangeToString(sec->offset, sec->size) + in assignFileOffsets()
2700 OutputSection *sec; member
2718 if (b.offset >= a.offset + a.sec->size) in checkOverlap()
2723 if (isVirtualAddr && a.sec->inOverlay && b.sec->inOverlay) in checkOverlap()
2726 errorOrWarn("section " + a.sec->name + " " + name + in checkOverlap()
2727 " range overlaps with " + b.sec->name + "\n>>> " + a.sec->name + in checkOverlap()
2728 " range is " + rangeToString(a.offset, a.sec->size) + "\n>>> " + in checkOverlap()
2729 b.sec->name + " range is " + in checkOverlap()
2730 rangeToString(b.offset, b.sec->size)); in checkOverlap()
2754 for (OutputSection *sec : outputSections) in checkSections()
2755 if (sec->size > 0 && sec->type != SHT_NOBITS && in checkSections()
2756 (!config->oFormatBinary || (sec->flags & SHF_ALLOC))) in checkSections()
2757 fileOffs.push_back({sec, sec->offset}); in checkSections()
2772 for (OutputSection *sec : outputSections) in checkSections()
2773 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2774 vmas.push_back({sec, sec->addr}); in checkSections()
2781 for (OutputSection *sec : outputSections) in checkSections()
2782 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2783 lmas.push_back({sec, sec->getLMA()}); in checkSections()
2852 for (OutputSection *sec : outputSections) in writeHeader()
2853 sec->writeHeaderTo<ELFT>(++sHdrs); in writeHeader()
2890 for (OutputSection *sec : outputSections) in writeSectionsBinary()
2891 if (sec->flags & SHF_ALLOC) in writeSectionsBinary()
2892 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSectionsBinary()
2940 for (OutputSection *sec : outputSections) in writeSections()
2941 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
2942 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
2946 for (OutputSection *sec : outputSections) in writeSections()
2947 if (sec->type != SHT_REL && sec->type != SHT_RELA) in writeSections()
2948 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
2953 for (OutputSection *sec : outputSections) in writeSections()
2954 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
2955 sec->checkDynRelAddends(Out::bufferStart); in writeSections()