Lines Matching refs:ELFT
90 template <class ELFT> struct RelSymbol {
91 RelSymbol(const typename ELFT::Sym *S, StringRef N) in RelSymbol()
93 const typename ELFT::Sym *Sym;
189 template <class ELFT> class Relocation {
191 Relocation(const typename ELFT::Rel &R, bool IsMips64EL) in Relocation()
195 Relocation(const typename ELFT::Rela &R, bool IsMips64EL) in Relocation()
196 : Relocation((const typename ELFT::Rel &)R, IsMips64EL) { in Relocation()
202 typename ELFT::uint Offset;
203 typename ELFT::uint Info;
207 template <class ELFT> class MipsGOTParser;
209 template <typename ELFT> class ELFDumper : public ObjDumper {
210 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
213 ELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer);
224 const object::ELFObjectFile<ELFT> &getElfObject() const { return ObjF; }; in getElfObject()
271 virtual void printRelRelaReloc(const Relocation<ELFT> &R,
272 const RelSymbol<ELFT> &RelSym) = 0;
276 void printReloc(const Relocation<ELFT> &R, unsigned RelIndex,
278 void printDynamicReloc(const Relocation<ELFT> &R);
283 llvm::function_ref<void(const Relocation<ELFT> &, unsigned,
296 virtual void printMipsGOT(const MipsGOTParser<ELFT> &Parser) = 0;
297 virtual void printMipsPLT(const MipsGOTParser<ELFT> &Parser) = 0;
317 void printStackSize(const Relocation<ELFT> &R, const Elf_Shdr &RelocSec,
333 const object::ELFObjectFile<ELFT> &ObjF;
334 const ELFFile<ELFT> &Obj;
396 Expected<RelSymbol<ELFT>> getRelocationTarget(const Relocation<ELFT> &R,
405 template <class ELFT>
406 std::string ELFDumper<ELFT>::describe(const Elf_Shdr &Sec) const { in describe()
412 template <class ELFT> struct SymtabLink {
413 typename ELFT::SymRange Symbols;
415 const typename ELFT::Shdr *SymTab;
420 template <class ELFT>
421 Expected<SymtabLink<ELFT>> getLinkAsSymtab(const ELFFile<ELFT> &Obj, in getLinkAsSymtab()
422 const typename ELFT::Shdr &Sec, in getLinkAsSymtab()
424 Expected<const typename ELFT::Shdr *> SymtabOrErr = in getLinkAsSymtab()
444 Expected<typename ELFT::SymRange> SymsOrErr = Obj.symbols(*SymtabOrErr); in getLinkAsSymtab()
449 return SymtabLink<ELFT>{*SymsOrErr, *StrTabOrErr, *SymtabOrErr}; in getLinkAsSymtab()
454 template <class ELFT>
455 Expected<ArrayRef<typename ELFT::Versym>>
456 ELFDumper<ELFT>::getVersionTable(const Elf_Shdr &Sec, ArrayRef<Elf_Sym> *SymTab, in getVersionTable()
471 Expected<SymtabLink<ELFT>> SymTabOrErr = in getVersionTable()
494 template <class ELFT>
495 void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const { in printSymbolsHelper()
542 template <typename ELFT> class GNUELFDumper : public ELFDumper<ELFT> {
546 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
548 GNUELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer) in GNUELFDumper()
549 : ELFDumper<ELFT>(ObjF, Writer), in GNUELFDumper()
634 void printRelRelaReloc(const Relocation<ELFT> &R,
635 const RelSymbol<ELFT> &RelSym) override;
647 void printGNUVersionSectionProlog(const typename ELFT::Shdr &Sec,
653 void printMipsGOT(const MipsGOTParser<ELFT> &Parser) override;
654 void printMipsPLT(const MipsGOTParser<ELFT> &Parser) override;
658 template <typename ELFT> class LLVMELFDumper : public ELFDumper<ELFT> {
660 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
662 LLVMELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer) in LLVMELFDumper()
663 : ELFDumper<ELFT>(ObjF, Writer), W(Writer) {} in LLVMELFDumper()
688 void printRelRelaReloc(const Relocation<ELFT> &R,
689 const RelSymbol<ELFT> &RelSym) override;
702 void printMipsGOT(const MipsGOTParser<ELFT> &Parser) override;
703 void printMipsPLT(const MipsGOTParser<ELFT> &Parser) override;
712 template <typename ELFT> class JSONELFDumper : public LLVMELFDumper<ELFT> {
714 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
716 JSONELFDumper(const object::ELFObjectFile<ELFT> &ObjF, ScopedPrinter &Writer) in JSONELFDumper()
717 : LLVMELFDumper<ELFT>(ObjF, Writer) {} in JSONELFDumper()
731 template <class ELFT>
733 createELFDumper(const ELFObjectFile<ELFT> &Obj, ScopedPrinter &Writer) { in createELFDumper()
735 return std::make_unique<GNUELFDumper<ELFT>>(Obj, Writer); in createELFDumper()
737 return std::make_unique<JSONELFDumper<ELFT>>(Obj, Writer); in createELFDumper()
738 return std::make_unique<LLVMELFDumper<ELFT>>(Obj, Writer); in createELFDumper()
761 template <class ELFT>
763 ELFDumper<ELFT>::getVersionMap() const { in getVersionMap()
779 template <typename ELFT>
780 Expected<StringRef> ELFDumper<ELFT>::getSymbolVersion(const Elf_Sym &Sym, in getSymbolVersion()
816 template <typename ELFT>
817 Expected<RelSymbol<ELFT>>
818 ELFDumper<ELFT>::getRelocationTarget(const Relocation<ELFT> &R, in getRelocationTarget()
821 return RelSymbol<ELFT>(nullptr, ""); in getRelocationTarget()
831 return RelSymbol<ELFT>(nullptr, ""); in getRelocationTarget()
842 return RelSymbol<ELFT>(Sym, SymbolName); in getRelocationTarget()
845 template <typename ELFT>
846 ArrayRef<typename ELFT::Word>
847 ELFDumper<ELFT>::getShndxTable(const Elf_Shdr *Symtab) const { in getShndxTable()
860 template <typename ELFT>
861 std::string ELFDumper<ELFT>::getStaticSymbolName(uint32_t Index) const { in getStaticSymbolName()
868 Expected<const typename ELFT::Sym *> SymOrErr = in getStaticSymbolName()
883 template <typename ELFT>
884 std::string ELFDumper<ELFT>::getFullSymbolName(const Elf_Sym &Symbol, in getFullSymbolName()
932 template <typename ELFT>
934 ELFDumper<ELFT>::getSymbolSectionIndex(const Elf_Sym &Symbol, unsigned SymIndex, in getSymbolSectionIndex()
938 return object::getExtendedSymbolTableIndex<ELFT>(Symbol, SymIndex, in getSymbolSectionIndex()
967 template <typename ELFT>
969 ELFDumper<ELFT>::getSymbolSectionName(const Elf_Sym &Symbol, in getSymbolSectionName()
1706 template <typename ELFT>
1707 std::pair<const typename ELFT::Phdr *, const typename ELFT::Shdr *>
1708 ELFDumper<ELFT>::findDynamic() { in findDynamic()
1763 template <typename ELFT>
1764 void ELFDumper<ELFT>::loadDynamicTable() { in loadDynamicTable()
1846 template <typename ELFT>
1847 ELFDumper<ELFT>::ELFDumper(const object::ELFObjectFile<ELFT> &O, in ELFDumper()
1857 typename ELFT::ShdrRange Sections = cantFail(Obj.sections()); in ELFDumper()
1932 template <typename ELFT> void ELFDumper<ELFT>::parseDynamicTable() { in parseDynamicTable()
2125 template <typename ELFT> void ELFDumper<ELFT>::printVersionInfo() { in printVersionInfo()
2209 template <class ELFT>
2210 const typename ELFT::Shdr *
2211 ELFDumper<ELFT>::findSectionByName(StringRef Name) const { in findSectionByName()
2224 template <class ELFT>
2225 std::string ELFDumper<ELFT>::getDynamicEntry(uint64_t Type, in getDynamicEntry()
2398 template <class ELFT>
2399 StringRef ELFDumper<ELFT>::getDynamicString(uint64_t Value) const { in getDynamicString()
2437 template <class ELFT> void ELFDumper<ELFT>::printUnwindInfo() { in printUnwindInfo()
2438 DwarfCFIEH::PrinterContext<ELFT> Ctx(W, ObjF); in printUnwindInfo()
2455 template <class ELFT> void ELFDumper<ELFT>::printNeededLibraries() { in printNeededLibraries()
2469 template <class ELFT>
2470 static Error checkHashTable(const ELFDumper<ELFT> &Dumper, in checkHashTable()
2471 const typename ELFT::Hash *H, in checkHashTable()
2473 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile(); in checkHashTable()
2495 const unsigned HeaderSize = 2 * sizeof(typename ELFT::Word); in checkHashTable()
2504 ((uint64_t)H->nbucket + H->nchain) * sizeof(typename ELFT::Word)) in checkHashTable()
2510 template <class ELFT>
2511 static Error checkGNUHashTable(const ELFFile<ELFT> &Obj, in checkGNUHashTable()
2512 const typename ELFT::GnuHash *GnuHashTable, in checkGNUHashTable()
2522 (uint64_t)GnuHashTable->maskwords * sizeof(typename ELFT::Off) >= in checkGNUHashTable()
2531 template <typename ELFT> void ELFDumper<ELFT>::printHashTable() { in printHashTable()
2552 template <class ELFT>
2553 static Expected<ArrayRef<typename ELFT::Word>>
2555 const typename ELFT::GnuHash *GnuHashTable) { in getGnuHashTableChains()
2559 ArrayRef<typename ELFT::Sym> DynSymTable = in getGnuHashTableChains()
2560 DynSymRegion->template getAsArrayRef<typename ELFT::Sym>(); in getGnuHashTableChains()
2575 ArrayRef<typename ELFT::Word> Buckets = GnuHashTable->buckets(); in getGnuHashTableChains()
2576 if (!llvm::all_of(Buckets, [](typename ELFT::Word V) { return V == 0; })) in getGnuHashTableChains()
2583 return ArrayRef<typename ELFT::Word>(); in getGnuHashTableChains()
2586 template <typename ELFT>
2587 void ELFDumper<ELFT>::printGnuHashTable() { in printGnuHashTable()
2593 Error Err = checkGNUHashTable<ELFT>(Obj, GnuHashTable, &IsHeaderValid); in printGnuHashTable()
2606 ArrayRef<typename ELFT::Off> BloomFilter = GnuHashTable->filter(); in printGnuHashTable()
2613 getGnuHashTableChains<ELFT>(DynSymRegion, GnuHashTable); in printGnuHashTable()
2624 template <typename ELFT> void ELFDumper<ELFT>::printLoadName() { in printLoadName()
2631 template <class ELFT> void ELFDumper<ELFT>::printArchSpecificInfo() { in printArchSpecificInfo()
2660 MipsGOTParser<ELFT> Parser(*this); in printArchSpecificInfo()
2677 template <class ELFT>
2678 void ELFDumper<ELFT>::printAttributes( in printAttributes()
2712 template <class ELFT> class MipsGOTParser {
2714 LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
2715 using Entry = typename ELFT::Addr;
2719 const ELFFile<ELFT> &Obj;
2720 const ELFDumper<ELFT> &Dumper;
2722 MipsGOTParser(const ELFDumper<ELFT> &D);
2770 template <class ELFT>
2771 MipsGOTParser<ELFT>::MipsGOTParser(const ELFDumper<ELFT> &D) in MipsGOTParser()
2777 template <class ELFT>
2778 Error MipsGOTParser<ELFT>::findGOT(Elf_Dyn_Range DynTable, in findGOT()
2849 template <class ELFT>
2850 Error MipsGOTParser<ELFT>::findPLT(Elf_Dyn_Range DynTable) { in findPLT()
2912 template <class ELFT> uint64_t MipsGOTParser<ELFT>::getGp() const { in getGp()
2916 template <class ELFT>
2917 const typename MipsGOTParser<ELFT>::Entry *
2918 MipsGOTParser<ELFT>::getGotLazyResolver() const { in getGotLazyResolver()
2922 template <class ELFT>
2923 const typename MipsGOTParser<ELFT>::Entry *
2924 MipsGOTParser<ELFT>::getGotModulePointer() const { in getGotModulePointer()
2933 template <class ELFT>
2934 typename MipsGOTParser<ELFT>::Entries
2935 MipsGOTParser<ELFT>::getLocalEntries() const { in getLocalEntries()
2942 template <class ELFT>
2943 typename MipsGOTParser<ELFT>::Entries
2944 MipsGOTParser<ELFT>::getGlobalEntries() const { in getGlobalEntries()
2950 template <class ELFT>
2951 typename MipsGOTParser<ELFT>::Entries
2952 MipsGOTParser<ELFT>::getOtherEntries() const { in getOtherEntries()
2959 template <class ELFT>
2960 uint64_t MipsGOTParser<ELFT>::getGotAddress(const Entry *E) const { in getGotAddress()
2965 template <class ELFT>
2966 int64_t MipsGOTParser<ELFT>::getGotOffset(const Entry *E) const { in getGotOffset()
2971 template <class ELFT>
2972 const typename MipsGOTParser<ELFT>::Elf_Sym *
2973 MipsGOTParser<ELFT>::getGotSym(const Entry *E) const { in getGotSym()
2978 template <class ELFT>
2979 const typename MipsGOTParser<ELFT>::Entry *
2980 MipsGOTParser<ELFT>::getPltLazyResolver() const { in getPltLazyResolver()
2984 template <class ELFT>
2985 const typename MipsGOTParser<ELFT>::Entry *
2986 MipsGOTParser<ELFT>::getPltModulePointer() const { in getPltModulePointer()
2990 template <class ELFT>
2991 typename MipsGOTParser<ELFT>::Entries
2992 MipsGOTParser<ELFT>::getPltEntries() const { in getPltEntries()
2998 template <class ELFT>
2999 uint64_t MipsGOTParser<ELFT>::getPltAddress(const Entry *E) const { in getPltAddress()
3004 template <class ELFT>
3005 const typename MipsGOTParser<ELFT>::Elf_Sym *
3006 MipsGOTParser<ELFT>::getPltSym(const Entry *E) const { in getPltSym()
3092 template <class ELFT>
3094 const Elf_Mips_RegInfo<ELFT> &Reginfo) { in printMipsReginfoData()
3103 template <class ELFT> void ELFDumper<ELFT>::printMipsReginfo() { in printMipsReginfo()
3119 if (ContentsOrErr->size() < sizeof(Elf_Mips_RegInfo<ELFT>)) { in printMipsReginfo()
3126 printMipsReginfoData(W, *reinterpret_cast<const Elf_Mips_RegInfo<ELFT> *>( in printMipsReginfo()
3130 template <class ELFT>
3131 static Expected<const Elf_Mips_Options<ELFT> *>
3134 if (SecData.size() < sizeof(Elf_Mips_Options<ELFT>)) in readMipsOptions()
3138 const Elf_Mips_Options<ELFT> *O = in readMipsOptions()
3139 reinterpret_cast<const Elf_Mips_Options<ELFT> *>(SecData.data()); in readMipsOptions()
3153 sizeof(Elf_Mips_Options<ELFT>) + sizeof(Elf_Mips_RegInfo<ELFT>); in readMipsOptions()
3167 template <class ELFT> void ELFDumper<ELFT>::printMipsOptions() { in printMipsOptions()
3181 Expected<const Elf_Mips_Options<ELFT> *> OptsOrErr = in printMipsOptions()
3182 readMipsOptions<ELFT>(SecBegin, Data, IsSupported); in printMipsOptions()
3204 template <class ELFT> void ELFDumper<ELFT>::printStackMap() const { in printStackMap()
3222 if (Error E = StackMapParser<ELFT::TargetEndianness>::validateHeader( in printStackMap()
3228 prettyPrintStackMap(W, StackMapParser<ELFT::TargetEndianness>(*ContentOrErr)); in printStackMap()
3231 template <class ELFT>
3232 void ELFDumper<ELFT>::printReloc(const Relocation<ELFT> &R, unsigned RelIndex, in printReloc()
3234 Expected<RelSymbol<ELFT>> Target = getRelocationTarget(R, SymTab); in printReloc()
3252 template <class ELFT>
3253 static std::string getSectionHeadersNumString(const ELFFile<ELFT> &Obj, in getSectionHeadersNumString()
3255 const typename ELFT::Ehdr &ElfHeader = Obj.getHeader(); in getSectionHeadersNumString()
3259 Expected<ArrayRef<typename ELFT::Shdr>> ArrOrErr = Obj.sections(); in getSectionHeadersNumString()
3272 template <class ELFT>
3273 static std::string getSectionHeaderTableIndexString(const ELFFile<ELFT> &Obj, in getSectionHeaderTableIndexString()
3275 const typename ELFT::Ehdr &ElfHeader = Obj.getHeader(); in getSectionHeaderTableIndexString()
3279 Expected<ArrayRef<typename ELFT::Shdr>> ArrOrErr = Obj.sections(); in getSectionHeaderTableIndexString()
3302 template <class ELFT>
3303 void GNUELFDumper<ELFT>::printFileSummary(StringRef FileStr, ObjectFile &Obj, in printFileSummary()
3312 template <class ELFT> void GNUELFDumper<ELFT>::printFileHeaders() { in printFileHeaders()
3390 template <class ELFT> std::vector<GroupSection> ELFDumper<ELFT>::getGroups() { in getGroups()
3485 template <class ELFT> void GNUELFDumper<ELFT>::printGroupSections() { in printGroupSections()
3511 template <class ELFT>
3512 void GNUELFDumper<ELFT>::printRelrReloc(const Elf_Relr &R) { in printRelrReloc()
3513 OS << to_string(format_hex_no_prefix(R, ELFT::Is64Bits ? 16 : 8)) << "\n"; in printRelrReloc()
3516 template <class ELFT>
3517 void GNUELFDumper<ELFT>::printRelRelaReloc(const Relocation<ELFT> &R, in printRelRelaReloc()
3518 const RelSymbol<ELFT> &RelSym) { in printRelRelaReloc()
3520 unsigned Bias = ELFT::Is64Bits ? 8 : 0; in printRelRelaReloc()
3522 unsigned Width = ELFT::Is64Bits ? 16 : 8; in printRelRelaReloc()
3555 template <class ELFT>
3559 if (ELFT::Is64Bits) in printRelocHeaderFields()
3567 if (ELFT::Is64Bits) in printRelocHeaderFields()
3577 template <class ELFT>
3578 void GNUELFDumper<ELFT>::printDynamicRelocHeader(unsigned Type, StringRef Name, in printDynamicRelocHeader()
3583 printRelocHeaderFields<ELFT>(OS, Type); in printDynamicRelocHeader()
3586 template <class ELFT>
3587 static bool isRelocationSec(const typename ELFT::Shdr &Sec) { in isRelocationSec()
3594 template <class ELFT> void GNUELFDumper<ELFT>::printRelocations() { in printRelocations()
3600 Expected<std::vector<typename ELFT::Rela>> RelasOrErr = in printRelocations()
3620 if (!isRelocationSec<ELFT>(Sec)) in printRelocations()
3637 printRelocHeaderFields<ELFT>(OS, Sec.sh_type); in printRelocations()
3695 template <class ELFT> void GNUELFDumper<ELFT>::printSectionHeaders() { in printSectionHeaders()
3696 unsigned Bias = ELFT::Is64Bits ? 0 : 8; in printSectionHeaders()
3729 to_string(format_hex_no_prefix(Sec.sh_addr, ELFT::Is64Bits ? 16 : 8)); in printSectionHeaders()
3757 template <class ELFT>
3758 void GNUELFDumper<ELFT>::printSymtabMessage(const Elf_Shdr *Symtab, in printSymtabMessage()
3770 if (ELFT::Is64Bits) in printSymtabMessage()
3780 template <class ELFT>
3782 GNUELFDumper<ELFT>::getSymbolSectionNdx(const Elf_Sym &Symbol, in getSymbolSectionNdx()
3795 object::getExtendedSymbolTableIndex<ELFT>(Symbol, SymIndex, ShndxTable); in getSymbolSectionNdx()
3825 template <class ELFT>
3826 void GNUELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex, in printSymbol()
3831 unsigned Bias = ELFT::Is64Bits ? 8 : 0; in printSymbol()
3836 to_string(format_hex_no_prefix(Symbol.st_value, ELFT::Is64Bits ? 16 : 8)); in printSymbol()
3886 template <class ELFT>
3887 void GNUELFDumper<ELFT>::printHashedSymbol(const Elf_Sym *Symbol, in printHashedSymbol()
3892 unsigned Bias = ELFT::Is64Bits ? 8 : 0; in printHashedSymbol()
3899 format_hex_no_prefix(Symbol->st_value, ELFT::Is64Bits ? 16 : 8)); in printHashedSymbol()
3922 template <class ELFT>
3923 void GNUELFDumper<ELFT>::printSymbols(bool PrintSymbols, in printSymbols()
3933 template <class ELFT>
3934 void GNUELFDumper<ELFT>::printHashTableSymbols(const Elf_Hash &SysVHash) { in printHashTableSymbols()
3938 if (ELFT::Is64Bits) in printHashTableSymbols()
3980 template <class ELFT>
3981 void GNUELFDumper<ELFT>::printGnuHashTableSymbols(const Elf_GnuHash &GnuHash) { in printGnuHashTableSymbols()
4009 getGnuHashTableChains<ELFT>(this->DynSymRegion, &GnuHash); in printGnuHashTableSymbols()
4050 template <class ELFT> void GNUELFDumper<ELFT>::printHashSymbols() { in printHashSymbols()
4053 if (Error E = checkHashTable<ELFT>(*this, this->HashTable)) in printHashSymbols()
4062 if (ELFT::Is64Bits) in printHashSymbols()
4068 if (Error E = checkGNUHashTable<ELFT>(this->Obj, this->GnuHashTable)) in printHashSymbols()
4075 template <class ELFT> void GNUELFDumper<ELFT>::printSectionDetails() { in printSectionDetails()
4091 constexpr bool Is64 = ELFT::Is64Bits; in printSectionDetails()
4185 template <class ELFT>
4186 static bool checkTLSSections(const typename ELFT::Phdr &Phdr, in checkTLSSections()
4187 const typename ELFT::Shdr &Sec) { in checkTLSSections()
4203 template <class ELFT>
4204 static bool checkOffsets(const typename ELFT::Phdr &Phdr, in checkOffsets()
4205 const typename ELFT::Shdr &Sec) { in checkOffsets()
4221 template <class ELFT>
4222 static bool checkVMA(const typename ELFT::Phdr &Phdr, in checkVMA()
4223 const typename ELFT::Shdr &Sec) { in checkVMA()
4240 template <class ELFT>
4241 static bool checkPTDynamic(const typename ELFT::Phdr &Phdr, in checkPTDynamic()
4242 const typename ELFT::Shdr &Sec) { in checkPTDynamic()
4257 template <class ELFT>
4258 void GNUELFDumper<ELFT>::printProgramHeaders( in printProgramHeaders()
4269 template <class ELFT> void GNUELFDumper<ELFT>::printProgramHeaders() { in printProgramHeaders()
4270 unsigned Bias = ELFT::Is64Bits ? 8 : 0; in printProgramHeaders()
4280 if (ELFT::Is64Bits) in printProgramHeaders()
4287 unsigned Width = ELFT::Is64Bits ? 18 : 10; in printProgramHeaders()
4288 unsigned SizeWidth = ELFT::Is64Bits ? 8 : 7; in printProgramHeaders()
4338 template <class ELFT> void GNUELFDumper<ELFT>::printSectionMapping() { in printSectionMapping()
4362 if (checkTLSSections<ELFT>(Phdr, Sec) && checkOffsets<ELFT>(Phdr, Sec) && in printSectionMapping()
4363 checkVMA<ELFT>(Phdr, Sec) && checkPTDynamic<ELFT>(Phdr, Sec)) { in printSectionMapping()
4390 template <class ELFT>
4391 RelSymbol<ELFT> getSymbolForReloc(const ELFDumper<ELFT> &Dumper, in getSymbolForReloc()
4392 const Relocation<ELFT> &Reloc) { in getSymbolForReloc()
4393 using Elf_Sym = typename ELFT::Sym; in getSymbolForReloc()
4395 const Twine &Reason) -> RelSymbol<ELFT> { in getSymbolForReloc()
4416 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile(); in getSymbolForReloc()
4434 template <class ELFT>
4435 static size_t getMaxDynamicTagSize(const ELFFile<ELFT> &Obj, in getMaxDynamicTagSize()
4436 typename ELFT::DynRange Tags) { in getMaxDynamicTagSize()
4438 for (const typename ELFT::Dyn &Dyn : Tags) in getMaxDynamicTagSize()
4443 template <class ELFT> void GNUELFDumper<ELFT>::printDynamicTable() { in printDynamicTable()
4459 OS << " Tag" + std::string(ELFT::Is64Bits ? 16 : 8, ' ') + "Type" in printDynamicTable()
4468 OS << " " << format_hex(Tag, ELFT::Is64Bits ? 18 : 10) in printDynamicTable()
4473 template <class ELFT> void GNUELFDumper<ELFT>::printDynamicRelocations() { in printDynamicRelocations()
4477 template <class ELFT>
4478 void ELFDumper<ELFT>::printDynamicReloc(const Relocation<ELFT> &R) { in printDynamicReloc()
4482 template <class ELFT>
4483 void ELFDumper<ELFT>::printRelocationsHelper(const Elf_Shdr &Sec) { in printRelocationsHelper()
4486 [&](const Relocation<ELFT> &R, unsigned Ndx, const Elf_Shdr &Sec, in printRelocationsHelper()
4491 template <class ELFT> void ELFDumper<ELFT>::printDynamicRelocationsHelper() { in printDynamicRelocationsHelper()
4497 printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL)); in printDynamicRelocationsHelper()
4504 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL)); in printDynamicRelocationsHelper()
4512 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL)); in printDynamicRelocationsHelper()
4520 printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL)); in printDynamicRelocationsHelper()
4525 printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL)); in printDynamicRelocationsHelper()
4530 template <class ELFT>
4531 void GNUELFDumper<ELFT>::printGNUVersionSectionProlog( in printGNUVersionSectionProlog()
4532 const typename ELFT::Shdr &Sec, const Twine &Label, unsigned EntriesNum) { in printGNUVersionSectionProlog()
4540 if (Expected<const typename ELFT::Shdr *> LinkedSecOrErr = in printGNUVersionSectionProlog()
4553 template <class ELFT>
4554 void GNUELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) { in printVersionSymbolSection()
4638 template <class ELFT>
4639 void GNUELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) { in printVersionDefinitionSection()
4665 template <class ELFT>
4666 void GNUELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) { in printVersionDependencySection()
4691 template <class ELFT>
4692 void GNUELFDumper<ELFT>::printHashHistogram(const Elf_Hash &HashTable) { in printHashHistogram()
4746 template <class ELFT>
4747 void GNUELFDumper<ELFT>::printGnuHashHistogram( in printGnuHashHistogram()
4750 getGnuHashTableChains<ELFT>(this->DynSymRegion, &GnuHashTable); in printGnuHashHistogram()
4805 template <class ELFT> void GNUELFDumper<ELFT>::printHashHistograms() { in printHashHistograms()
4808 if (Error E = checkHashTable<ELFT>(*this, this->HashTable)) in printHashHistograms()
4816 if (Error E = checkGNUHashTable<ELFT>(this->Obj, this->GnuHashTable)) in printHashHistograms()
4823 template <class ELFT> void GNUELFDumper<ELFT>::printCGProfile() { in printCGProfile()
4827 template <class ELFT> void GNUELFDumper<ELFT>::printBBAddrMaps() { in printBBAddrMaps()
4846 template <class ELFT>
4848 decodeAddrsigSection(const ELFFile<ELFT> &Obj, const typename ELFT::Shdr &Sec) { in decodeAddrsigSection()
4861 template <class ELFT> void GNUELFDumper<ELFT>::printAddrsig() { in printAddrsig()
4888 template <typename ELFT>
4909 if (DataSize == sizeof(typename ELFT::uint)) in getGNUProperty()
4911 (uint64_t)(*(const typename ELFT::Addr *)Data.data())); in getGNUProperty()
4929 PrData = support::endian::read32<ELFT::TargetEndianness>(Data.data()); in getGNUProperty()
4952 PrData = support::endian::read32<ELFT::TargetEndianness>(Data.data()); in getGNUProperty()
4978 PrData = support::endian::read32<ELFT::TargetEndianness>(Data.data()); in getGNUProperty()
4993 template <typename ELFT>
4995 using Elf_Word = typename ELFT::Word; in getGNUPropertyList()
5004 uint64_t PaddedSize = alignTo(DataSize, sizeof(typename ELFT::uint)); in getGNUPropertyList()
5013 getGNUProperty<ELFT>(Type, DataSize, Arr.take_front(PaddedSize))); in getGNUPropertyList()
5029 template <typename ELFT> static GNUAbiTag getGNUAbiTag(ArrayRef<uint8_t> Desc) { in getGNUAbiTag()
5030 typedef typename ELFT::Word Elf_Word; in getGNUAbiTag()
5063 template <typename ELFT>
5071 const GNUAbiTag &AbiTag = getGNUAbiTag<ELFT>(Desc); in printGNUNote()
5087 for (const std::string &Property : getGNUPropertyList<ELFT>(Desc)) in printGNUNote()
5146 template <typename ELFT>
5180 template <typename ELFT>
5191 utostr(support::endian::read32<ELFT::TargetEndianness>(Desc.data()))}; in getFreeBSDNote()
5198 support::endian::read32<ELFT::TargetEndianness>(Desc.data()); in getFreeBSDNote()
5218 template <typename ELFT>
5322 template <typename ELFT>
5413 template <typename ELFT>
5416 const int FieldWidth = ELFT::Is64Bits ? 18 : 10; in printCoreNote()
5577 template <class ELFT>
5578 StringRef getNoteTypeName(const typename ELFT::Note &Note, unsigned ELFType) { in getNoteTypeName()
5628 template <class ELFT>
5630 const ELFDumper<ELFT> &Dumper, in printNotesHelper()
5631 llvm::function_ref<void(Optional<StringRef>, typename ELFT::Off, in printNotesHelper()
5632 typename ELFT::Addr)> in printNotesHelper()
5634 llvm::function_ref<Error(const typename ELFT::Note &, bool)> ProcessNoteFn, in printNotesHelper()
5636 const ELFFile<ELFT> &Obj = Dumper.getElfObject().getELFFile(); in printNotesHelper()
5639 ArrayRef<typename ELFT::Shdr> Sections = cantFail(Obj.sections()); in printNotesHelper()
5641 for (const typename ELFT::Shdr &S : Sections) { in printNotesHelper()
5648 for (const typename ELFT::Note Note : Obj.notes(S, Err)) { in printNotesHelper()
5664 Expected<ArrayRef<typename ELFT::Phdr>> PhdrsOrErr = Obj.program_headers(); in printNotesHelper()
5673 const typename ELFT::Phdr &P = (*PhdrsOrErr)[I]; in printNotesHelper()
5679 for (const typename ELFT::Note Note : Obj.notes(P, Err)) { in printNotesHelper()
5695 template <class ELFT> void GNUELFDumper<ELFT>::printNotes() { in printNotes()
5698 const typename ELFT::Off Offset, in printNotes()
5699 const typename ELFT::Addr Size) { in printNotes()
5728 getNoteTypeName<ELFT>(Note, this->Obj.getHeader().e_type); in printNotes()
5737 if (printGNUNote<ELFT>(OS, Type, Descriptor)) in printNotes()
5741 getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) { in printNotes()
5746 const AMDNote N = getAMDNote<ELFT>(Type, Descriptor); in printNotes()
5752 const AMDGPUNote N = getAMDGPUNote<ELFT>(Type, Descriptor); in printNotes()
5758 if (printLLVMOMPOFFLOADNote<ELFT>(OS, Type, Descriptor)) in printNotes()
5763 ELFT::TargetEndianness == support::little, in printNotes()
5766 printCoreNote<ELFT>(OS, *NoteOrErr); in printNotes()
5788 template <class ELFT> void GNUELFDumper<ELFT>::printELFLinkerOptions() { in printELFLinkerOptions()
5792 template <class ELFT>
5793 void ELFDumper<ELFT>::printDependentLibsHelper( in printDependentLibsHelper()
5829 template <class ELFT>
5830 void ELFDumper<ELFT>::forEachRelocationDo( in forEachRelocationDo()
5832 llvm::function_ref<void(const Relocation<ELFT> &, unsigned, in forEachRelocationDo() argument
5861 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5869 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5888 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, in forEachRelocationDo()
5896 RelRelaFn(Relocation<ELFT>(R, IsMips64EL), RelNdx++, Sec, SymTab); in forEachRelocationDo()
5904 template <class ELFT>
5905 StringRef ELFDumper<ELFT>::getPrintableSectionName(const Elf_Shdr &Sec) const { in getPrintableSectionName()
5916 template <class ELFT> void GNUELFDumper<ELFT>::printDependentLibs() { in printDependentLibs()
5951 template <class ELFT>
5952 SmallVector<uint32_t> ELFDumper<ELFT>::getSymbolIndexesForFunctionAddress( in getSymbolIndexesForFunctionAddress()
6017 template <class ELFT>
6018 bool ELFDumper<ELFT>::printFunctionStackSize( in printFunctionStackSize()
6051 template <class ELFT>
6052 void GNUELFDumper<ELFT>::printStackSizeEntry(uint64_t Size, in printStackSizeEntry()
6061 template <class ELFT>
6062 void ELFDumper<ELFT>::printStackSize(const Relocation<ELFT> &R, in printStackSize()
6072 Expected<RelSymbol<ELFT>> TargetOrErr = this->getRelocationTarget(R, SymTab); in printStackSize()
6114 template <class ELFT>
6115 void ELFDumper<ELFT>::printNonRelocatableStackSizes( in printNonRelocatableStackSizes()
6144 template <class ELFT>
6145 void ELFDumper<ELFT>::getSectionAndRelocations( in getSectionAndRelocations()
6170 template <class ELFT>
6171 void ELFDumper<ELFT>::printRelocatableStackSizes( in printRelocatableStackSizes()
6216 [&](const Relocation<ELFT> &R, unsigned Ndx, const Elf_Shdr &Sec, in printRelocatableStackSizes()
6236 template <class ELFT>
6237 void GNUELFDumper<ELFT>::printStackSizes() { in printStackSizes()
6258 template <class ELFT>
6259 void GNUELFDumper<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) { in printMipsGOT()
6260 size_t Bias = ELFT::Is64Bits ? 8 : 0; in printMipsGOT()
6277 if (ELFT::Is64Bits) in printMipsGOT()
6288 if (ELFT::Is64Bits) in printMipsGOT()
6302 if (ELFT::Is64Bits) in printMipsGOT()
6339 template <class ELFT>
6340 void GNUELFDumper<ELFT>::printMipsPLT(const MipsGOTParser<ELFT> &Parser) { in printMipsPLT()
6341 size_t Bias = ELFT::Is64Bits ? 8 : 0; in printMipsPLT()
6389 template <class ELFT>
6390 Expected<const Elf_Mips_ABIFlags<ELFT> *>
6391 getMipsAbiFlagsSection(const ELFDumper<ELFT> &Dumper) { in getMipsAbiFlagsSection()
6392 const typename ELFT::Shdr *Sec = Dumper.findSectionByName(".MIPS.abiflags"); in getMipsAbiFlagsSection()
6402 if (DataOrErr->size() != sizeof(Elf_Mips_ABIFlags<ELFT>)) in getMipsAbiFlagsSection()
6405 return reinterpret_cast<const Elf_Mips_ABIFlags<ELFT> *>(DataOrErr->data()); in getMipsAbiFlagsSection()
6408 template <class ELFT> void GNUELFDumper<ELFT>::printMipsABIFlags() { in printMipsABIFlags()
6409 const Elf_Mips_ABIFlags<ELFT> *Flags = nullptr; in printMipsABIFlags()
6410 if (Expected<const Elf_Mips_ABIFlags<ELFT> *> SecOrErr = in printMipsABIFlags()
6441 template <class ELFT> void LLVMELFDumper<ELFT>::printFileHeaders() { in printFileHeaders()
6538 template <class ELFT> void LLVMELFDumper<ELFT>::printGroupSections() { in printGroupSections()
6569 template <class ELFT> void LLVMELFDumper<ELFT>::printRelocations() { in printRelocations()
6573 if (!isRelocationSec<ELFT>(Sec)) in printRelocations()
6586 template <class ELFT>
6587 void LLVMELFDumper<ELFT>::printRelrReloc(const Elf_Relr &R) { in printRelrReloc()
6591 template <class ELFT>
6592 void LLVMELFDumper<ELFT>::printRelRelaReloc(const Relocation<ELFT> &R, in printRelRelaReloc()
6593 const RelSymbol<ELFT> &RelSym) { in printRelRelaReloc()
6615 template <class ELFT> void LLVMELFDumper<ELFT>::printSectionHeaders() { in printSectionHeaders()
6652 typename ELFT::SymRange Symbols = unwrapOrError( in printSectionHeaders()
6675 template <class ELFT>
6676 void LLVMELFDumper<ELFT>::printSymbolSection( in printSymbolSection()
6726 template <class ELFT>
6727 void LLVMELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex, in printSymbol()
6779 template <class ELFT>
6780 void LLVMELFDumper<ELFT>::printSymbols(bool PrintSymbols, in printSymbols()
6792 template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicTable() { in printDynamicTable()
6803 W.startLine() << " Tag" << std::string(ELFT::Is64Bits ? 16 : 8, ' ') in printDynamicTable()
6810 W.startLine() << " " << format_hex(Tag, ELFT::Is64Bits ? 18 : 10, true) in printDynamicTable()
6819 template <class ELFT> void LLVMELFDumper<ELFT>::printDynamicRelocations() { in printDynamicRelocations()
6827 template <class ELFT>
6828 void LLVMELFDumper<ELFT>::printProgramHeaders( in printProgramHeaders()
6836 template <class ELFT> void LLVMELFDumper<ELFT>::printProgramHeaders() { in printProgramHeaders()
6862 template <class ELFT>
6863 void LLVMELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) { in printVersionSymbolSection()
6896 template <class ELFT>
6897 void LLVMELFDumper<ELFT>::printVersionDefinitionSection(const Elf_Shdr *Sec) { in printVersionDefinitionSection()
6921 template <class ELFT>
6922 void LLVMELFDumper<ELFT>::printVersionDependencySection(const Elf_Shdr *Sec) { in printVersionDependencySection()
6951 template <class ELFT> void LLVMELFDumper<ELFT>::printHashHistograms() { in printHashHistograms()
6957 template <class ELFT>
6958 static bool getSymbolIndices(const typename ELFT::Shdr *CGRelSection, in getSymbolIndices()
6959 const ELFFile<ELFT> &Obj, in getSymbolIndices()
6960 const LLVMELFDumper<ELFT> *Dumper, in getSymbolIndices()
6969 typename ELFT::RelRange CGProfileRel; in getSymbolIndices()
6970 Expected<typename ELFT::RelRange> CGProfileRelOrError = in getSymbolIndices()
6980 for (const typename ELFT::Rel &Rel : CGProfileRel) in getSymbolIndices()
6986 typename ELFT::RelaRange CGProfileRela; in getSymbolIndices()
6987 Expected<typename ELFT::RelaRange> CGProfileRelaOrError = in getSymbolIndices()
6997 for (const typename ELFT::Rela &Rela : CGProfileRela) in getSymbolIndices()
7004 template <class ELFT> void LLVMELFDumper<ELFT>::printCGProfile() { in printCGProfile()
7027 getSymbolIndices<ELFT>(CGRelSection, this->Obj, this, SymbolIndices); in printCGProfile()
7049 template <class ELFT> void LLVMELFDumper<ELFT>::printBBAddrMaps() { in printBBAddrMaps()
7096 template <class ELFT> void LLVMELFDumper<ELFT>::printAddrsig() { in printAddrsig()
7112 template <typename ELFT>
7120 const GNUAbiTag &AbiTag = getGNUAbiTag<ELFT>(Desc); in printGNUNoteLLVMStyle()
7139 for (const std::string &Property : getGNUPropertyList<ELFT>(Desc)) in printGNUNoteLLVMStyle()
7157 template <typename ELFT>
7188 template <class ELFT> void LLVMELFDumper<ELFT>::printNotes() { in printNotes()
7193 const typename ELFT::Off Offset, in printNotes()
7194 const typename ELFT::Addr Size) { in printNotes()
7214 getNoteTypeName<ELFT>(Note, this->Obj.getHeader().e_type); in printNotes()
7224 if (printGNUNoteLLVMStyle<ELFT>(Type, Descriptor, W)) in printNotes()
7228 getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) { in printNotes()
7233 const AMDNote N = getAMDNote<ELFT>(Type, Descriptor); in printNotes()
7239 const AMDGPUNote N = getAMDGPUNote<ELFT>(Type, Descriptor); in printNotes()
7245 if (printLLVMOMPOFFLOADNoteLLVMStyle<ELFT>(Type, Descriptor, W)) in printNotes()
7250 ELFT::TargetEndianness == support::little, in printNotes()
7272 template <class ELFT> void LLVMELFDumper<ELFT>::printELFLinkerOptions() { in printELFLinkerOptions()
7316 template <class ELFT> void LLVMELFDumper<ELFT>::printDependentLibs() { in printDependentLibs()
7323 template <class ELFT> void LLVMELFDumper<ELFT>::printStackSizes() { in printStackSizes()
7331 template <class ELFT>
7332 void LLVMELFDumper<ELFT>::printStackSizeEntry(uint64_t Size, in printStackSizeEntry()
7339 template <class ELFT>
7340 void LLVMELFDumper<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) { in printMipsGOT()
7401 template <class ELFT>
7402 void LLVMELFDumper<ELFT>::printMipsPLT(const MipsGOTParser<ELFT> &Parser) { in printMipsPLT()
7447 template <class ELFT> void LLVMELFDumper<ELFT>::printMipsABIFlags() { in printMipsABIFlags()
7448 const Elf_Mips_ABIFlags<ELFT> *Flags; in printMipsABIFlags()
7449 if (Expected<const Elf_Mips_ABIFlags<ELFT> *> SecOrErr = in printMipsABIFlags()
7481 template <class ELFT>
7482 void JSONELFDumper<ELFT>::printFileSummary(StringRef FileStr, ObjectFile &Obj, in printFileSummary()