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
153 /*size=*/0, sec}); in addOptionalRegular()
256 for (auto [i, sec] : llvm::enumerate(sym.file->getSections())) in demoteDefined()
257 map.try_emplace(sec, i); in demoteDefined()
336 InputSection *sec = createInterpSection(); in createSyntheticSections() local
337 sec->partition = i; in createSyntheticSections()
338 ctx.inputSections.push_back(sec); in createSyntheticSections()
342 auto add = [](SyntheticSection &sec) { ctx.inputSections.push_back(&sec); }; in createSyntheticSections() argument
384 auto add = [&](SyntheticSection &sec) { in createSyntheticSections() argument
385 sec.partition = part.getNumber(); in createSyntheticSections()
386 ctx.inputSections.push_back(&sec); in createSyntheticSections()
609 for (OutputSection *sec : outputSections) in run()
610 sec->maybeCompress<ELFT>(); in run()
745 SectionBase *sec = d->section; in includeInSymtab() local
746 if (!sec) in includeInSymtab()
748 assert(sec->isLive()); in includeInSymtab()
750 if (auto *s = dyn_cast<MergeInputSection>(sec)) in includeInSymtab()
830 static bool isRelroSection(const OutputSection *sec) { in isRelroSection() argument
833 if (sec->relro) in isRelroSection()
836 uint64_t flags = sec->flags; in isRelroSection()
859 uint32_t type = sec->type; in isRelroSection()
867 if (in.got && sec == in.got->getParent()) in isRelroSection()
875 if (sec->name.equals(".toc")) in isRelroSection()
882 if (sec == in.gotPlt->getParent()) in isRelroSection()
885 if (in.relroPadding && sec == in.relroPadding->getParent()) in isRelroSection()
891 if (sec->name == ".dynamic") in isRelroSection()
898 StringRef s = sec->name; in isRelroSection()
1053 void PhdrEntry::add(OutputSection *sec) { in add() argument
1054 lastSec = sec; in add()
1056 firstSec = sec; in add()
1057 p_align = std::max(p_align, sec->addralign); in add()
1059 sec->ptLoad = this; in add()
1094 InputSection *sec = in.gotPlt.get(); in setReservedSymbolSections() local
1096 sec = in.mipsGot ? cast<InputSection>(in.mipsGot.get()) in setReservedSymbolSections()
1098 ElfSym::globalOffsetTable->section = sec; in setReservedSymbolSections()
1210 OutputSection *sec = &cast<OutputDesc>(*e)->osec; in findOrphanPos() local
1214 if (in.relroPadding && sec == in.relroPadding->getParent()) { in findOrphanPos()
1226 return getRankProximity(sec, a) < getRankProximity(sec, b); in findOrphanPos()
1235 int proximity = getRankProximity(sec, *i); in findOrphanPos()
1236 unsigned sortRank = sec->sortRank; in findOrphanPos()
1249 if (getRankProximity(sec, curSecDesc) != proximity || in findOrphanPos()
1286 for (InputSectionBase *sec : sections) in maybeShuffle()
1287 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1288 matched.push_back(sec); in maybeShuffle()
1301 for (InputSectionBase *&sec : sections) in maybeShuffle()
1302 if (patAndSeed.first.match(sec->name)) in maybeShuffle()
1303 sec = matched[i++]; in maybeShuffle()
1309 for (InputSectionBase *sec : sections) { in maybeShuffle()
1310 if (order.try_emplace(sec, prio).second) in maybeShuffle()
1349 if (auto *sec = dyn_cast_or_null<InputSectionBase>(d->section)) { in buildSectionOrder() local
1350 int &priority = sectionOrder[cast<InputSectionBase>(sec)]; in buildSectionOrder()
1637 for (OutputSection *sec : outputSections) { in resolveShfLinkOrder()
1638 if (!(sec->flags & SHF_LINK_ORDER)) in resolveShfLinkOrder()
1644 sec->type == SHT_ARM_EXIDX) in resolveShfLinkOrder()
1651 for (SectionCommand *cmd : sec->commands) { in resolveShfLinkOrder()
1678 static void finalizeSynthetic(SyntheticSection *sec) { in finalizeSynthetic() argument
1679 if (sec && sec->isNeeded() && sec->getParent()) { in finalizeSynthetic()
1680 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name); in finalizeSynthetic()
1681 sec->finalizeContents(); in finalizeSynthetic()
1762 for (OutputSection *sec : outputSections) in finalizeAddressDependentContent()
1763 sec->addr = 0; in finalizeAddressDependentContent()
1788 const SectionBase *sec = def->section; in fixSymbolsAfterShrinking() local
1789 if (!sec) in fixSymbolsAfterShrinking()
1792 const InputSectionBase *inputSec = dyn_cast<InputSectionBase>(sec); in fixSymbolsAfterShrinking()
1845 InputSection &sec = *sections[i]; in optimizeBasicBlockJumps() local
1846 numDeleted += target->deleteFallThruJmpInsn(sec, sec.file, next); in optimizeBasicBlockJumps()
1887 auto *sec = cast<SyntheticSection>(s); in removeUnusedSyntheticSections() local
1888 if (sec->getParent() && sec->isNeeded()) in removeUnusedSyntheticSections()
1890 unused.insert(sec); in removeUnusedSyntheticSections()
1897 for (auto *sec : unused) in removeUnusedSyntheticSections() local
1898 if (OutputSection *osec = cast<SyntheticSection>(sec)->getParent()) in removeUnusedSyntheticSections()
1904 llvm::erase_if(script->orphanSections, [&](const InputSectionBase *sec) { in removeUnusedSyntheticSections() argument
1905 return unused.count(sec); in removeUnusedSyntheticSections()
1945 OutputSection *sec = findSection(".sdata"); in finalizeSections() local
1947 "__global_pointer$", sec ? sec : Out::elfHeader, 0x800, STV_DEFAULT); in finalizeSections()
2112 for (OutputSection *sec : outputSections) { in finalizeSections()
2113 auto i = config->sectionStartMap.find(sec->name); in finalizeSections()
2115 sec->addrExpr = [=] { return i->second; }; in finalizeSections()
2266 for (OutputSection *sec : outputSections) in finalizeSections()
2267 sec->finalize(); in finalizeSections()
2331 if (OutputSection *sec = findSection(".ARM.exidx")) in addStartEndSymbols() local
2332 define("__exidx_start", "__exidx_end", sec); in addStartEndSymbols()
2351 static bool needsPtLoad(OutputSection *sec) { in needsPtLoad() argument
2352 if (!(sec->flags & SHF_ALLOC)) in needsPtLoad()
2358 if ((sec->flags & SHF_TLS) && sec->type == SHT_NOBITS) in needsPtLoad()
2425 for (OutputSection *sec : outputSections) { in createPhdrs()
2426 if (sec->partition != partNo || !needsPtLoad(sec)) in createPhdrs()
2428 if (isRelroSection(sec)) { in createPhdrs()
2431 relRo->add(sec); in createPhdrs()
2433 error("section: " + sec->name + " is not contiguous with other relro" + in createPhdrs()
2437 relroEnd = sec; in createPhdrs()
2442 for (OutputSection *sec : outputSections) { in createPhdrs()
2443 if (!needsPtLoad(sec)) in createPhdrs()
2452 if (sec->partition != partNo) { in createPhdrs()
2453 if (isMain && sec->partition == 255) in createPhdrs()
2454 addHdr(PT_LOAD, computeFlags(sec->getPhdrFlags()))->add(sec); in createPhdrs()
2474 uint64_t newFlags = computeFlags(sec->getPhdrFlags()); in createPhdrs()
2476 load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion; in createPhdrs()
2477 if (!(load && newFlags == flags && sec != relroEnd && in createPhdrs()
2478 sec->memRegion == load->firstSec->memRegion && in createPhdrs()
2480 (script->hasSectionsCommand || sec->type == SHT_NOBITS || in createPhdrs()
2486 load->add(sec); in createPhdrs()
2491 for (OutputSection *sec : outputSections) in createPhdrs()
2492 if (sec->partition == partNo && sec->flags & SHF_TLS) in createPhdrs()
2493 tlsHdr->add(sec); in createPhdrs()
2498 if (OutputSection *sec = part.dynamic->getParent()) in createPhdrs() local
2499 addHdr(PT_DYNAMIC, sec->getPhdrFlags())->add(sec); in createPhdrs()
2539 for (OutputSection *sec : outputSections) { in createPhdrs()
2540 if (sec->partition != partNo) in createPhdrs()
2542 if (sec->type == SHT_NOTE && (sec->flags & SHF_ALLOC)) { in createPhdrs()
2543 if (!note || sec->lmaExpr || note->lastSec->addralign != sec->addralign) in createPhdrs()
2545 note->add(sec); in createPhdrs()
2664 auto needsOffset = [](OutputSection &sec) { in assignFileOffsetsBinary() argument
2665 return sec.type != SHT_NOBITS && (sec.flags & SHF_ALLOC) && sec.size > 0; in assignFileOffsetsBinary()
2668 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2669 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2670 sec->offset = sec->getLMA(); in assignFileOffsetsBinary()
2671 minAddr = std::min(minAddr, sec->offset); in assignFileOffsetsBinary()
2676 for (OutputSection *sec : outputSections) in assignFileOffsetsBinary()
2677 if (needsOffset(*sec)) { in assignFileOffsetsBinary()
2678 sec->offset -= minAddr; in assignFileOffsetsBinary()
2679 fileSize = std::max(fileSize, sec->offset + sec->size); in assignFileOffsetsBinary()
2700 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2701 if (!(sec->flags & SHF_ALLOC)) in assignFileOffsets()
2703 off = computeFileOffset(sec, off); in assignFileOffsets()
2704 sec->offset = off; in assignFileOffsets()
2705 if (sec->type != SHT_NOBITS) in assignFileOffsets()
2706 off += sec->size; in assignFileOffsets()
2712 lastRX->lastSec == sec) in assignFileOffsets()
2733 for (OutputSection *sec : outputSections) { in assignFileOffsets()
2734 if (sec->type == SHT_NOBITS) in assignFileOffsets()
2736 if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize)) in assignFileOffsets()
2737 error("unable to place section " + sec->name + " at file offset " + in assignFileOffsets()
2738 rangeToString(sec->offset, sec->size) + in assignFileOffsets()
2790 OutputSection *sec; member
2808 if (b.offset >= a.offset + a.sec->size) in checkOverlap()
2813 if (isVirtualAddr && a.sec->inOverlay && b.sec->inOverlay) in checkOverlap()
2816 errorOrWarn("section " + a.sec->name + " " + name + in checkOverlap()
2817 " range overlaps with " + b.sec->name + "\n>>> " + a.sec->name + in checkOverlap()
2818 " range is " + rangeToString(a.offset, a.sec->size) + "\n>>> " + in checkOverlap()
2819 b.sec->name + " range is " + in checkOverlap()
2820 rangeToString(b.offset, b.sec->size)); in checkOverlap()
2844 for (OutputSection *sec : outputSections) in checkSections()
2845 if (sec->size > 0 && sec->type != SHT_NOBITS && in checkSections()
2846 (!config->oFormatBinary || (sec->flags & SHF_ALLOC))) in checkSections()
2847 fileOffs.push_back({sec, sec->offset}); in checkSections()
2862 for (OutputSection *sec : outputSections) in checkSections()
2863 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2864 vmas.push_back({sec, sec->addr}); in checkSections()
2871 for (OutputSection *sec : outputSections) in checkSections()
2872 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS)) in checkSections()
2873 lmas.push_back({sec, sec->getLMA()}); in checkSections()
2942 for (OutputSection *sec : outputSections) in writeHeader()
2943 sec->writeHeaderTo<ELFT>(++sHdrs); in writeHeader()
2980 for (OutputSection *sec : outputSections) in writeSectionsBinary()
2981 if (sec->flags & SHF_ALLOC) in writeSectionsBinary()
2982 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSectionsBinary()
3030 for (OutputSection *sec : outputSections) in writeSections()
3031 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
3032 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
3036 for (OutputSection *sec : outputSections) in writeSections()
3037 if (sec->type != SHT_REL && sec->type != SHT_RELA) in writeSections()
3038 sec->writeTo<ELFT>(Out::bufferStart + sec->offset, tg); in writeSections()
3043 for (OutputSection *sec : outputSections) in writeSections()
3044 if (sec->type == SHT_REL || sec->type == SHT_RELA) in writeSections()
3045 sec->checkDynRelAddends(Out::bufferStart); in writeSections()