1//===-- MachODump.h ---------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_TOOLS_LLVM_OBJDUMP_MACHODUMP_H
10#define LLVM_TOOLS_LLVM_OBJDUMP_MACHODUMP_H
11
12#include "llvm/ADT/SmallVector.h"
13#include "llvm/Support/CommandLine.h"
14
15namespace llvm {
16
17class Error;
18class StringRef;
19class MemoryBuffer;
20
21namespace object {
22class MachOObjectFile;
23class MachOUniversalBinary;
24class ObjectFile;
25class RelocationRef;
26class Binary;
27} // namespace object
28
29namespace opt {
30class InputArgList;
31} // namespace opt
32
33namespace objdump {
34
35void parseMachOOptions(const llvm::opt::InputArgList &InputArgs);
36
37enum class FunctionStartsMode { Addrs, Names, Both, None };
38
39// MachO specific options
40extern bool Bind;
41extern bool DataInCode;
42extern std::string DisSymName;
43extern bool IsOtool;
44extern bool ChainedFixups;
45extern bool DyldInfo;
46extern bool DylibId;
47extern bool DylibsUsed;
48extern bool ExportsTrie;
49extern bool FirstPrivateHeader;
50extern bool FullLeadingAddr;
51extern FunctionStartsMode FunctionStartsType;
52extern bool IndirectSymbols;
53extern bool InfoPlist;
54extern bool LazyBind;
55extern bool LeadingHeaders;
56extern bool LinkOptHints;
57extern bool ObjcMetaData;
58extern bool Rebase;
59extern bool Rpaths;
60extern bool SymbolicOperands;
61extern bool UniversalHeaders;
62extern bool Verbose;
63extern bool WeakBind;
64
65Error getMachORelocationValueString(const object::MachOObjectFile *Obj,
66 const object::RelocationRef &RelRef,
67 llvm::SmallVectorImpl<char> &Result);
68
69const object::MachOObjectFile *
70getMachODSymObject(const object::MachOObjectFile *O, StringRef Filename,
71 std::unique_ptr<object::Binary> &DSYMBinary,
72 std::unique_ptr<MemoryBuffer> &DSYMBuf);
73
74void parseInputMachO(StringRef Filename);
75void parseInputMachO(object::MachOUniversalBinary *UB);
76
77void printMachOUnwindInfo(const object::MachOObjectFile *O);
78void printMachOFileHeader(const object::ObjectFile *O);
79void printMachOLoadCommands(const object::ObjectFile *O);
80
81void printExportsTrie(const object::ObjectFile *O);
82void printRebaseTable(object::ObjectFile *O);
83void printBindTable(object::ObjectFile *O);
84void printLazyBindTable(object::ObjectFile *O);
85void printWeakBindTable(object::ObjectFile *O);
86
87} // namespace objdump
88} // namespace llvm
89
90#endif
91