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()
165 static Defined *addOptionalRegular(StringRef name, SectionBase *sec, in addOptionalRegular() argument
172 /*size=*/0, sec}); in addOptionalRegular()
294 InputSection *sec = createInterpSection(); in createSyntheticSections() local
295 sec->partition = i; in createSyntheticSections()
296 inputSections.push_back(sec); in createSyntheticSections()
300 auto add = [](SyntheticSection &sec) { inputSections.push_back(&sec); }; in createSyntheticSections() argument
341 auto add = [&](SyntheticSection &sec) { in createSyntheticSections() argument
342 sec.partition = part.getNumber(); in createSyntheticSections()
343 inputSections.push_back(&sec); in createSyntheticSections()
555 for (OutputSection *sec : outputSections) in run()
556 sec->maybeCompress<ELFT>(); in run()
683 SectionBase *sec = d->section; in includeInSymtab() local
684 if (!sec) in includeInSymtab()
687 if (auto *s = dyn_cast<MergeInputSection>(sec)) in includeInSymtab()
689 return sec->isLive(); in includeInSymtab()
766 static bool isRelroSection(const OutputSection *sec) { in isRelroSection() argument
769 if (sec->relro) in isRelroSection()
772 uint64_t flags = sec->flags; in isRelroSection()
795 uint32_t type = sec->type; in isRelroSection()
803 if (in.got && sec == in.got->getParent()) in isRelroSection()
811 if (sec->name.equals(".toc")) in isRelroSection()
818 if (sec == in.gotPlt->getParent()) in isRelroSection()
824 if (sec->name == ".dynamic") in isRelroSection()
831 StringRef s = sec->name; in isRelroSection()
1009 void PhdrEntry::add(OutputSection *sec) { in add() argument
1010 lastSec = sec; in add()
1012 firstSec = sec; in add()
1013 p_align = std::max(p_align, sec->alignment); in add()
1015 sec->ptLoad = this; in add()
1050 InputSection *sec = in.gotPlt.get(); in setReservedSymbolSections() local
1052 sec = in.mipsGot.get() ? cast<InputSection>(in.mipsGot.get()) in setReservedSymbolSections()
1054 ElfSym::globalOffsetTable->section = sec; in setReservedSymbolSections()
1166 OutputSection *sec = &cast<OutputDesc>(*e)->osec; in findOrphanPos() local
1170 return getRankProximity(sec, a) < getRankProximity(sec, b); in findOrphanPos()
1179 int proximity = getRankProximity(sec, *i); in findOrphanPos()
1180 unsigned sortRank = sec->sortRank; in findOrphanPos()
1193 if (getRankProximity(sec, curSecDesc) != proximity || in findOrphanPos()
1230 for (InputSectionBase *sec : sections) in maybeShuffle()
1231 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1232 matched.push_back(sec); in maybeShuffle()
1245 for (InputSectionBase *&sec : sections) in maybeShuffle()
1246 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1247 sec = matched[i++]; in maybeShuffle()
1253 for (InputSectionBase *sec : sections) { in maybeShuffle()
1254 if (order.try_emplace(sec, prio).second) in maybeShuffle()
1293 if (auto *sec = dyn_cast_or_null<InputSectionBase>(d->section)) { in buildSectionOrder() local
1294 int &priority = sectionOrder[cast<InputSectionBase>(sec)]; in buildSectionOrder()
1579 for (OutputSection *sec : outputSections) { in resolveShfLinkOrder()
1580 if (!(sec->flags & SHF_LINK_ORDER)) in resolveShfLinkOrder()
1586 sec->type == SHT_ARM_EXIDX) in resolveShfLinkOrder()
1593 for (SectionCommand *cmd : sec->commands) { in resolveShfLinkOrder()
1620 static void finalizeSynthetic(SyntheticSection *sec) { in finalizeSynthetic() argument
1621 if (sec && sec->isNeeded() && sec->getParent()) { in finalizeSynthetic()
1622 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name); in finalizeSynthetic()
1623 sec->finalizeContents(); in finalizeSynthetic()
1701 for (OutputSection *sec : outputSections) in finalizeAddressDependentContent()
1702 sec->addr = 0; in finalizeAddressDependentContent()
1727 const SectionBase *sec = def->section; in fixSymbolsAfterShrinking() local
1728 if (!sec) in fixSymbolsAfterShrinking()
1731 const InputSectionBase *inputSec = dyn_cast<InputSectionBase>(sec); in fixSymbolsAfterShrinking()
1784 InputSection &sec = *sections[i]; in optimizeBasicBlockJumps() local
1785 numDeleted += target->deleteFallThruJmpInsn(sec, sec.file, next); in optimizeBasicBlockJumps()
1827 auto *sec = cast<SyntheticSection>(s); in removeUnusedSyntheticSections() local
1828 if (sec->getParent() && sec->isNeeded()) in removeUnusedSyntheticSections()
1830 unused.insert(sec); in removeUnusedSyntheticSections()
1837 for (auto *sec : unused) in removeUnusedSyntheticSections() local
1838 if (OutputSection *osec = cast<SyntheticSection>(sec)->getParent()) in removeUnusedSyntheticSections()
1844 llvm::erase_if(script->orphanSections, [&](const InputSectionBase *sec) { in removeUnusedSyntheticSections() argument
1845 return unused.count(sec); in removeUnusedSyntheticSections()
1881 OutputSection *sec = findSection(".sdata"); in finalizeSections() local
1883 addOptionalRegular("__global_pointer$", sec ? sec : Out::elfHeader, in finalizeSections()
1939 for (InputSectionBase *sec : inputSections) in finalizeSections()
1940 if (sec->isLive() && isa<InputSection>(sec) && (sec->flags & SHF_ALLOC)) in finalizeSections()
1941 scanRelocations<ELFT>(*sec); in finalizeSections()
1943 for (EhInputSection *sec : part.ehFrame->sections) in finalizeSections()
1944 scanRelocations<ELFT>(*sec); in finalizeSections()
1946 for (InputSection *sec : part.armExidx->exidxSections) in finalizeSections()
1947 scanRelocations<ELFT>(*sec); in finalizeSections()
2038 for (OutputSection *sec : outputSections) { in finalizeSections()
2039 auto i = config->sectionStartMap.find(sec->name); in finalizeSections()
2041 sec->addrExpr = [=] { return i->second; }; in finalizeSections()
2179 for (OutputSection *sec : outputSections) in finalizeSections()
2180 sec->finalize(); in finalizeSections()
2237 if (OutputSection *sec = findSection(".ARM.exidx")) in addStartEndSymbols() local
2238 define("__exidx_start", "__exidx_end", sec); in addStartEndSymbols()
2257 static bool needsPtLoad(OutputSection *sec) { in needsPtLoad() argument
2258 if (!(sec->flags & SHF_ALLOC)) in needsPtLoad()
2264 if ((sec->flags & SHF_TLS) && sec->type == SHT_NOBITS) in needsPtLoad()
2331 for (OutputSection *sec : outputSections) { in createPhdrs()
2332 if (sec->partition != partNo || !needsPtLoad(sec)) in createPhdrs()
2334 if (isRelroSection(sec)) { in createPhdrs()
2337 relRo->add(sec); in createPhdrs()
2339 error("section: " + sec->name + " is not contiguous with other relro" + in createPhdrs()
2343 relroEnd = sec; in createPhdrs()
2347 for (OutputSection *sec : outputSections) { in createPhdrs()
2348 if (!needsPtLoad(sec)) in createPhdrs()
2357 if (sec->partition != partNo) { in createPhdrs()
2358 if (isMain && sec->partition == 255) in createPhdrs()
2359 addHdr(PT_LOAD, computeFlags(sec->getPhdrFlags()))->add(sec); in createPhdrs()
2370 uint64_t newFlags = computeFlags(sec->getPhdrFlags()); in createPhdrs()
2372 load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion; in createPhdrs()
2373 if (!(load && newFlags == flags && sec != relroEnd && in createPhdrs()
2374 sec->memRegion == load->firstSec->memRegion && in createPhdrs()
2380 load->add(sec); in createPhdrs()
2385 for (OutputSection *sec : outputSections) in createPhdrs()
2386 if (sec->partition == partNo && sec->flags & SHF_TLS) in createPhdrs()
2387 tlsHdr->add(sec); in createPhdrs()
2392 if (OutputSection *sec = part.dynamic->getParent()) in createPhdrs() local
2393 addHdr(PT_DYNAMIC, sec->getPhdrFlags())->add(sec); in createPhdrs()
2433 for (OutputSection *sec : outputSections) { in createPhdrs()
2434 if (sec->partition != partNo) in createPhdrs()
2436 if (sec->type == SHT_NOTE && (sec->flags & SHF_ALLOC)) { in createPhdrs()
2437 if (!note || sec->lmaExpr || note->lastSec->alignment != sec->alignment) in createPhdrs()
2439 note->add(sec); in createPhdrs()
2558 auto needsOffset = [](OutputSection &sec) { in assignFileOffsetsBinary() argument
2559 return sec.type != SHT_NOBITS && (sec.flags & SHF_ALLOC) && sec.size > 0; in assignFileOffsetsBinary()
2562 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2563 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2564 sec->offset = sec->getLMA(); in assignFileOffsetsBinary()
2565 minAddr = std::min(minAddr, sec->offset); in assignFileOffsetsBinary()
2570 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2571 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2572 sec->offset -= minAddr; in assignFileOffsetsBinary()
2573 fileSize = std::max(fileSize, sec->offset + sec->size); in assignFileOffsetsBinary()
2594 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2595 if (!(sec->flags & SHF_ALLOC)) in assignFileOffsets()
2597 off = computeFileOffset(sec, off); in assignFileOffsets()
2598 sec->offset = off; in assignFileOffsets()
2599 if (sec->type != SHT_NOBITS) in assignFileOffsets()
2600 off += sec->size; in assignFileOffsets()
2606 lastRX->lastSec == sec) in assignFileOffsets()
2627 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2628 if (sec->type == SHT_NOBITS) in assignFileOffsets()
2630 if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize)) in assignFileOffsets()
2631 error("unable to place section " + sec->name + " at file offset " + in assignFileOffsets()
2632 rangeToString(sec->offset, sec->size) + in assignFileOffsets()
2677 OutputSection *sec; member
2695 if (b.offset >= a.offset + a.sec->size) in checkOverlap()
2700 if (isVirtualAddr && a.sec->inOverlay && b.sec->inOverlay) in checkOverlap()
2703 errorOrWarn("section " + a.sec->name + " " + name + in checkOverlap()
2704 " range overlaps with " + b.sec->name + "\n>>> " + a.sec->name + in checkOverlap()
2705 " range is " + rangeToString(a.offset, a.sec->size) + "\n>>> " + in checkOverlap()
2706 b.sec->name + " range is " + in checkOverlap()
2707 rangeToString(b.offset, b.sec->size)); in checkOverlap()
2731 for (OutputSection *sec : outputSections) in checkSections()
2732 if (sec->size > 0 && sec->type != SHT_NOBITS && in checkSections()
2733 (!config->oFormatBinary || (sec->flags & SHF_ALLOC))) in checkSections()
2734 fileOffs.push_back({sec, sec->offset}); in checkSections()
2749 for (OutputSection *sec : outputSections) in checkSections()
2750 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2751 vmas.push_back({sec, sec->addr}); in checkSections()
2758 for (OutputSection *sec : outputSections) in checkSections()
2759 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2760 lmas.push_back({sec, sec->getLMA()}); in checkSections()
2829 for (OutputSection *sec : outputSections) in writeHeader()
2830 sec->writeHeaderTo<ELFT>(++sHdrs); in writeHeader()
2866 for (OutputSection *sec : outputSections) in writeSectionsBinary()
2867 if (sec->flags & SHF_ALLOC) in writeSectionsBinary()
2868 sec->writeTo<ELFT>(Out::bufferStart + sec->offset); in writeSectionsBinary()
2914 for (OutputSection *sec : outputSections) in writeSections()
2915 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
2916 sec->writeTo<ELFT>(Out::bufferStart + sec->offset); in writeSections()
2918 for (OutputSection *sec : outputSections) in writeSections()
2919 if (sec->type != SHT_REL && sec->type != SHT_RELA) in writeSections()
2920 sec->writeTo<ELFT>(Out::bufferStart + sec->offset); in writeSections()
2924 for (OutputSection *sec : outputSections) in writeSections()
2925 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
2926 sec->checkDynRelAddends(Out::bufferStart); in writeSections()