Lines Matching full:sec

120   if (sec)  in getValue()
121 return alignToPowerOf2(sec->getOutputSection()->addr + sec->getOffset(val), in getValue()
127 return sec ? sec->getOutputSection()->addr + sec->getOffset(0) : 0; in getSecAddr()
137 OutputDesc *sec; in createOutputSection() local
140 sec = secRef; in createOutputSection()
142 sec = make<OutputDesc>(name, SHT_PROGBITS, 0); in createOutputSection()
144 secRef = sec; in createOutputSection()
146 sec->osec.location = std::string(location); in createOutputSection()
147 return sec; in createOutputSection()
213 SectionBase *sec = value.isAbsolute() ? nullptr : value.sec; in addSymbol() local
227 uint64_t symValue = value.sec ? 0 : value.getValue(); in addSymbol()
230 visibility, value.type, symValue, 0, sec); in addSymbol()
356 const OutputSection &sec = cast<OutputDesc>(cmd)->osec; in declareSymbols() local
357 if (sec.constraint != ConstraintKind::NoConstraint) in declareSymbols()
359 for (SectionCommand *cmd : sec.commands) in declareSymbols()
382 cmd->sym->section = v.sec; in assignSymbol()
430 sections, [](InputSectionBase *sec) { return sec->flags & SHF_WRITE; }); in matchConstraints() argument
516 InputSectionBase *sec = sections[i]; in computeInputSections() local
517 if (!sec->isLive() || seen.contains(i)) in computeInputSections()
525 if (isa<InputSection>(sec) && in computeInputSections()
526 cast<InputSection>(sec)->getRelocatedSection()) in computeInputSections()
530 if (!pat.sectionPat.match(sec->name)) in computeInputSections()
533 if (!cmd->matchesFile(sec->file) || pat.excludesFile(sec->file) || in computeInputSections()
534 (sec->flags & cmd->withFlags) != cmd->withFlags || in computeInputSections()
535 (sec->flags & cmd->withoutFlags) != 0) in computeInputSections()
538 if (sec->parent) { in computeInputSections()
550 if (sec->parent->name == "/DISCARD/") in computeInputSections()
555 if (sec->parent == &outCmd) in computeInputSections()
558 spills.insert(sec); in computeInputSections()
561 ret.push_back(sec); in computeInputSections()
593 for (InputSectionBase *&sec : ret) { in computeInputSections()
594 if (!spills.contains(sec)) in computeInputSections()
600 *sec, const_cast<InputSectionDescription &>(*cmd)); in computeInputSections()
602 potentialSpillLists.try_emplace(sec, PotentialSpillList{pss, pss}); in computeInputSections()
607 sec = pss; in computeInputSections()
620 for (InputSection *sec : s.dependentSections) in discard()
621 discard(*sec); in discard()
792 auto *sec = cast<InputSection>(isec); in addInputSec() local
793 OutputSection *out = sec->getRelocatedSection()->getOutputSection(); in addInputSec()
796 relSec->recordSection(sec); in addInputSec()
848 for (OutputSection *sec : v) { in addInputSec()
849 if (sec->partition != isec->partition) in addInputSec()
858 cast<InputSectionDescription>(sec->commands[0])->sectionBases[0]); in addInputSec()
867 sec->recordSection(isec); in addInputSec()
888 } else if (OutputSection *sec = findByName(sectionCommands, name)) { in addOrphanSections() local
889 sec->recordSection(s); in addOrphanSections()
915 if (auto *sec = dyn_cast<InputSection>(isec)) in addOrphanSections() local
916 if (InputSectionBase *rel = sec->getRelocatedSection()) in addOrphanSections()
943 for (const InputSectionBase *sec : orphanSections) { in diagnoseOrphanHandling() local
946 if (sec == in.relroPadding.get()) in diagnoseOrphanHandling()
950 if (isa<InputSection>(sec) && in diagnoseOrphanHandling()
951 cast<InputSection>(sec)->getRelocatedSection()) in diagnoseOrphanHandling()
954 StringRef name = getOutputSectionName(sec); in diagnoseOrphanHandling()
956 error(toString(sec) + " is being placed in '" + name + "'"); in diagnoseOrphanHandling()
958 warn(toString(sec) + " is being placed in '" + name + "'"); in diagnoseOrphanHandling()
966 OutputSection *sec = findByName(sectionCommands, ".gnu.sgstubs"); in diagnoseMissingSGSectionAddress() local
967 if (sec && !sec->addrExpr && !config->sectionStartMap.count(".gnu.sgstubs")) in diagnoseMissingSGSectionAddress()
968 error("no address assigned to the veneers output section " + sec->name); in diagnoseMissingSGSectionAddress()
977 LinkerScript::findMemoryRegion(OutputSection *sec, MemoryRegion *hint) { in findMemoryRegion() argument
979 if (!(sec->flags & SHF_ALLOC)) { in findMemoryRegion()
981 sec->hasInputSections || in findMemoryRegion()
982 llvm::any_of(sec->commands, [](SectionCommand *comm) { in findMemoryRegion()
985 if (!sec->memoryRegionName.empty() && hasInputOrByteCommand) in findMemoryRegion()
987 sec->name + "'"); in findMemoryRegion()
993 if (!sec->memoryRegionName.empty()) { in findMemoryRegion()
994 if (MemoryRegion *m = memoryRegions.lookup(sec->memoryRegionName)) in findMemoryRegion()
996 error("memory region '" + sec->memoryRegionName + "' not declared"); in findMemoryRegion()
1007 if (sec->sectionIndex == UINT32_MAX && hint) in findMemoryRegion()
1013 if (m->compatibleWith(sec->flags)) in findMemoryRegion()
1018 error("no memory region specified for section '" + sec->name + "'"); in findMemoryRegion()
1023 for (OutputSection *sec : outputSections) in findFirstSection()
1024 if (sec->ptLoad == load) in findFirstSection()
1025 return sec; in findFirstSection()
1031 bool LinkerScript::assignOffsets(OutputSection *sec) { in assignOffsets() argument
1032 const bool isTbss = (sec->flags & SHF_TLS) && sec->type == SHT_NOBITS; in assignOffsets()
1033 const bool sameMemRegion = state->memRegion == sec->memRegion; in assignOffsets()
1037 state->memRegion = sec->memRegion; in assignOffsets()
1038 state->lmaRegion = sec->lmaRegion; in assignOffsets()
1040 if (!(sec->flags & SHF_ALLOC)) { in assignOffsets()
1053 if (sec->addrExpr) in assignOffsets()
1054 setDot(sec->addrExpr, sec->location, false); in assignOffsets()
1062 sec->name); in assignOffsets()
1065 state->outSec = sec; in assignOffsets()
1066 if (!(sec->addrExpr && script->hasSectionsCommand)) { in assignOffsets()
1067 // ALIGN is respected. sec->alignment is the max of ALIGN and the maximum of in assignOffsets()
1070 dot = alignToPowerOf2(dot, sec->addralign); in assignOffsets()
1073 addressChanged = sec->addr != dot; in assignOffsets()
1074 sec->addr = dot; in assignOffsets()
1082 if (sec->lmaExpr) { in assignOffsets()
1083 state->lmaOffset = sec->lmaExpr().getValue() - dot; in assignOffsets()
1084 } else if (MemoryRegion *mr = sec->lmaRegion) { in assignOffsets()
1085 uint64_t lmaStart = alignToPowerOf2(mr->curPos, sec->addralign); in assignOffsets()
1087 expandMemoryRegion(mr, lmaStart - mr->curPos, sec->name); in assignOffsets()
1094 if (PhdrEntry *l = sec->ptLoad) in assignOffsets()
1095 if (sec == findFirstSection(l)) in assignOffsets()
1100 sec->size = 0; in assignOffsets()
1105 for (SectionCommand *cmd : sec->commands) { in assignOffsets()
1116 data->offset = dot - sec->addr; in assignOffsets()
1128 assert(isec->getParent() == sec); in assignOffsets()
1133 isec->outSecOff = dot - sec->addr; in assignOffsets()
1145 if (in.relroPadding && sec == in.relroPadding->getParent()) in assignOffsets()
1150 if (!(sec->flags & SHF_ALLOC)) { in assignOffsets()
1160 static bool isDiscardable(const OutputSection &sec) { in isDiscardable() argument
1161 if (sec.name == "/DISCARD/") in isDiscardable()
1167 if (sec.expressionsUseSymbols) in isDiscardable()
1173 if (sec.usedInExpression) in isDiscardable()
1176 for (SectionCommand *cmd : sec.commands) { in isDiscardable()
1189 static void maybePropagatePhdrs(OutputSection &sec, in maybePropagatePhdrs() argument
1191 if (sec.phdrs.empty()) { in maybePropagatePhdrs()
1194 if (sec.flags & SHF_ALLOC) in maybePropagatePhdrs()
1195 sec.phdrs = phdrs; in maybePropagatePhdrs()
1197 phdrs = sec.phdrs; in maybePropagatePhdrs()
1231 auto *sec = &cast<OutputDesc>(cmd)->osec; in adjustOutputSections() local
1234 if (sec->alignExpr) in adjustOutputSections()
1235 sec->addralign = in adjustOutputSections()
1236 std::max<uint32_t>(sec->addralign, sec->alignExpr().getValue()); in adjustOutputSections()
1238 bool isEmpty = (getFirstInputSection(sec) == nullptr); in adjustOutputSections()
1239 bool discardable = isEmpty && isDiscardable(*sec); in adjustOutputSections()
1240 // If sec has at least one input section and not discarded, remember its in adjustOutputSections()
1241 // flags to be inherited by subsequent output sections. (sec may contain in adjustOutputSections()
1243 if (sec->hasInputSections && !discardable) in adjustOutputSections()
1244 flags = sec->flags; in adjustOutputSections()
1249 sec->flags = in adjustOutputSections()
1250 flags & ((sec->nonAlloc ? 0 : (uint64_t)SHF_ALLOC) | SHF_WRITE); in adjustOutputSections()
1251 sec->sortRank = getSectionRank(*sec); in adjustOutputSections()
1263 if (sec->sectionIndex != UINT32_MAX) in adjustOutputSections()
1264 maybePropagatePhdrs(*sec, defPhdrs); in adjustOutputSections()
1269 if (in.relroPadding && in.relroPadding->getParent() == sec && !seenRelro) in adjustOutputSections()
1272 sec->markDead(); in adjustOutputSections()
1276 sec->relro && !(sec->type == SHT_NOBITS && (sec->flags & SHF_TLS)); in adjustOutputSections()
1294 OutputSection *sec = &osd->osec; in adjustSectionsAfterSorting() local
1295 if (!sec->lmaRegionName.empty()) { in adjustSectionsAfterSorting()
1296 if (MemoryRegion *m = memoryRegions.lookup(sec->lmaRegionName)) in adjustSectionsAfterSorting()
1297 sec->lmaRegion = m; in adjustSectionsAfterSorting()
1299 error("memory region '" + sec->lmaRegionName + "' not declared"); in adjustSectionsAfterSorting()
1301 std::tie(sec->memRegion, hint) = findMemoryRegion(sec, hint); in adjustSectionsAfterSorting()
1343 for (OutputSection *sec : outputSections) in allocateHeaders()
1344 if (sec->flags & SHF_ALLOC) in allocateHeaders()
1345 min = std::min<uint64_t>(min, sec->addr); in allocateHeaders()
1558 for (OutputSection *sec : outputSections) { in createPhdrs()
1560 for (size_t id : getPhdrIndices(sec)) { in createPhdrs()
1561 ret[id]->add(sec); in createPhdrs()
1563 ret[id]->p_flags |= sec->getPhdrFlags(); in createPhdrs()
1679 for (const OutputSection *sec : outputSections) { in checkFinalScriptConditions() local
1680 if (const MemoryRegion *memoryRegion = sec->memRegion) in checkFinalScriptConditions()
1681 checkMemoryRegion(memoryRegion, sec, sec->addr); in checkFinalScriptConditions()
1682 if (const MemoryRegion *lmaRegion = sec->lmaRegion) in checkFinalScriptConditions()
1683 checkMemoryRegion(lmaRegion, sec, sec->getLMA()); in checkFinalScriptConditions()