1 //===-- llvm-objdump.cpp - Object file dumping utility for llvm -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This program is a utility that works like binutils "objdump", that is, it
11 // dumps out a plethora of information about an object file depending on the
14 // The flags and output of this program should be near identical to those of
17 //===----------------------------------------------------------------------===//
19 #include "llvm-objdump.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/ADT/Triple.h"
24 #include "llvm/CodeGen/FaultMaps.h"
25 #include "llvm/MC/MCAsmInfo.h"
26 #include "llvm/MC/MCContext.h"
27 #include "llvm/MC/MCDisassembler.h"
28 #include "llvm/MC/MCInst.h"
29 #include "llvm/MC/MCInstPrinter.h"
30 #include "llvm/MC/MCInstrAnalysis.h"
31 #include "llvm/MC/MCInstrInfo.h"
32 #include "llvm/MC/MCObjectFileInfo.h"
33 #include "llvm/MC/MCRegisterInfo.h"
34 #include "llvm/MC/MCRelocationInfo.h"
35 #include "llvm/MC/MCSubtargetInfo.h"
36 #include "llvm/Object/Archive.h"
37 #include "llvm/Object/ELFObjectFile.h"
38 #include "llvm/Object/COFF.h"
39 #include "llvm/Object/MachO.h"
40 #include "llvm/Object/ObjectFile.h"
41 #include "llvm/Support/Casting.h"
42 #include "llvm/Support/CommandLine.h"
43 #include "llvm/Support/Debug.h"
44 #include "llvm/Support/Errc.h"
45 #include "llvm/Support/FileSystem.h"
46 #include "llvm/Support/Format.h"
47 #include "llvm/Support/GraphWriter.h"
48 #include "llvm/Support/Host.h"
49 #include "llvm/Support/ManagedStatic.h"
50 #include "llvm/Support/MemoryBuffer.h"
51 #include "llvm/Support/PrettyStackTrace.h"
52 #include "llvm/Support/Signals.h"
53 #include "llvm/Support/SourceMgr.h"
54 #include "llvm/Support/TargetRegistry.h"
55 #include "llvm/Support/TargetSelect.h"
56 #include "llvm/Support/raw_ostream.h"
60 #include <system_error>
63 using namespace object;
65 static cl::list<std::string>
66 InputFilenames(cl::Positional, cl::desc("<input object files>"),cl::ZeroOrMore);
69 llvm::Disassemble("disassemble",
70 cl::desc("Display assembler mnemonics for the machine instructions"));
72 Disassembled("d", cl::desc("Alias for --disassemble"),
73 cl::aliasopt(Disassemble));
76 llvm::Relocations("r", cl::desc("Display the relocation entries in the file"));
79 llvm::SectionContents("s", cl::desc("Display the content of each section"));
82 llvm::SymbolTable("t", cl::desc("Display the symbol table"));
85 llvm::ExportsTrie("exports-trie", cl::desc("Display mach-o exported symbols"));
88 llvm::Rebase("rebase", cl::desc("Display mach-o rebasing info"));
91 llvm::Bind("bind", cl::desc("Display mach-o binding info"));
94 llvm::LazyBind("lazy-bind", cl::desc("Display mach-o lazy binding info"));
97 llvm::WeakBind("weak-bind", cl::desc("Display mach-o weak binding info"));
100 llvm::RawClangAST("raw-clang-ast",
101 cl::desc("Dump the raw binary contents of the clang AST section"));
104 MachOOpt("macho", cl::desc("Use MachO specific object file parser"));
106 MachOm("m", cl::desc("Alias for --macho"), cl::aliasopt(MachOOpt));
109 llvm::TripleName("triple", cl::desc("Target triple to disassemble for, "
110 "see -version for available targets"));
114 cl::desc("Target a specific cpu type (-mcpu=help for details)"),
115 cl::value_desc("cpu-name"),
119 llvm::ArchName("arch-name", cl::desc("Target arch to disassemble for, "
120 "see -version for available targets"));
123 llvm::SectionHeaders("section-headers", cl::desc("Display summaries of the "
124 "headers for each section."));
126 SectionHeadersShort("headers", cl::desc("Alias for --section-headers"),
127 cl::aliasopt(SectionHeaders));
129 SectionHeadersShorter("h", cl::desc("Alias for --section-headers"),
130 cl::aliasopt(SectionHeaders));
132 cl::list<std::string>
133 llvm::MAttrs("mattr",
135 cl::desc("Target specific attributes"),
136 cl::value_desc("a1,+a2,-a3,..."));
139 llvm::NoShowRawInsn("no-show-raw-insn", cl::desc("When disassembling "
140 "instructions, do not print "
141 "the instruction bytes."));
144 llvm::UnwindInfo("unwind-info", cl::desc("Display unwind information"));
147 UnwindInfoShort("u", cl::desc("Alias for --unwind-info"),
148 cl::aliasopt(UnwindInfo));
151 llvm::PrivateHeaders("private-headers",
152 cl::desc("Display format specific file headers"));
155 PrivateHeadersShort("p", cl::desc("Alias for --private-headers"),
156 cl::aliasopt(PrivateHeaders));
159 llvm::PrintImmHex("print-imm-hex",
160 cl::desc("Use hex format for immediate values"));
162 cl::opt<bool> PrintFaultMaps("fault-map-section",
163 cl::desc("Display contents of faultmap section"));
165 static StringRef ToolName;
166 static int ReturnValue = EXIT_SUCCESS;
168 bool llvm::error(std::error_code EC) {
172 outs() << ToolName << ": error reading file: " << EC.message() << ".\n";
174 ReturnValue = EXIT_FAILURE;
178 static void report_error(StringRef File, std::error_code EC) {
180 errs() << ToolName << ": '" << File << "': " << EC.message() << ".\n";
181 ReturnValue = EXIT_FAILURE;
184 static const Target *getTarget(const ObjectFile *Obj = nullptr) {
185 // Figure out the target triple.
186 llvm::Triple TheTriple("unknown-unknown-unknown");
187 if (TripleName.empty()) {
189 TheTriple.setArch(Triple::ArchType(Obj->getArch()));
190 // TheTriple defaults to ELF, and COFF doesn't have an environment:
191 // the best we can do here is indicate that it is mach-o.
193 TheTriple.setObjectFormat(Triple::MachO);
196 const auto COFFObj = dyn_cast<COFFObjectFile>(Obj);
197 if (COFFObj->getArch() == Triple::thumb)
198 TheTriple.setTriple("thumbv7-windows");
202 TheTriple.setTriple(Triple::normalize(TripleName));
204 // Get the target specific parser.
206 const Target *TheTarget = TargetRegistry::lookupTarget(ArchName, TheTriple,
209 errs() << ToolName << ": " << Error;
213 // Update the triple name and return the found target.
214 TripleName = TheTriple.getTriple();
218 bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) {
219 return a.getOffset() < b.getOffset();
223 class PrettyPrinter {
225 virtual ~PrettyPrinter(){}
226 virtual void printInst(MCInstPrinter &IP, const MCInst *MI,
227 ArrayRef<uint8_t> Bytes, uint64_t Address,
228 raw_ostream &OS, StringRef Annot,
229 MCSubtargetInfo const &STI) {
230 outs() << format("%8" PRIx64 ":", Address);
231 if (!NoShowRawInsn) {
233 dumpBytes(Bytes, outs());
235 IP.printInst(MI, outs(), "", STI);
238 PrettyPrinter PrettyPrinterInst;
239 class HexagonPrettyPrinter : public PrettyPrinter {
241 void printLead(ArrayRef<uint8_t> Bytes, uint64_t Address,
244 (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | Bytes[0];
245 OS << format("%8" PRIx64 ":", Address);
246 if (!NoShowRawInsn) {
248 dumpBytes(Bytes.slice(0, 4), OS);
249 OS << format("%08" PRIx32, opcode);
252 void printInst(MCInstPrinter &IP, const MCInst *MI,
253 ArrayRef<uint8_t> Bytes, uint64_t Address,
254 raw_ostream &OS, StringRef Annot,
255 MCSubtargetInfo const &STI) override {
258 raw_string_ostream TempStream(Buffer);
259 IP.printInst(MI, TempStream, "", STI);
261 StringRef Contents(Buffer);
262 // Split off bundle attributes
263 auto PacketBundle = Contents.rsplit('\n');
264 // Split off first instruction from the rest
265 auto HeadTail = PacketBundle.first.split('\n');
266 auto Preamble = " { ";
268 while(!HeadTail.first.empty()) {
271 printLead(Bytes, Address, OS);
275 auto Duplex = HeadTail.first.split('\v');
276 if(!Duplex.second.empty()){
279 Inst = Duplex.second;
282 Inst = HeadTail.first;
284 Bytes = Bytes.slice(4);
286 HeadTail = HeadTail.second.split('\n');
288 OS << " } " << PacketBundle.second;
291 HexagonPrettyPrinter HexagonPrettyPrinterInst;
292 PrettyPrinter &selectPrettyPrinter(Triple const &Triple) {
293 switch(Triple.getArch()) {
295 return PrettyPrinterInst;
296 case Triple::hexagon:
297 return HexagonPrettyPrinterInst;
302 template <class ELFT>
303 static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
305 SmallVectorImpl<char> &Result) {
306 typedef typename ELFObjectFile<ELFT>::Elf_Sym Elf_Sym;
307 typedef typename ELFObjectFile<ELFT>::Elf_Shdr Elf_Shdr;
308 typedef typename ELFObjectFile<ELFT>::Elf_Rel Elf_Rel;
309 typedef typename ELFObjectFile<ELFT>::Elf_Rela Elf_Rela;
311 const ELFFile<ELFT> &EF = *Obj->getELFFile();
313 ErrorOr<const Elf_Shdr *> SecOrErr = EF.getSection(Rel.d.a);
314 if (std::error_code EC = SecOrErr.getError())
316 const Elf_Shdr *Sec = *SecOrErr;
317 ErrorOr<const Elf_Shdr *> SymTabOrErr = EF.getSection(Sec->sh_link);
318 if (std::error_code EC = SymTabOrErr.getError())
320 const Elf_Shdr *SymTab = *SymTabOrErr;
321 assert(SymTab->sh_type == ELF::SHT_SYMTAB ||
322 SymTab->sh_type == ELF::SHT_DYNSYM);
323 ErrorOr<const Elf_Shdr *> StrTabSec = EF.getSection(SymTab->sh_link);
324 if (std::error_code EC = StrTabSec.getError())
326 ErrorOr<StringRef> StrTabOrErr = EF.getStringTable(*StrTabSec);
327 if (std::error_code EC = StrTabOrErr.getError())
329 StringRef StrTab = *StrTabOrErr;
333 uint16_t symbol_index = 0;
334 switch (Sec->sh_type) {
336 return object_error::parse_failed;
338 const Elf_Rel *ERel = Obj->getRel(Rel);
339 type = ERel->getType(EF.isMips64EL());
340 symbol_index = ERel->getSymbol(EF.isMips64EL());
341 // TODO: Read implicit addend from section data.
344 case ELF::SHT_RELA: {
345 const Elf_Rela *ERela = Obj->getRela(Rel);
346 type = ERela->getType(EF.isMips64EL());
347 symbol_index = ERela->getSymbol(EF.isMips64EL());
348 addend = ERela->r_addend;
352 const Elf_Sym *symb =
353 EF.template getEntry<Elf_Sym>(Sec->sh_link, symbol_index);
355 ErrorOr<const Elf_Shdr *> SymSec = EF.getSection(symb);
356 if (std::error_code EC = SymSec.getError())
358 if (symb->getType() == ELF::STT_SECTION) {
359 ErrorOr<StringRef> SecName = EF.getSectionName(*SymSec);
360 if (std::error_code EC = SecName.getError())
364 ErrorOr<StringRef> SymName = symb->getName(StrTab);
366 return SymName.getError();
369 switch (EF.getHeader()->e_machine) {
372 case ELF::R_X86_64_PC8:
373 case ELF::R_X86_64_PC16:
374 case ELF::R_X86_64_PC32: {
376 raw_string_ostream fmt(fmtbuf);
377 fmt << Target << (addend < 0 ? "" : "+") << addend << "-P";
379 Result.append(fmtbuf.begin(), fmtbuf.end());
381 case ELF::R_X86_64_8:
382 case ELF::R_X86_64_16:
383 case ELF::R_X86_64_32:
384 case ELF::R_X86_64_32S:
385 case ELF::R_X86_64_64: {
387 raw_string_ostream fmt(fmtbuf);
388 fmt << Target << (addend < 0 ? "" : "+") << addend;
390 Result.append(fmtbuf.begin(), fmtbuf.end());
396 case ELF::EM_AARCH64: {
398 raw_string_ostream fmt(fmtbuf);
401 fmt << (addend < 0 ? "" : "+") << addend;
403 Result.append(fmtbuf.begin(), fmtbuf.end());
408 case ELF::EM_HEXAGON:
416 Result.append(res.begin(), res.end());
417 return std::error_code();
420 static std::error_code getRelocationValueString(const ELFObjectFileBase *Obj,
421 const RelocationRef &RelRef,
422 SmallVectorImpl<char> &Result) {
423 DataRefImpl Rel = RelRef.getRawDataRefImpl();
424 if (auto *ELF32LE = dyn_cast<ELF32LEObjectFile>(Obj))
425 return getRelocationValueString(ELF32LE, Rel, Result);
426 if (auto *ELF64LE = dyn_cast<ELF64LEObjectFile>(Obj))
427 return getRelocationValueString(ELF64LE, Rel, Result);
428 if (auto *ELF32BE = dyn_cast<ELF32BEObjectFile>(Obj))
429 return getRelocationValueString(ELF32BE, Rel, Result);
430 auto *ELF64BE = cast<ELF64BEObjectFile>(Obj);
431 return getRelocationValueString(ELF64BE, Rel, Result);
434 static std::error_code getRelocationValueString(const COFFObjectFile *Obj,
435 const RelocationRef &Rel,
436 SmallVectorImpl<char> &Result) {
437 symbol_iterator SymI = Rel.getSymbol();
438 ErrorOr<StringRef> SymNameOrErr = SymI->getName();
439 if (std::error_code EC = SymNameOrErr.getError())
441 StringRef SymName = *SymNameOrErr;
442 Result.append(SymName.begin(), SymName.end());
443 return std::error_code();
446 static void printRelocationTargetName(const MachOObjectFile *O,
447 const MachO::any_relocation_info &RE,
448 raw_string_ostream &fmt) {
449 bool IsScattered = O->isRelocationScattered(RE);
451 // Target of a scattered relocation is an address. In the interest of
452 // generating pretty output, scan through the symbol table looking for a
453 // symbol that aligns with that address. If we find one, print it.
454 // Otherwise, we just print the hex address of the target.
456 uint32_t Val = O->getPlainRelocationSymbolNum(RE);
458 for (const SymbolRef &Symbol : O->symbols()) {
460 ErrorOr<uint64_t> Addr = Symbol.getAddress();
461 if ((ec = Addr.getError()))
462 report_fatal_error(ec.message());
465 ErrorOr<StringRef> Name = Symbol.getName();
466 if (std::error_code EC = Name.getError())
467 report_fatal_error(EC.message());
472 // If we couldn't find a symbol that this relocation refers to, try
473 // to find a section beginning instead.
474 for (const SectionRef &Section : O->sections()) {
478 uint64_t Addr = Section.getAddress();
481 if ((ec = Section.getName(Name)))
482 report_fatal_error(ec.message());
487 fmt << format("0x%x", Val);
492 bool isExtern = O->getPlainRelocationExternal(RE);
493 uint64_t Val = O->getPlainRelocationSymbolNum(RE);
496 symbol_iterator SI = O->symbol_begin();
498 ErrorOr<StringRef> SOrErr = SI->getName();
499 if (!error(SOrErr.getError()))
502 section_iterator SI = O->section_begin();
503 // Adjust for the fact that sections are 1-indexed.
504 advance(SI, Val - 1);
511 static std::error_code getRelocationValueString(const MachOObjectFile *Obj,
512 const RelocationRef &RelRef,
513 SmallVectorImpl<char> &Result) {
514 DataRefImpl Rel = RelRef.getRawDataRefImpl();
515 MachO::any_relocation_info RE = Obj->getRelocation(Rel);
517 unsigned Arch = Obj->getArch();
520 raw_string_ostream fmt(fmtbuf);
521 unsigned Type = Obj->getAnyRelocationType(RE);
522 bool IsPCRel = Obj->getAnyRelocationPCRel(RE);
524 // Determine any addends that should be displayed with the relocation.
525 // These require decoding the relocation type, which is triple-specific.
527 // X86_64 has entirely custom relocation types.
528 if (Arch == Triple::x86_64) {
529 bool isPCRel = Obj->getAnyRelocationPCRel(RE);
532 case MachO::X86_64_RELOC_GOT_LOAD:
533 case MachO::X86_64_RELOC_GOT: {
534 printRelocationTargetName(Obj, RE, fmt);
540 case MachO::X86_64_RELOC_SUBTRACTOR: {
541 DataRefImpl RelNext = Rel;
542 Obj->moveRelocationNext(RelNext);
543 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext);
545 // X86_64_RELOC_SUBTRACTOR must be followed by a relocation of type
546 // X86_64_RELOC_UNSIGNED.
547 // NOTE: Scattered relocations don't exist on x86_64.
548 unsigned RType = Obj->getAnyRelocationType(RENext);
549 if (RType != MachO::X86_64_RELOC_UNSIGNED)
550 report_fatal_error("Expected X86_64_RELOC_UNSIGNED after "
551 "X86_64_RELOC_SUBTRACTOR.");
553 // The X86_64_RELOC_UNSIGNED contains the minuend symbol;
554 // X86_64_RELOC_SUBTRACTOR contains the subtrahend.
555 printRelocationTargetName(Obj, RENext, fmt);
557 printRelocationTargetName(Obj, RE, fmt);
560 case MachO::X86_64_RELOC_TLV:
561 printRelocationTargetName(Obj, RE, fmt);
566 case MachO::X86_64_RELOC_SIGNED_1:
567 printRelocationTargetName(Obj, RE, fmt);
570 case MachO::X86_64_RELOC_SIGNED_2:
571 printRelocationTargetName(Obj, RE, fmt);
574 case MachO::X86_64_RELOC_SIGNED_4:
575 printRelocationTargetName(Obj, RE, fmt);
579 printRelocationTargetName(Obj, RE, fmt);
582 // X86 and ARM share some relocation types in common.
583 } else if (Arch == Triple::x86 || Arch == Triple::arm ||
584 Arch == Triple::ppc) {
585 // Generic relocation types...
587 case MachO::GENERIC_RELOC_PAIR: // prints no info
588 return std::error_code();
589 case MachO::GENERIC_RELOC_SECTDIFF: {
590 DataRefImpl RelNext = Rel;
591 Obj->moveRelocationNext(RelNext);
592 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext);
594 // X86 sect diff's must be followed by a relocation of type
595 // GENERIC_RELOC_PAIR.
596 unsigned RType = Obj->getAnyRelocationType(RENext);
598 if (RType != MachO::GENERIC_RELOC_PAIR)
599 report_fatal_error("Expected GENERIC_RELOC_PAIR after "
600 "GENERIC_RELOC_SECTDIFF.");
602 printRelocationTargetName(Obj, RE, fmt);
604 printRelocationTargetName(Obj, RENext, fmt);
609 if (Arch == Triple::x86 || Arch == Triple::ppc) {
611 case MachO::GENERIC_RELOC_LOCAL_SECTDIFF: {
612 DataRefImpl RelNext = Rel;
613 Obj->moveRelocationNext(RelNext);
614 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext);
616 // X86 sect diff's must be followed by a relocation of type
617 // GENERIC_RELOC_PAIR.
618 unsigned RType = Obj->getAnyRelocationType(RENext);
619 if (RType != MachO::GENERIC_RELOC_PAIR)
620 report_fatal_error("Expected GENERIC_RELOC_PAIR after "
621 "GENERIC_RELOC_LOCAL_SECTDIFF.");
623 printRelocationTargetName(Obj, RE, fmt);
625 printRelocationTargetName(Obj, RENext, fmt);
628 case MachO::GENERIC_RELOC_TLV: {
629 printRelocationTargetName(Obj, RE, fmt);
636 printRelocationTargetName(Obj, RE, fmt);
638 } else { // ARM-specific relocations
640 case MachO::ARM_RELOC_HALF:
641 case MachO::ARM_RELOC_HALF_SECTDIFF: {
642 // Half relocations steal a bit from the length field to encode
643 // whether this is an upper16 or a lower16 relocation.
644 bool isUpper = Obj->getAnyRelocationLength(RE) >> 1;
650 printRelocationTargetName(Obj, RE, fmt);
652 DataRefImpl RelNext = Rel;
653 Obj->moveRelocationNext(RelNext);
654 MachO::any_relocation_info RENext = Obj->getRelocation(RelNext);
656 // ARM half relocs must be followed by a relocation of type
658 unsigned RType = Obj->getAnyRelocationType(RENext);
659 if (RType != MachO::ARM_RELOC_PAIR)
660 report_fatal_error("Expected ARM_RELOC_PAIR after "
663 // NOTE: The half of the target virtual address is stashed in the
664 // address field of the secondary relocation, but we can't reverse
665 // engineer the constant offset from it without decoding the movw/movt
666 // instruction to find the other half in its immediate field.
668 // ARM_RELOC_HALF_SECTDIFF encodes the second section in the
669 // symbol/section pointer of the follow-on relocation.
670 if (Type == MachO::ARM_RELOC_HALF_SECTDIFF) {
672 printRelocationTargetName(Obj, RENext, fmt);
678 default: { printRelocationTargetName(Obj, RE, fmt); }
682 printRelocationTargetName(Obj, RE, fmt);
685 Result.append(fmtbuf.begin(), fmtbuf.end());
686 return std::error_code();
689 static std::error_code getRelocationValueString(const RelocationRef &Rel,
690 SmallVectorImpl<char> &Result) {
691 const ObjectFile *Obj = Rel.getObject();
692 if (auto *ELF = dyn_cast<ELFObjectFileBase>(Obj))
693 return getRelocationValueString(ELF, Rel, Result);
694 if (auto *COFF = dyn_cast<COFFObjectFile>(Obj))
695 return getRelocationValueString(COFF, Rel, Result);
696 auto *MachO = cast<MachOObjectFile>(Obj);
697 return getRelocationValueString(MachO, Rel, Result);
700 /// @brief Indicates whether this relocation should hidden when listing
701 /// relocations, usually because it is the trailing part of a multipart
702 /// relocation that will be printed as part of the leading relocation.
703 static bool getHidden(RelocationRef RelRef) {
704 const ObjectFile *Obj = RelRef.getObject();
705 auto *MachO = dyn_cast<MachOObjectFile>(Obj);
709 unsigned Arch = MachO->getArch();
710 DataRefImpl Rel = RelRef.getRawDataRefImpl();
711 uint64_t Type = MachO->getRelocationType(Rel);
713 // On arches that use the generic relocations, GENERIC_RELOC_PAIR
715 if (Arch == Triple::x86 || Arch == Triple::arm || Arch == Triple::ppc) {
716 if (Type == MachO::GENERIC_RELOC_PAIR)
718 } else if (Arch == Triple::x86_64) {
719 // On x86_64, X86_64_RELOC_UNSIGNED is hidden only when it follows
720 // an X86_64_RELOC_SUBTRACTOR.
721 if (Type == MachO::X86_64_RELOC_UNSIGNED && Rel.d.a > 0) {
722 DataRefImpl RelPrev = Rel;
724 uint64_t PrevType = MachO->getRelocationType(RelPrev);
725 if (PrevType == MachO::X86_64_RELOC_SUBTRACTOR)
733 static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
734 const Target *TheTarget = getTarget(Obj);
735 // getTarget() will have already issued a diagnostic if necessary, so
736 // just bail here if it failed.
740 // Package up features to be passed to target/subtarget
741 std::string FeaturesStr;
743 SubtargetFeatures Features;
744 for (unsigned i = 0; i != MAttrs.size(); ++i)
745 Features.AddFeature(MAttrs[i]);
746 FeaturesStr = Features.getString();
749 std::unique_ptr<const MCRegisterInfo> MRI(
750 TheTarget->createMCRegInfo(TripleName));
752 errs() << "error: no register info for target " << TripleName << "\n";
756 // Set up disassembler.
757 std::unique_ptr<const MCAsmInfo> AsmInfo(
758 TheTarget->createMCAsmInfo(*MRI, TripleName));
760 errs() << "error: no assembly info for target " << TripleName << "\n";
764 std::unique_ptr<const MCSubtargetInfo> STI(
765 TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
767 errs() << "error: no subtarget info for target " << TripleName << "\n";
771 std::unique_ptr<const MCInstrInfo> MII(TheTarget->createMCInstrInfo());
773 errs() << "error: no instruction info for target " << TripleName << "\n";
777 std::unique_ptr<const MCObjectFileInfo> MOFI(new MCObjectFileInfo);
778 MCContext Ctx(AsmInfo.get(), MRI.get(), MOFI.get());
780 std::unique_ptr<MCDisassembler> DisAsm(
781 TheTarget->createMCDisassembler(*STI, Ctx));
784 errs() << "error: no disassembler for target " << TripleName << "\n";
788 std::unique_ptr<const MCInstrAnalysis> MIA(
789 TheTarget->createMCInstrAnalysis(MII.get()));
791 int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
792 std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
793 Triple(TripleName), AsmPrinterVariant, *AsmInfo, *MII, *MRI));
795 errs() << "error: no instruction printer for target " << TripleName
799 IP->setPrintImmHex(PrintImmHex);
800 PrettyPrinter &PIP = selectPrettyPrinter(Triple(TripleName));
802 StringRef Fmt = Obj->getBytesInAddress() > 4 ? "\t\t%016" PRIx64 ": " :
803 "\t\t\t%08" PRIx64 ": ";
805 // Create a mapping, RelocSecs = SectionRelocMap[S], where sections
806 // in RelocSecs contain the relocations for section S.
808 std::map<SectionRef, SmallVector<SectionRef, 1>> SectionRelocMap;
809 for (const SectionRef &Section : Obj->sections()) {
810 section_iterator Sec2 = Section.getRelocatedSection();
811 if (Sec2 != Obj->section_end())
812 SectionRelocMap[*Sec2].push_back(Section);
815 // Create a mapping from virtual address to symbol name. This is used to
816 // pretty print the target of a call.
817 std::vector<std::pair<uint64_t, StringRef>> AllSymbols;
819 for (const SymbolRef &Symbol : Obj->symbols()) {
820 ErrorOr<uint64_t> AddressOrErr = Symbol.getAddress();
821 if (error(AddressOrErr.getError()))
823 uint64_t Address = *AddressOrErr;
825 ErrorOr<StringRef> Name = Symbol.getName();
826 if (error(Name.getError()))
830 AllSymbols.push_back(std::make_pair(Address, *Name));
833 array_pod_sort(AllSymbols.begin(), AllSymbols.end());
836 for (const SectionRef &Section : Obj->sections()) {
837 if (!Section.isText() || Section.isVirtual())
840 uint64_t SectionAddr = Section.getAddress();
841 uint64_t SectSize = Section.getSize();
845 // Make a list of all the symbols in this section.
846 std::vector<std::pair<uint64_t, StringRef>> Symbols;
847 for (const SymbolRef &Symbol : Obj->symbols()) {
848 if (Section.containsSymbol(Symbol)) {
849 ErrorOr<uint64_t> AddressOrErr = Symbol.getAddress();
850 if (error(AddressOrErr.getError()))
852 uint64_t Address = *AddressOrErr;
853 Address -= SectionAddr;
854 if (Address >= SectSize)
857 ErrorOr<StringRef> Name = Symbol.getName();
858 if (error(Name.getError()))
860 Symbols.push_back(std::make_pair(Address, *Name));
864 // Sort the symbols by address, just in case they didn't come in that way.
865 array_pod_sort(Symbols.begin(), Symbols.end());
867 // Make a list of all the relocations for this section.
868 std::vector<RelocationRef> Rels;
870 for (const SectionRef &RelocSec : SectionRelocMap[Section]) {
871 for (const RelocationRef &Reloc : RelocSec.relocations()) {
872 Rels.push_back(Reloc);
877 // Sort relocations by address.
878 std::sort(Rels.begin(), Rels.end(), RelocAddressLess);
880 StringRef SegmentName = "";
881 if (const MachOObjectFile *MachO = dyn_cast<const MachOObjectFile>(Obj)) {
882 DataRefImpl DR = Section.getRawDataRefImpl();
883 SegmentName = MachO->getSectionFinalSegmentName(DR);
886 if (error(Section.getName(name)))
888 outs() << "Disassembly of section ";
889 if (!SegmentName.empty())
890 outs() << SegmentName << ",";
891 outs() << name << ':';
893 // If the section has no symbol at the start, just insert a dummy one.
894 if (Symbols.empty() || Symbols[0].first != 0)
895 Symbols.insert(Symbols.begin(), std::make_pair(0, name));
897 SmallString<40> Comments;
898 raw_svector_ostream CommentStream(Comments);
901 if (error(Section.getContents(BytesStr)))
903 ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(BytesStr.data()),
909 std::vector<RelocationRef>::const_iterator rel_cur = Rels.begin();
910 std::vector<RelocationRef>::const_iterator rel_end = Rels.end();
911 // Disassemble symbol by symbol.
912 for (unsigned si = 0, se = Symbols.size(); si != se; ++si) {
914 uint64_t Start = Symbols[si].first;
915 // The end is either the section end or the beginning of the next symbol.
916 uint64_t End = (si == se - 1) ? SectSize : Symbols[si + 1].first;
917 // If this symbol has the same address as the next symbol, then skip it.
921 outs() << '\n' << Symbols[si].second << ":\n";
924 raw_ostream &DebugOut = DebugFlag ? dbgs() : nulls();
926 raw_ostream &DebugOut = nulls();
929 for (Index = Start; Index < End; Index += Size) {
932 if (DisAsm->getInstruction(Inst, Size, Bytes.slice(Index),
933 SectionAddr + Index, DebugOut,
935 PIP.printInst(*IP, &Inst,
936 Bytes.slice(Index, Size),
937 SectionAddr + Index, outs(), "", *STI);
938 outs() << CommentStream.str();
940 if (MIA && (MIA->isCall(Inst) || MIA->isUnconditionalBranch(Inst))) {
942 if (MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target)) {
943 const auto &TargetSym =
944 std::lower_bound(AllSymbols.begin(), AllSymbols.end(),
945 std::make_pair(Target, StringRef()));
946 if (TargetSym != AllSymbols.end()) {
947 outs() << " <" << TargetSym->second;
948 uint64_t Disp = TargetSym->first - Target;
950 outs() << '-' << Disp;
957 errs() << ToolName << ": warning: invalid instruction encoding\n";
959 Size = 1; // skip illegible bytes
962 // Print relocation for instruction.
963 while (rel_cur != rel_end) {
964 bool hidden = getHidden(*rel_cur);
965 uint64_t addr = rel_cur->getOffset();
966 SmallString<16> name;
969 // If this relocation is hidden, skip it.
970 if (hidden) goto skip_print_rel;
972 // Stop when rel_cur's address is past the current instruction.
973 if (addr >= Index + Size) break;
974 rel_cur->getTypeName(name);
975 if (error(getRelocationValueString(*rel_cur, val)))
977 outs() << format(Fmt.data(), SectionAddr + addr) << name
978 << "\t" << val << "\n";
988 void llvm::PrintRelocations(const ObjectFile *Obj) {
989 StringRef Fmt = Obj->getBytesInAddress() > 4 ? "%016" PRIx64 :
991 // Regular objdump doesn't print relocations in non-relocatable object
993 if (!Obj->isRelocatableObject())
996 for (const SectionRef &Section : Obj->sections()) {
997 if (Section.relocation_begin() == Section.relocation_end())
1000 if (error(Section.getName(secname)))
1002 outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n";
1003 for (const RelocationRef &Reloc : Section.relocations()) {
1004 bool hidden = getHidden(Reloc);
1005 uint64_t address = Reloc.getOffset();
1006 SmallString<32> relocname;
1007 SmallString<32> valuestr;
1010 Reloc.getTypeName(relocname);
1011 if (error(getRelocationValueString(Reloc, valuestr)))
1013 outs() << format(Fmt.data(), address) << " " << relocname << " "
1014 << valuestr << "\n";
1020 void llvm::PrintSectionHeaders(const ObjectFile *Obj) {
1021 outs() << "Sections:\n"
1022 "Idx Name Size Address Type\n";
1024 for (const SectionRef &Section : Obj->sections()) {
1026 if (error(Section.getName(Name)))
1028 uint64_t Address = Section.getAddress();
1029 uint64_t Size = Section.getSize();
1030 bool Text = Section.isText();
1031 bool Data = Section.isData();
1032 bool BSS = Section.isBSS();
1033 std::string Type = (std::string(Text ? "TEXT " : "") +
1034 (Data ? "DATA " : "") + (BSS ? "BSS" : ""));
1035 outs() << format("%3d %-13s %08" PRIx64 " %016" PRIx64 " %s\n", i,
1036 Name.str().c_str(), Size, Address, Type.c_str());
1041 void llvm::PrintSectionContents(const ObjectFile *Obj) {
1043 for (const SectionRef &Section : Obj->sections()) {
1046 if (error(Section.getName(Name)))
1048 uint64_t BaseAddr = Section.getAddress();
1049 uint64_t Size = Section.getSize();
1053 outs() << "Contents of section " << Name << ":\n";
1054 if (Section.isBSS()) {
1055 outs() << format("<skipping contents of bss section at [%04" PRIx64
1056 ", %04" PRIx64 ")>\n",
1057 BaseAddr, BaseAddr + Size);
1061 if (error(Section.getContents(Contents)))
1064 // Dump out the content as hex and printable ascii characters.
1065 for (std::size_t addr = 0, end = Contents.size(); addr < end; addr += 16) {
1066 outs() << format(" %04" PRIx64 " ", BaseAddr + addr);
1067 // Dump line of hex.
1068 for (std::size_t i = 0; i < 16; ++i) {
1069 if (i != 0 && i % 4 == 0)
1072 outs() << hexdigit((Contents[addr + i] >> 4) & 0xF, true)
1073 << hexdigit(Contents[addr + i] & 0xF, true);
1079 for (std::size_t i = 0; i < 16 && addr + i < end; ++i) {
1080 if (std::isprint(static_cast<unsigned char>(Contents[addr + i]) & 0xFF))
1081 outs() << Contents[addr + i];
1090 static void PrintCOFFSymbolTable(const COFFObjectFile *coff) {
1091 for (unsigned SI = 0, SE = coff->getNumberOfSymbols(); SI != SE; ++SI) {
1092 ErrorOr<COFFSymbolRef> Symbol = coff->getSymbol(SI);
1094 if (error(Symbol.getError()))
1097 if (error(coff->getSymbolName(*Symbol, Name)))
1100 outs() << "[" << format("%2d", SI) << "]"
1101 << "(sec " << format("%2d", int(Symbol->getSectionNumber())) << ")"
1102 << "(fl 0x00)" // Flag bits, which COFF doesn't have.
1103 << "(ty " << format("%3x", unsigned(Symbol->getType())) << ")"
1104 << "(scl " << format("%3x", unsigned(Symbol->getStorageClass())) << ") "
1105 << "(nx " << unsigned(Symbol->getNumberOfAuxSymbols()) << ") "
1106 << "0x" << format("%08x", unsigned(Symbol->getValue())) << " "
1109 for (unsigned AI = 0, AE = Symbol->getNumberOfAuxSymbols(); AI < AE; ++AI, ++SI) {
1110 if (Symbol->isSectionDefinition()) {
1111 const coff_aux_section_definition *asd;
1112 if (error(coff->getAuxSymbol<coff_aux_section_definition>(SI + 1, asd)))
1115 int32_t AuxNumber = asd->getNumber(Symbol->isBigObj());
1118 << format("scnlen 0x%x nreloc %d nlnno %d checksum 0x%x "
1119 , unsigned(asd->Length)
1120 , unsigned(asd->NumberOfRelocations)
1121 , unsigned(asd->NumberOfLinenumbers)
1122 , unsigned(asd->CheckSum))
1123 << format("assoc %d comdat %d\n"
1124 , unsigned(AuxNumber)
1125 , unsigned(asd->Selection));
1126 } else if (Symbol->isFileRecord()) {
1127 const char *FileName;
1128 if (error(coff->getAuxSymbol<char>(SI + 1, FileName)))
1131 StringRef Name(FileName, Symbol->getNumberOfAuxSymbols() *
1132 coff->getSymbolTableEntrySize());
1133 outs() << "AUX " << Name.rtrim(StringRef("\0", 1)) << '\n';
1135 SI = SI + Symbol->getNumberOfAuxSymbols();
1138 outs() << "AUX Unknown\n";
1144 void llvm::PrintSymbolTable(const ObjectFile *o) {
1145 outs() << "SYMBOL TABLE:\n";
1147 if (const COFFObjectFile *coff = dyn_cast<const COFFObjectFile>(o)) {
1148 PrintCOFFSymbolTable(coff);
1151 for (const SymbolRef &Symbol : o->symbols()) {
1152 ErrorOr<uint64_t> AddressOrError = Symbol.getAddress();
1153 if (error(AddressOrError.getError()))
1155 uint64_t Address = *AddressOrError;
1156 SymbolRef::Type Type = Symbol.getType();
1157 uint32_t Flags = Symbol.getFlags();
1158 section_iterator Section = o->section_end();
1159 if (error(Symbol.getSection(Section)))
1162 if (Type == SymbolRef::ST_Debug && Section != o->section_end()) {
1163 Section->getName(Name);
1165 ErrorOr<StringRef> NameOrErr = Symbol.getName();
1166 if (error(NameOrErr.getError()))
1171 bool Global = Flags & SymbolRef::SF_Global;
1172 bool Weak = Flags & SymbolRef::SF_Weak;
1173 bool Absolute = Flags & SymbolRef::SF_Absolute;
1174 bool Common = Flags & SymbolRef::SF_Common;
1175 bool Hidden = Flags & SymbolRef::SF_Hidden;
1178 if (Type != SymbolRef::ST_Unknown)
1179 GlobLoc = Global ? 'g' : 'l';
1180 char Debug = (Type == SymbolRef::ST_Debug || Type == SymbolRef::ST_File)
1182 char FileFunc = ' ';
1183 if (Type == SymbolRef::ST_File)
1185 else if (Type == SymbolRef::ST_Function)
1188 const char *Fmt = o->getBytesInAddress() > 4 ? "%016" PRIx64 :
1191 outs() << format(Fmt, Address) << " "
1192 << GlobLoc // Local -> 'l', Global -> 'g', Neither -> ' '
1193 << (Weak ? 'w' : ' ') // Weak?
1194 << ' ' // Constructor. Not supported yet.
1195 << ' ' // Warning. Not supported yet.
1196 << ' ' // Indirect reference to another symbol.
1197 << Debug // Debugging (d) or dynamic (D) symbol.
1198 << FileFunc // Name of function (F), file (f) or object (O).
1202 } else if (Common) {
1204 } else if (Section == o->section_end()) {
1207 if (const MachOObjectFile *MachO =
1208 dyn_cast<const MachOObjectFile>(o)) {
1209 DataRefImpl DR = Section->getRawDataRefImpl();
1210 StringRef SegmentName = MachO->getSectionFinalSegmentName(DR);
1211 outs() << SegmentName << ",";
1213 StringRef SectionName;
1214 if (error(Section->getName(SectionName)))
1216 outs() << SectionName;
1220 if (Common || isa<ELFObjectFileBase>(o)) {
1222 Common ? Symbol.getAlignment() : ELFSymbolRef(Symbol).getSize();
1223 outs() << format("\t %08" PRIx64 " ", Val);
1227 outs() << ".hidden ";
1234 static void PrintUnwindInfo(const ObjectFile *o) {
1235 outs() << "Unwind info:\n\n";
1237 if (const COFFObjectFile *coff = dyn_cast<COFFObjectFile>(o)) {
1238 printCOFFUnwindInfo(coff);
1239 } else if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1240 printMachOUnwindInfo(MachO);
1242 // TODO: Extract DWARF dump tool to objdump.
1243 errs() << "This operation is only currently supported "
1244 "for COFF and MachO object files.\n";
1249 void llvm::printExportsTrie(const ObjectFile *o) {
1250 outs() << "Exports trie:\n";
1251 if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1252 printMachOExportsTrie(MachO);
1254 errs() << "This operation is only currently supported "
1255 "for Mach-O executable files.\n";
1260 void llvm::printRebaseTable(const ObjectFile *o) {
1261 outs() << "Rebase table:\n";
1262 if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1263 printMachORebaseTable(MachO);
1265 errs() << "This operation is only currently supported "
1266 "for Mach-O executable files.\n";
1271 void llvm::printBindTable(const ObjectFile *o) {
1272 outs() << "Bind table:\n";
1273 if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1274 printMachOBindTable(MachO);
1276 errs() << "This operation is only currently supported "
1277 "for Mach-O executable files.\n";
1282 void llvm::printLazyBindTable(const ObjectFile *o) {
1283 outs() << "Lazy bind table:\n";
1284 if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1285 printMachOLazyBindTable(MachO);
1287 errs() << "This operation is only currently supported "
1288 "for Mach-O executable files.\n";
1293 void llvm::printWeakBindTable(const ObjectFile *o) {
1294 outs() << "Weak bind table:\n";
1295 if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
1296 printMachOWeakBindTable(MachO);
1298 errs() << "This operation is only currently supported "
1299 "for Mach-O executable files.\n";
1304 /// Dump the raw contents of the __clangast section so the output can be piped
1305 /// into llvm-bcanalyzer.
1306 void llvm::printRawClangAST(const ObjectFile *Obj) {
1307 if (outs().is_displayed()) {
1308 errs() << "The -raw-clang-ast option will dump the raw binary contents of "
1309 "the clang ast section.\n"
1310 "Please redirect the output to a file or another program such as "
1311 "llvm-bcanalyzer.\n";
1315 StringRef ClangASTSectionName("__clangast");
1316 if (isa<COFFObjectFile>(Obj)) {
1317 ClangASTSectionName = "clangast";
1320 Optional<object::SectionRef> ClangASTSection;
1321 for (auto Sec : Obj->sections()) {
1324 if (Name == ClangASTSectionName) {
1325 ClangASTSection = Sec;
1329 if (!ClangASTSection)
1332 StringRef ClangASTContents;
1333 if (error(ClangASTSection.getValue().getContents(ClangASTContents))) {
1334 errs() << "Could not read the " << ClangASTSectionName << " section!\n";
1338 outs().write(ClangASTContents.data(), ClangASTContents.size());
1341 static void printFaultMaps(const ObjectFile *Obj) {
1342 const char *FaultMapSectionName = nullptr;
1344 if (isa<ELFObjectFileBase>(Obj)) {
1345 FaultMapSectionName = ".llvm_faultmaps";
1346 } else if (isa<MachOObjectFile>(Obj)) {
1347 FaultMapSectionName = "__llvm_faultmaps";
1349 errs() << "This operation is only currently supported "
1350 "for ELF and Mach-O executable files.\n";
1354 Optional<object::SectionRef> FaultMapSection;
1356 for (auto Sec : Obj->sections()) {
1359 if (Name == FaultMapSectionName) {
1360 FaultMapSection = Sec;
1365 outs() << "FaultMap table:\n";
1367 if (!FaultMapSection.hasValue()) {
1368 outs() << "<not found>\n";
1372 StringRef FaultMapContents;
1373 if (error(FaultMapSection.getValue().getContents(FaultMapContents))) {
1374 errs() << "Could not read the " << FaultMapContents << " section!\n";
1378 FaultMapParser FMP(FaultMapContents.bytes_begin(),
1379 FaultMapContents.bytes_end());
1384 static void printPrivateFileHeader(const ObjectFile *o) {
1386 printELFFileHeader(o);
1387 } else if (o->isCOFF()) {
1388 printCOFFFileHeader(o);
1389 } else if (o->isMachO()) {
1390 printMachOFileHeader(o);
1394 static void DumpObject(const ObjectFile *o) {
1395 // Avoid other output when using a raw option.
1398 outs() << o->getFileName()
1399 << ":\tfile format " << o->getFileFormatName() << "\n\n";
1403 DisassembleObject(o, Relocations);
1404 if (Relocations && !Disassemble)
1405 PrintRelocations(o);
1407 PrintSectionHeaders(o);
1408 if (SectionContents)
1409 PrintSectionContents(o);
1411 PrintSymbolTable(o);
1415 printPrivateFileHeader(o);
1417 printExportsTrie(o);
1419 printRebaseTable(o);
1423 printLazyBindTable(o);
1425 printWeakBindTable(o);
1427 printRawClangAST(o);
1432 /// @brief Dump each object file in \a a;
1433 static void DumpArchive(const Archive *a) {
1434 for (Archive::child_iterator i = a->child_begin(), e = a->child_end(); i != e;
1436 ErrorOr<std::unique_ptr<Binary>> ChildOrErr = i->getAsBinary();
1437 if (std::error_code EC = ChildOrErr.getError()) {
1438 // Ignore non-object files.
1439 if (EC != object_error::invalid_file_type)
1440 report_error(a->getFileName(), EC);
1443 if (ObjectFile *o = dyn_cast<ObjectFile>(&*ChildOrErr.get()))
1446 report_error(a->getFileName(), object_error::invalid_file_type);
1450 /// @brief Open file and figure out how to dump it.
1451 static void DumpInput(StringRef file) {
1452 // If file isn't stdin, check that it exists.
1453 if (file != "-" && !sys::fs::exists(file)) {
1454 report_error(file, errc::no_such_file_or_directory);
1458 // If we are using the Mach-O specific object file parser, then let it parse
1459 // the file and process the command line options. So the -arch flags can
1460 // be used to select specific slices, etc.
1462 ParseInputMachO(file);
1466 // Attempt to open the binary.
1467 ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(file);
1468 if (std::error_code EC = BinaryOrErr.getError()) {
1469 report_error(file, EC);
1472 Binary &Binary = *BinaryOrErr.get().getBinary();
1474 if (Archive *a = dyn_cast<Archive>(&Binary))
1476 else if (ObjectFile *o = dyn_cast<ObjectFile>(&Binary))
1479 report_error(file, object_error::invalid_file_type);
1482 int main(int argc, char **argv) {
1483 // Print a stack trace if we signal out.
1484 sys::PrintStackTraceOnErrorSignal();
1485 PrettyStackTraceProgram X(argc, argv);
1486 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
1488 // Initialize targets and assembly printers/parsers.
1489 llvm::InitializeAllTargetInfos();
1490 llvm::InitializeAllTargetMCs();
1491 llvm::InitializeAllAsmParsers();
1492 llvm::InitializeAllDisassemblers();
1494 // Register the target printer for --version.
1495 cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
1497 cl::ParseCommandLineOptions(argc, argv, "llvm object file dumper\n");
1498 TripleName = Triple::normalize(TripleName);
1502 // Defaults to a.out if no filenames specified.
1503 if (InputFilenames.size() == 0)
1504 InputFilenames.push_back("a.out");
1519 && !(UniversalHeaders && MachOOpt)
1520 && !(ArchiveHeaders && MachOOpt)
1521 && !(IndirectSymbols && MachOOpt)
1522 && !(DataInCode && MachOOpt)
1523 && !(LinkOptHints && MachOOpt)
1524 && !(InfoPlist && MachOOpt)
1525 && !(DylibsUsed && MachOOpt)
1526 && !(DylibId && MachOOpt)
1527 && !(ObjcMetaData && MachOOpt)
1528 && !(DumpSections.size() != 0 && MachOOpt)
1529 && !PrintFaultMaps) {
1530 cl::PrintHelpMessage();
1534 std::for_each(InputFilenames.begin(), InputFilenames.end(),