blob: 2fcd506884b18275650a8b6011124cfde6b57608 [file] [log] [blame]
Benjamin Kramer43a772e2011-09-19 17:56:04 +00001//
2// The LLVM Compiler Infrastructure
3//
4// This file is distributed under the University of Illinois Open Source
5// License. See LICENSE.TXT for details.
6//
7//===----------------------------------------------------------------------===//
8
Benjamin Kramera7c40ef2014-08-13 16:26:38 +00009#ifndef LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H
10#define LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H
Benjamin Kramer43a772e2011-09-19 17:56:04 +000011
Igor Laevsky03a670c2016-01-26 15:09:42 +000012#include "llvm/DebugInfo/DIContext.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000013#include "llvm/Support/CommandLine.h"
Davide Italianoed9d95b2015-12-29 13:41:02 +000014#include "llvm/Support/Compiler.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000015#include "llvm/Support/DataTypes.h"
Kevin Enderbyac9e1552016-05-17 17:10:12 +000016#include "llvm/Object/Archive.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000017
18namespace llvm {
Mehdi Aminib550cb12016-04-18 09:17:29 +000019class StringRef;
20
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000021namespace object {
22 class COFFObjectFile;
Saleem Abdulrasoolc6bf5472016-08-18 16:39:19 +000023 class COFFImportFile;
Tim Northover4bd286a2014-08-01 13:07:19 +000024 class MachOObjectFile;
Michael J. Spencer209565db2013-01-06 03:56:49 +000025 class ObjectFile;
Kevin Enderbyac9e1552016-05-17 17:10:12 +000026 class Archive;
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000027 class RelocationRef;
28}
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000029
Benjamin Kramer43a772e2011-09-19 17:56:04 +000030extern cl::opt<std::string> TripleName;
31extern cl::opt<std::string> ArchName;
Kevin Enderbyc9595622014-08-06 23:24:41 +000032extern cl::opt<std::string> MCPU;
33extern cl::list<std::string> MAttrs;
Colin LeMahieufcc32762015-07-29 19:08:10 +000034extern cl::list<std::string> FilterSections;
Colin LeMahieu77804be2015-07-29 15:45:39 +000035extern cl::opt<bool> Disassemble;
Colin LeMahieuf34933e2015-07-23 20:58:49 +000036extern cl::opt<bool> DisassembleAll;
Kevin Enderbybf246f52014-09-24 23:08:22 +000037extern cl::opt<bool> NoShowRawInsn;
Saleem Abdulrasooldea14b22017-02-08 18:11:31 +000038extern cl::opt<bool> NoLeadingAddr;
Kevin Enderbye2297dd2015-01-07 21:02:18 +000039extern cl::opt<bool> PrivateHeaders;
Kevin Enderby0ae163f2016-01-13 00:25:36 +000040extern cl::opt<bool> FirstPrivateHeader;
Kevin Enderbye2297dd2015-01-07 21:02:18 +000041extern cl::opt<bool> ExportsTrie;
42extern cl::opt<bool> Rebase;
43extern cl::opt<bool> Bind;
44extern cl::opt<bool> LazyBind;
45extern cl::opt<bool> WeakBind;
Adrian Prantl437105a2015-07-08 02:04:15 +000046extern cl::opt<bool> RawClangAST;
Kevin Enderby131d1772015-01-09 19:22:37 +000047extern cl::opt<bool> UniversalHeaders;
Kevin Enderby13023a12015-01-15 23:19:11 +000048extern cl::opt<bool> ArchiveHeaders;
Kevin Enderbya7bdc7e2015-01-22 18:55:27 +000049extern cl::opt<bool> IndirectSymbols;
Kevin Enderby69fe98d2015-01-23 18:52:17 +000050extern cl::opt<bool> DataInCode;
Kevin Enderby9a509442015-01-27 21:28:24 +000051extern cl::opt<bool> LinkOptHints;
Kevin Enderbycd66be52015-03-11 22:06:32 +000052extern cl::opt<bool> InfoPlist;
Kevin Enderbybc847fa2015-03-16 20:08:09 +000053extern cl::opt<bool> DylibsUsed;
54extern cl::opt<bool> DylibId;
Kevin Enderby0fc11822015-04-01 20:57:01 +000055extern cl::opt<bool> ObjcMetaData;
Kevin Enderby6a221752015-03-17 17:10:57 +000056extern cl::opt<std::string> DisSymName;
Kevin Enderbyf0640752015-03-13 17:56:32 +000057extern cl::opt<bool> NonVerbose;
Kevin Enderby98da6132015-01-20 21:47:46 +000058extern cl::opt<bool> Relocations;
59extern cl::opt<bool> SectionHeaders;
60extern cl::opt<bool> SectionContents;
61extern cl::opt<bool> SymbolTable;
62extern cl::opt<bool> UnwindInfo;
Colin LeMahieu14ec76e2015-06-07 21:07:17 +000063extern cl::opt<bool> PrintImmHex;
Igor Laevsky03a670c2016-01-26 15:09:42 +000064extern cl::opt<DIDumpType> DwarfDumpType;
Benjamin Kramer43a772e2011-09-19 17:56:04 +000065
66// Various helper functions.
Davide Italianoccd53fe2015-08-05 07:18:31 +000067void error(std::error_code ec);
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000068bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b);
Kevin Enderbye2297dd2015-01-07 21:02:18 +000069void ParseInputMachO(StringRef Filename);
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000070void printCOFFUnwindInfo(const object::COFFObjectFile* o);
Tim Northover4bd286a2014-08-01 13:07:19 +000071void printMachOUnwindInfo(const object::MachOObjectFile* o);
Nick Kledzikd04bc352014-08-30 00:20:14 +000072void printMachOExportsTrie(const object::MachOObjectFile* o);
Kevin Enderbya8d256c2017-03-20 19:46:55 +000073void printMachORebaseTable(object::MachOObjectFile* o);
74void printMachOBindTable(object::MachOObjectFile* o);
75void printMachOLazyBindTable(object::MachOObjectFile* o);
76void printMachOWeakBindTable(object::MachOObjectFile* o);
Michael J. Spencer209565db2013-01-06 03:56:49 +000077void printELFFileHeader(const object::ObjectFile *o);
Rui Ueyamac2bed422013-09-27 21:04:00 +000078void printCOFFFileHeader(const object::ObjectFile *o);
Saleem Abdulrasoolc6bf5472016-08-18 16:39:19 +000079void printCOFFSymbolTable(const object::COFFImportFile *i);
Davide Italianoe85abf72015-12-20 09:54:34 +000080void printCOFFSymbolTable(const object::COFFObjectFile *o);
Kevin Enderbyb76d3862014-08-22 20:35:18 +000081void printMachOFileHeader(const object::ObjectFile *o);
Kevin Enderby0ae163f2016-01-13 00:25:36 +000082void printMachOLoadCommands(const object::ObjectFile *o);
Derek Schuff2c6f75d2016-11-30 16:49:11 +000083void printWasmFileHeader(const object::ObjectFile *o);
Kevin Enderbye2297dd2015-01-07 21:02:18 +000084void printExportsTrie(const object::ObjectFile *o);
Kevin Enderbya8d256c2017-03-20 19:46:55 +000085void printRebaseTable(object::ObjectFile *o);
86void printBindTable(object::ObjectFile *o);
87void printLazyBindTable(object::ObjectFile *o);
88void printWeakBindTable(object::ObjectFile *o);
Adrian Prantl437105a2015-07-08 02:04:15 +000089void printRawClangAST(const object::ObjectFile *o);
Kevin Enderby98da6132015-01-20 21:47:46 +000090void PrintRelocations(const object::ObjectFile *o);
91void PrintSectionHeaders(const object::ObjectFile *o);
92void PrintSectionContents(const object::ObjectFile *o);
Kevin Enderby9acb1092016-05-31 20:35:34 +000093void PrintSymbolTable(const object::ObjectFile *o, StringRef ArchiveName,
94 StringRef ArchitectureName = StringRef());
Kevin Enderby42398052016-06-28 23:16:13 +000095LLVM_ATTRIBUTE_NORETURN void error(Twine Message);
Kevin Enderby7fa40c92016-11-16 22:17:38 +000096LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message);
Davide Italianoed9d95b2015-12-29 13:41:02 +000097LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC);
Kevin Enderby3fcdf6a2016-04-06 22:14:09 +000098LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, llvm::Error E);
Kevin Enderbyac9e1552016-05-17 17:10:12 +000099LLVM_ATTRIBUTE_NORETURN void report_error(StringRef FileName,
100 StringRef ArchiveName,
Kevin Enderby9acb1092016-05-31 20:35:34 +0000101 llvm::Error E,
102 StringRef ArchitectureName
103 = StringRef());
Kevin Enderbyac9e1552016-05-17 17:10:12 +0000104LLVM_ATTRIBUTE_NORETURN void report_error(StringRef ArchiveName,
105 const object::Archive::Child &C,
Kevin Enderby9acb1092016-05-31 20:35:34 +0000106 llvm::Error E,
107 StringRef ArchitectureName
108 = StringRef());
Benjamin Kramer43a772e2011-09-19 17:56:04 +0000109
Rui Ueyamac2bed422013-09-27 21:04:00 +0000110} // end namespace llvm
Benjamin Kramer43a772e2011-09-19 17:56:04 +0000111
112#endif