Lines Matching +full:freebsd13 +full:- +full:4 +full:r
1 //===-- llvm-objdump.cpp - Object file dumping utility for llvm -----------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
18 #include "llvm-objdump.h"
127 std::size(NAME##_init) - 1);
158 std::size(NAME##_init) - 1);
173 "Mach-O object file displaying tool") {} in OtoolOptTable()
265 [[maybe_unused]] auto R = FunctionAddrToMap.try_emplace( in AddFunctionEntry() local
267 assert(R.second && "duplicate function address"); in AddFunctionEntry()
278 FunctionAddr = S->second; in getEntryForAddress()
279 auto R = FunctionAddrToMap.find(FunctionAddr); in getEntryForAddress() local
280 if (R == FunctionAddrToMap.end()) in getEntryForAddress()
282 return &R->second; in getEntryForAddress()
365 reportWarning(Msg, this->O.getFileName()); in Dumper()
401 // in the --section flag, but we still want those to count toward the section
509 "' mentioned in a -j/--section option, but not " in warnOnNoMatchForSections()
515 Triple TheTriple("unknown-unknown-unknown"); in getTarget()
517 TheTriple = Obj->makeTriple(); in getTarget()
520 auto Arch = Obj->getArch(); in getTarget()
522 Obj->setARMSubArch(TheTriple); in getTarget()
530 reportError(Obj->getFileName(), "can't find target: " + Error); in getTarget()
567 unsigned Arch = MachO->getArch(); in getHidden()
569 uint64_t Type = MachO->getRelocationType(Rel); in getHidden()
581 RelPrev.d.a--; in getHidden()
582 uint64_t PrevType = MachO->getRelocationType(RelPrev); in getHidden()
602 unsigned Column = OS.tell() - Start; in AlignToInstStartColumn()
603 OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8); in AlignToInstStartColumn()
623 return Elf && Elf->getEMachine() == ELF::EM_AARCH64; in isAArch64Elf()
628 return Elf && Elf->getEMachine() == ELF::EM_ARM; in isArmElf()
633 return Elf && Elf->getEMachine() == ELF::EM_CSKY; in isCSKYElf()
667 FOS << "CO-RE " << Val; in printBTFRelocation()
681 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
710 dumpBytes(Bytes.slice(0, 4), OS); in printLead()
720 SP->printSourceLine(OS, Address, ObjectFilename, LVP, ""); in printInst()
741 std::vector<RelocationRef>::const_iterator RelCur = Rels->begin(); in printInst()
742 std::vector<RelocationRef>::const_iterator RelEnd = Rels->end(); in printInst()
743 auto PrintReloc = [&]() -> void { in printInst()
744 while ((RelCur != RelEnd) && (RelCur->getOffset() <= Address.Address)) { in printInst()
745 if (RelCur->getOffset() == Address.Address) { in printInst()
757 SP->printSourceLine(OS, Address, ObjectFilename, LVP, ""); in printInst()
775 Bytes = Bytes.slice(4); in printInst()
776 Address.Address += 4; in printInst()
790 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
800 // an unrecognized encoding - this is probably data so represent it in printInst()
801 // using the .long directive, or .byte directive if fewer than 4 bytes in printInst()
803 if (Bytes.size() >= 4) { in printInst()
812 OS.indent(55 - (6 * Bytes.size())); in printInst()
817 if (Bytes.size() >= 4) { in printInst()
822 Bytes.size() / 4)) in printInst()
843 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
866 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
874 if (STI.checkFeatures("+thumb-mode")) { in printInst()
880 4); in printInst()
882 for (; Pos + 4 <= End; Pos += 4) in printInst()
920 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
928 for (; Pos + 4 <= End; Pos += 4) in printInst()
958 SP->printSourceLine(OS, Address, ObjectFilename, LVP); in printInst()
966 if (End % 4 == 0) { in printInst()
967 // 32-bit and 64-bit instructions. in printInst()
968 for (; Pos + 4 <= End; Pos += 4) in printInst()
975 // 16-bit and 48-bits instructions. in printInst()
981 4); in printInst()
1053 RegisterInfo(TheTarget->createMCRegInfo(TripleName)) { in DisassemblerTarget()
1058 AsmInfo.reset(TheTarget->createMCAsmInfo(*RegisterInfo, TripleName, Options)); in DisassemblerTarget()
1063 TheTarget->createMCSubtargetInfo(TripleName, MCPU, Features.getString())); in DisassemblerTarget()
1067 InstrInfo.reset(TheTarget->createMCInstrInfo()); in DisassemblerTarget()
1077 TheTarget->createMCObjectFileInfo(*Context, /*PIC=*/false)); in DisassemblerTarget()
1078 Context->setObjectFileInfo(ObjectFileInfo.get()); in DisassemblerTarget()
1080 DisAsm.reset(TheTarget->createMCDisassembler(*SubtargetInfo, *Context)); in DisassemblerTarget()
1085 DisAsm->setABIVersion(ELFObj->getEIdentABIVersion()); in DisassemblerTarget()
1087 InstrAnalysis.reset(TheTarget->createMCInstrAnalysis(InstrInfo.get())); in DisassemblerTarget()
1089 int AsmPrinterVariant = AsmInfo->getAssemblerDialect(); in DisassemblerTarget()
1090 InstPrinter.reset(TheTarget->createMCInstPrinter(Triple(TripleName), in DisassemblerTarget()
1096 InstPrinter->setPrintImmHex(PrintImmHex); in DisassemblerTarget()
1097 InstPrinter->setPrintBranchImmAsAddress(true); in DisassemblerTarget()
1098 InstPrinter->setSymbolizeOperands(SymbolizeOperands); in DisassemblerTarget()
1099 InstPrinter->setMCInstrAnalysis(InstrAnalysis.get()); in DisassemblerTarget()
1103 InstPrinter->setUseColor(true); in DisassemblerTarget()
1106 InstPrinter->setUseColor(outs().has_colors()); in DisassemblerTarget()
1110 InstPrinter->setUseColor(false); in DisassemblerTarget()
1118 SubtargetInfo(TheTarget->createMCSubtargetInfo(TripleName, MCPU, in DisassemblerTarget()
1121 DisAsm(TheTarget->createMCDisassembler(*SubtargetInfo, *Context)), in DisassemblerTarget()
1131 return unwrapOrError(Elf32LEObj->getSymbol(Sym.getRawDataRefImpl()), in getElfSymbolType()
1133 ->getType(); in getElfSymbolType()
1135 return unwrapOrError(Elf64LEObj->getSymbol(Sym.getRawDataRefImpl()), in getElfSymbolType()
1137 ->getType(); in getElfSymbolType()
1139 return unwrapOrError(Elf32BEObj->getSymbol(Sym.getRawDataRefImpl()), in getElfSymbolType()
1141 ->getType(); in getElfSymbolType()
1143 return unwrapOrError(Elf64BEObj->getSymbol(Sym.getRawDataRefImpl()), in getElfSymbolType()
1145 ->getType(); in getElfSymbolType()
1164 ->st_value; in addDynamicElfSymbols()
1219 : Section->getAddress(); in addMissingWasmCodeSymbols()
1250 for (auto Plt : ElfObj->getPltEntries()) { in addPltEntries()
1255 if (!NameOrErr->empty()) in addPltEntries()
1284 // We skip zeroes in multiples of 4 because do not want to truncate an in countSkippableZeroBytes()
1293 uint64_t I = (uint64_t)-1; in getRelocsMap()
1314 // Used for --adjust-vma to check if address should be adjusted by the
1316 // For ELF we do not adjust non-allocatable sections like debug ones,
1321 if (Obj->isELF()) in shouldAdjustVA()
1338 return (It - 1)->second; in getMappingSymbolKind()
1350 if (Index + 4 <= End) { in dumpARMELFData()
1351 dumpBytes(Bytes.slice(Index, 4), OS); in dumpARMELFData()
1356 return 4; in dumpARMELFData()
1367 OS << "\t.byte\t" << format_hex(Bytes[Index], 4); in dumpARMELFData()
1387 if (Index == End - 1 || NumBytes > 8) { in dumpELFData()
1390 IndentOffset = 3 * (8 - NumBytes); in dumpELFData()
1427 cast<WasmObjectFile>(&Obj)->getWasmSymbol(Symbol).Info.Kind; in createSymbolInfo()
1460 FunctionMap->getAddrMap().getBBRangeIndexForBaseAddress(StartAddress); in collectBBAddrMapLabels()
1466 FunctionMap->getAddrMap().BBRanges[I].BBEntries.size(); in collectBBAddrMapLabels()
1467 const auto &BBRange = FunctionMap->getAddrMap().BBRanges[*BBRangeIndex]; in collectBBAddrMapLabels()
1476 {LabelString, FunctionMap->constructPGOLabelString( in collectBBAddrMapLabels()
1488 const bool isPPC = STI->getTargetTriple().isPPC(); in collectLocalBranchTargets()
1489 if (!isPPC && !STI->getTargetTriple().isX86()) in collectLocalBranchTargets()
1493 MIA->resetState(); in collectLocalBranchTargets()
1499 const bool isXCOFF = STI->getTargetTriple().isOSBinFormatXCOFF(); in collectLocalBranchTargets()
1501 // Disassemble a real instruction and record function-local branch labels. in collectLocalBranchTargets()
1504 ArrayRef<uint8_t> ThisBytes = Bytes.slice(Index - SectionAddr); in collectLocalBranchTargets()
1506 DisAsm->getInstruction(Inst, Size, ThisBytes, Index, nulls()); in collectLocalBranchTargets()
1509 DisAsm->suggestBytesToSkip(ThisBytes, Index)); in collectLocalBranchTargets()
1514 bool TargetKnown = MIA->evaluateBranch(Inst, Index, Size, Target); in collectLocalBranchTargets()
1524 MIA->updateState(Inst, Index); in collectLocalBranchTargets()
1526 MIA->resetState(); in collectLocalBranchTargets()
1542 Target->createMCRelocationInfo(TripleName, Ctx)); in addSymbolizer()
1545 std::unique_ptr<MCSymbolizer> Symbolizer(Target->createMCSymbolizer( in addSymbolizer()
1548 DisAsm->setSymbolizer(std::move(Symbolizer)); in addSymbolizer()
1561 DisAsm->getInstruction(Inst, Size, ThisBytes, ThisAddr, nulls()); in addSymbolizer()
1564 DisAsm->suggestBytesToSkip(ThisBytes, Index)); in addSymbolizer()
1567 ArrayRef<uint64_t> LabelAddrsRef = SymbolizerPtr->getReferencedAddresses(); in addSymbolizer()
1573 LabelAddrs.resize(llvm::unique(LabelAddrs) - LabelAddrs.begin()); in addSymbolizer()
1584 RelInfo.reset(Target->createMCRelocationInfo(TripleName, Ctx)); in addSymbolizer()
1585 Symbolizer.reset(Target->createMCSymbolizer( in addSymbolizer()
1587 DisAsm->setSymbolizer(std::move(Symbolizer)); in addSymbolizer()
1594 StringRef SegmentName = MachO->getSectionFinalSegmentName(DR); in getSegmentName()
1613 MAI.getCommentColumn() - 8 + getInstStartColumn(STI); in emitPostInstructionInfo()
1626 Elf32LEObj->createFakeSections(); in createFakeELFSections()
1628 Elf64LEObj->createFakeSections(); in createFakeELFSections()
1630 Elf32BEObj->createFakeSections(); in createFakeELFSections()
1632 Elf64BEObj->createFakeSections(); in createFakeELFSections()
1644 std::optional<std::string> Path = BIDFetcher->fetch(BuildID); in fetchBinaryByBuildID()
1667 PrimaryTarget.SubtargetInfo->checkFeatures("+thumb-mode"); in disassembleObject()
1669 const chpe_metadata *CHPEMetadata = COFFObj->getCHPEMetadata(); in disassembleObject()
1670 if (CHPEMetadata && CHPEMetadata->CodeMapCount) { in disassembleObject()
1672 cantFail(COFFObj->getRvaPtr(CHPEMetadata->CodeMap, CodeMapInt)); in disassembleObject()
1675 for (uint32_t i = 0; i < CHPEMetadata->CodeMapCount; ++i) { in disassembleObject()
1679 uint64_t Start = CodeMap[i].getStart() + COFFObj->getImageBase(); in disassembleObject()
1691 bool Is64Bits = Obj.getBytesInAddress() > 4; in disassembleObject()
1706 if (NameOrErr->empty() && !(Obj.isXCOFF() && SymbolDescription)) in disassembleObject()
1716 // AllMappingSymbols. If --show-all-symbols is unspecified, its label will in disassembleObject()
1722 uint64_t SectionAddr = SecI->getAddress(); in disassembleObject()
1727 AllMappingSymbols[*SecI].emplace_back(Address - SectionAddr, in disassembleObject()
1741 if (NameOrErr->starts_with("__mh_") && NameOrErr->ends_with("_header")) in disassembleObject()
1743 // Don't ask a Mach-O STAB symbol for its section unless you know that in disassembleObject()
1747 uint8_t NType = (MachO->is64Bit() ? in disassembleObject()
1748 MachO->getSymbol64TableEntry(SymDRI).n_type: in disassembleObject()
1749 MachO->getSymbolTableEntry(SymDRI).n_type); in disassembleObject()
1776 // before same-addressed non-empty sections so that symbol lookups prefer the in disassembleObject()
1777 // non-empty section. in disassembleObject()
1790 for (const auto &ExportEntry : COFFObj->export_directories()) { in disassembleObject()
1801 uint64_t VA = COFFObj->getImageBase() + RVA; in disassembleObject()
1807 --Sec; in disassembleObject()
1808 AllSymbols[Sec->second].emplace_back(VA, Name, ELF::STT_NOTYPE); in disassembleObject()
1823 LiveVariablePrinter LVP(*DT->Context->getRegisterInfo(), *DT->SubtargetInfo); in disassembleObject()
1827 for (const std::unique_ptr<DWARFUnit> &CU : DICtx->compile_units()) in disassembleObject()
1828 LVP.addCompileUnit(CU->getUnitDIE(false)); in disassembleObject()
1839 auto BBAddrMapsOrErr = Elf->readBBAddrMap(SectionIndex, &PGOAnalyses); in disassembleObject()
1852 // For non-relocatable objects, Read all LLVM_BB_ADDR_MAP sections into a in disassembleObject()
1863 if (Error E = BTF->parse(Obj, Opts)) in disassembleObject()
1893 addSymbolizer(*DT->Context, DT->TheTarget, TripleName, DT->DisAsm.get(), in disassembleObject()
1900 // Without --show-all-symbols, also insert one if all symbols at the start in disassembleObject()
1950 SymbolsHere = ArrayRef<SymbolInfoTy>(&Symbols[FirstSI], SI - FirstSI); in disassembleObject()
1984 // So here, we spot whether there's any non-data symbol present at all, in disassembleObject()
1988 // code-related symbol name to go with it. in disassembleObject()
1990 size_t DisplaySymIndex = SymbolsHere.size() - 1; in disassembleObject()
2005 // If the user has given the --disassemble-symbols option, then we must in disassembleObject()
2022 // Symbols array, because that array is pre-sorted in a way intended to in disassembleObject()
2031 // That way, '--show-all-symbols --disassemble-symbol=foo' will print in disassembleObject()
2047 // --stop-address. in disassembleObject()
2053 Start -= SectionAddr; in disassembleObject()
2054 End -= SectionAddr; in disassembleObject()
2092 // See if any of the symbols defined at this location triggers target- in disassembleObject()
2105 Expected<bool> RespondedOrErr = DT->DisAsm->onSymbolStart( in disassembleObject()
2106 Symbol, Size, Bytes.slice(Start, End - Start), SectionAddr + Start); in disassembleObject()
2125 outs() << DT->Context->getAsmInfo()->getCommentString() in disassembleObject()
2131 outs() << DT->Context->getAsmInfo()->getCommentString() in disassembleObject()
2151 Index = std::max<uint64_t>(Index, StartAddress - SectionAddr); in disassembleObject()
2161 uint64_t Offset = RelCur->getOffset() - RelAdjustment; in disassembleObject()
2169 Symbols[SI - 1].XCOFFSymInfo.StorageMappingClass && in disassembleObject()
2170 (*Symbols[SI - 1].XCOFFSymInfo.StorageMappingClass == XCOFF::XMC_PR); in disassembleObject()
2177 collectLocalBranchTargets(Bytes, DT->InstrAnalysis.get(), in disassembleObject()
2178 DT->DisAsm.get(), DT->InstPrinter.get(), in disassembleObject()
2185 if (DT->InstrAnalysis) in disassembleObject()
2186 DT->InstrAnalysis->resetState(); in disassembleObject()
2212 if (It != CHPECodeMap.begin() && Address < (It - 1)->second) { in disassembleObject()
2219 Index = llvm::alignTo(Index, 4); in disassembleObject()
2227 RelOffset = RelCur->getOffset() - RelAdjustment; in disassembleObject()
2247 MappingSymbols, *DT->SubtargetInfo, FOS); in disassembleObject()
2249 // When -z or --disassemble-zeroes are given we always dissasemble in disassembleObject()
2252 uint64_t MaxOffset = End - Index; in disassembleObject()
2253 // For --reloc: print zero blocks patched by relocations, so that in disassembleObject()
2256 MaxOffset = std::min(RelCur->getOffset() - RelAdjustment - Index, in disassembleObject()
2268 doesXCOFFTracebackTableBegin(Bytes.slice(Index, 4))) { in disassembleObject()
2272 *DT->SubtargetInfo, cast<XCOFFObjectFile>(&Obj)); in disassembleObject()
2280 for (const auto &BBLabel : Iter1->second) in disassembleObject()
2286 FOS << "<" << Iter2->second << ">:\n"; in disassembleObject()
2294 bool Disassembled = DT->DisAsm->getInstruction( in disassembleObject()
2299 DT->DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr)); in disassembleObject()
2304 DT->InstPrinter->setCommentStream(CommentStream); in disassembleObject()
2306 DT->Printer->printInst( in disassembleObject()
2307 *DT->InstPrinter, Disassembled ? &Inst : nullptr, in disassembleObject()
2310 "", *DT->SubtargetInfo, &SP, Obj.getFileName(), &Rels, LVP); in disassembleObject()
2312 DT->InstPrinter->setCommentStream(llvm::nulls()); in disassembleObject()
2320 if (Disassembled && DT->InstrAnalysis) { in disassembleObject()
2323 bool PrintTarget = DT->InstrAnalysis->evaluateBranch( in disassembleObject()
2328 DT->InstrAnalysis->evaluateMemoryOperandAddress( in disassembleObject()
2329 Inst, DT->SubtargetInfo.get(), SectionAddr + Index, in disassembleObject()
2347 // In a non-relocatable object, the target may be in any section. in disassembleObject()
2362 --It; in disassembleObject()
2364 TargetSecAddr = It->first; in disassembleObject()
2365 if (It->first != TargetSecAddr) in disassembleObject()
2367 TargetSectionSymbols.push_back(&AllSymbols[It->second]); in disassembleObject()
2385 while (It != TargetSymbols->begin()) { in disassembleObject()
2386 --It; in disassembleObject()
2389 if (!It->IsMappingSymbol) { in disassembleObject()
2404 uint64_t TargetAddress = TargetSym->Addr; in disassembleObject()
2405 uint64_t Disp = Target - TargetAddress; in disassembleObject()
2406 std::string TargetName = Demangle ? demangle(TargetSym->Name) in disassembleObject()
2407 : TargetSym->Name.str(); in disassembleObject()
2412 // On XCOFF, we use relocations, even without -r, so we in disassembleObject()
2422 RelCur->getRawDataRefImpl().p); in disassembleObject()
2423 RelFixedUp = Reloc->isFixupIndicated(); in disassembleObject()
2424 RelocType = Reloc->Type; in disassembleObject()
2428 RelCur->getRawDataRefImpl().p); in disassembleObject()
2429 RelFixedUp = Reloc->isFixupIndicated(); in disassembleObject()
2430 RelocType = Reloc->Type; in disassembleObject()
2444 // If -r was used, this error will be printed later. in disassembleObject()
2486 DT->InstrAnalysis->updateState(Inst, SectionAddr + Index); in disassembleObject()
2487 } else if (!Disassembled && DT->InstrAnalysis) { in disassembleObject()
2488 DT->InstrAnalysis->resetState(); in disassembleObject()
2492 assert(DT->Context->getAsmInfo()); in disassembleObject()
2493 emitPostInstructionInfo(FOS, *DT->Context->getAsmInfo(), in disassembleObject()
2494 *DT->SubtargetInfo, CommentStream.str(), LVP); in disassembleObject()
2503 // When --adjust-vma is used, update the address printed. in disassembleObject()
2504 if (RelCur->getSymbol() != Obj.symbol_end()) { in disassembleObject()
2506 RelCur->getSymbol()->getSection(); in disassembleObject()
2533 if (Obj->symbols().empty()) { in disassembleObject()
2536 if (auto *O = dyn_cast<ObjectFile>(FetchedBinaryOpt->getBinary())) { in disassembleObject()
2537 if (!O->symbols().empty() || in disassembleObject()
2538 (!O->sections().empty() && Obj->sections().empty())) { in disassembleObject()
2549 Expected<SubtargetFeatures> FeaturesValue = Obj->getFeatures(); in disassembleObject()
2551 reportError(FeaturesValue.takeError(), Obj->getFileName()); in disassembleObject()
2556 } else if (MCPU.empty() && Obj->getArch() == llvm::Triple::aarch64) { in disassembleObject()
2561 MCPU = Obj->tryGetCPUName().value_or("").str(); in disassembleObject()
2564 // When disassembling big-endian Arm ELF, the instruction endianness is in disassembleObject()
2568 // flag, in which case instructions are little-endian regardless of data in disassembleObject()
2571 // We must set the big-endian-instructions SubtargetFeature to make the in disassembleObject()
2577 if (Elf32BE && (Elf32BE->isRelocatableObject() || in disassembleObject()
2578 !(Elf32BE->getPlatformFlags() & ELF::EF_ARM_BE8))) { in disassembleObject()
2579 Features.AddFeature("+big-endian-instructions"); in disassembleObject()
2595 if (!PrimaryTarget.SubtargetInfo->checkFeatures("+mclass")) { in disassembleObject()
2596 if (PrimaryTarget.SubtargetInfo->checkFeatures("+thumb-mode")) in disassembleObject()
2597 Features.AddFeature("-thumb-mode"); in disassembleObject()
2599 Features.AddFeature("+thumb-mode"); in disassembleObject()
2603 const chpe_metadata *CHPEMetadata = COFFObj->getCHPEMetadata(); in disassembleObject()
2604 if (CHPEMetadata && CHPEMetadata->CodeMapCount) { in disassembleObject()
2617 reportWarning(Error, Obj->getFileName()); in disassembleObject()
2623 if (!FetchedBinary.getBinary() && !Obj->hasDebugInfo()) { in disassembleObject()
2627 dyn_cast<const ObjectFile>(DebugBinaryOpt->getBinary())) { in disassembleObject()
2628 if (FetchedObj->hasDebugInfo()) { in disassembleObject()
2638 if (!DbgObj->hasDebugInfo()) { in disassembleObject()
2640 DbgObj = objdump::getMachODSymObject(MachOOF, Obj->getFileName(), in disassembleObject()
2647 SourcePrinter SP(DbgObj, TheTarget->getName()); in disassembleObject()
2650 if (!PrimaryTarget.InstPrinter->applyTargetSpecificCLOption(Opt)) in disassembleObject()
2651 reportError(Obj->getFileName(), in disassembleObject()
2659 StringRef Fmt = O.getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64; in printRelocations()
2683 uint32_t OffsetPadding = (O.getBytesInAddress() > 4 ? 16 : 8); in printRelocations()
2721 // whose VMA and LMA are different and/or when --show-lma flag is used.
2775 outs() << format("%3" PRIu64 " %-*s %08" PRIx64 " ", Idx, NameWidth, in printSectionHeaders()
2781 outs() << format("%3" PRIu64 " %-*s %08" PRIx64 " ", Idx, NameWidth, in printSectionHeaders()
2791 StringRef Name = unwrapOrError(Section.getName(), Obj->getFileName()); in printSectionContents()
2809 StringRef Contents = unwrapOrError(Section.getContents(), Obj->getFileName()); in printSectionContents()
2816 if (I != 0 && I % 4 == 0) in printSectionContents()
2819 outs() << hexdigit((Contents[Addr + I] >> 4) & 0xF, true) in printSectionContents()
2863 auto Symbols = ELF->getDynamicSymbolIterators(); in printSymbolTable()
2865 ELF->readDynsymVersions(); in printSymbolTable()
2897 // Don't ask a Mach-O STAB symbol for its section unless you know that in printSymbol()
2904 (MachO->is64Bit() ? MachO->getSymbol64TableEntry(SymDRI).n_type in printSymbol()
2905 : MachO->getSymbolTableEntry(SymDRI).n_type); in printSymbol()
2916 if (Expected<StringRef> NameOrErr = Section->getName()) in printSymbol()
2957 const char *Fmt = O.getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64; in printSymbol()
2960 << GlobLoc // Local -> 'l', Global -> 'g', Neither -> ' ' in printSymbol()
2986 StringRef SectionName = unwrapOrError(Section->getName(), FileName); in printSymbol()
2993 Expected<StringRef> NameOrErr = SymRef->getName(); in printSymbol()
2998 Demangle ? demangle(*NameOrErr) : NameOrErr->str(); in printSymbol()
3028 SymbolVersions[Symbol.getRawDataRefImpl().d.b - 1]; in printSymbol()
3078 /// into llvm-bcanalyzer.
3082 << "The -raw-clang-ast option will dump the raw binary contents of " in printRawClangAST()
3085 "llvm-bcanalyzer.\n"; in printRawClangAST()
3090 if (Obj->isCOFF()) { in printRawClangAST()
3111 unwrapOrError(ClangASTSection->getContents(), Obj->getFileName()); in printRawClangAST()
3118 if (Obj->isELF()) { in printFaultMaps()
3120 } else if (Obj->isMachO()) { in printFaultMaps()
3125 "for ELF and Mach-O executable files.\n"; in printFaultMaps()
3152 unwrapOrError(FaultMapSection->getContents(), Obj->getFileName()); in printFaultMaps()
3164 if (!O->isELF() && !O->isCOFF() && !O->isXCOFF()) in printFileHeaders()
3165 reportError(O->getFileName(), "Invalid/Unsupported object file format"); in printFileHeaders()
3167 Triple::ArchType AT = O->getArch(); in printFileHeaders()
3169 uint64_t Address = unwrapOrError(O->getStartAddress(), O->getFileName()); in printFileHeaders()
3171 StringRef Fmt = O->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64; in printFileHeaders()
3179 WithColor::error(errs(), ToolName) << "ill-formed archive entry.\n"; in printArchiveChild()
3184 outs() << ((Mode & sys::fs::owner_read) ? "r" : "-"); in printArchiveChild()
3185 outs() << ((Mode & sys::fs::owner_write) ? "w" : "-"); in printArchiveChild()
3186 outs() << ((Mode & sys::fs::owner_exe) ? "x" : "-"); in printArchiveChild()
3187 outs() << ((Mode & sys::fs::group_read) ? "r" : "-"); in printArchiveChild()
3188 outs() << ((Mode & sys::fs::group_write) ? "w" : "-"); in printArchiveChild()
3189 outs() << ((Mode & sys::fs::group_exe) ? "x" : "-"); in printArchiveChild()
3190 outs() << ((Mode & sys::fs::others_read) ? "r" : "-"); in printArchiveChild()
3191 outs() << ((Mode & sys::fs::others_write) ? "w" : "-"); in printArchiveChild()
3192 outs() << ((Mode & sys::fs::others_exe) ? "x" : "-"); in printArchiveChild()
3204 << "\" contains non-decimal chars) "; in printArchiveChild()
3227 if (Elf->getEType() != ELF::ET_REL) in shouldWarnForInvalidStartStopAddress()
3238 for (const SectionRef &Section : Obj->sections()) in checkForInvalidStartStopAddress()
3248 Twine::utohexstr(Stop) + " specified by --stop-address", in checkForInvalidStartStopAddress()
3249 Obj->getFileName()); in checkForInvalidStartStopAddress()
3252 Twine::utohexstr(Start) + " specified by --start-address", in checkForInvalidStartStopAddress()
3253 Obj->getFileName()); in checkForInvalidStartStopAddress()
3257 ") specified by --start-address/--stop-address", in checkForInvalidStartStopAddress()
3258 Obj->getFileName()); in checkForInvalidStartStopAddress()
3265 reportError(DumperOrErr.takeError(), O->getFileName(), in dumpObject()
3266 A ? A->getFileName() : ""); in dumpObject()
3275 outs() << A->getFileName() << "(" << O->getFileName() << ")"; in dumpObject()
3277 outs() << O->getFileName(); in dumpObject()
3278 outs() << ":\tfile format " << O->getFileFormatName().lower() << "\n"; in dumpObject()
3288 StringRef ArchiveName = A ? A->getFileName() : ""; in dumpObject()
3307 DICtx->dump(outs(), DumpOpts); in dumpObject()
3320 // Mach-O specific options: in dumpObject()
3343 StringRef ArchiveName = A ? A->getFileName() : ""; in dumpObject()
3348 << ArchiveName << "(" << I->getFileName() << ")" in dumpObject()
3349 << ":\tfile format COFF-import-file" in dumpObject()
3361 unsigned I = -1; in dumpArchive()
3362 for (auto &C : A->children(Err)) { in dumpArchive()
3367 reportError(std::move(E), getFileNameForError(C, I), A->getFileName()); in dumpArchive()
3376 A->getFileName()); in dumpArchive()
3379 reportError(std::move(Err), A->getFileName()); in dumpArchive()
3384 // If we are using the Mach-O specific object file parser, then let it parse in dumpInput()
3385 // the file and process the command line options. So the -arch flags can in dumpInput()
3412 StringRef V(A->getValue()); in parseIntArg()
3414 reportCmdLineError(A->getSpelling() + in parseIntArg()
3415 ": expected a non-negative integer, but got '" + V + in parseIntArg()
3422 StringRef V(A->getValue()); in parseBuildIDArg()
3425 reportCmdLineError(A->getSpelling() + ": expected a build ID, but got '" + in parseBuildIDArg()
3431 reportCmdLineError("'" + StringRef(A->getValue()) + in invalidArgValue()
3432 "' is not a valid value for '" + A->getSpelling() + "'"); in invalidArgValue()
3470 auto Filter = (A->getValue(0) + StringRef(",") + A->getValue(1)).str(); in parseOtoolOptions()
3490 const Option &O = A->getOption(); in parseOtoolOptions()
3512 DwarfDumpType = StringSwitch<DIDumpType>(A->getValue()) in parseObjdumpOptions()
3548 reportCmdLineWarning("--symbolize-operands must be enabled for " in parseObjdumpOptions()
3549 "--pretty-pgo-analysis-map to have an effect"); in parseObjdumpOptions()
3557 DbgVariables = StringSwitch<DebugVarsFormat>(A->getValue()) in parseObjdumpOptions()
3565 DisassemblyColor = StringSwitch<ColorOutput>(A->getValue()) in parseObjdumpOptions()
3578 // Parse -M (--disassembler-options) and deprecated in parseObjdumpOptions()
3579 // --x86-asm-syntax={att,intel}. in parseObjdumpOptions()
3588 switch (A->getOption().getID()) { in parseObjdumpOptions()
3590 AsmSyntax = "--x86-asm-syntax=att"; in parseObjdumpOptions()
3593 AsmSyntax = "--x86-asm-syntax=intel"; in parseObjdumpOptions()
3598 llvm::SplitString(A->getValue(), Values, ","); in parseObjdumpOptions()
3601 AsmSyntax = "--x86-asm-syntax=att"; in parseObjdumpOptions()
3603 AsmSyntax = "--x86-asm-syntax=intel"; in parseObjdumpOptions()
3608 SmallVector<const char *> Args = {"llvm-objdump"}; in parseObjdumpOptions()
3610 Args.push_back(A->getValue()); in parseObjdumpOptions()
3619 std::optional<std::string> Path = BIDFetcher->fetch(BuildID); in parseObjdumpOptions()
3621 reportCmdLineError(A->getSpelling() + ": could not find build ID '" + in parseObjdumpOptions()
3622 A->getValue() + "'"); in parseObjdumpOptions()
3643 // llvm-objdump -> objdump in llvm_objdump_main()
3644 // llvm-otool-10.exe -> otool in llvm_objdump_main()
3645 // powerpc64-unknown-freebsd13-objdump -> objdump in llvm_objdump_main()
3667 T->parseArgs(argc, argv, Unknown, Saver, in llvm_objdump_main()
3671 T->printHelp(ToolName); in llvm_objdump_main()
3675 T->printHelp(ToolName, /*ShowHidden=*/true); in llvm_objdump_main()
3738 T->printHelp(ToolName); in llvm_objdump_main()