xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objdump/MachODump.h (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
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 
15 namespace llvm {
16 
17 class Error;
18 class StringRef;
19 class MemoryBuffer;
20 
21 namespace object {
22 class MachOObjectFile;
23 class MachOUniversalBinary;
24 class ObjectFile;
25 class RelocationRef;
26 class Binary;
27 } // namespace object
28 
29 namespace opt {
30 class InputArgList;
31 } // namespace opt
32 
33 namespace objdump {
34 
35 void parseMachOOptions(const llvm::opt::InputArgList &InputArgs);
36 
37 enum class FunctionStartsMode { Addrs, Names, Both, None };
38 
39 // MachO specific options
40 extern bool Bind;
41 extern bool DataInCode;
42 extern std::string DisSymName;
43 extern bool ChainedFixups;
44 extern bool DyldInfo;
45 extern bool DylibId;
46 extern bool DylibsUsed;
47 extern bool ExportsTrie;
48 extern bool FirstPrivateHeader;
49 extern bool FullLeadingAddr;
50 extern FunctionStartsMode FunctionStartsType;
51 extern bool IndirectSymbols;
52 extern bool InfoPlist;
53 extern bool LazyBind;
54 extern bool LeadingHeaders;
55 extern bool LinkOptHints;
56 extern bool ObjcMetaData;
57 extern bool Rebase;
58 extern bool Rpaths;
59 extern bool SymbolicOperands;
60 extern bool UniversalHeaders;
61 extern bool Verbose;
62 extern bool WeakBind;
63 
64 Error getMachORelocationValueString(const object::MachOObjectFile *Obj,
65                                     const object::RelocationRef &RelRef,
66                                     llvm::SmallVectorImpl<char> &Result);
67 
68 const object::MachOObjectFile *
69 getMachODSymObject(const object::MachOObjectFile *O, StringRef Filename,
70                    std::unique_ptr<object::Binary> &DSYMBinary,
71                    std::unique_ptr<MemoryBuffer> &DSYMBuf);
72 
73 void parseInputMachO(StringRef Filename);
74 void parseInputMachO(object::MachOUniversalBinary *UB);
75 
76 void printMachOUnwindInfo(const object::MachOObjectFile *O);
77 void printMachOFileHeader(const object::ObjectFile *O);
78 void printMachOLoadCommands(const object::ObjectFile *O);
79 
80 void printExportsTrie(const object::ObjectFile *O);
81 void printRebaseTable(object::ObjectFile *O);
82 void printBindTable(object::ObjectFile *O);
83 void printLazyBindTable(object::ObjectFile *O);
84 void printWeakBindTable(object::ObjectFile *O);
85 
86 } // namespace objdump
87 } // namespace llvm
88 
89 #endif
90