Lines Matching refs:Sec

81   void addStartStopSymbols(OutputSection *Sec);
169 static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec, in addOptionalRegular() argument
176 /*Size=*/0, Binding, Sec, in addOptionalRegular()
264 if (auto *Sec = dyn_cast<OutputSection>(Base)) in findSection() local
265 if (Sec->Name == Name) in findSection()
266 return Sec; in findSection()
276 auto Add = [](InputSectionBase *Sec) { InputSections.push_back(Sec); }; in createSyntheticSections() argument
325 if (auto *Sec = MipsAbiFlagsSection<ELFT>::create()) in createSyntheticSections() local
326 Add(Sec); in createSyntheticSections()
327 if (auto *Sec = MipsOptionsSection<ELFT>::create()) in createSyntheticSections() local
328 Add(Sec); in createSyntheticSections()
329 if (auto *Sec = MipsReginfoSection<ELFT>::create()) in createSyntheticSections() local
330 Add(Sec); in createSyntheticSections()
486 for (OutputSection *Sec : OutputSections) in run()
487 Sec->maybeCompress<ELFT>(); in run()
504 for (OutputSection *Sec : OutputSections) in run()
505 Sec->Addr = 0; in run()
542 static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName, in shouldKeepInSymtab() argument
566 return !Sec || !(Sec->Flags & SHF_MERGE); in shouldKeepInSymtab()
575 SectionBase *Sec = D->Section; in includeInSymtab() local
576 if (!Sec) in includeInSymtab()
578 Sec = Sec->Repl; in includeInSymtab()
581 if (isa<InputSectionBase>(Sec) && !Sec->Live) in includeInSymtab()
584 if (auto *S = dyn_cast<MergeInputSection>(Sec)) in includeInSymtab()
611 SectionBase *Sec = DR->Section; in copyLocalSymbols() local
612 if (!shouldKeepInSymtab(Sec, B->getName(), *B)) in copyLocalSymbols()
625 auto *Sec = dyn_cast<OutputSection>(Base); in addSectionSymbols() local
626 if (!Sec) in addSectionSymbols()
628 auto I = llvm::find_if(Sec->SectionCommands, [](BaseCommand *Base) { in addSectionSymbols()
633 if (I == Sec->SectionCommands.end()) in addSectionSymbols()
660 static bool isRelroSection(const OutputSection *Sec) { in isRelroSection() argument
664 uint64_t Flags = Sec->Flags; in isRelroSection()
687 uint32_t Type = Sec->Type; in isRelroSection()
695 if (In.Got && Sec == In.Got->getParent()) in isRelroSection()
703 if (Sec->Name.equals(".toc")) in isRelroSection()
710 if (Sec == In.GotPlt->getParent()) in isRelroSection()
716 if (Sec == In.Dynamic->getParent()) in isRelroSection()
723 StringRef S = Sec->Name; in isRelroSection()
758 static unsigned getSectionRank(const OutputSection *Sec) { in getSectionRank() argument
763 if (Config->SectionStartMap.count(Sec->Name)) in getSectionRank()
769 if (!(Sec->Flags & SHF_ALLOC)) in getSectionRank()
774 if (Sec->Name == ".interp") in getSectionRank()
782 if (Sec->Type == SHT_NOTE) in getSectionRank()
797 bool IsExec = Sec->Flags & SHF_EXECINSTR; in getSectionRank()
798 bool IsWrite = Sec->Flags & SHF_WRITE; in getSectionRank()
807 } else if (Sec->Type == SHT_PROGBITS) { in getSectionRank()
817 bool IsTls = Sec->Flags & SHF_TLS; in getSectionRank()
818 bool IsNoBits = Sec->Type == SHT_NOBITS; in getSectionRank()
830 bool IsRelRo = isRelroSection(Sec); in getSectionRank()
857 StringRef Name = Sec->Name; in getSectionRank()
877 if (Sec->Flags & SHF_MIPS_GPREL) in getSectionRank()
880 if (Sec->Name != ".got") in getSectionRank()
900 void PhdrEntry::add(OutputSection *Sec) { in add() argument
901 LastSec = Sec; in add()
903 FirstSec = Sec; in add()
904 p_align = std::max(p_align, Sec->Alignment); in add()
906 Sec->PtLoad = this; in add()
1038 if (auto *Sec = dyn_cast<OutputSection>(B)) in getRankProximity() local
1039 return getRankProximityAux(A, Sec); in getRankProximity()
1070 OutputSection *Sec = cast<OutputSection>(*E); in findOrphanPos() local
1074 return getRankProximity(Sec, A) < getRankProximity(Sec, B); in findOrphanPos()
1080 int Proximity = getRankProximity(Sec, *I); in findOrphanPos()
1085 if (getRankProximity(Sec, CurSec) != Proximity || in findOrphanPos()
1086 Sec->SortRank < CurSec->SortRank) in findOrphanPos()
1143 if (auto *Sec = dyn_cast_or_null<InputSectionBase>(D->Section)) { in buildSectionOrder() local
1144 int &Priority = SectionOrder[cast<InputSectionBase>(Sec->Repl)]; in buildSectionOrder()
1236 static void sortSection(OutputSection *Sec, in sortSection() argument
1238 StringRef Name = Sec->Name; in sortSection()
1244 Sec->sortInitFini(); in sortSection()
1251 Sec->sortCtorsDtors(); in sortSection()
1262 for (BaseCommand *B : Sec->SectionCommands) in sortSection()
1273 if (auto *Sec = dyn_cast<OutputSection>(Base)) in sortInputSections() local
1274 sortSection(Sec, Order); in sortInputSections()
1297 for (InputSection *Sec : getInputSections(OS)) in sortSections()
1298 Sec->OutSecOff = I++; in sortSections()
1353 if (auto *Sec = dyn_cast<OutputSection>(Base)) in sortSections() local
1354 return Sec->SectionIndex == UINT32_MAX; in sortSections()
1453 for (OutputSection *Sec : OutputSections) { in resolveShfLinkOrder()
1454 if (!(Sec->Flags & SHF_LINK_ORDER)) in resolveShfLinkOrder()
1461 for (BaseCommand *Base : Sec->SectionCommands) { in resolveShfLinkOrder()
1472 Sec->Type == SHT_ARM_EXIDX) { in resolveShfLinkOrder()
1506 for (BaseCommand *Base : Sec->SectionCommands) in resolveShfLinkOrder()
1552 static void finalizeSynthetic(SyntheticSection *Sec) { in finalizeSynthetic() argument
1553 if (Sec && !Sec->empty() && Sec->getParent()) in finalizeSynthetic()
1554 Sec->finalizeContents(); in finalizeSynthetic()
1633 if (auto *Sec = dyn_cast<OutputSection>(Base)) in finalizeSections() local
1634 addStartStopSymbols(Sec); in finalizeSections()
1727 if (auto *Sec = dyn_cast<OutputSection>(Base)) in finalizeSections() local
1728 OutputSections.push_back(Sec); in finalizeSections()
1731 for (OutputSection *Sec : OutputSections) { in finalizeSections()
1732 auto I = Config->SectionStartMap.find(Sec->Name); in finalizeSections()
1734 Sec->AddrExpr = [=] { return I->second; }; in finalizeSections()
1743 OutputSection *Sec = OutputSections[I]; in finalizeSections() local
1744 Sec->SectionIndex = I + 1; in finalizeSections()
1745 Sec->ShName = In.ShStrTab->addString(Sec->Name); in finalizeSections()
1820 for (OutputSection *Sec : OutputSections) in finalizeSections()
1821 Sec->finalize<ELFT>(); in finalizeSections()
1876 if (OutputSection *Sec = findSection(".ARM.exidx")) in addStartEndSymbols() local
1877 Define("__exidx_start", "__exidx_end", Sec); in addStartEndSymbols()
1886 void Writer<ELFT>::addStartStopSymbols(OutputSection *Sec) { in addStartStopSymbols() argument
1887 StringRef S = Sec->Name; in addStartStopSymbols()
1890 addOptionalRegular(Saver.save("__start_" + S), Sec, 0, STV_PROTECTED); in addStartStopSymbols()
1891 addOptionalRegular(Saver.save("__stop_" + S), Sec, -1, STV_PROTECTED); in addStartStopSymbols()
1894 static bool needsPtLoad(OutputSection *Sec) { in needsPtLoad() argument
1895 if (!(Sec->Flags & SHF_ALLOC) || Sec->Noload) in needsPtLoad()
1901 if ((Sec->Flags & SHF_TLS) && Sec->Type == SHT_NOBITS) in needsPtLoad()
1944 for (OutputSection *Sec : OutputSections) { in createPhdrs()
1945 if (!(Sec->Flags & SHF_ALLOC)) in createPhdrs()
1947 if (!needsPtLoad(Sec)) in createPhdrs()
1957 uint64_t NewFlags = computeFlags(Sec->getPhdrFlags()); in createPhdrs()
1958 if (((Sec->LMAExpr || in createPhdrs()
1959 (Sec->LMARegion && (Sec->LMARegion != Load->FirstSec->LMARegion))) && in createPhdrs()
1961 Sec->MemRegion != Load->FirstSec->MemRegion || Flags != NewFlags) { in createPhdrs()
1967 Load->add(Sec); in createPhdrs()
1972 for (OutputSection *Sec : OutputSections) in createPhdrs()
1973 if (Sec->Flags & SHF_TLS) in createPhdrs()
1974 TlsHdr->add(Sec); in createPhdrs()
1979 if (OutputSection *Sec = In.Dynamic->getParent()) in createPhdrs() local
1980 AddHdr(PT_DYNAMIC, Sec->getPhdrFlags())->add(Sec); in createPhdrs()
1989 for (OutputSection *Sec : OutputSections) { in createPhdrs()
1990 if (!needsPtLoad(Sec)) in createPhdrs()
1992 if (isRelroSection(Sec)) { in createPhdrs()
1995 RelRo->add(Sec); in createPhdrs()
1997 error("section: " + Sec->Name + " is not contiguous with other relro" + in createPhdrs()
2036 for (OutputSection *Sec : OutputSections) { in createPhdrs()
2037 if (Sec->Type == SHT_NOTE && (Sec->Flags & SHF_ALLOC)) { in createPhdrs()
2038 if (!Note || Sec->LMAExpr) in createPhdrs()
2040 Note->add(Sec); in createPhdrs()
2138 for (OutputSection *Sec : OutputSections) in assignFileOffsetsBinary()
2139 if (Sec->Flags & SHF_ALLOC) in assignFileOffsetsBinary()
2140 Off = setFileOffset(Sec, Off); in assignFileOffsetsBinary()
2159 for (OutputSection *Sec : OutputSections) { in assignFileOffsets()
2160 Off = setFileOffset(Sec, Off); in assignFileOffsets()
2167 if (LastRX && LastRX->LastSec == Sec) in assignFileOffsets()
2183 for (OutputSection *Sec : OutputSections) { in assignFileOffsets()
2184 if (Sec->Type == SHT_NOBITS) in assignFileOffsets()
2186 if ((Sec->Offset > FileSize) || (Sec->Offset + Sec->Size > FileSize)) in assignFileOffsets()
2187 error("unable to place section " + Sec->Name + " at file offset " + in assignFileOffsets()
2188 rangeToString(Sec->Offset, Sec->Size) + in assignFileOffsets()
2235 OutputSection *Sec; member
2253 if (B.Offset >= A.Offset + A.Sec->Size) in checkOverlap()
2258 if (IsVirtualAddr && A.Sec->InOverlay && B.Sec->InOverlay) in checkOverlap()
2261 errorOrWarn("section " + A.Sec->Name + " " + Name + in checkOverlap()
2262 " range overlaps with " + B.Sec->Name + "\n>>> " + A.Sec->Name + in checkOverlap()
2263 " range is " + rangeToString(A.Offset, A.Sec->Size) + "\n>>> " + in checkOverlap()
2264 B.Sec->Name + " range is " + in checkOverlap()
2265 rangeToString(B.Offset, B.Sec->Size)); in checkOverlap()
2289 for (OutputSection *Sec : OutputSections) in checkSections()
2290 if (Sec->Size > 0 && Sec->Type != SHT_NOBITS && in checkSections()
2291 (!Config->OFormatBinary || (Sec->Flags & SHF_ALLOC))) in checkSections()
2292 FileOffs.push_back({Sec, Sec->Offset}); in checkSections()
2307 for (OutputSection *Sec : OutputSections) in checkSections()
2308 if (Sec->Size > 0 && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS)) in checkSections()
2309 VMAs.push_back({Sec, Sec->Addr}); in checkSections()
2316 for (OutputSection *Sec : OutputSections) in checkSections()
2317 if (Sec->Size > 0 && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS)) in checkSections()
2318 LMAs.push_back({Sec, Sec->getLMA()}); in checkSections()
2341 if (OutputSection *Sec = findSection(".text")) { in getEntryAddr() local
2344 utohexstr(Sec->Addr)); in getEntryAddr()
2345 return Sec->Addr; in getEntryAddr()
2440 for (OutputSection *Sec : OutputSections) in writeHeader()
2441 Sec->writeHeaderTo<ELFT>(++SHdrs); in writeHeader()
2468 for (OutputSection *Sec : OutputSections) in writeSectionsBinary()
2469 if (Sec->Flags & SHF_ALLOC) in writeSectionsBinary()
2470 Sec->writeTo<ELFT>(Buf + Sec->Offset); in writeSectionsBinary()
2518 for (OutputSection *Sec : OutputSections) in writeSections()
2519 if (Sec->Type == SHT_REL || Sec->Type == SHT_RELA) in writeSections()
2520 Sec->writeTo<ELFT>(Buf + Sec->Offset); in writeSections()
2522 for (OutputSection *Sec : OutputSections) in writeSections()
2523 if (Sec != EhFrameHdr && Sec->Type != SHT_REL && Sec->Type != SHT_RELA) in writeSections()
2524 Sec->writeTo<ELFT>(Buf + Sec->Offset); in writeSections()