Lines Matching defs:ELFT

93 template <class ELFT> struct RelSymbol {
94 RelSymbol(const typename ELFT::Sym *S, StringRef N)
96 const typename ELFT::Sym *Sym;
192 template <class ELFT> class Relocation {
194 Relocation(const typename ELFT::Rel &R, bool IsMips64EL)
198 Relocation(const typename ELFT::Rela &R, bool IsMips64EL)
199 : Relocation((const typename ELFT::Rel &)R, IsMips64EL) {
205 typename ELFT::uint Offset;
206 typename ELFT::uint Info;
210 template <class ELFT> class MipsGOTParser;
212 template <typename ELFT> class ELFDumper : public ObjDumper {
213 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
216 ELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer);
236 const object::ELFObjectFile<ELFT> &getElfObject() const { return ObjF; };
286 virtual void printRelRelaReloc(const Relocation<ELFT> &R,
287 const RelSymbol<ELFT> &RelSym) = 0;
290 void printReloc(const Relocation<ELFT> &R, unsigned RelIndex,
292 void printDynamicReloc(const Relocation<ELFT> &R);
297 llvm::function_ref<void(const Relocation<ELFT> &, unsigned,
311 virtual void printMipsGOT(const MipsGOTParser<ELFT> &Parser) = 0;
312 virtual void printMipsPLT(const MipsGOTParser<ELFT> &Parser) = 0;
342 void printStackSize(const Relocation<ELFT> &R, const Elf_Shdr &RelocSec,
352 const object::ELFObjectFile<ELFT> &ObjF;
353 const ELFFile<ELFT> &Obj;
417 Expected<RelSymbol<ELFT>> getRelocationTarget(const Relocation<ELFT> &R,
426 template <class ELFT>
427 std::string ELFDumper<ELFT>::describe(const Elf_Shdr &Sec) const {
433 template <class ELFT> struct SymtabLink {
434 typename ELFT::SymRange Symbols;
436 const typename ELFT::Shdr *SymTab;
441 template <class ELFT>
442 Expected<SymtabLink<ELFT>> getLinkAsSymtab(const ELFFile<ELFT> &Obj,
443 const typename ELFT::Shdr &Sec,
445 Expected<const typename ELFT::Shdr *> SymtabOrErr =
465 Expected<typename ELFT::SymRange> SymsOrErr = Obj.symbols(*SymtabOrErr);
470 return SymtabLink<ELFT>{*SymsOrErr, *StrTabOrErr, *SymtabOrErr};
475 template <class ELFT>
476 Expected<ArrayRef<typename ELFT::Versym>>
477 ELFDumper<ELFT>::getVersionTable(const Elf_Shdr &Sec, ArrayRef<Elf_Sym> *SymTab,
492 Expected<SymtabLink<ELFT>> SymTabOrErr =
515 template <class ELFT>
516 std::pair<typename ELFDumper<ELFT>::Elf_Sym_Range, std::optional<StringRef>>
517 ELFDumper<ELFT>::getSymtabAndStrtab() const {
537 template <class ELFT>
538 void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic,
573 template <typename ELFT> class GNUELFDumper : public ELFDumper<ELFT> {
577 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
579 GNUELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer)
580 : ELFDumper<ELFT>(ObjF, Writer),
671 void printRelRelaReloc(const Relocation<ELFT> &R,
672 const RelSymbol<ELFT> &RelSym) override;
686 void printGNUVersionSectionProlog(const typename ELFT::Shdr &Sec,
692 void printMipsGOT(const MipsGOTParser<ELFT> &Parser) override;
693 void printMipsPLT(const MipsGOTParser<ELFT> &Parser) override;
697 template <typename ELFT> class LLVMELFDumper : public ELFDumper<ELFT> {
699 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
701 LLVMELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer)
702 : ELFDumper<ELFT>(ObjF, Writer), W(Writer) {}
735 void printRelRelaReloc(const Relocation<ELFT> &R,
736 const RelSymbol<ELFT> &RelSym) override;
748 void printMipsGOT(const MipsGOTParser<ELFT> &Parser) override;
749 void printMipsPLT(const MipsGOTParser<ELFT> &Parser) override;
756 virtual void printExpandedRelRelaReloc(const Relocation<ELFT> &R,
759 virtual void printDefaultRelRelaReloc(const Relocation<ELFT> &R,
772 template <typename ELFT> class JSONELFDumper : public LLVMELFDumper<ELFT> {
774 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
776 JSONELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer)
777 : LLVMELFDumper<ELFT>(ObjF, Writer) {}
786 void printDefaultRelRelaReloc(const Relocation<ELFT> &R,
809 template <class ELFT>
811 createELFDumper(const ELFObjectFile<ELFT> &Obj, ScopedPrinter &Writer) {
813 return std::make_unique<GNUELFDumper<ELFT>>(Obj, Writer);
815 return std::make_unique<JSONELFDumper<ELFT>>(Obj, Writer);
816 return std::make_unique<LLVMELFDumper<ELFT>>(Obj, Writer);
839 template <class ELFT>
841 ELFDumper<ELFT>::getVersionMap() const {
857 template <typename ELFT>
858 Expected<StringRef> ELFDumper<ELFT>::getSymbolVersion(const Elf_Sym &Sym,
894 template <typename ELFT>
895 Expected<RelSymbol<ELFT>>
896 ELFDumper<ELFT>::getRelocationTarget(const Relocation<ELFT> &R,
899 return RelSymbol<ELFT>(nullptr, "");
909 return RelSymbol<ELFT>(nullptr, "");
920 return RelSymbol<ELFT>(Sym, SymbolName);
923 template <typename ELFT>
924 ArrayRef<typename ELFT::Word>
925 ELFDumper<ELFT>::getShndxTable(const Elf_Shdr *Symtab) const {
938 template <typename ELFT>
939 std::string ELFDumper<ELFT>::getStaticSymbolName(uint32_t Index) const {
946 Expected<const typename ELFT::Sym *> SymOrErr =
961 template <typename ELFT>
962 std::string ELFDumper<ELFT>::getFullSymbolName(
1008 template <typename ELFT>
1010 ELFDumper<ELFT>::getSymbolSectionIndex(const Elf_Sym &Symbol, unsigned SymIndex,
1014 return object::getExtendedSymbolTableIndex<ELFT>(Symbol, SymIndex,
1044 template <typename ELFT>
1046 ELFDumper<ELFT>::getSymbolSectionName(const Elf_Sym &Symbol,
1768 template <typename ELFT>
1769 std::pair<const typename ELFT::Phdr *, const typename ELFT::Shdr *>
1770 ELFDumper<ELFT>::findDynamic() {
1825 template <typename ELFT>
1826 void ELFDumper<ELFT>::loadDynamicTable() {
1908 template <typename ELFT>
1909 ELFDumper<ELFT>::ELFDumper(const object::ELFObjectFile<ELFT> &O,
1919 typename ELFT::ShdrRange Sections = cantFail(Obj.sections());
1994 template <typename ELFT> void ELFDumper<ELFT>::parseDynamicTable() {
2207 template <typename ELFT> void ELFDumper<ELFT>::printVersionInfo() {
2291 template <class ELFT>
2292 const typename ELFT::Shdr *
2293 ELFDumper<ELFT>::findSectionByName(StringRef Name) const {
2306 template <class ELFT>
2307 std::string ELFDumper<ELFT>::getDynamicEntry(uint64_t Type,
2507 template <class ELFT>
2508 StringRef ELFDumper<ELFT>::getDynamicString(uint64_t Value) const {
2546 template <class ELFT> void ELFDumper<ELFT>::printUnwindInfo() {
2547 DwarfCFIEH::PrinterContext<ELFT> Ctx(W, ObjF);
2564 template <class ELFT> void ELFDumper<ELFT>::printNeededLibraries() {
2578 template <class ELFT>
2579 static Error checkHashTable(const ELFDumper<ELFT> &Dumper,
2580 const typename ELFT::Hash *H,
2582 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile();
2604 const unsigned HeaderSize = 2 * sizeof(typename ELFT::Word);
2613 ((uint64_t)H->nbucket + H->nchain) * sizeof(typename ELFT::Word))
2619 template <class ELFT>
2620 static Error checkGNUHashTable(const ELFFile<ELFT> &Obj,
2621 const typename ELFT::GnuHash *GnuHashTable,
2631 (uint64_t)GnuHashTable->maskwords * sizeof(typename ELFT::Off) >=
2640 template <typename ELFT> void ELFDumper<ELFT>::printHashTable() {
2661 template <class ELFT>
2662 static Expected<ArrayRef<typename ELFT::Word>>
2664 const typename ELFT::GnuHash *GnuHashTable) {
2668 ArrayRef<typename ELFT::Sym> DynSymTable =
2669 DynSymRegion->template getAsArrayRef<typename ELFT::Sym>();
2684 ArrayRef<typename ELFT::Word> Buckets = GnuHashTable->buckets();
2685 if (!llvm::all_of(Buckets, [](typename ELFT::Word V) { return V == 0; }))
2692 return ArrayRef<typename ELFT::Word>();
2695 template <typename ELFT>
2696 void ELFDumper<ELFT>::printGnuHashTable() {
2702 Error Err = checkGNUHashTable<ELFT>(Obj, GnuHashTable, &IsHeaderValid);
2715 ArrayRef<typename ELFT::Off> BloomFilter = GnuHashTable->filter();
2722 getGnuHashTableChains<ELFT>(DynSymRegion, GnuHashTable);
2733 template <typename ELFT> void ELFDumper<ELFT>::printHashHistograms() {
2736 if (Error E = checkHashTable<ELFT>(*this, this->HashTable))
2744 if (Error E = checkGNUHashTable<ELFT>(this->Obj, this->GnuHashTable))
2751 template <typename ELFT>
2752 void ELFDumper<ELFT>::printHashHistogram(const Elf_Hash &HashTable) const {
2797 template <class ELFT>
2798 void ELFDumper<ELFT>::printGnuHashHistogram(
2801 getGnuHashTableChains<ELFT>(this->DynSymRegion, &GnuHashTable);
2843 template <typename ELFT> void ELFDumper<ELFT>::printLoadName() {
2850 template <class ELFT> void ELFDumper<ELFT>::printArchSpecificInfo() {
2880 MipsGOTParser<ELFT> Parser(*this);
2897 template <class ELFT>
2898 void ELFDumper<ELFT>::printAttributes(
2932 template <class ELFT> class MipsGOTParser {
2934 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
2935 using Entry = typename ELFT::Addr;
2939 const ELFFile<ELFT> &Obj;
2940 const ELFDumper<ELFT> &Dumper;
2942 MipsGOTParser(const ELFDumper<ELFT> &D);
2990 template <class ELFT>
2991 MipsGOTParser<ELFT>::MipsGOTParser(const ELFDumper<ELFT> &D)
2997 template <class ELFT>
2998 Error MipsGOTParser<ELFT>::findGOT(Elf_Dyn_Range DynTable,
3069 template <class ELFT>
3070 Error MipsGOTParser<ELFT>::findPLT(Elf_Dyn_Range DynTable) {
3132 template <class ELFT> uint64_t MipsGOTParser<ELFT>::getGp() const {
3136 template <class ELFT>
3137 const typename MipsGOTParser<ELFT>::Entry *
3138 MipsGOTParser<ELFT>::getGotLazyResolver() const {
3142 template <class ELFT>
3143 const typename MipsGOTParser<ELFT>::Entry *
3144 MipsGOTParser<ELFT>::getGotModulePointer() const {
3153 template <class ELFT>
3154 typename MipsGOTParser<ELFT>::Entries
3155 MipsGOTParser<ELFT>::getLocalEntries() const {
3162 template <class ELFT>
3163 typename MipsGOTParser<ELFT>::Entries
3164 MipsGOTParser<ELFT>::getGlobalEntries() const {
3170 template <class ELFT>
3171 typename MipsGOTParser<ELFT>::Entries
3172 MipsGOTParser<ELFT>::getOtherEntries() const {
3179 template <class ELFT>
3180 uint64_t MipsGOTParser<ELFT>::getGotAddress(const Entry *E) const {
3185 template <class ELFT>
3186 int64_t MipsGOTParser<ELFT>::getGotOffset(const Entry *E) const {
3191 template <class ELFT>
3192 const typename MipsGOTParser<ELFT>::Elf_Sym *
3193 MipsGOTParser<ELFT>::getGotSym(const Entry *E) const {
3198 template <class ELFT>
3199 const typename MipsGOTParser<ELFT>::Entry *
3200 MipsGOTParser<ELFT>::getPltLazyResolver() const {
3204 template <class ELFT>
3205 const typename MipsGOTParser<ELFT>::Entry *
3206 MipsGOTParser<ELFT>::getPltModulePointer() const {
3210 template <class ELFT>
3211 typename MipsGOTParser<ELFT>::Entries
3212 MipsGOTParser<ELFT>::getPltEntries() const {
3218 template <class ELFT>
3219 uint64_t MipsGOTParser<ELFT>::getPltAddress(const Entry *E) const {
3224 template <class ELFT>
3225 const typename MipsGOTParser<ELFT>::Elf_Sym *
3226 MipsGOTParser<ELFT>::getPltSym(const Entry *E) const {
3312 template <class ELFT>
3314 const Elf_Mips_RegInfo<ELFT> &Reginfo) {
3323 template <class ELFT> void ELFDumper<ELFT>::printMipsReginfo() {
3339 if (ContentsOrErr->size() < sizeof(Elf_Mips_RegInfo<ELFT>)) {
3346 printMipsReginfoData(W, *reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>(
3350 template <class ELFT>
3351 static Expected<const Elf_Mips_Options<ELFT> *>
3354 if (SecData.size() < sizeof(Elf_Mips_Options<ELFT>))
3358 const Elf_Mips_Options<ELFT> *O =
3359 reinterpret_cast<const Elf_Mips_Options<ELFT> *>(SecData.data());
3373 sizeof(Elf_Mips_Options<ELFT>) + sizeof(Elf_Mips_RegInfo<ELFT>);
3387 template <class ELFT> void ELFDumper<ELFT>::printMipsOptions() {
3401 Expected<const Elf_Mips_Options<ELFT> *> OptsOrErr =
3402 readMipsOptions<ELFT>(SecBegin, Data, IsSupported);
3424 template <class ELFT> void ELFDumper<ELFT>::printStackMap() const {
3443 StackMapParser<ELFT::Endianness>::validateHeader(*ContentOrErr)) {
3448 prettyPrintStackMap(W, StackMapParser<ELFT::Endianness>(*ContentOrErr));
3451 template <class ELFT>
3452 void ELFDumper<ELFT>::printReloc(const Relocation<ELFT> &R, unsigned RelIndex,
3454 Expected<RelSymbol<ELFT>> Target = getRelocationTarget(R, SymTab);
3463 template <class ELFT>
3465 ELFDumper<ELFT>::getOtherFlagsFromSymbol(const Elf_Ehdr &Header,
3501 template <class ELFT>
3502 static std::string getSectionHeadersNumString(const ELFFile<ELFT> &Obj,
3504 const typename ELFT::Ehdr &ElfHeader = Obj.getHeader();
3508 Expected<ArrayRef<typename ELFT::Shdr>> ArrOrErr = Obj.sections();
3521 template <class ELFT>
3522 static std::string getSectionHeaderTableIndexString(const ELFFile<ELFT> &Obj,
3524 const typename ELFT::Ehdr &ElfHeader = Obj.getHeader();
3528 Expected<ArrayRef<typename ELFT::Shdr>> ArrOrErr = Obj.sections();
3551 template <class ELFT>
3552 void GNUELFDumper<ELFT>::printFileSummary(StringRef FileStr, ObjectFile &Obj,
3561 template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() {
3693 template <class ELFT> std::vector<GroupSection> ELFDumper<ELFT>::getGroups() {
3788 template <class ELFT> void GNUELFDumper<ELFT>::printGroupSections() {
3814 template <class ELFT>
3815 void GNUELFDumper<ELFT>::printRelRelaReloc(const Relocation<ELFT> &R,
3816 const RelSymbol<ELFT> &RelSym) {
3818 unsigned Bias = ELFT::Is64Bits ? 8 : 0;
3820 unsigned Width = ELFT::Is64Bits ? 16 : 8;
3856 template <class ELFT>
3858 const typename ELFT::Ehdr &EHeader,
3861 if (ELFT::Is64Bits)
3871 template <class ELFT>
3872 void GNUELFDumper<ELFT>::printDynamicRelocHeader(unsigned Type, StringRef Name,
3880 printRelocHeaderFields<ELFT>(OS, Type, this->Obj.getHeader());
3883 template <class ELFT>
3884 static bool isRelocationSec(const typename ELFT::Shdr &Sec,
3885 const typename ELFT::Ehdr &EHeader) {
3895 template <class ELFT> void GNUELFDumper<ELFT>::printRelocations() {
3907 Expected<std::vector<typename ELFT::Rela>> RelasOrErr =
3937 if (!isRelocationSec<ELFT>(Sec, this->Obj.getHeader()))
3965 printRelocHeaderFields<ELFT>(OS, Sec.sh_type, this->Obj.getHeader(),
3975 template <class ELFT> void GNUELFDumper<ELFT>::printRelr(const Elf_Shdr &Sec) {
3983 if (ELFT::Is64Bits)
4007 typename ELFT::uint Base = 0;
4010 OS << format_hex_no_prefix(Where, ELFT::Is64Bits ? 16 : 8);
4023 typename ELFT::uint Entry = R;
4025 << format_hex_no_prefix(Entry, ELFT::Is64Bits ? 16 : 8) << ' ';
4028 Base = Entry + sizeof(typename ELFT::uint);
4032 Where += sizeof(typename ELFT::uint)) {
4037 OS.indent(ELFT::Is64Bits ? 24 : 16);
4041 Base += (CHAR_BIT * sizeof(Entry) - 1) * sizeof(typename ELFT::uint);
4097 template <class ELFT> void GNUELFDumper<ELFT>::printSectionHeaders() {
4107 unsigned Bias = ELFT::Is64Bits ? 0 : 8;
4139 to_string(format_hex_no_prefix(Sec.sh_addr, ELFT::Is64Bits ? 16 : 8));
4167 template <class ELFT>
4168 void GNUELFDumper<ELFT>::printSymtabMessage(const Elf_Shdr *Symtab,
4181 if (ELFT::Is64Bits) {
4191 OS.PadToColumn((ELFT::Is64Bits ? 56 : 48) + (NonVisibilityBitsUsed ? 13 : 0));
4198 template <class ELFT>
4199 std::string GNUELFDumper<ELFT>::getSymbolSectionNdx(
4212 object::getExtendedSymbolTableIndex<ELFT>(Symbol, SymIndex, ShndxTable);
4257 template <class ELFT>
4258 void GNUELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
4263 unsigned Bias = ELFT::Is64Bits ? 8 : 0;
4268 to_string(format_hex_no_prefix(Symbol.st_value, ELFT::Is64Bits ? 16 : 8));
4320 template <class ELFT>
4321 void GNUELFDumper<ELFT>::printHashedSymbol(const Elf_Sym *Symbol,
4326 unsigned Bias = ELFT::Is64Bits ? 8 : 0;
4333 format_hex_no_prefix(Symbol->st_value, ELFT::Is64Bits ? 16 : 8));
4356 template <class ELFT>
4357 void GNUELFDumper<ELFT>::printSymbols(bool PrintSymbols,
4368 template <class ELFT>
4369 void GNUELFDumper<ELFT>::printHashTableSymbols(const Elf_Hash &SysVHash) {
4373 if (ELFT::Is64Bits)
4415 template <class ELFT>
4416 void GNUELFDumper<ELFT>::printGnuHashTableSymbols(const Elf_GnuHash &GnuHash) {
4444 getGnuHashTableChains<ELFT>(this->DynSymRegion, &GnuHash);
4485 template <class ELFT> void GNUELFDumper<ELFT>::printHashSymbols() {
4488 if (Error E = checkHashTable<ELFT>(*this, this->HashTable))
4497 if (ELFT::Is64Bits)
4503 if (Error E = checkGNUHashTable<ELFT>(this->Obj, this->GnuHashTable))
4510 template <class ELFT> void GNUELFDumper<ELFT>::printSectionDetails() {
4534 constexpr bool Is64 = ELFT::Is64Bits;
4637 OS << ", " << format_hex_no_prefix(Chdr->ch_size, ELFT::Is64Bits ? 16 : 8)
4652 template <class ELFT>
4653 static bool checkTLSSections(const typename ELFT::Phdr &Phdr,
4654 const typename ELFT::Shdr &Sec) {
4670 template <class ELFT>
4671 static bool checkPTDynamic(const typename ELFT::Phdr &Phdr,
4672 const typename ELFT::Shdr &Sec) {
4687 template <class ELFT>
4688 void GNUELFDumper<ELFT>::printProgramHeaders(
4708 template <class ELFT> void GNUELFDumper<ELFT>::printProgramHeaders() {
4709 unsigned Bias = ELFT::Is64Bits ? 8 : 0;
4719 if (ELFT::Is64Bits)
4726 unsigned Width = ELFT::Is64Bits ? 18 : 10;
4727 unsigned SizeWidth = ELFT::Is64Bits ? 8 : 7;
4777 template <class ELFT> void GNUELFDumper<ELFT>::printSectionMapping() {
4801 if (isSectionInSegment<ELFT>(Phdr, Sec) &&
4802 checkTLSSections<ELFT>(Phdr, Sec) &&
4803 checkPTDynamic<ELFT>(Phdr, Sec)) {
4830 template <class ELFT>
4831 RelSymbol<ELFT> getSymbolForReloc(const ELFDumper<ELFT> &Dumper,
4832 const Relocation<ELFT> &Reloc) {
4833 using Elf_Sym = typename ELFT::Sym;
4835 const Twine &Reason) -> RelSymbol<ELFT> {
4856 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile();
4874 template <class ELFT>
4875 static size_t getMaxDynamicTagSize(const ELFFile<ELFT> &Obj,
4876 typename ELFT::DynRange Tags) {
4878 for (const typename ELFT::Dyn &Dyn : Tags)
4883 template <class ELFT> void GNUELFDumper<ELFT>::printDynamicTable() {
4899 OS << " Tag" + std::string(ELFT::Is64Bits ? 16 : 8, ' ') + "Type"
4908 OS << " " << format_hex(Tag, ELFT::Is64Bits ? 18 : 10)
4913 template <class ELFT> void GNUELFDumper<ELFT>::printDynamicRelocations() {
4917 template <class ELFT>
4918 void ELFDumper<ELFT>::printDynamicReloc(const Relocation<ELFT> &R) {
4922 template <class ELFT>
4923 void ELFDumper<ELFT>::printRelocationsHelper(const Elf_Shdr &Sec) {
4925 Sec, [&](const Relocation<ELFT> &R, unsigned Ndx, const Elf_Shdr &Sec,
4929 template <class ELFT> void ELFDumper<ELFT>::printDynamicRelocationsHelper() {
4947 printDynamicReloc(Relocation<ELFT>(R, false));
4949 printDynamicReloc(Relocation<ELFT>(R, false));
4963 printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL));
4970 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
4978 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
4986 printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL));
4993 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
4998 template <class ELFT>
4999 void GNUELFDumper<ELFT>::printGNUVersionSectionProlog(
5000 const typename ELFT::Shdr &Sec, const Twine &Label, unsigned EntriesNum) {
5008 if (Expected<const typename ELFT::Shdr *> LinkedSecOrErr =
5021 template <class ELFT>
5022 void GNUELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) {
5106 template <class ELFT>
5107 void GNUELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) {
5133 template <class ELFT>
5134 void GNUELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) {
5159 template <class ELFT>
5160 void GNUELFDumper<ELFT>::printHashHistogramStats(size_t NBucket,
5177 template <class ELFT> void GNUELFDumper<ELFT>::printCGProfile() {
5181 template <class ELFT>
5182 void GNUELFDumper<ELFT>::printBBAddrMaps(bool /*PrettyPGOAnalysis*/) {
5201 template <class ELFT>
5203 decodeAddrsigSection(const ELFFile<ELFT> &Obj, const typename ELFT::Shdr &Sec) {
5216 template <class ELFT> void GNUELFDumper<ELFT>::printAddrsig() {
5243 template <class ELFT>
5254 support::endian::read64<ELFT::Endianness>(Desc.data() + 0);
5255 uint64_t Version = support::endian::read64<ELFT::Endianness>(Desc.data() + 8);
5310 template <typename ELFT>
5331 if (DataSize == sizeof(typename ELFT::uint))
5333 (uint64_t)(*(const typename ELFT::Addr *)Data.data()));
5351 PrData = endian::read32<ELFT::Endianness>(Data.data());
5368 printAArch64PAuthABICoreInfo<ELFT>(OS, DataSize, Data);
5378 PrData = endian::read32<ELFT::Endianness>(Data.data());
5404 PrData = endian::read32<ELFT::Endianness>(Data.data());
5419 template <typename ELFT>
5421 using Elf_Word = typename ELFT::Word;
5430 uint64_t PaddedSize = alignTo(DataSize, sizeof(typename ELFT::uint));
5439 getGNUProperty<ELFT>(Type, DataSize, Arr.take_front(PaddedSize)));
5455 template <typename ELFT> static GNUAbiTag getGNUAbiTag(ArrayRef<uint8_t> Desc) {
5456 typedef typename ELFT::Word Elf_Word;
5489 template <typename ELFT>
5497 const GNUAbiTag &AbiTag = getGNUAbiTag<ELFT>(Desc);
5513 for (const std::string &Property : getGNUPropertyList<ELFT>(Desc))
5571 template <class ELFT>
5572 void GNUELFDumper<ELFT>::printMemtag(
5598 template <typename ELFT>
5632 template <typename ELFT>
5642 utostr(endian::read32<ELFT::Endianness>(Desc.data()))};
5648 unsigned Value = endian::read32<ELFT::Endianness>(Desc.data());
5668 template <typename ELFT>
5772 template <typename ELFT>
5869 template <typename ELFT>
5872 const int FieldWidth = ELFT::Is64Bits ? 18 : 10;
6041 template <class ELFT>
6042 StringRef getNoteTypeName(const typename ELFT::Note &Note, unsigned ELFType) {
6092 template <class ELFT>
6094 const ELFDumper<ELFT> &Dumper,
6095 llvm::function_ref<void(std::optional<StringRef>, typename ELFT::Off,
6096 typename ELFT::Addr, size_t)>
6098 llvm::function_ref<Error(const typename ELFT::Note &, bool)> ProcessNoteFn,
6100 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile();
6103 ArrayRef<typename ELFT::Shdr> Sections = cantFail(Obj.sections());
6105 for (const typename ELFT::Shdr &S : Sections) {
6112 for (const typename ELFT::Note Note : Obj.notes(S, Err)) {
6128 Expected<ArrayRef<typename ELFT::Phdr>> PhdrsOrErr = Obj.program_headers();
6137 const typename ELFT::Phdr &P = (*PhdrsOrErr)[I];
6143 for (const typename ELFT::Note Note : Obj.notes(P, Err)) {
6159 template <class ELFT> void GNUELFDumper<ELFT>::printNotes() {
6163 const typename ELFT::Off Offset,
6164 const typename ELFT::Addr Size, size_t Al) {
6194 getNoteTypeName<ELFT>(Note, this->Obj.getHeader().e_type);
6203 if (printGNUNote<ELFT>(OS, Type, Descriptor))
6207 getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) {
6212 const AMDNote N = getAMDNote<ELFT>(Type, Descriptor);
6218 const AMDGPUNote N = getAMDGPUNote<ELFT>(Type, Descriptor);
6224 if (printLLVMOMPOFFLOADNote<ELFT>(OS, Type, Descriptor))
6229 Descriptor, ELFT::Endianness == llvm::endianness::little,
6232 printCoreNote<ELFT>(OS, *NoteOrErr);
6255 template <class ELFT>
6257 ELFDumper<ELFT>::getMemtagGlobalsSectionContents(uint64_t ExpectedAddr) {
6258 for (const typename ELFT::Shdr &Sec : cantFail(Obj.sections())) {
6287 template <typename ELFT> void ELFDumper<ELFT>::printMemtag() {
6292 for (const typename ELFT::Dyn &Entry : dynamic_table()) {
6325 [](std::optional<StringRef>, const typename ELFT::Off,
6326 const typename ELFT::Addr, size_t) {},
6379 template <class ELFT> void GNUELFDumper<ELFT>::printELFLinkerOptions() {
6383 template <class ELFT>
6384 void ELFDumper<ELFT>::printDependentLibsHelper(
6420 template <class ELFT>
6421 void ELFDumper<ELFT>::forEachRelocationDo(
6423 llvm::function_ref<void(const Relocation<ELFT> &, unsigned,
6453 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab);
6461 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab);
6479 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec,
6486 RelRelaFn(Relocation<ELFT>(R, false), RelNdx++, Sec, SymTab);
6488 RelRelaFn(Relocation<ELFT>(R, false), RelNdx++, Sec, SymTab);
6498 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab);
6506 template <class ELFT>
6507 StringRef ELFDumper<ELFT>::getPrintableSectionName(const Elf_Shdr &Sec) const {
6518 template <class ELFT> void GNUELFDumper<ELFT>::printDependentLibs() {
6553 template <class ELFT>
6554 SmallVector<uint32_t> ELFDumper<ELFT>::getSymbolIndexesForFunctionAddress(
6619 template <class ELFT>
6620 bool ELFDumper<ELFT>::printFunctionStackSize(
6653 template <class ELFT>
6654 void GNUELFDumper<ELFT>::printStackSizeEntry(uint64_t Size,
6663 template <class ELFT>
6664 void ELFDumper<ELFT>::printStackSize(const Relocation<ELFT> &R,
6674 Expected<RelSymbol<ELFT>> TargetOrErr = this->getRelocationTarget(R, SymTab);
6716 template <class ELFT>
6717 void ELFDumper<ELFT>::printNonRelocatableStackSizes(
6746 template <class ELFT>
6747 void ELFDumper<ELFT>::printRelocatableStackSizes(
6797 *RelocSec, [&](const Relocation<ELFT> &R, unsigned Ndx,
6813 template <class ELFT>
6814 void GNUELFDumper<ELFT>::printStackSizes() {
6835 template <class ELFT>
6836 void GNUELFDumper<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) {
6837 size_t Bias = ELFT::Is64Bits ? 8 : 0;
6854 if (ELFT::Is64Bits)
6865 if (ELFT::Is64Bits)
6879 if (ELFT::Is64Bits)
6916 template <class ELFT>
6917 void GNUELFDumper<ELFT>::printMipsPLT(const MipsGOTParser<ELFT> &Parser) {
6918 size_t Bias = ELFT::Is64Bits ? 8 : 0;
6966 template <class ELFT>
6967 Expected<const Elf_Mips_ABIFlags<ELFT> *>
6968 getMipsAbiFlagsSection(const ELFDumper<ELFT> &Dumper) {
6969 const typename ELFT::Shdr *Sec = Dumper.findSectionByName(".MIPS.abiflags");
6979 if (DataOrErr->size() != sizeof(Elf_Mips_ABIFlags<ELFT>))
6982 return reinterpret_cast<const Elf_Mips_ABIFlags<ELFT> *>(DataOrErr->data());
6985 template <class ELFT> void GNUELFDumper<ELFT>::printMipsABIFlags() {
6986 const Elf_Mips_ABIFlags<ELFT> *Flags = nullptr;
6987 if (Expected<const Elf_Mips_ABIFlags<ELFT> *> SecOrErr =
7018 template <class ELFT> void LLVMELFDumper<ELFT>::printFileHeaders() {
7143 template <class ELFT> void LLVMELFDumper<ELFT>::printGroupSections() {
7174 template <class ELFT>
7175 std::string LLVMELFDumper<ELFT>::getGroupSectionHeaderName() const {
7179 template <class ELFT>
7180 void LLVMELFDumper<ELFT>::printSectionGroupMembers(StringRef Name,
7185 template <class ELFT> void LLVMELFDumper<ELFT>::printRelocations() {
7189 if (!isRelocationSec<ELFT>(Sec, this->Obj.getHeader()))
7198 template <class ELFT>
7199 void LLVMELFDumper<ELFT>::printExpandedRelRelaReloc(const Relocation<ELFT> &R,
7210 template <class ELFT>
7211 void LLVMELFDumper<ELFT>::printDefaultRelRelaReloc(const Relocation<ELFT> &R,
7222 template <class ELFT>
7223 void LLVMELFDumper<ELFT>::printRelocationSectionInfo(const Elf_Shdr &Sec,
7230 template <class ELFT> void LLVMELFDumper<ELFT>::printEmptyGroupMessage() const {
7234 template <class ELFT>
7235 void LLVMELFDumper<ELFT>::printRelRelaReloc(const Relocation<ELFT> &R,
7236 const RelSymbol<ELFT> &RelSym) {
7250 template <class ELFT> void LLVMELFDumper<ELFT>::printSectionHeaders() {
7287 typename ELFT::SymRange Symbols = unwrapOrError(
7311 template <class ELFT>
7312 void LLVMELFDumper<ELFT>::printSymbolSection(
7362 template <class ELFT>
7363 void LLVMELFDumper<ELFT>::printSymbolOtherField(const Elf_Sym &Symbol) const {
7369 template <class ELFT>
7370 void LLVMELFDumper<ELFT>::printZeroSymbolOtherField(
7378 template <class ELFT>
7379 void LLVMELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
7406 template <class ELFT>
7407 void LLVMELFDumper<ELFT>::printSymbols(bool PrintSymbols,
7420 template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicTable() {
7431 W.startLine() << " Tag" << std::string(ELFT::Is64Bits ? 16 : 8, ' ')
7438 W.startLine() << " " << format_hex(Tag, ELFT::Is64Bits ? 18 : 10, true)
7447 template <class ELFT>
7448 void JSONELFDumper<ELFT>::printAuxillaryDynamicTableEntryInfo(
7491 template <class ELFT> void JSONELFDumper<ELFT>::printDynamicTable() {
7504 template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicRelocations() {
7512 template <class ELFT>
7513 void LLVMELFDumper<ELFT>::printProgramHeaders(
7521 template <class ELFT> void LLVMELFDumper<ELFT>::printProgramHeaders() {
7547 template <class ELFT>
7548 void LLVMELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) {
7581 template <class ELFT>
7582 void LLVMELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) {
7606 template <class ELFT>
7607 void LLVMELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) {
7636 template <class ELFT>
7637 void LLVMELFDumper<ELFT>::printHashHistogramStats(size_t NBucket,
7661 template <class ELFT>
7662 static bool getSymbolIndices(const typename ELFT::Shdr *CGRelSection,
7663 const ELFFile<ELFT> &Obj,
7664 const LLVMELFDumper<ELFT> *Dumper,
7673 typename ELFT::RelRange CGProfileRel;
7674 Expected<typename ELFT::RelRange> CGProfileRelOrError =
7684 for (const typename ELFT::Rel &Rel : CGProfileRel)
7690 typename ELFT::RelaRange CGProfileRela;
7691 Expected<typename ELFT::RelaRange> CGProfileRelaOrError =
7701 for (const typename ELFT::Rela &Rela : CGProfileRela)
7708 template <class ELFT> void LLVMELFDumper<ELFT>::printCGProfile() {
7736 getSymbolIndices<ELFT>(CGRelSection, this->Obj, this, SymbolIndices);
7758 template <class ELFT>
7759 void LLVMELFDumper<ELFT>::printBBAddrMaps(bool PrettyPGOAnalysis) {
7761 using Elf_Shdr = typename ELFT::Shdr;
7869 template <class ELFT> void LLVMELFDumper<ELFT>::printAddrsig() {
7885 template <typename ELFT>
7893 const GNUAbiTag &AbiTag = getGNUAbiTag<ELFT>(Desc);
7912 for (const std::string &Property : getGNUPropertyList<ELFT>(Desc))
7930 template <class ELFT>
7931 void LLVMELFDumper<ELFT>::printMemtag(
7959 template <typename ELFT>
7991 template <class ELFT> void LLVMELFDumper<ELFT>::printNotes() {
7998 const typename ELFT::Off Offset,
7999 const typename ELFT::Addr Size, size_t Al) {
8024 getNoteTypeName<ELFT>(Note, this->Obj.getHeader().e_type);
8034 if (printGNUNoteLLVMStyle<ELFT>(Type, Descriptor, W))
8038 getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) {
8043 const AMDNote N = getAMDNote<ELFT>(Type, Descriptor);
8049 const AMDGPUNote N = getAMDGPUNote<ELFT>(Type, Descriptor);
8055 if (printLLVMOMPOFFLOADNoteLLVMStyle<ELFT>(Type, Descriptor, W))
8060 Descriptor, ELFT::Endianness == llvm::endianness::little,
8083 template <class ELFT> void LLVMELFDumper<ELFT>::printELFLinkerOptions() {
8127 template <class ELFT> void LLVMELFDumper<ELFT>::printDependentLibs() {
8134 template <class ELFT> void LLVMELFDumper<ELFT>::printStackSizes() {
8142 template <class ELFT>
8143 void LLVMELFDumper<ELFT>::printStackSizeEntry(uint64_t Size,
8150 template <class ELFT>
8151 void LLVMELFDumper<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) {
8212 template <class ELFT>
8213 void LLVMELFDumper<ELFT>::printMipsPLT(const MipsGOTParser<ELFT> &Parser) {
8258 template <class ELFT> void LLVMELFDumper<ELFT>::printMipsABIFlags() {
8259 const Elf_Mips_ABIFlags<ELFT> *Flags;
8260 if (Expected<const Elf_Mips_ABIFlags<ELFT> *> SecOrErr =
8292 template <class ELFT>
8293 void JSONELFDumper<ELFT>::printFileSummary(StringRef FileStr, ObjectFile &Obj,
8307 template <class ELFT>
8308 void JSONELFDumper<ELFT>::printZeroSymbolOtherField(
8315 template <class ELFT>
8316 void JSONELFDumper<ELFT>::printDefaultRelRelaReloc(const Relocation<ELFT> &R,
8322 template <class ELFT>
8323 void JSONELFDumper<ELFT>::printRelocationSectionInfo(const Elf_Shdr &Sec,
8332 template <class ELFT>
8333 std::string JSONELFDumper<ELFT>::getGroupSectionHeaderName() const {
8337 template <class ELFT>
8338 void JSONELFDumper<ELFT>::printSectionGroupMembers(StringRef Name,
8345 template <class ELFT> void JSONELFDumper<ELFT>::printEmptyGroupMessage() const {