Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 1 | // |
| 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 Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 9 | #ifndef LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H |
| 10 | #define LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 11 | |
Igor Laevsky | 03a670c | 2016-01-26 15:09:42 +0000 | [diff] [blame] | 12 | #include "llvm/DebugInfo/DIContext.h" |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 13 | #include "llvm/Support/CommandLine.h" |
Davide Italiano | ed9d95b | 2015-12-29 13:41:02 +0000 | [diff] [blame] | 14 | #include "llvm/Support/Compiler.h" |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 15 | #include "llvm/Support/DataTypes.h" |
Kevin Enderby | ac9e155 | 2016-05-17 17:10:12 +0000 | [diff] [blame] | 16 | #include "llvm/Object/Archive.h" |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 17 | |
| 18 | namespace llvm { |
Mehdi Amini | b550cb1 | 2016-04-18 09:17:29 +0000 | [diff] [blame] | 19 | class StringRef; |
| 20 | |
Michael J. Spencer | 0c6ec48 | 2012-12-05 20:12:35 +0000 | [diff] [blame] | 21 | namespace object { |
| 22 | class COFFObjectFile; |
Saleem Abdulrasool | c6bf547 | 2016-08-18 16:39:19 +0000 | [diff] [blame] | 23 | class COFFImportFile; |
Tim Northover | 4bd286a | 2014-08-01 13:07:19 +0000 | [diff] [blame] | 24 | class MachOObjectFile; |
Michael J. Spencer | 209565db | 2013-01-06 03:56:49 +0000 | [diff] [blame] | 25 | class ObjectFile; |
Kevin Enderby | ac9e155 | 2016-05-17 17:10:12 +0000 | [diff] [blame] | 26 | class Archive; |
Michael J. Spencer | 0c6ec48 | 2012-12-05 20:12:35 +0000 | [diff] [blame] | 27 | class RelocationRef; |
| 28 | } |
Michael J. Spencer | 0c6ec48 | 2012-12-05 20:12:35 +0000 | [diff] [blame] | 29 | |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 30 | extern cl::opt<std::string> TripleName; |
| 31 | extern cl::opt<std::string> ArchName; |
Kevin Enderby | c959562 | 2014-08-06 23:24:41 +0000 | [diff] [blame] | 32 | extern cl::opt<std::string> MCPU; |
| 33 | extern cl::list<std::string> MAttrs; |
Colin LeMahieu | fcc3276 | 2015-07-29 19:08:10 +0000 | [diff] [blame] | 34 | extern cl::list<std::string> FilterSections; |
Colin LeMahieu | 77804be | 2015-07-29 15:45:39 +0000 | [diff] [blame] | 35 | extern cl::opt<bool> Disassemble; |
Colin LeMahieu | f34933e | 2015-07-23 20:58:49 +0000 | [diff] [blame] | 36 | extern cl::opt<bool> DisassembleAll; |
Kevin Enderby | bf246f5 | 2014-09-24 23:08:22 +0000 | [diff] [blame] | 37 | extern cl::opt<bool> NoShowRawInsn; |
Saleem Abdulrasool | dea14b2 | 2017-02-08 18:11:31 +0000 | [diff] [blame] | 38 | extern cl::opt<bool> NoLeadingAddr; |
Kevin Enderby | e2297dd | 2015-01-07 21:02:18 +0000 | [diff] [blame] | 39 | extern cl::opt<bool> PrivateHeaders; |
Kevin Enderby | 0ae163f | 2016-01-13 00:25:36 +0000 | [diff] [blame] | 40 | extern cl::opt<bool> FirstPrivateHeader; |
Kevin Enderby | e2297dd | 2015-01-07 21:02:18 +0000 | [diff] [blame] | 41 | extern cl::opt<bool> ExportsTrie; |
| 42 | extern cl::opt<bool> Rebase; |
| 43 | extern cl::opt<bool> Bind; |
| 44 | extern cl::opt<bool> LazyBind; |
| 45 | extern cl::opt<bool> WeakBind; |
Adrian Prantl | 437105a | 2015-07-08 02:04:15 +0000 | [diff] [blame] | 46 | extern cl::opt<bool> RawClangAST; |
Kevin Enderby | 131d177 | 2015-01-09 19:22:37 +0000 | [diff] [blame] | 47 | extern cl::opt<bool> UniversalHeaders; |
Kevin Enderby | 13023a1 | 2015-01-15 23:19:11 +0000 | [diff] [blame] | 48 | extern cl::opt<bool> ArchiveHeaders; |
Kevin Enderby | a7bdc7e | 2015-01-22 18:55:27 +0000 | [diff] [blame] | 49 | extern cl::opt<bool> IndirectSymbols; |
Kevin Enderby | 69fe98d | 2015-01-23 18:52:17 +0000 | [diff] [blame] | 50 | extern cl::opt<bool> DataInCode; |
Kevin Enderby | 9a50944 | 2015-01-27 21:28:24 +0000 | [diff] [blame] | 51 | extern cl::opt<bool> LinkOptHints; |
Kevin Enderby | cd66be5 | 2015-03-11 22:06:32 +0000 | [diff] [blame] | 52 | extern cl::opt<bool> InfoPlist; |
Kevin Enderby | bc847fa | 2015-03-16 20:08:09 +0000 | [diff] [blame] | 53 | extern cl::opt<bool> DylibsUsed; |
| 54 | extern cl::opt<bool> DylibId; |
Kevin Enderby | 0fc1182 | 2015-04-01 20:57:01 +0000 | [diff] [blame] | 55 | extern cl::opt<bool> ObjcMetaData; |
Kevin Enderby | 6a22175 | 2015-03-17 17:10:57 +0000 | [diff] [blame] | 56 | extern cl::opt<std::string> DisSymName; |
Kevin Enderby | f064075 | 2015-03-13 17:56:32 +0000 | [diff] [blame] | 57 | extern cl::opt<bool> NonVerbose; |
Kevin Enderby | 98da613 | 2015-01-20 21:47:46 +0000 | [diff] [blame] | 58 | extern cl::opt<bool> Relocations; |
| 59 | extern cl::opt<bool> SectionHeaders; |
| 60 | extern cl::opt<bool> SectionContents; |
| 61 | extern cl::opt<bool> SymbolTable; |
| 62 | extern cl::opt<bool> UnwindInfo; |
Colin LeMahieu | 14ec76e | 2015-06-07 21:07:17 +0000 | [diff] [blame] | 63 | extern cl::opt<bool> PrintImmHex; |
Igor Laevsky | 03a670c | 2016-01-26 15:09:42 +0000 | [diff] [blame] | 64 | extern cl::opt<DIDumpType> DwarfDumpType; |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 65 | |
| 66 | // Various helper functions. |
Davide Italiano | ccd53fe | 2015-08-05 07:18:31 +0000 | [diff] [blame] | 67 | void error(std::error_code ec); |
Michael J. Spencer | 0c6ec48 | 2012-12-05 20:12:35 +0000 | [diff] [blame] | 68 | bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b); |
Kevin Enderby | e2297dd | 2015-01-07 21:02:18 +0000 | [diff] [blame] | 69 | void ParseInputMachO(StringRef Filename); |
Michael J. Spencer | 0c6ec48 | 2012-12-05 20:12:35 +0000 | [diff] [blame] | 70 | void printCOFFUnwindInfo(const object::COFFObjectFile* o); |
Tim Northover | 4bd286a | 2014-08-01 13:07:19 +0000 | [diff] [blame] | 71 | void printMachOUnwindInfo(const object::MachOObjectFile* o); |
Nick Kledzik | d04bc35 | 2014-08-30 00:20:14 +0000 | [diff] [blame] | 72 | void printMachOExportsTrie(const object::MachOObjectFile* o); |
Kevin Enderby | a8d256c | 2017-03-20 19:46:55 +0000 | [diff] [blame] | 73 | void printMachORebaseTable(object::MachOObjectFile* o); |
| 74 | void printMachOBindTable(object::MachOObjectFile* o); |
| 75 | void printMachOLazyBindTable(object::MachOObjectFile* o); |
| 76 | void printMachOWeakBindTable(object::MachOObjectFile* o); |
Michael J. Spencer | 209565db | 2013-01-06 03:56:49 +0000 | [diff] [blame] | 77 | void printELFFileHeader(const object::ObjectFile *o); |
Rui Ueyama | c2bed42 | 2013-09-27 21:04:00 +0000 | [diff] [blame] | 78 | void printCOFFFileHeader(const object::ObjectFile *o); |
Saleem Abdulrasool | c6bf547 | 2016-08-18 16:39:19 +0000 | [diff] [blame] | 79 | void printCOFFSymbolTable(const object::COFFImportFile *i); |
Davide Italiano | e85abf7 | 2015-12-20 09:54:34 +0000 | [diff] [blame] | 80 | void printCOFFSymbolTable(const object::COFFObjectFile *o); |
Kevin Enderby | b76d386 | 2014-08-22 20:35:18 +0000 | [diff] [blame] | 81 | void printMachOFileHeader(const object::ObjectFile *o); |
Kevin Enderby | 0ae163f | 2016-01-13 00:25:36 +0000 | [diff] [blame] | 82 | void printMachOLoadCommands(const object::ObjectFile *o); |
Derek Schuff | 2c6f75d | 2016-11-30 16:49:11 +0000 | [diff] [blame] | 83 | void printWasmFileHeader(const object::ObjectFile *o); |
Kevin Enderby | e2297dd | 2015-01-07 21:02:18 +0000 | [diff] [blame] | 84 | void printExportsTrie(const object::ObjectFile *o); |
Kevin Enderby | a8d256c | 2017-03-20 19:46:55 +0000 | [diff] [blame] | 85 | void printRebaseTable(object::ObjectFile *o); |
| 86 | void printBindTable(object::ObjectFile *o); |
| 87 | void printLazyBindTable(object::ObjectFile *o); |
| 88 | void printWeakBindTable(object::ObjectFile *o); |
Adrian Prantl | 437105a | 2015-07-08 02:04:15 +0000 | [diff] [blame] | 89 | void printRawClangAST(const object::ObjectFile *o); |
Kevin Enderby | 98da613 | 2015-01-20 21:47:46 +0000 | [diff] [blame] | 90 | void PrintRelocations(const object::ObjectFile *o); |
| 91 | void PrintSectionHeaders(const object::ObjectFile *o); |
| 92 | void PrintSectionContents(const object::ObjectFile *o); |
Kevin Enderby | 9acb109 | 2016-05-31 20:35:34 +0000 | [diff] [blame] | 93 | void PrintSymbolTable(const object::ObjectFile *o, StringRef ArchiveName, |
| 94 | StringRef ArchitectureName = StringRef()); |
Kevin Enderby | 4239805 | 2016-06-28 23:16:13 +0000 | [diff] [blame] | 95 | LLVM_ATTRIBUTE_NORETURN void error(Twine Message); |
Kevin Enderby | 7fa40c9 | 2016-11-16 22:17:38 +0000 | [diff] [blame] | 96 | LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message); |
Davide Italiano | ed9d95b | 2015-12-29 13:41:02 +0000 | [diff] [blame] | 97 | LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC); |
Kevin Enderby | 3fcdf6a | 2016-04-06 22:14:09 +0000 | [diff] [blame] | 98 | LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, llvm::Error E); |
Kevin Enderby | ac9e155 | 2016-05-17 17:10:12 +0000 | [diff] [blame] | 99 | LLVM_ATTRIBUTE_NORETURN void report_error(StringRef FileName, |
| 100 | StringRef ArchiveName, |
Kevin Enderby | 9acb109 | 2016-05-31 20:35:34 +0000 | [diff] [blame] | 101 | llvm::Error E, |
| 102 | StringRef ArchitectureName |
| 103 | = StringRef()); |
Kevin Enderby | ac9e155 | 2016-05-17 17:10:12 +0000 | [diff] [blame] | 104 | LLVM_ATTRIBUTE_NORETURN void report_error(StringRef ArchiveName, |
| 105 | const object::Archive::Child &C, |
Kevin Enderby | 9acb109 | 2016-05-31 20:35:34 +0000 | [diff] [blame] | 106 | llvm::Error E, |
| 107 | StringRef ArchitectureName |
| 108 | = StringRef()); |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 109 | |
Rui Ueyama | c2bed42 | 2013-09-27 21:04:00 +0000 | [diff] [blame] | 110 | } // end namespace llvm |
Benjamin Kramer | 43a772e | 2011-09-19 17:56:04 +0000 | [diff] [blame] | 111 | |
| 112 | #endif |