Lines Matching full:section
143 // Used to keep track of section and symbol names, so that in the YAML file
166 assert(false && "Expected section not found in index"); in get()
189 /// The future symbol table string section.
192 /// The future section header string table section, if a unique string table
197 /// The future dynamic symbol string section.
200 /// The name of the section header string table section. If it is .strtab or
201 /// .dynstr, the section header strings will be written to the same string
203 /// section will be created with that name.
229 StringRef SecName, ELFYAML::Section *YAMLSec);
234 ELFYAML::Section *YAMLSec);
238 ELFYAML::Section *YAMLSec);
241 ELFYAML::Section *YAMLSec);
252 const ELFYAML::NoBitsSection &Section,
255 const ELFYAML::RawContentSection &Section,
258 const ELFYAML::RelocationSection &Section,
261 const ELFYAML::RelrSection &Section,
270 const ELFYAML::SymverSection &Section,
273 const ELFYAML::VerneedSection &Section,
276 const ELFYAML::VerdefSection &Section,
279 const ELFYAML::ARMIndexTableSection &Section,
282 const ELFYAML::MipsABIFlags &Section,
285 const ELFYAML::DynamicSection &Section,
288 const ELFYAML::StackSizesSection &Section,
291 const ELFYAML::BBAddrMapSection &Section,
294 const ELFYAML::HashSection &Section,
297 const ELFYAML::AddrsigSection &Section,
300 const ELFYAML::NoteSection &Section,
303 const ELFYAML::GnuHashSection &Section,
306 const ELFYAML::LinkerOptionsSection &Section,
309 const ELFYAML::DependentLibrariesSection &Section,
312 const ELFYAML::CallGraphProfileSection &Section,
319 void assignSectionAddress(Elf_Shdr &SHeader, ELFYAML::Section *YAMLSec);
348 // The input may explicitly request to store the section header table strings in ELFState()
360 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in ELFState()
361 // Insert SHT_NULL section implicitly when it is not defined in YAML. in ELFState()
365 std::make_unique<ELFYAML::Section>( in ELFState()
373 // We might have an explicit section header table declaration. in ELFState()
376 reportError("multiple section header tables are not allowed"); in ELFState()
381 // We add a technical suffix for each unnamed section/fill. It does not in ELFState()
392 reportError("repeated section/fill name: '" + C->Name + in ELFState()
393 "' at YAML section/fill number " + Twine(I)); in ELFState()
399 reportError("cannot use '.dynsym' as the section header name table when " in ELFState()
406 reportError("cannot use '.symtab' as the section header name table when " in ELFState()
417 "' as the section header name table when it is needed for " in ELFState()
432 std::unique_ptr<ELFYAML::Section> Sec = std::make_unique<ELFYAML::Section>( in ELFState()
445 // When the section header table is explicitly defined at the end of the in ELFState()
447 // section headers, but still wants to place the section header table after in ELFState()
449 // other implicit sections right before the section header table. in ELFState()
456 // Insert the section header table implicitly at the end, when it is not in ELFState()
550 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in initProgramHeaders()
564 // Get the index of the section, or 0 in the case when the section doesn't exist. in initProgramHeaders()
567 reportError("unknown section or fill referenced: '" + *YamlPhdr.FirstSec + in initProgramHeaders()
572 reportError("unknown section or fill referenced: '" + *YamlPhdr.LastSec + in initProgramHeaders()
580 ": the section index of " + *YamlPhdr.FirstSec + in initProgramHeaders()
596 reportError("unknown section referenced: '" + S + "' by YAML symbol '" + in toSectionIndex()
599 reportError("unknown section referenced: '" + S + "' by YAML section '" + in toSectionIndex()
616 reportError("unable to link '" + LocSec + "' to excluded section '" + S + in toSectionIndex()
619 reportError("excluded section referenced: '" + S + "' by symbol '" + in toSectionIndex()
633 reportError("unknown symbol referenced: '" + S + "' by YAML section '" + in toSymbolIndex()
641 static void overrideFields(ELFYAML::Section *From, typename ELFT::Shdr &To) { in overrideFields()
661 ELFYAML::Section *YAMLSec) { in initImplicitHeader()
677 // If a ".debug_*" section's type is a preserved one, e.g., SHT_DYNAMIC, we in initImplicitHeader()
678 // will not treat it as a debug section. in initImplicitHeader()
687 // Override section fields if requested. in initImplicitHeader()
718 // If a section is excluded from section headers, we do not save its name in in getSectionNameOffset()
767 // Ensure SHN_UNDEF entry is present. An all-zero section header is a in initSectionHeaders()
791 // The full section header information might be not available here, so in initSectionHeaders()
798 ELFYAML::Section *Sec = cast<ELFYAML::Section>(D.get()); in initSectionHeaders()
828 assert(Sec && "It can't be null unless it is an implicit section. But all " in initSectionHeaders()
838 // Set the offset for all sections, except the SHN_UNDEF section with index in initSectionHeaders()
847 // We do not write any content for special SHN_UNDEF section. in initSectionHeaders()
905 llvm_unreachable("Unknown section type"); in initSectionHeaders()
910 // Override section fields if requested. in initSectionHeaders()
917 ELFYAML::Section *YAMLSec) { in assignSectionAddress()
963 if (Sym.Section) in toELFSymbols()
964 Symbol.st_shndx = toSectionIndex(*Sym.Section, "", Sym.Name); in toELFSymbols()
980 ELFYAML::Section *YAMLSec) { in initSymtabSectionHeader()
998 " for symbol table section '" + RawSec->Name + "'"); in initSymtabSectionHeader()
1001 " for symbol table section '" + RawSec->Name + "'"); in initSymtabSectionHeader()
1018 // If the symbol table section is explicitly described in the YAML in initSymtabSectionHeader()
1045 ELFYAML::Section *YAMLSec) { in initStrtabSectionHeader()
1103 ELFYAML::Section *YAMLSec) { in initDWARFSectionHeader()
1114 reportError("cannot specify section '" + Name + in initDWARFSectionHeader()
1164 const ELFYAML::Section *S = cast<ELFYAML::Section>(C); in getPhdrFragments()
1208 // Find the maximum offset of the end of a section in order to set p_memsz. in setProgramHeaderLayout()
1236 cast<ELFYAML::Section>(C)->Type != ELF::SHT_NOBITS); in shouldAllocateFileSpace()
1252 // When a nobits section is followed by a non-nobits section or fill in writeSectionContent()
1261 Elf_Shdr &SHeader, const ELFYAML::RawContentSection &Section, in writeSectionContent() argument
1263 if (Section.Info) in writeSectionContent()
1264 SHeader.sh_info = *Section.Info; in writeSectionContent()
1275 Elf_Shdr &SHeader, const ELFYAML::RelocationSection &Section, in writeSectionContent() argument
1277 assert((Section.Type == llvm::ELF::SHT_REL || in writeSectionContent()
1278 Section.Type == llvm::ELF::SHT_RELA || in writeSectionContent()
1279 Section.Type == llvm::ELF::SHT_CREL) && in writeSectionContent()
1280 "Section type is not SHT_REL nor SHT_RELA"); in writeSectionContent()
1282 if (!Section.RelocatableSec.empty()) in writeSectionContent()
1283 SHeader.sh_info = toSectionIndex(Section.RelocatableSec, Section.Name); in writeSectionContent()
1285 if (!Section.Relocations) in writeSectionContent()
1288 const bool IsCrel = Section.Type == llvm::ELF::SHT_CREL; in writeSectionContent()
1289 const bool IsRela = Section.Type == llvm::ELF::SHT_RELA; in writeSectionContent()
1294 for (const ELFYAML::Relocation &Rel : *Section.Relocations) in writeSectionContent()
1298 CBA.writeULEB128(Section.Relocations->size() * 8 + ELF::CREL_HDR_ADDEND + in writeSectionContent()
1300 for (const ELFYAML::Relocation &Rel : *Section.Relocations) { in writeSectionContent()
1301 const bool IsDynamic = Section.Link && (*Section.Link == ".dynsym"); in writeSectionContent()
1303 Rel.Symbol ? toSymbolIndex(*Rel.Symbol, Section.Name, IsDynamic) : 0; in writeSectionContent()
1356 const ELFYAML::RelrSection &Section, in writeSectionContent() argument
1358 if (!Section.Entries) in writeSectionContent()
1361 for (llvm::yaml::Hex64 E : *Section.Entries) { in writeSectionContent()
1363 reportError(Section.Name + ": the value is too large for 32-bits: 0x" + in writeSectionContent()
1368 SHeader.sh_size = sizeof(uintX_t) * Section.Entries->size(); in writeSectionContent()
1390 const ELFYAML::GroupSection &Section, in writeSectionContent() argument
1392 assert(Section.Type == llvm::ELF::SHT_GROUP && in writeSectionContent()
1393 "Section type is not SHT_GROUP"); in writeSectionContent()
1395 if (Section.Signature) in writeSectionContent()
1397 toSymbolIndex(*Section.Signature, Section.Name, /*IsDynamic=*/false); in writeSectionContent()
1399 if (!Section.Members) in writeSectionContent()
1402 for (const ELFYAML::SectionOrType &Member : *Section.Members) { in writeSectionContent()
1407 SectionIndex = toSectionIndex(Member.sectionNameOrType, Section.Name); in writeSectionContent()
1410 SHeader.sh_size = SHeader.sh_entsize * Section.Members->size(); in writeSectionContent()
1415 const ELFYAML::SymverSection &Section, in writeSectionContent() argument
1417 if (!Section.Entries) in writeSectionContent()
1420 for (uint16_t Version : *Section.Entries) in writeSectionContent()
1422 SHeader.sh_size = Section.Entries->size() * SHeader.sh_entsize; in writeSectionContent()
1427 Elf_Shdr &SHeader, const ELFYAML::StackSizesSection &Section, in writeSectionContent() argument
1429 if (!Section.Entries) in writeSectionContent()
1432 for (const ELFYAML::StackSizeEntry &E : *Section.Entries) { in writeSectionContent()
1440 Elf_Shdr &SHeader, const ELFYAML::BBAddrMapSection &Section, in writeSectionContent() argument
1442 if (!Section.Entries) { in writeSectionContent()
1443 if (Section.PGOAnalyses) in writeSectionContent()
1451 if (Section.PGOAnalyses) { in writeSectionContent()
1452 if (Section.Entries->size() != Section.PGOAnalyses->size()) in writeSectionContent()
1456 PGOAnalyses = &Section.PGOAnalyses.value(); in writeSectionContent()
1459 for (const auto &[Idx, E] : llvm::enumerate(*Section.Entries)) { in writeSectionContent()
1461 if (Section.Type == llvm::ELF::SHT_LLVM_BB_ADDR_MAP) { in writeSectionContent()
1507 if (Section.Type == llvm::ELF::SHT_LLVM_BB_ADDR_MAP && E.Version > 1) in writeSectionContent()
1549 Elf_Shdr &SHeader, const ELFYAML::LinkerOptionsSection &Section, in writeSectionContent() argument
1551 if (!Section.Options) in writeSectionContent()
1554 for (const ELFYAML::LinkerOption &LO : *Section.Options) { in writeSectionContent()
1565 Elf_Shdr &SHeader, const ELFYAML::DependentLibrariesSection &Section, in writeSectionContent() argument
1567 if (!Section.Libs) in writeSectionContent()
1570 for (StringRef Lib : *Section.Libs) { in writeSectionContent()
1603 Elf_Shdr &SHeader, const ELFYAML::CallGraphProfileSection &Section, in writeSectionContent() argument
1605 if (!Section.Entries) in writeSectionContent()
1608 for (const ELFYAML::CallGraphEntryWeight &E : *Section.Entries) { in writeSectionContent()
1616 const ELFYAML::HashSection &Section, in writeSectionContent() argument
1618 if (!Section.Bucket) in writeSectionContent()
1622 Section.NBucket.value_or(llvm::yaml::Hex64(Section.Bucket->size())), in writeSectionContent()
1625 Section.NChain.value_or(llvm::yaml::Hex64(Section.Chain->size())), in writeSectionContent()
1628 for (uint32_t Val : *Section.Bucket) in writeSectionContent()
1630 for (uint32_t Val : *Section.Chain) in writeSectionContent()
1633 SHeader.sh_size = (2 + Section.Bucket->size() + Section.Chain->size()) * 4; in writeSectionContent()
1638 const ELFYAML::VerdefSection &Section, in writeSectionContent() argument
1641 if (Section.Info) in writeSectionContent()
1642 SHeader.sh_info = *Section.Info; in writeSectionContent()
1643 else if (Section.Entries) in writeSectionContent()
1644 SHeader.sh_info = Section.Entries->size(); in writeSectionContent()
1646 if (!Section.Entries) in writeSectionContent()
1650 for (size_t I = 0; I < Section.Entries->size(); ++I) { in writeSectionContent()
1651 const ELFYAML::VerdefEntry &E = (*Section.Entries)[I]; in writeSectionContent()
1660 if (I == Section.Entries->size() - 1) in writeSectionContent()
1678 SHeader.sh_size = Section.Entries->size() * sizeof(Elf_Verdef) + in writeSectionContent()
1684 const ELFYAML::VerneedSection &Section, in writeSectionContent() argument
1686 if (Section.Info) in writeSectionContent()
1687 SHeader.sh_info = *Section.Info; in writeSectionContent()
1688 else if (Section.VerneedV) in writeSectionContent()
1689 SHeader.sh_info = Section.VerneedV->size(); in writeSectionContent()
1691 if (!Section.VerneedV) in writeSectionContent()
1695 for (size_t I = 0; I < Section.VerneedV->size(); ++I) { in writeSectionContent()
1696 const ELFYAML::VerneedEntry &VE = (*Section.VerneedV)[I]; in writeSectionContent()
1701 if (I == Section.VerneedV->size() - 1) in writeSectionContent()
1726 SHeader.sh_size = Section.VerneedV->size() * sizeof(Elf_Verneed) + in writeSectionContent()
1732 Elf_Shdr &SHeader, const ELFYAML::ARMIndexTableSection &Section, in writeSectionContent() argument
1734 if (!Section.Entries) in writeSectionContent()
1737 for (const ELFYAML::ARMIndexTableEntry &E : *Section.Entries) { in writeSectionContent()
1741 SHeader.sh_size = Section.Entries->size() * 8; in writeSectionContent()
1746 const ELFYAML::MipsABIFlags &Section, in writeSectionContent() argument
1748 assert(Section.Type == llvm::ELF::SHT_MIPS_ABIFLAGS && in writeSectionContent()
1749 "Section type is not SHT_MIPS_ABIFLAGS"); in writeSectionContent()
1755 Flags.version = Section.Version; in writeSectionContent()
1756 Flags.isa_level = Section.ISALevel; in writeSectionContent()
1757 Flags.isa_rev = Section.ISARevision; in writeSectionContent()
1758 Flags.gpr_size = Section.GPRSize; in writeSectionContent()
1759 Flags.cpr1_size = Section.CPR1Size; in writeSectionContent()
1760 Flags.cpr2_size = Section.CPR2Size; in writeSectionContent()
1761 Flags.fp_abi = Section.FpABI; in writeSectionContent()
1762 Flags.isa_ext = Section.ISAExtension; in writeSectionContent()
1763 Flags.ases = Section.ASEs; in writeSectionContent()
1764 Flags.flags1 = Section.Flags1; in writeSectionContent()
1765 Flags.flags2 = Section.Flags2; in writeSectionContent()
1771 const ELFYAML::DynamicSection &Section, in writeSectionContent() argument
1773 assert(Section.Type == llvm::ELF::SHT_DYNAMIC && in writeSectionContent()
1774 "Section type is not SHT_DYNAMIC"); in writeSectionContent()
1776 if (!Section.Entries) in writeSectionContent()
1779 for (const ELFYAML::DynamicEntry &DE : *Section.Entries) { in writeSectionContent()
1783 SHeader.sh_size = 2 * sizeof(uintX_t) * Section.Entries->size(); in writeSectionContent()
1788 const ELFYAML::AddrsigSection &Section, in writeSectionContent() argument
1790 if (!Section.Symbols) in writeSectionContent()
1793 for (StringRef Sym : *Section.Symbols) in writeSectionContent()
1795 CBA.writeULEB128(toSymbolIndex(Sym, Section.Name, /*IsDynamic=*/false)); in writeSectionContent()
1800 const ELFYAML::NoteSection &Section, in writeSectionContent() argument
1802 if (!Section.Notes) in writeSectionContent()
1806 for (const ELFYAML::NoteEntry &NE : *Section.Notes) { in writeSectionContent()
1841 const ELFYAML::GnuHashSection &Section, in writeSectionContent() argument
1843 if (!Section.HashBuckets) in writeSectionContent()
1846 if (!Section.Header) in writeSectionContent()
1853 if (Section.Header->NBuckets) in writeSectionContent()
1854 CBA.write<uint32_t>(*Section.Header->NBuckets, ELFT::Endianness); in writeSectionContent()
1856 CBA.write<uint32_t>(Section.HashBuckets->size(), ELFT::Endianness); in writeSectionContent()
1860 CBA.write<uint32_t>(Section.Header->SymNdx, ELFT::Endianness); in writeSectionContent()
1864 if (Section.Header->MaskWords) in writeSectionContent()
1865 CBA.write<uint32_t>(*Section.Header->MaskWords, ELFT::Endianness); in writeSectionContent()
1867 CBA.write<uint32_t>(Section.BloomFilter->size(), ELFT::Endianness); in writeSectionContent()
1870 CBA.write<uint32_t>(Section.Header->Shift2, ELFT::Endianness); in writeSectionContent()
1873 for (llvm::yaml::Hex64 Val : *Section.BloomFilter) in writeSectionContent()
1877 for (llvm::yaml::Hex32 Val : *Section.HashBuckets) in writeSectionContent()
1881 for (llvm::yaml::Hex32 Val : *Section.HashValues) in writeSectionContent()
1885 Section.BloomFilter->size() * sizeof(typename ELFT::uint) + in writeSectionContent()
1886 Section.HashBuckets->size() * 4 + in writeSectionContent()
1887 Section.HashValues->size() * 4; in writeSectionContent()
1920 reportError("repeated section name: '" + Hdr.Name + in buildSectionHeaderReorderMap()
1921 "' in the section header description"); in buildSectionHeaderReorderMap()
1933 for (const ELFYAML::Section *S : Doc.getSections()) { in buildSectionHeaderReorderMap()
1934 // Ignore special first SHT_NULL section. in buildSectionHeaderReorderMap()
1938 reportError("section '" + S->Name + in buildSectionHeaderReorderMap()
1944 reportError("section header contains undefined section '" + It.getKey() + in buildSectionHeaderReorderMap()
1950 // A YAML description can have an explicit section header declaration that in buildSectionIndex()
1951 // allows to change the order of section headers. in buildSectionIndex()
1957 // Build excluded section headers map. in buildSectionIndex()
1958 std::vector<ELFYAML::Section *> Sections = Doc.getSections(); in buildSectionIndex()
1967 for (const ELFYAML::Section *S : Sections) in buildSectionIndex()
1972 for (const ELFYAML::Section *S : Sections) { in buildSectionIndex()
2000 // Add the regular symbol names to .strtab section. in finalizeStrings()
2006 // Add the dynamic symbol names to .dynstr section. in finalizeStrings()
2012 // add strings to .dynstr section. in finalizeStrings()
2032 // Don't finalize the section header string table a second time if it has in finalizeStrings()
2045 // Build the section index, which adds sections to the section header string in writeELF()
2046 // table first, so that we can finalize the section header string table. in writeELF()
2050 // Finalize section header string table and the .strtab and .dynstr sections. in writeELF()