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 ChainedFixups;
44extern bool DyldInfo;
45extern bool DylibId;
46extern bool DylibsUsed;
47extern bool ExportsTrie;
48extern bool FirstPrivateHeader;
49extern bool FullLeadingAddr;
50extern FunctionStartsMode FunctionStartsType;
51extern bool IndirectSymbols;
52extern bool InfoPlist;
53extern bool LazyBind;
54extern bool LeadingHeaders;
55extern bool LinkOptHints;
56extern bool ObjcMetaData;
57extern bool Rebase;
58extern bool Rpaths;
59extern bool SymbolicOperands;
60extern bool UniversalHeaders;
61extern bool Verbose;
62extern bool WeakBind;
63
64Error getMachORelocationValueString(const object::MachOObjectFile *Obj,
65 const object::RelocationRef &RelRef,
66 llvm::SmallVectorImpl<char> &Result);
67
68const object::MachOObjectFile *
69getMachODSymObject(const object::MachOObjectFile *O, StringRef Filename,
70 std::unique_ptr<object::Binary> &DSYMBinary,
71 std::unique_ptr<MemoryBuffer> &DSYMBuf);
72
73void parseInputMachO(StringRef Filename);
74void parseInputMachO(object::MachOUniversalBinary *UB);
75
76void printMachOUnwindInfo(const object::MachOObjectFile *O);
77void printMachOFileHeader(const object::ObjectFile *O);
78void printMachOLoadCommands(const object::ObjectFile *O);
79
80void printExportsTrie(const object::ObjectFile *O);
81void printRebaseTable(object::ObjectFile *O);
82void printBindTable(object::ObjectFile *O);
83void printLazyBindTable(object::ObjectFile *O);
84void printWeakBindTable(object::ObjectFile *O);
85
86} // namespace objdump
87} // namespace llvm
88
89#endif
90