Lines Matching refs:Obj

429 static const Target *getTarget(const ObjectFile *Obj = nullptr) {  in getTarget()  argument
433 if (Obj) in getTarget()
434 TheTriple = Obj->makeTriple(); in getTarget()
439 if (Obj) { in getTarget()
440 auto Arch = Obj->getArch(); in getTarget()
442 Obj->setARMSubArch(TheTriple); in getTarget()
451 if (Obj) in getTarget()
452 report_error(Obj->getFileName(), "can't find target: " + Error); in getTarget()
482 static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj, in getRelocationValueString() argument
489 const ELFFile<ELFT> &EF = *Obj->getELFFile(); in getRelocationValueString()
521 const Elf_Rela *ERela = Obj->getRela(Rel); in getRelocationValueString()
530 const Elf_Sym *symb = Obj->getSymbol(SI->getRawDataRefImpl()); in getRelocationValueString()
535 const Elf_Shdr *SymSec = Obj->getSection((*SymSI)->getRawDataRefImpl()); in getRelocationValueString()
564 static std::error_code getRelocationValueString(const ELFObjectFileBase *Obj, in getRelocationValueString() argument
567 if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj)) in getRelocationValueString()
569 if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj)) in getRelocationValueString()
571 if (auto *ELF32BE = dyn_cast<ELF32BEObjectFile>(Obj)) in getRelocationValueString()
573 auto *ELF64BE = cast<ELF64BEObjectFile>(Obj); in getRelocationValueString()
577 static std::error_code getRelocationValueString(const COFFObjectFile *Obj, in getRelocationValueString() argument
668 static std::error_code getRelocationValueString(const WasmObjectFile *Obj, in getRelocationValueString() argument
671 const wasm::WasmRelocation& Rel = Obj->getWasmRelocation(RelRef); in getRelocationValueString()
675 if (SI == Obj->symbol_end()) { in getRelocationValueString()
692 static std::error_code getRelocationValueString(const MachOObjectFile *Obj, in getRelocationValueString() argument
696 MachO::any_relocation_info RE = Obj->getRelocation(Rel); in getRelocationValueString()
698 unsigned Arch = Obj->getArch(); in getRelocationValueString()
702 unsigned Type = Obj->getAnyRelocationType(RE); in getRelocationValueString()
703 bool IsPCRel = Obj->getAnyRelocationPCRel(RE); in getRelocationValueString()
713 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
721 Obj->moveRelocationNext(RelNext); in getRelocationValueString()
722 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext); in getRelocationValueString()
727 unsigned RType = Obj->getAnyRelocationType(RENext); in getRelocationValueString()
729 report_error(Obj->getFileName(), "Expected X86_64_RELOC_UNSIGNED after " in getRelocationValueString()
734 printRelocationTargetName(Obj, RENext, Fmt); in getRelocationValueString()
736 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
740 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
746 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
750 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
754 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
758 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
770 Obj->moveRelocationNext(RelNext); in getRelocationValueString()
771 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext); in getRelocationValueString()
775 unsigned RType = Obj->getAnyRelocationType(RENext); in getRelocationValueString()
778 report_error(Obj->getFileName(), "Expected GENERIC_RELOC_PAIR after " in getRelocationValueString()
781 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
783 printRelocationTargetName(Obj, RENext, Fmt); in getRelocationValueString()
792 Obj->moveRelocationNext(RelNext); in getRelocationValueString()
793 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext); in getRelocationValueString()
797 unsigned RType = Obj->getAnyRelocationType(RENext); in getRelocationValueString()
799 report_error(Obj->getFileName(), "Expected GENERIC_RELOC_PAIR after " in getRelocationValueString()
802 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
804 printRelocationTargetName(Obj, RENext, Fmt); in getRelocationValueString()
808 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
815 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
823 bool isUpper = (Obj->getAnyRelocationLength(RE) & 0x1) == 1; in getRelocationValueString()
829 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
832 Obj->moveRelocationNext(RelNext); in getRelocationValueString()
833 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext); in getRelocationValueString()
837 unsigned RType = Obj->getAnyRelocationType(RENext); in getRelocationValueString()
839 report_error(Obj->getFileName(), "Expected ARM_RELOC_PAIR after " in getRelocationValueString()
851 printRelocationTargetName(Obj, RENext, Fmt); in getRelocationValueString()
857 default: { printRelocationTargetName(Obj, RE, Fmt); } in getRelocationValueString()
861 printRelocationTargetName(Obj, RE, Fmt); in getRelocationValueString()
870 const ObjectFile *Obj = Rel.getObject(); in getRelocationValueString() local
871 if (auto *ELF = dyn_cast<ELFObjectFileBase>(Obj)) in getRelocationValueString()
873 if (auto *COFF = dyn_cast<COFFObjectFile>(Obj)) in getRelocationValueString()
875 if (auto *Wasm = dyn_cast<WasmObjectFile>(Obj)) in getRelocationValueString()
877 if (auto *MachO = dyn_cast<MachOObjectFile>(Obj)) in getRelocationValueString()
918 const ObjectFile *Obj = nullptr; member in __anonc7e4a1d00311::SourcePrinter
930 SourcePrinter(const ObjectFile *Obj, StringRef DefaultArch) : Obj(Obj) { in SourcePrinter() argument
973 Symbolizer->symbolizeCode(Obj->getFileName(), Address); in printSourceLine()
1004 static bool isArmElf(const ObjectFile *Obj) { in isArmElf() argument
1005 return (Obj->isELF() && in isArmElf()
1006 (Obj->getArch() == Triple::aarch64 || in isArmElf()
1007 Obj->getArch() == Triple::aarch64_be || in isArmElf()
1008 Obj->getArch() == Triple::arm || Obj->getArch() == Triple::armeb || in isArmElf()
1009 Obj->getArch() == Triple::thumb || in isArmElf()
1010 Obj->getArch() == Triple::thumbeb)); in isArmElf()
1212 static uint8_t getElfSymbolType(const ObjectFile *Obj, const SymbolRef &Sym) { in getElfSymbolType() argument
1213 assert(Obj->isELF()); in getElfSymbolType()
1214 if (auto *Elf32LEObj = dyn_cast<ELF32LEObjectFile>(Obj)) in getElfSymbolType()
1216 if (auto *Elf64LEObj = dyn_cast<ELF64LEObjectFile>(Obj)) in getElfSymbolType()
1218 if (auto *Elf32BEObj = dyn_cast<ELF32BEObjectFile>(Obj)) in getElfSymbolType()
1220 if (auto *Elf64BEObj = cast<ELF64BEObjectFile>(Obj)) in getElfSymbolType()
1226 addDynamicElfSymbols(const ELFObjectFile<ELFT> *Obj, in addDynamicElfSymbols() argument
1228 for (auto Symbol : Obj->getDynamicSymbolIterators()) { in addDynamicElfSymbols()
1235 report_error(Obj->getFileName(), AddressOrErr.takeError()); in addDynamicElfSymbols()
1239 report_error(Obj->getFileName(), Name.takeError()); in addDynamicElfSymbols()
1245 report_error(Obj->getFileName(), SectionOrErr.takeError()); in addDynamicElfSymbols()
1247 if (SecI == Obj->section_end()) in addDynamicElfSymbols()
1255 addDynamicElfSymbols(const ObjectFile *Obj, in addDynamicElfSymbols() argument
1257 assert(Obj->isELF()); in addDynamicElfSymbols()
1258 if (auto *Elf32LEObj = dyn_cast<ELF32LEObjectFile>(Obj)) in addDynamicElfSymbols()
1260 else if (auto *Elf64LEObj = dyn_cast<ELF64LEObjectFile>(Obj)) in addDynamicElfSymbols()
1262 else if (auto *Elf32BEObj = dyn_cast<ELF32BEObjectFile>(Obj)) in addDynamicElfSymbols()
1264 else if (auto *Elf64BEObj = cast<ELF64BEObjectFile>(Obj)) in addDynamicElfSymbols()
1270 static void addPltEntries(const ObjectFile *Obj, in addPltEntries() argument
1274 for (const SectionRef &Section : Obj->sections()) { in addPltEntries()
1283 if (auto *ElfObj = dyn_cast<ELFObjectFileBase>(Obj)) { in addPltEntries()
1286 uint8_t SymbolType = getElfSymbolType(Obj, Symbol); in addPltEntries()
1290 report_error(Obj->getFileName(), NameOrErr.takeError()); in addPltEntries()
1323 static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) { in disassembleObject() argument
1327 const Target *TheTarget = getTarget(Obj); in disassembleObject()
1330 SubtargetFeatures Features = Obj->getFeatures(); in disassembleObject()
1338 report_error(Obj->getFileName(), "no register info for target " + in disassembleObject()
1345 report_error(Obj->getFileName(), "no assembly info for target " + in disassembleObject()
1350 report_error(Obj->getFileName(), "no subtarget info for target " + in disassembleObject()
1354 report_error(Obj->getFileName(), "no instruction info for target " + in disassembleObject()
1364 report_error(Obj->getFileName(), "no disassembler for target " + in disassembleObject()
1374 report_error(Obj->getFileName(), "no instruction printer for target " + in disassembleObject()
1379 StringRef Fmt = Obj->getBytesInAddress() > 4 ? "\t\t%016" PRIx64 ": " : in disassembleObject()
1382 SourcePrinter SP(Obj, TheTarget->getName()); in disassembleObject()
1388 for (const SectionRef &Section : ToolSectionFilter(*Obj)) { in disassembleObject()
1390 if (Sec2 != Obj->section_end()) in disassembleObject()
1398 for (const SymbolRef &Symbol : Obj->symbols()) { in disassembleObject()
1401 report_error(Obj->getFileName(), AddressOrErr.takeError()); in disassembleObject()
1406 report_error(Obj->getFileName(), Name.takeError()); in disassembleObject()
1412 report_error(Obj->getFileName(), SectionOrErr.takeError()); in disassembleObject()
1415 if (Obj->isELF()) in disassembleObject()
1416 SymbolType = getElfSymbolType(Obj, Symbol); in disassembleObject()
1419 if (SecI != Obj->section_end()) in disassembleObject()
1426 if (AllSymbols.empty() && Obj->isELF()) in disassembleObject()
1427 addDynamicElfSymbols(Obj, AllSymbols); in disassembleObject()
1431 addPltEntries(Obj, AllSymbols, Saver); in disassembleObject()
1435 for (SectionRef Sec : Obj->sections()) in disassembleObject()
1441 if (const auto *COFFObj = dyn_cast<COFFObjectFile>(Obj)) { in disassembleObject()
1474 for (const SectionRef &Section : ToolSectionFilter(*Obj)) { in disassembleObject()
1487 if (isArmElf(Obj)) { in disassembleObject()
1505 if (Obj->isELF() && Obj->getArch() == Triple::amdgcn) { in disassembleObject()
1531 if (const MachOObjectFile *MachO = dyn_cast<const MachOObjectFile>(Obj)) { in disassembleObject()
1599 if (Obj->isELF() && Obj->getArch() == Triple::amdgcn) { in disassembleObject()
1652 if (isArmElf(Obj) && std::get<2>(Symbols[SI]) != ELF::STT_OBJECT && in disassembleObject()
1668 if (Obj->isLittleEndian()) { in disassembleObject()
1684 if (Obj->isLittleEndian()) { in disassembleObject()
1716 if (Obj->isELF() && std::get<2>(Symbols[SI]) == ELF::STT_OBJECT && in disassembleObject()
1793 if (!Obj->isRelocatableObject()) { in disassembleObject()
1841 if (Obj->getArch() != Triple::hexagon) in disassembleObject()
1868 void llvm::printRelocations(const ObjectFile *Obj) { in printRelocations() argument
1869 StringRef Fmt = Obj->getBytesInAddress() > 4 ? "%016" PRIx64 : in printRelocations()
1873 if (!Obj->isRelocatableObject()) in printRelocations()
1876 for (const SectionRef &Section : ToolSectionFilter(*Obj)) { in printRelocations()
1897 void llvm::printDynamicRelocations(const ObjectFile *Obj) { in printDynamicRelocations() argument
1899 if (!Obj->isELF()) in printDynamicRelocations()
1902 const auto *Elf = dyn_cast<ELFObjectFileBase>(Obj); in printDynamicRelocations()
1908 std::vector<SectionRef> DynRelSec = Obj->dynamic_relocation_sections(); in printDynamicRelocations()
1913 StringRef Fmt = Obj->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64; in printDynamicRelocations()
1929 void llvm::printSectionHeaders(const ObjectFile *Obj) { in printSectionHeaders() argument
1932 for (const SectionRef &Section : ToolSectionFilter(*Obj)) { in printSectionHeaders()
1949 void llvm::printSectionContents(const ObjectFile *Obj) { in printSectionContents() argument
1951 for (const SectionRef &Section : ToolSectionFilter(*Obj)) { in printSectionContents()
2191 void llvm::printRawClangAST(const ObjectFile *Obj) { in printRawClangAST() argument
2202 if (isa<COFFObjectFile>(Obj)) { in printRawClangAST()
2207 for (auto Sec : ToolSectionFilter(*Obj)) { in printRawClangAST()
2223 static void printFaultMaps(const ObjectFile *Obj) { in printFaultMaps() argument
2226 if (isa<ELFObjectFileBase>(Obj)) { in printFaultMaps()
2228 } else if (isa<MachOObjectFile>(Obj)) { in printFaultMaps()
2239 for (auto Sec : ToolSectionFilter(*Obj)) { in printFaultMaps()