Lines Matching defs:sec
117 for (OutputSection *sec : ctx.outputSections)
118 if (removed.count(sec->ptLoad))
119 sec->ptLoad = nullptr;
146 static Defined *addOptionalRegular(Ctx &ctx, StringRef name, SectionBase *sec,
155 /*size=*/0, sec});
263 for (auto [i, sec] : llvm::enumerate(sym.file->getSections()))
264 map.try_emplace(sec, i);
329 for (OutputSection *sec : ctx.outputSections)
330 sec->maybeCompress<ELFT>(ctx);
476 SectionBase *sec = d->section;
477 if (!sec)
479 assert(sec->isLive());
481 if (auto *s = dyn_cast<MergeInputSection>(sec))
562 static bool isRelroSection(Ctx &ctx, const OutputSection *sec) {
565 if (sec->relro)
568 uint64_t flags = sec->flags;
591 uint32_t type = sec->type;
599 if (ctx.in.got && sec == ctx.in.got->getParent())
607 if (sec->name == ".toc")
614 if (sec == ctx.in.gotPlt->getParent())
617 if (ctx.in.relroPadding && sec == ctx.in.relroPadding->getParent())
623 if (sec->name == ".dynamic")
630 StringRef s = sec->name;
798 void PhdrEntry::add(OutputSection *sec) {
799 lastSec = sec;
801 firstSec = sec;
802 p_align = std::max(p_align, sec->addralign);
804 sec->ptLoad = this;
836 InputSection *sec = ctx.in.gotPlt.get();
838 sec = ctx.in.mipsGot ? cast<InputSection>(ctx.in.mipsGot.get())
840 ctx.sym.globalOffsetTable->section = sec;
962 OutputSection *sec = &cast<OutputDesc>(*e)->osec;
963 if (!(sec->flags & SHF_ALLOC))
968 if (ctx.in.relroPadding && sec == ctx.in.relroPadding->getParent()) {
987 int p = getRankProximity(sec, *j);
989 (p == maxP && cast<OutputDesc>(*j)->osec.sortRank <= sec->sortRank)) {
1012 if (cast<OutputDesc>(*i)->osec.sortRank <= sec->sortRank || mustAfter) {
1016 if (getRankProximity(sec, *j) != maxP)
1049 for (InputSectionBase *sec : sections)
1050 if (patAndSeed.first.match(sec->name))
1051 matched.push_back(sec);
1064 for (InputSectionBase *&sec : sections)
1065 if (patAndSeed.first.match(sec->name))
1066 sec = matched[i++];
1072 for (InputSectionBase *sec : sections) {
1073 if (order.try_emplace(sec, prio).second)
1114 if (auto *sec = dyn_cast_or_null<InputSectionBase>(d->section)) {
1115 int &priority = sectionOrder[cast<InputSectionBase>(sec)];
1401 for (OutputSection *sec : ctx.outputSections) {
1402 if (!(sec->flags & SHF_LINK_ORDER))
1408 sec->type == SHT_ARM_EXIDX)
1415 for (SectionCommand *cmd : sec->commands) {
1442 static void finalizeSynthetic(Ctx &ctx, SyntheticSection *sec) {
1443 if (sec && sec->isNeeded() && sec->getParent()) {
1444 llvm::TimeTraceScope timeScope("Finalize synthetic sections", sec->name);
1445 sec->finalizeContents();
1449 static bool canInsertPadding(OutputSection *sec) {
1450 StringRef s = sec->name;
1603 for (OutputSection *sec : ctx.outputSections)
1604 sec->addr = 0;
1634 const SectionBase *sec = def->section;
1635 if (!sec)
1638 const InputSectionBase *inputSec = dyn_cast<InputSectionBase>(sec);
1691 InputSection &sec = *sections[i];
1692 numDeleted += ctx.target->deleteFallThruJmpInsn(sec, sec.file, next);
1733 auto *sec = cast<SyntheticSection>(s);
1734 if (sec->getParent() && sec->isNeeded())
1741 sec == ctx.mainPart->relaDyn.get())
1743 unused.insert(sec);
1750 for (auto *sec : unused)
1751 if (OutputSection *osec = cast<SyntheticSection>(sec)->getParent())
1757 llvm::erase_if(ctx.script->orphanSections, [&](const InputSectionBase *sec) {
1758 return unused.count(sec);
1797 OutputSection *sec = findSection(ctx, ".sdata");
1799 sec ? sec : ctx.out.elfHeader.get(), 0x800,
1980 for (OutputSection *sec : ctx.outputSections) {
1981 auto i = ctx.arg.sectionStartMap.find(sec->name);
1983 sec->addrExpr = [=] { return i->second; };
2141 for (OutputSection *sec : ctx.outputSections)
2142 sec->finalize(ctx);
2196 if (OutputSection *sec = findSection(ctx, ".ARM.exidx"))
2197 define("__exidx_start", "__exidx_end", sec);
2219 static bool needsPtLoad(OutputSection *sec) {
2220 if (!(sec->flags & SHF_ALLOC))
2226 if ((sec->flags & SHF_TLS) && sec->type == SHT_NOBITS)
2289 for (OutputSection *sec : ctx.outputSections) {
2290 if (sec->partition != partNo || !needsPtLoad(sec))
2292 if (isRelroSection(ctx, sec)) {
2295 relRo->add(sec);
2297 ErrAlways(ctx) << "section: " << sec->name
2301 relroEnd = sec;
2306 for (OutputSection *sec : ctx.outputSections) {
2307 if (!needsPtLoad(sec))
2316 if (sec->partition != partNo) {
2317 if (isMain && sec->partition == 255)
2318 addHdr(PT_LOAD, computeFlags(ctx, sec->getPhdrFlags()))->add(sec);
2338 uint64_t newFlags = computeFlags(ctx, sec->getPhdrFlags());
2347 load && !sec->lmaExpr && sec->lmaRegion == load->firstSec->lmaRegion;
2348 if (load && sec != relroEnd &&
2349 sec->memRegion == load->firstSec->memRegion &&
2351 (ctx.script->hasSectionsCommand || sec->type == SHT_NOBITS ||
2359 load->add(sec);
2364 for (OutputSection *sec : ctx.outputSections)
2365 if (sec->partition == partNo && sec->flags & SHF_TLS)
2366 tlsHdr->add(sec);
2371 if (OutputSection *sec = part.dynamic->getParent())
2372 addHdr(PT_DYNAMIC, sec->getPhdrFlags())->add(sec);
2429 for (OutputSection *sec : ctx.outputSections) {
2430 if (sec->partition != partNo)
2432 if (sec->type == SHT_NOTE && (sec->flags & SHF_ALLOC)) {
2433 if (!note || sec->lmaExpr || note->lastSec->addralign != sec->addralign)
2435 note->add(sec);
2553 auto needsOffset = [](OutputSection &sec) {
2554 return sec.type != SHT_NOBITS && (sec.flags & SHF_ALLOC) && sec.size > 0;
2557 for (OutputSection *sec : ctx.outputSections)
2558 if (needsOffset(*sec)) {
2559 sec->offset = sec->getLMA();
2560 minAddr = std::min(minAddr, sec->offset);
2565 for (OutputSection *sec : ctx.outputSections)
2566 if (needsOffset(*sec)) {
2567 sec->offset -= minAddr;
2568 fileSize = std::max(fileSize, sec->offset + sec->size);
2589 for (OutputSection *sec : ctx.outputSections) {
2590 if (!(sec->flags & SHF_ALLOC))
2592 off = computeFileOffset(ctx, sec, off);
2593 sec->offset = off;
2594 if (sec->type != SHT_NOBITS)
2595 off += sec->size;
2601 lastRX->lastSec == sec)
2624 for (OutputSection *sec : ctx.outputSections) {
2625 if (sec->type == SHT_NOBITS)
2627 if ((sec->offset > fileSize) || (sec->offset + sec->size > fileSize))
2628 ErrAlways(ctx) << "unable to place section " << sec->name
2630 << rangeToString(sec->offset, sec->size)
2682 OutputSection *sec;
2701 if (b.offset >= a.offset + a.sec->size)
2706 if (isVirtualAddr && a.sec->inOverlay && b.sec->inOverlay)
2709 Err(ctx) << "section " << a.sec->name << " " << name
2710 << " range overlaps with " << b.sec->name << "\n>>> "
2711 << a.sec->name << " range is "
2712 << rangeToString(a.offset, a.sec->size) << "\n>>> " << b.sec->name
2713 << " range is " << rangeToString(b.offset, b.sec->size);
2738 for (OutputSection *sec : ctx.outputSections)
2739 if (sec->size > 0 && sec->type != SHT_NOBITS &&
2740 (!ctx.arg.oFormatBinary || (sec->flags & SHF_ALLOC)))
2741 fileOffs.push_back({sec, sec->offset});
2756 for (OutputSection *sec : ctx.outputSections)
2757 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS))
2758 vmas.push_back({sec, sec->addr});
2765 for (OutputSection *sec : ctx.outputSections)
2766 if (sec->size > 0 && (sec->flags & SHF_ALLOC) && !(sec->flags & SHF_TLS))
2767 lmas.push_back({sec, sec->getLMA()});
2840 for (OutputSection *sec : ctx.outputSections)
2841 sec->writeHeaderTo<ELFT>(++sHdrs);
2878 for (OutputSection *sec : ctx.outputSections)
2879 if (sec->flags & SHF_ALLOC)
2880 sec->writeTo<ELFT>(ctx, ctx.bufferStart + sec->offset, tg);
2929 for (OutputSection *sec : ctx.outputSections)
2930 if (isStaticRelSecType(sec->type))
2931 sec->writeTo<ELFT>(ctx, ctx.bufferStart + sec->offset, tg);
2935 for (OutputSection *sec : ctx.outputSections)
2936 if (!isStaticRelSecType(sec->type))
2937 sec->writeTo<ELFT>(ctx, ctx.bufferStart + sec->offset, tg);
2942 for (OutputSection *sec : ctx.outputSections)
2943 if (isStaticRelSecType(sec->type))
2944 sec->checkDynRelAddends(ctx);