| 1 |
include "llvm/Option/OptParser.td" |
| 2 |
|
| 3 |
class F<string letter, string help> : Flag<["-"], letter>, HelpText<help>; |
| 4 |
class FF<string name, string help> : Flag<["--"], name>, HelpText<help>; |
| 5 |
|
| 6 |
multiclass BB<string name, string help1, string help2> { |
| 7 |
def NAME: Flag<["--"], name>, HelpText<help1>; |
| 8 |
def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>; |
| 9 |
} |
| 10 |
|
| 11 |
multiclass Eq<string name, string help> { |
| 12 |
def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>; |
| 13 |
def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>; |
| 14 |
} |
| 15 |
|
| 16 |
def addrsig : FF<"addrsig", "Display address-significance table">; |
| 17 |
def all : FF<"all", "Equivalent to setting: --file-header, --program-headers, --section-headers, " |
| 18 |
"--symbols, --relocations, --dynamic-table, --notes, --version-info, --unwind, " |
| 19 |
"--section-groups and --histogram">; |
| 20 |
def arch_specific : FF<"arch-specific", "Display architecture-specific information">; |
| 21 |
def bb_addr_map : FF<"bb-addr-map", "Display the BB address map section">; |
| 22 |
def pretty_pgo_analysis_map : FF<"pretty-pgo-analysis-map", "Display PGO analysis values with formatting rather than raw numbers">; |
| 23 |
def cg_profile : FF<"cg-profile", "Display call graph profile section">; |
| 24 |
def decompress : FF<"decompress", "Dump decompressed section content when used with -x or -p">; |
| 25 |
defm demangle : BB<"demangle", "Demangle symbol names", "Do not demangle symbol names (default)">; |
| 26 |
def dependent_libraries : FF<"dependent-libraries", "Display the dependent libraries section">; |
| 27 |
def dyn_relocations : FF<"dyn-relocations", "Display the dynamic relocation entries in the file">; |
| 28 |
def dyn_syms : FF<"dyn-syms", "Display the dynamic symbol table">; |
| 29 |
def expand_relocs : FF<"expand-relocs", "Expand each shown relocation to multiple lines">; |
| 30 |
def extra_sym_info : FF<"extra-sym-info", "Display extra information when showing symbols">; |
| 31 |
def file_header : FF<"file-header", "Display file header">; |
| 32 |
def headers : FF<"headers", "Equivalent to setting: --file-header, --program-headers, --section-headers">; |
| 33 |
defm hex_dump : Eq<"hex-dump", "Display the specified section(s) as hexadecimal bytes">, MetaVarName<"<name or index>">; |
| 34 |
def pretty_print : FF<"pretty-print", "Pretty print JSON output">; |
| 35 |
def offloading : FF<"offloading", "Display the content of the offloading section">; |
| 36 |
def relocs : FF<"relocs", "Display the relocation entries in the file">; |
| 37 |
def section_data : FF<"section-data", "Display section data for each section shown. This option has no effect for GNU style output">; |
| 38 |
def section_details : FF<"section-details", "Display the section details">; |
| 39 |
def section_headers : FF<"section-headers", "Display section headers">; |
| 40 |
def section_mapping : FF<"section-mapping", "Display the section to segment mapping">; |
| 41 |
def section_mapping_EQ_false : FF<"section-mapping=false", "Don't display the section to segment mapping">, Flags<[HelpHidden]>; |
| 42 |
def section_relocations : FF<"section-relocations", "Display relocations for each section shown. This option has no effect for GNU style output">; |
| 43 |
def section_symbols : FF<"section-symbols", "Display symbols for each section shown. This option has no effect for GNU style output">; |
| 44 |
defm sort_symbols : Eq<"sort-symbols", "Specify the keys to sort the symbols before displaying symtab">; |
| 45 |
def stack_sizes : FF<"stack-sizes", "Display contents of all stack sizes sections. This option has no effect for GNU style output">; |
| 46 |
def stackmap : FF<"stackmap", "Display contents of stackmap section">; |
| 47 |
defm string_dump : Eq<"string-dump", "Display the specified section(s) as a list of strings">, MetaVarName<"<name or index>">; |
| 48 |
def string_table : FF<"string-table", "Display the string table (only for XCOFF/COFF now)">; |
| 49 |
def symbols : FF<"symbols", "Display the symbol table. Also display the dynamic symbol table when using GNU output style for ELF">; |
| 50 |
def unwind : FF<"unwind", "Display unwind information">; |
| 51 |
|
| 52 |
// ELF specific options. |
| 53 |
def grp_elf : OptionGroup<"kind">, HelpText<"OPTIONS (ELF specific)">; |
| 54 |
def dynamic_table : FF<"dynamic-table", "Display the dynamic section table">, Group<grp_elf>; |
| 55 |
def elf_linker_options : FF<"elf-linker-options", "Display the .linker-options section">, Group<grp_elf>; |
| 56 |
defm elf_output_style : Eq<"elf-output-style", "Specify ELF dump style: LLVM, GNU, JSON">, Group<grp_elf>; |
| 57 |
def histogram : FF<"histogram", "Display bucket list histogram for hash sections">, Group<grp_elf>; |
| 58 |
def section_groups : FF<"section-groups", "Display section groups">, Group<grp_elf>; |
| 59 |
def gnu_hash_table : FF<"gnu-hash-table", "Display the GNU hash table for dynamic symbols">, Group<grp_elf>; |
| 60 |
def hash_symbols : FF<"hash-symbols", "Display the dynamic symbols derived from the hash section">, Group<grp_elf>; |
| 61 |
def hash_table : FF<"hash-table", "Display .hash section">, Group<grp_elf>; |
| 62 |
def memtag : FF<"memtag", "Display memory tagging metadata (modes, Android notes, global descriptors)">, Group<grp_elf>; |
| 63 |
def needed_libs : FF<"needed-libs", "Display the needed libraries">, Group<grp_elf>; |
| 64 |
def notes : FF<"notes", "Display notes">, Group<grp_elf>; |
| 65 |
def program_headers : FF<"program-headers", "Display program headers">, Group<grp_elf>; |
| 66 |
def sframe_EQ : Joined<["--"], "sframe=">, HelpText<"Display SFrame section <name>">, MetaVarName<"<name>">, Group<grp_elf>; |
| 67 |
def sframe: FF<"sframe", "Alias for --sframe=.sframe">, Alias<sframe_EQ>, AliasArgs<[".sframe"]>, Group<grp_elf>; |
| 68 |
def version_info : FF<"version-info", "Display version sections">, Group<grp_elf>; |
| 69 |
|
| 70 |
// Mach-O specific options. |
| 71 |
def grp_mach_o : OptionGroup<"kind">, HelpText<"OPTIONS (Mach-O specific)">; |
| 72 |
def macho_data_in_code : FF<"macho-data-in-code", "Display Data in Code command">, Group<grp_mach_o>; |
| 73 |
def macho_dysymtab : FF<"macho-dysymtab", "Display Dysymtab command">, Group<grp_mach_o>; |
| 74 |
def macho_indirect_symbols : FF<"macho-indirect-symbols", "Display indirect symbols">, Group<grp_mach_o>; |
| 75 |
def macho_linker_options : FF<"macho-linker-options", "Display linker options">, Group<grp_mach_o>; |
| 76 |
def macho_segment : FF<"macho-segment", "Display Segment command">, Group<grp_mach_o>; |
| 77 |
def macho_version_min : FF<"macho-version-min", "Display version min command">, Group<grp_mach_o>; |
| 78 |
|
| 79 |
// PE/COFF specific options. |
| 80 |
def grp_coff : OptionGroup<"kind">, HelpText<"OPTIONS (PE/COFF specific)">; |
| 81 |
def codeview : FF<"codeview", "Display CodeView debug information">, Group<grp_coff>; |
| 82 |
def codeview_ghash : FF<"codeview-ghash", "Enable global hashing for CodeView type stream de-duplication">, Group<grp_coff>; |
| 83 |
def codeview_merged_types : FF<"codeview-merged-types", "Display the merged CodeView type stream">, Group<grp_coff>; |
| 84 |
def codeview_subsection_bytes : FF<"codeview-subsection-bytes", "Dump raw contents of codeview debug sections and records">, Group<grp_coff>; |
| 85 |
def coff_basereloc : FF<"coff-basereloc", "Display .reloc section">, Group<grp_coff>; |
| 86 |
def coff_debug_directory : FF<"coff-debug-directory", "Display debug directory">, Group<grp_coff>; |
| 87 |
def coff_directives : FF<"coff-directives", "Display .drectve section">, Group<grp_coff>; |
| 88 |
def coff_exports : FF<"coff-exports", "Display export table">, Group<grp_coff>; |
| 89 |
def coff_imports : FF<"coff-imports", "Display import table">, Group<grp_coff>; |
| 90 |
def coff_load_config : FF<"coff-load-config", "Display load config">, Group<grp_coff>; |
| 91 |
def coff_pseudoreloc |
| 92 |
: FF<"coff-pseudoreloc", |
| 93 |
"Display runtime pseudo-relocations (Cygwin/MinGW specific)">, |
| 94 |
Group<grp_coff>; |
| 95 |
def coff_resources : FF<"coff-resources", "Display .rsrc section">, Group<grp_coff>; |
| 96 |
def coff_tls_directory : FF<"coff-tls-directory", "Display TLS directory">, Group<grp_coff>; |
| 97 |
|
| 98 |
// XCOFF specific options. |
| 99 |
def grp_xcoff : OptionGroup<"kind">, HelpText<"OPTIONS (XCOFF specific)">; |
| 100 |
def auxiliary_header : FF<"auxiliary-header" , "Display the auxiliary header">, Group<grp_xcoff>; |
| 101 |
def exception_section : FF<"exception-section" , "Display the exception section entries">, Group<grp_xcoff>; |
| 102 |
def loader_section_header : FF<"loader-section-header" , "Display the loader section header">, Group<grp_xcoff>; |
| 103 |
def loader_section_symbols : FF<"loader-section-symbols" , "Display the loader section symbol table">, Group<grp_xcoff>; |
| 104 |
def loader_section_relocations : FF<"loader-section-relocations" , "Display the loader section relocation entries">, Group<grp_xcoff>; |
| 105 |
|
| 106 |
def help : FF<"help", "Display this help">; |
| 107 |
def version : FF<"version", "Display the version">; |
| 108 |
|
| 109 |
// Ignored for GNU readelf compatibility. |
| 110 |
def wide : FF<"wide", "Ignored for GNU readelf compatibility">; |
| 111 |
def : F<"W", "Ignored for GNU readelf compatibility">, Alias<wide>; |
| 112 |
|
| 113 |
// Traditional llvm-readobj Aliases. |
| 114 |
def : Flag<["--"], "dt">, Alias<dyn_syms>, HelpText<"Alias for --dyn-syms">; |
| 115 |
def : Flag<["--"], "sd">, Alias<section_data>, HelpText<"Alias for --section-data">; |
| 116 |
def : Flag<["--"], "st">, Alias<section_symbols>, HelpText<"Alias for --section-symbols">; |
| 117 |
def : Flag<["--"], "sr">, Alias<section_relocations>, HelpText<"Alias for --section-relocations">; |
| 118 |
|
| 119 |
// Aliases. |
| 120 |
def : FF<"dyn-symbols", "Alias for --dyn-syms">, Alias<dyn_syms>; |
| 121 |
def : FF<"dynamic", "Alias for --dynamic-table">, Alias<dynamic_table>; |
| 122 |
def : FF<"elf-cg-profile", "Alias for --cg-profile">, Alias<cg_profile>, Flags<[HelpHidden]>; |
| 123 |
def : FF<"elf-hash-histogram", "Alias for --histogram">, Alias<histogram>, Flags<[HelpHidden]>; |
| 124 |
def : FF<"elf-section-groups", "Alias for --section-groups">, Alias<section_groups>, Flags<[HelpHidden]>; |
| 125 |
def : FF<"file-headers", "Alias for --file-header">, Alias<file_header>, Flags<[HelpHidden]>; |
| 126 |
def : FF<"relocations", "Alias for --relocs">, Alias<relocs>; |
| 127 |
def : FF<"sections", "Alias for --section-headers">, Alias<section_headers>; |
| 128 |
def : FF<"segments", "Alias for --program-headers">, Alias<program_headers>, Group<grp_elf>; |
| 129 |
def : FF<"syms", "Alias for --symbols">, Alias<symbols>; |
| 130 |
|
| 131 |
def : F<"A", "Alias for --arch-specific">, Alias<arch_specific>; |
| 132 |
def : F<"a", "Alias for --all">, Alias<all>; |
| 133 |
def : F<"C", "Alias for --demangle">, Alias<demangle>; |
| 134 |
def : F<"d", "Alias for --dynamic-table">, Alias<dynamic_table>, Group<grp_elf>; |
| 135 |
def : F<"e", "Alias for --headers">, Alias<headers>; |
| 136 |
def : F<"g", "Alias for --section-groups">, Alias<section_groups>, Group<grp_elf>; |
| 137 |
def : F<"h", "Alias for --file-header">, Alias<file_header>; |
| 138 |
def : F<"I", "Alias for --histogram">, Alias<histogram>, Group<grp_elf>; |
| 139 |
def : F<"l", "Alias for --program-headers">, Alias<program_headers>; |
| 140 |
def : F<"n", "Alias for --notes">, Alias<notes>; |
| 141 |
def : JoinedOrSeparate<["-"], "p">, Alias<string_dump_EQ>, HelpText<"Alias for --string-dump">, MetaVarName<"<name or index>">; |
| 142 |
def : F<"r", "Alias for --relocs">, Alias<relocs>; |
| 143 |
def : F<"S", "Alias for --section-headers">, Alias<section_headers>; |
| 144 |
def : F<"s", "Alias for --symbols">, Alias<symbols>; |
| 145 |
def : F<"t", "Alias for --section-details">, Alias<section_details>; |
| 146 |
def : F<"u", "Alias for --unwind">, Alias<unwind>; |
| 147 |
def : F<"X", "Alias for --extra-sym-info">, Alias<extra_sym_info>, Group<grp_elf>; |
| 148 |
def : F<"V", "Alias for --version-info">, Alias<version_info>, Group<grp_elf>; |
| 149 |
def : JoinedOrSeparate<["-"], "x">, Alias<hex_dump_EQ>, HelpText<"Alias for --hex-dump">, MetaVarName<"<name or index>">; |
| 150 |
def : F<"z", "Alias for --decompress">, Alias<decompress>; |