Lines Matching refs:Sec

61   if (Sec)  in getValue()
62 return alignTo(Sec->getOffset(Val) + getOutputSectionVA(Sec, Loc), in getValue()
68 if (Sec) in getSecAddr()
69 return Sec->getOffset(0) + getOutputSectionVA(Sec, Loc); in getSecAddr()
77 if (Alignment == 1 && (!Sec || !Sec->getOutputSection())) in getSectionOffset()
85 OutputSection *Sec; in createOutputSection() local
88 Sec = SecRef; in createOutputSection()
90 Sec = make<OutputSection>(Name, SHT_NOBITS, 0); in createOutputSection()
92 SecRef = Sec; in createOutputSection()
94 Sec->Location = Location; in createOutputSection()
95 return Sec; in createOutputSection()
176 SectionBase *Sec = Value.isAbsolute() ? nullptr : Value.Sec; in addSymbol() local
189 uint64_t SymValue = Value.Sec ? 0 : Value.getValue(); in addSymbol()
192 STT_NOTYPE, SymValue, 0, Sec); in addSymbol()
258 auto *Sec = cast<OutputSection>(Base); in declareSymbols() local
259 if (Sec->Constraint != ConstraintKind::NoConstraint) in declareSymbols()
261 for (BaseCommand *Base2 : Sec->SectionCommands) in declareSymbols()
284 Cmd->Sym->Section = V.Sec; in assignSymbol()
340 Sections, [](InputSection *Sec) { return Sec->Flags & SHF_WRITE; }); in matchConstraints() argument
384 for (InputSectionBase *Sec : InputSections) { in computeInputSections()
385 if (!Sec->Live || Sec->Assigned) in computeInputSections()
393 if (auto *IS = dyn_cast<InputSection>(Sec)) in computeInputSections()
397 std::string Filename = getFilename(Sec->File); in computeInputSections()
400 !Pat.SectionPat.match(Sec->Name)) in computeInputSections()
406 Ret.push_back(cast<InputSection>(Sec)); in computeInputSections()
407 Sec->Assigned = true; in computeInputSections()
478 if (auto *Sec = dyn_cast<OutputSection>(Base)) { in processSectionCommands() local
479 std::vector<InputSection *> V = createInputSectionList(*Sec); in processSectionCommands()
483 if (Sec->Name == "/DISCARD/") { in processSectionCommands()
485 Sec->SectionCommands.clear(); in processSectionCommands()
496 if (!matchConstraints(V, Sec->Constraint)) { in processSectionCommands()
499 Sec->SectionCommands.clear(); in processSectionCommands()
505 for (BaseCommand *Base : Sec->SectionCommands) in processSectionCommands()
512 if (Sec->SubalignExpr) { in processSectionCommands()
513 uint32_t Subalign = Sec->SubalignExpr().getValue(); in processSectionCommands()
520 Sec->addSection(S); in processSectionCommands()
522 Sec->SectionIndex = I++; in processSectionCommands()
523 if (Sec->Noload) in processSectionCommands()
524 Sec->Type = SHT_NOBITS; in processSectionCommands()
525 if (Sec->NonAlloc) in processSectionCommands()
526 Sec->Flags &= ~(uint64_t)SHF_ALLOC; in processSectionCommands()
535 if (auto *Sec = dyn_cast<OutputSection>(Base)) in findByName() local
536 if (Sec->Name == Name) in findByName()
537 return Sec; in findByName()
543 OutputSection *Sec = Script->createOutputSection(OutsecName, "<internal>"); in createSection() local
544 Sec->addSection(cast<InputSection>(IS)); in createSection()
545 return Sec; in createSection()
568 auto *Sec = cast<InputSection>(IS); in addInputSec() local
569 OutputSection *Out = Sec->getRelocatedSection()->getOutputSection(); in addInputSec()
572 Out->RelocationSection->addSection(Sec); in addInputSec()
628 OutputSection *&Sec = Map[OutsecName]; in addInputSec() local
629 if (Sec) { in addInputSec()
630 Sec->addSection(cast<InputSection>(IS)); in addInputSec()
634 Sec = createSection(IS, OutsecName); in addInputSec()
635 return Sec; in addInputSec()
655 if (OutputSection *Sec = in addOrphanSections() local
657 Sec->addSection(cast<InputSection>(S)); in addOrphanSections()
671 if (auto *Sec = dyn_cast<InputSection>(IS)) in addOrphanSections() local
672 if (InputSectionBase *Rel = Sec->getRelocatedSection()) in addOrphanSections()
714 void LinkerScript::switchTo(OutputSection *Sec) { in switchTo() argument
715 Ctx->OutSec = Sec; in switchTo()
725 MemoryRegion *LinkerScript::findMemoryRegion(OutputSection *Sec) { in findMemoryRegion() argument
728 if (!Sec->MemoryRegionName.empty()) { in findMemoryRegion()
729 if (MemoryRegion *M = MemoryRegions.lookup(Sec->MemoryRegionName)) in findMemoryRegion()
731 error("memory region '" + Sec->MemoryRegionName + "' not declared"); in findMemoryRegion()
744 if ((M->Flags & Sec->Flags) && (M->NegFlags & Sec->Flags) == 0) in findMemoryRegion()
749 if (Sec->Flags & SHF_ALLOC) in findMemoryRegion()
750 error("no memory region specified for section '" + Sec->Name + "'"); in findMemoryRegion()
755 for (OutputSection *Sec : OutputSections) in findFirstSection()
756 if (Sec->PtLoad == Load) in findFirstSection()
757 return Sec; in findFirstSection()
763 void LinkerScript::assignOffsets(OutputSection *Sec) { in assignOffsets() argument
764 if (!(Sec->Flags & SHF_ALLOC)) in assignOffsets()
766 else if (Sec->AddrExpr) in assignOffsets()
767 setDot(Sec->AddrExpr, Sec->Location, false); in assignOffsets()
769 Ctx->MemRegion = Sec->MemRegion; in assignOffsets()
770 Ctx->LMARegion = Sec->LMARegion; in assignOffsets()
774 switchTo(Sec); in assignOffsets()
776 if (Sec->LMAExpr) in assignOffsets()
777 Ctx->LMAOffset = Sec->LMAExpr().getValue() - Dot; in assignOffsets()
779 if (MemoryRegion *MR = Sec->LMARegion) in assignOffsets()
789 if (Sec == findFirstSection(L)) in assignOffsets()
794 Sec->Size = 0; in assignOffsets()
799 for (BaseCommand *Base : Sec->SectionCommands) { in assignOffsets()
819 for (InputSection *Sec : cast<InputSectionDescription>(Base)->Sections) in assignOffsets()
820 output(Sec); in assignOffsets()
824 static bool isDiscardable(OutputSection &Sec) { in isDiscardable() argument
827 if (!Sec.Phdrs.empty()) in isDiscardable()
833 if (Sec.ExpressionsUseSymbols) in isDiscardable()
836 for (BaseCommand *Base : Sec.SectionCommands) { in isDiscardable()
873 auto *Sec = dyn_cast<OutputSection>(Cmd); in adjustSectionsBeforeSorting() local
874 if (!Sec) in adjustSectionsBeforeSorting()
878 if (Sec->AlignExpr) in adjustSectionsBeforeSorting()
879 Sec->Alignment = in adjustSectionsBeforeSorting()
880 std::max<uint32_t>(Sec->Alignment, Sec->AlignExpr().getValue()); in adjustSectionsBeforeSorting()
885 if (Sec->Live) in adjustSectionsBeforeSorting()
886 Flags = Sec->Flags; in adjustSectionsBeforeSorting()
890 bool IsEmpty = getInputSections(Sec).empty(); in adjustSectionsBeforeSorting()
892 Sec->Flags = Flags & (SHF_ALLOC | SHF_WRITE | SHF_EXECINSTR); in adjustSectionsBeforeSorting()
894 if (IsEmpty && isDiscardable(*Sec)) { in adjustSectionsBeforeSorting()
895 Sec->Live = false; in adjustSectionsBeforeSorting()
912 if (auto *Sec = dyn_cast<OutputSection>(Base)) { in adjustSectionsAfterSorting() local
913 if (!Sec->LMARegionName.empty()) { in adjustSectionsAfterSorting()
914 if (MemoryRegion *M = MemoryRegions.lookup(Sec->LMARegionName)) in adjustSectionsAfterSorting()
915 Sec->LMARegion = M; in adjustSectionsAfterSorting()
917 error("memory region '" + Sec->LMARegionName + "' not declared"); in adjustSectionsAfterSorting()
919 Sec->MemRegion = findMemoryRegion(Sec); in adjustSectionsAfterSorting()
939 auto *Sec = dyn_cast<OutputSection>(Base); in adjustSectionsAfterSorting() local
940 if (!Sec) in adjustSectionsAfterSorting()
943 if (Sec->Phdrs.empty()) { in adjustSectionsAfterSorting()
946 if (Sec->Flags & SHF_ALLOC) in adjustSectionsAfterSorting()
947 Sec->Phdrs = DefPhdrs; in adjustSectionsAfterSorting()
949 DefPhdrs = Sec->Phdrs; in adjustSectionsAfterSorting()
976 for (OutputSection *Sec : OutputSections) in allocateHeaders()
977 if (Sec->Flags & SHF_ALLOC) in allocateHeaders()
978 Min = std::min<uint64_t>(Min, Sec->Addr); in allocateHeaders()
1077 for (OutputSection *Sec : OutputSections) { in createPhdrs()
1079 for (size_t Id : getPhdrIndices(Sec)) { in createPhdrs()
1080 Ret[Id]->add(Sec); in createPhdrs()
1082 Ret[Id]->p_flags |= Sec->getPhdrFlags(); in createPhdrs()