Lines Matching refs:Sec
221 std::string describe(const Elf_Shdr &Sec) const;
258 virtual void printVersionSymbolSection(const Elf_Shdr *Sec) = 0;
259 virtual void printVersionDefinitionSection(const Elf_Shdr *Sec) = 0;
260 virtual void printVersionDependencySection(const Elf_Shdr *Sec) = 0;
272 const Elf_Shdr &Sec, const Elf_Shdr *SymTab);
275 void printRelocationsHelper(const Elf_Shdr &Sec);
277 const Elf_Shdr &Sec, bool RawRelr,
295 getVersionTable(const Elf_Shdr &Sec, ArrayRef<Elf_Sym> *SymTab,
297 StringRef getPrintableSectionName(const Elf_Shdr &Sec) const;
400 std::string ELFDumper<ELFT>::describe(const Elf_Shdr &Sec) const { in describe()
401 return ::describe(Obj, Sec); in describe()
416 const typename ELFT::Shdr &Sec, in getLinkAsSymtab() argument
419 Obj.getSection(Sec.sh_link); in getLinkAsSymtab()
421 return createError("invalid section linked to " + describe(Obj, Sec) + in getLinkAsSymtab()
426 "invalid section linked to " + describe(Obj, Sec) + ": expected " + in getLinkAsSymtab()
436 describe(Obj, Sec) + ": " + toString(StrTabOrErr.takeError())); in getLinkAsSymtab()
440 return createError("unable to read symbols from the " + describe(Obj, Sec) + in getLinkAsSymtab()
450 ELFDumper<ELFT>::getVersionTable(const Elf_Shdr &Sec, ArrayRef<Elf_Sym> *SymTab, in getVersionTable() argument
454 if (reinterpret_cast<uintptr_t>(Obj.base() + Sec.sh_offset) % in getVersionTable()
457 return createError("the " + describe(Sec) + " is misaligned"); in getVersionTable()
460 Obj.template getSectionContentsAsArray<Elf_Versym>(Sec); in getVersionTable()
462 return createError("cannot read content of " + describe(Sec) + ": " + in getVersionTable()
466 getLinkAsSymtab(Obj, Sec, SHT_DYNSYM); in getVersionTable()
473 reportUniqueWarning(describe(Sec) + ": the number of entries (" + in getVersionTable()
478 Twine(Sec.sh_link)); in getVersionTable()
562 void printVersionSymbolSection(const Elf_Shdr *Sec) override;
563 void printVersionDefinitionSection(const Elf_Shdr *Sec) override;
564 void printVersionDependencySection(const Elf_Shdr *Sec) override;
646 void printGNUVersionSectionProlog(const typename ELFT::Shdr &Sec,
674 void printVersionSymbolSection(const Elf_Shdr *Sec) override;
675 void printVersionDefinitionSection(const Elf_Shdr *Sec) override;
676 void printVersionDependencySection(const Elf_Shdr *Sec) override;
1655 for (const Elf_Shdr &Sec : cantFail(Obj.sections())) { in findDynamic() local
1656 if (Sec.sh_type != ELF::SHT_DYNAMIC) in findDynamic()
1658 DynamicSec = &Sec; in findDynamic()
1787 for (const Elf_Shdr &Sec : Sections) { in ELFDumper() local
1788 switch (Sec.sh_type) { in ELFDumper()
1791 DotSymtabSec = &Sec; in ELFDumper()
1795 DotDynsymSec = &Sec; in ELFDumper()
1799 createDRI(Sec.sh_offset, Sec.sh_size, Sec.sh_entsize); in ELFDumper()
1802 DynSymRegion->Context = describe(Sec); in ELFDumper()
1804 if (Expected<StringRef> E = Obj.getStringTableForSymtab(Sec)) in ELFDumper()
1808 describe(Sec) + ": " + toString(E.takeError())); in ELFDumper()
1811 describe(Sec) + ": " + in ELFDumper()
1817 uint32_t SymtabNdx = Sec.sh_link; in ELFDumper()
1820 "unable to get the associated symbol table for " + describe(Sec) + in ELFDumper()
1828 Obj.getSHNDXTable(Sec)) { in ELFDumper()
1833 describe(Sec)); in ELFDumper()
1841 SymbolVersionSection = &Sec; in ELFDumper()
1845 SymbolVersionDefSection = &Sec; in ELFDumper()
1849 SymbolVersionNeedSection = &Sec; in ELFDumper()
1853 DotAddrsigSec = &Sec; in ELFDumper()
2595 for (const Elf_Shdr &Sec : cantFail(Obj.sections())) { in printAttributes() local
2596 if (Sec.sh_type != ELF::SHT_ARM_ATTRIBUTES && in printAttributes()
2597 Sec.sh_type != ELF::SHT_RISCV_ATTRIBUTES) in printAttributes()
2602 Obj.getSectionContents(Sec)) { in printAttributes()
2605 reportUniqueWarning("the " + describe(Sec) + " is empty"); in printAttributes()
2609 reportUniqueWarning("unable to read the content of the " + describe(Sec) + in printAttributes()
2624 describe(Sec) + ": " + toString(std::move(E))); in printAttributes()
3151 const Elf_Shdr &Sec, const Elf_Shdr *SymTab) { in printReloc() argument
3155 " in " + describe(Sec) + ": " + in printReloc()
3321 for (const Elf_Shdr &Sec : cantFail(Obj.sections())) { in getGroups() local
3323 if (Sec.sh_type != ELF::SHT_GROUP) in getGroups()
3327 if (Expected<const Elf_Shdr *> SymtabOrErr = Obj.getSection(Sec.sh_link)) { in getGroups()
3329 Obj.template getEntry<Elf_Sym>(**SymtabOrErr, Sec.sh_info)) in getGroups()
3330 Signature = GetSignature(**SymOrErr, Sec.sh_info, **SymtabOrErr); in getGroups()
3333 describe(Sec) + ": " + in getGroups()
3337 describe(Sec) + ": " + in getGroups()
3343 Obj.template getSectionContentsAsArray<Elf_Word>(Sec)) { in getGroups()
3346 describe(Sec) + ": the section is empty"); in getGroups()
3350 reportUniqueWarning("unable to get the content of the " + describe(Sec) + in getGroups()
3354 Ret.push_back({getPrintableSectionName(Sec), in getGroups()
3356 Sec.sh_name, in getGroups()
3358 Sec.sh_link, in getGroups()
3359 Sec.sh_info, in getGroups()
3372 Twine(Ndx) + " when dumping the " + describe(Sec) + in getGroups()
3492 static bool isRelocationSec(const typename ELFT::Shdr &Sec) { in isRelocationSec() argument
3493 return Sec.sh_type == ELF::SHT_REL || Sec.sh_type == ELF::SHT_RELA || in isRelocationSec()
3494 Sec.sh_type == ELF::SHT_RELR || Sec.sh_type == ELF::SHT_ANDROID_REL || in isRelocationSec()
3495 Sec.sh_type == ELF::SHT_ANDROID_RELA || in isRelocationSec()
3496 Sec.sh_type == ELF::SHT_ANDROID_RELR; in isRelocationSec()
3500 auto GetEntriesNum = [&](const Elf_Shdr &Sec) -> Expected<size_t> { in printRelocations() argument
3503 if (Sec.sh_type == ELF::SHT_ANDROID_REL || in printRelocations()
3504 Sec.sh_type == ELF::SHT_ANDROID_RELA) { in printRelocations()
3506 this->Obj.android_relas(Sec); in printRelocations()
3512 if (!opts::RawRelr && (Sec.sh_type == ELF::SHT_RELR || in printRelocations()
3513 Sec.sh_type == ELF::SHT_ANDROID_RELR)) { in printRelocations()
3514 Expected<Elf_Relr_Range> RelrsOrErr = this->Obj.relrs(Sec); in printRelocations()
3520 return Sec.getEntityCount(); in printRelocations()
3524 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printRelocations() local
3525 if (!isRelocationSec<ELFT>(Sec)) in printRelocations()
3530 if (Expected<size_t> NumOrErr = GetEntriesNum(Sec)) in printRelocations()
3534 this->describe(Sec) + ": " + in printRelocations()
3537 uintX_t Offset = Sec.sh_offset; in printRelocations()
3538 StringRef Name = this->getPrintableSectionName(Sec); in printRelocations()
3542 printRelocHeaderFields<ELFT>(OS, Sec.sh_type); in printRelocations()
3543 this->printRelocationsHelper(Sec); in printRelocations()
3624 for (const Elf_Shdr &Sec : Sections) { in printSectionHeaders() local
3630 this->FileName, this->Obj.getSectionName(Sec, SecStrTable))); in printSectionHeaders()
3632 getSectionTypeString(this->Obj.getHeader().e_machine, Sec.sh_type); in printSectionHeaders()
3634 to_string(format_hex_no_prefix(Sec.sh_addr, ELFT::Is64Bits ? 16 : 8)); in printSectionHeaders()
3635 Fields[4].Str = to_string(format_hex_no_prefix(Sec.sh_offset, 6)); in printSectionHeaders()
3636 Fields[5].Str = to_string(format_hex_no_prefix(Sec.sh_size, 6)); in printSectionHeaders()
3637 Fields[6].Str = to_string(format_hex_no_prefix(Sec.sh_entsize, 2)); in printSectionHeaders()
3638 Fields[7].Str = getGNUFlags(this->Obj.getHeader().e_machine, Sec.sh_flags); in printSectionHeaders()
3639 Fields[8].Str = to_string(Sec.sh_link); in printSectionHeaders()
3640 Fields[9].Str = to_string(Sec.sh_info); in printSectionHeaders()
3641 Fields[10].Str = to_string(Sec.sh_addralign); in printSectionHeaders()
4082 const typename ELFT::Shdr &Sec) { in checkTLSSections() argument
4083 if (Sec.sh_flags & ELF::SHF_TLS) { in checkTLSSections()
4085 if (Sec.sh_type == ELF::SHT_NOBITS) in checkTLSSections()
4100 const typename ELFT::Shdr &Sec) { in checkOffsets() argument
4102 if (Sec.sh_type == ELF::SHT_NOBITS) in checkOffsets()
4105 if (Sec.sh_offset < Phdr.p_offset) in checkOffsets()
4109 if (Sec.sh_size == 0) in checkOffsets()
4110 return (Sec.sh_offset + 1 <= Phdr.p_offset + Phdr.p_filesz); in checkOffsets()
4111 return Sec.sh_offset + Sec.sh_size <= Phdr.p_offset + Phdr.p_filesz; in checkOffsets()
4118 const typename ELFT::Shdr &Sec) { in checkVMA() argument
4119 if (!(Sec.sh_flags & ELF::SHF_ALLOC)) in checkVMA()
4122 if (Sec.sh_addr < Phdr.p_vaddr) in checkVMA()
4126 (Sec.sh_type == ELF::SHT_NOBITS) && ((Sec.sh_flags & ELF::SHF_TLS) != 0); in checkVMA()
4130 if (Sec.sh_size == 0 || IsTbssInNonTLS) in checkVMA()
4131 return Sec.sh_addr + 1 <= Phdr.p_vaddr + Phdr.p_memsz; in checkVMA()
4132 return Sec.sh_addr + Sec.sh_size <= Phdr.p_vaddr + Phdr.p_memsz; in checkVMA()
4137 const typename ELFT::Shdr &Sec) { in checkPTDynamic() argument
4138 if (Phdr.p_type != ELF::PT_DYNAMIC || Phdr.p_memsz == 0 || Sec.sh_size != 0) in checkPTDynamic()
4144 bool CheckOffset = (Sec.sh_type == ELF::SHT_NOBITS) || in checkPTDynamic()
4145 (Sec.sh_offset > Phdr.p_offset && in checkPTDynamic()
4146 Sec.sh_offset < Phdr.p_offset + Phdr.p_filesz); in checkPTDynamic()
4147 bool CheckVA = !(Sec.sh_flags & ELF::SHF_ALLOC) || in checkPTDynamic()
4148 (Sec.sh_addr > Phdr.p_vaddr && Sec.sh_addr < Phdr.p_memsz); in checkPTDynamic()
4250 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printSectionMapping() local
4251 if (Sec.sh_type == ELF::SHT_NULL) in printSectionMapping()
4257 if (checkTLSSections<ELFT>(Phdr, Sec) && checkOffsets<ELFT>(Phdr, Sec) && in printSectionMapping()
4258 checkVMA<ELFT>(Phdr, Sec) && checkPTDynamic<ELFT>(Phdr, Sec)) { in printSectionMapping()
4260 unwrapOrError(this->FileName, this->Obj.getSectionName(Sec)).str() + in printSectionMapping()
4262 BelongsToSegment.insert(&Sec); in printSectionMapping()
4271 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printSectionMapping() local
4272 if (BelongsToSegment.find(&Sec) == BelongsToSegment.end()) in printSectionMapping()
4274 unwrapOrError(this->FileName, this->Obj.getSectionName(Sec)).str() + in printSectionMapping()
4378 void ELFDumper<ELFT>::printRelocationsHelper(const Elf_Shdr &Sec) { in printRelocationsHelper() argument
4380 Sec, opts::RawRelr, in printRelocationsHelper()
4381 [&](const Relocation<ELFT> &R, unsigned Ndx, const Elf_Shdr &Sec, in printRelocationsHelper()
4382 const Elf_Shdr *SymTab) { printReloc(R, Ndx, Sec, SymTab); }, in printRelocationsHelper() argument
4427 const typename ELFT::Shdr &Sec, const Twine &Label, unsigned EntriesNum) { in printGNUVersionSectionProlog() argument
4430 StringRef SecName = this->getPrintableSectionName(Sec); in printGNUVersionSectionProlog()
4436 this->Obj.getSection(Sec.sh_link)) in printGNUVersionSectionProlog()
4440 this->describe(Sec) + ": " + in printGNUVersionSectionProlog()
4443 OS << " Addr: " << format_hex_no_prefix(Sec.sh_addr, 16) in printGNUVersionSectionProlog()
4444 << " Offset: " << format_hex(Sec.sh_offset, 8) in printGNUVersionSectionProlog()
4445 << " Link: " << Sec.sh_link << " (" << LinkedSecName << ")\n"; in printGNUVersionSectionProlog()
4449 void GNUELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) { in printVersionSymbolSection() argument
4450 if (!Sec) in printVersionSymbolSection()
4453 printGNUVersionSectionProlog(*Sec, "Version symbols", in printVersionSymbolSection()
4454 Sec->sh_size / sizeof(Elf_Versym)); in printVersionSymbolSection()
4456 this->getVersionTable(*Sec, /*SymTab=*/nullptr, in printVersionSymbolSection()
4489 Twine(I) + " of " + this->describe(*Sec) + in printVersionSymbolSection()
4534 void GNUELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) { in printVersionDefinitionSection() argument
4535 if (!Sec) in printVersionDefinitionSection()
4538 printGNUVersionSectionProlog(*Sec, "Version definition", Sec->sh_info); in printVersionDefinitionSection()
4540 Expected<std::vector<VerDef>> V = this->Obj.getVersionDefinitions(*Sec); in printVersionDefinitionSection()
4561 void GNUELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) { in printVersionDependencySection() argument
4562 if (!Sec) in printVersionDependencySection()
4565 unsigned VerneedNum = Sec->sh_info; in printVersionDependencySection()
4566 printGNUVersionSectionProlog(*Sec, "Version needs", VerneedNum); in printVersionDependencySection()
4569 this->Obj.getVersionDependencies(*Sec, this->WarningHandler); in printVersionDependencySection()
4743 decodeAddrsigSection(const ELFFile<ELFT> &Obj, const typename ELFT::Shdr &Sec) { in decodeAddrsigSection() argument
4744 Expected<ArrayRef<uint8_t>> ContentsOrErr = Obj.getSectionContents(Sec); in decodeAddrsigSection()
4752 return createError("unable to decode " + describe(Obj, Sec) + ": " + in decodeAddrsigSection()
5601 const Elf_Shdr &Sec, bool RawRelr, in forEachRelocationDo() argument
5608 this->reportUniqueWarning(Prefix + " " + describe(Sec) + ": " + in forEachRelocationDo()
5616 if (Sec.sh_type != ELF::SHT_RELR && Sec.sh_type != ELF::SHT_ANDROID_RELR) { in forEachRelocationDo()
5617 Expected<const Elf_Shdr *> SymTabOrErr = Obj.getSection(Sec.sh_link); in forEachRelocationDo()
5627 switch (Sec.sh_type) { in forEachRelocationDo()
5629 if (Expected<Elf_Rel_Range> RangeOrErr = Obj.rels(Sec)) { in forEachRelocationDo()
5631 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5637 if (Expected<Elf_Rela_Range> RangeOrErr = Obj.relas(Sec)) { in forEachRelocationDo()
5639 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5646 Expected<Elf_Relr_Range> RangeOrErr = Obj.relrs(Sec); in forEachRelocationDo()
5658 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, in forEachRelocationDo()
5664 if (Expected<std::vector<Elf_Rela>> RelasOrErr = Obj.android_relas(Sec)) { in forEachRelocationDo()
5666 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5675 StringRef ELFDumper<ELFT>::getPrintableSectionName(const Elf_Shdr &Sec) const { in getPrintableSectionName()
5678 Obj.getSectionName(Sec, this->WarningHandler)) in getPrintableSectionName()
5681 this->reportUniqueWarning("unable to get the name of " + describe(Sec) + in getPrintableSectionName()
5890 for (const Elf_Shdr &Sec : cantFail(Obj.sections())) { in printNonRelocatableStackSizes() local
5891 if (this->getPrintableSectionName(Sec) != ".stack_sizes") in printNonRelocatableStackSizes()
5895 unwrapOrError(this->FileName, Obj.getSectionContents(Sec)); in printNonRelocatableStackSizes()
5903 describe(Sec) + in printNonRelocatableStackSizes()
5908 if (!printFunctionStackSize(SymValue, /*FunctionSec=*/None, Sec, Data, in printNonRelocatableStackSizes()
5919 for (const Elf_Shdr &Sec : cantFail(Obj.sections())) { in getSectionAndRelocations() local
5920 if (IsMatch(Sec)) in getSectionAndRelocations()
5921 if (SecToRelocMap.insert(std::make_pair(&Sec, (const Elf_Shdr *)nullptr)) in getSectionAndRelocations()
5925 if (Sec.sh_type != ELF::SHT_RELA && Sec.sh_type != ELF::SHT_REL) in getSectionAndRelocations()
5928 Expected<const Elf_Shdr *> RelSecOrErr = Obj.getSection(Sec.sh_info); in getSectionAndRelocations()
5930 reportUniqueWarning(describe(Sec) + in getSectionAndRelocations()
5937 SecToRelocMap[ContentsSec] = &Sec; in getSectionAndRelocations()
5947 auto IsMatch = [&](const Elf_Shdr &Sec) -> bool { in printRelocatableStackSizes() argument
5949 if (Expected<StringRef> NameOrErr = Obj.getSectionName(Sec)) in printRelocatableStackSizes()
5987 [&](const Relocation<ELFT> &R, unsigned Ndx, const Elf_Shdr &Sec, in printRelocatableStackSizes()
6163 const typename ELFT::Shdr *Sec = Dumper.findSectionByName(".MIPS.abiflags"); in getMipsAbiFlagsSection() local
6164 if (Sec == nullptr) in getMipsAbiFlagsSection()
6169 Dumper.getElfObject().getELFFile().getSectionContents(*Sec); in getMipsAbiFlagsSection()
6339 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printRelocations() local
6340 if (!isRelocationSec<ELFT>(Sec)) in printRelocations()
6343 StringRef Name = this->getPrintableSectionName(Sec); in printRelocations()
6344 unsigned SecNdx = &Sec - &cantFail(this->Obj.sections()).front(); in printRelocations()
6347 this->printRelocationsHelper(Sec); in printRelocations()
6388 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printSectionHeaders() local
6391 W.printNumber("Name", this->getPrintableSectionName(Sec), Sec.sh_name); in printSectionHeaders()
6394 Sec.sh_type), in printSectionHeaders()
6395 Sec.sh_type); in printSectionHeaders()
6396 W.printFlags("Flags", Sec.sh_flags, makeArrayRef(FlagsList)); in printSectionHeaders()
6397 W.printHex("Address", Sec.sh_addr); in printSectionHeaders()
6398 W.printHex("Offset", Sec.sh_offset); in printSectionHeaders()
6399 W.printNumber("Size", Sec.sh_size); in printSectionHeaders()
6400 W.printNumber("Link", Sec.sh_link); in printSectionHeaders()
6401 W.printNumber("Info", Sec.sh_info); in printSectionHeaders()
6402 W.printNumber("AddressAlignment", Sec.sh_addralign); in printSectionHeaders()
6403 W.printNumber("EntrySize", Sec.sh_entsize); in printSectionHeaders()
6407 this->printRelocationsHelper(Sec); in printSectionHeaders()
6424 if (SymSec == &Sec) in printSectionHeaders()
6431 if (opts::SectionData && Sec.sh_type != ELF::SHT_NOBITS) { in printSectionHeaders()
6433 unwrapOrError(this->FileName, this->Obj.getSectionContents(Sec)); in printSectionHeaders()
6625 void LLVMELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) { in printVersionSymbolSection() argument
6627 if (!Sec) in printVersionSymbolSection()
6634 this->getVersionTable(*Sec, &Syms, &StrTable, &SymTabSec); in printVersionSymbolSection()
6659 void LLVMELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) { in printVersionDefinitionSection() argument
6661 if (!Sec) in printVersionDefinitionSection()
6664 Expected<std::vector<VerDef>> V = this->Obj.getVersionDefinitions(*Sec); in printVersionDefinitionSection()
6684 void LLVMELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) { in printVersionDependencySection() argument
6686 if (!Sec) in printVersionDependencySection()
6690 this->Obj.getVersionDependencies(*Sec, this->WarningHandler); in printVersionDependencySection()
6769 auto IsMatch = [](const Elf_Shdr &Sec) -> bool { in printCGProfile() argument
6770 return Sec.sh_type == ELF::SHT_LLVM_CALL_GRAPH_PROFILE; in printCGProfile()
6813 for (const Elf_Shdr &Sec : cantFail(this->Obj.sections())) { in printBBAddrMaps() local
6814 if (Sec.sh_type != SHT_LLVM_BB_ADDR_MAP) in printBBAddrMaps()
6819 unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link)); in printBBAddrMaps()
6822 this->Obj.decodeBBAddrMap(Sec); in printBBAddrMaps()
6824 this->reportUniqueWarning("unable to dump " + this->describe(Sec) + ": " + in printBBAddrMaps()
6837 Twine::utohexstr(AM.Addr) + ") in " + this->describe(Sec)); in printBBAddrMaps()