| 1 |
include "llvm/Option/OptParser.td" |
| 2 |
|
| 3 |
multiclass Eq<string name, string help> { |
| 4 |
def NAME : Separate<["--"], name>; |
| 5 |
def NAME #_eq : Joined<["--"], name #"=">, |
| 6 |
Alias<!cast<Separate>(NAME)>, |
| 7 |
HelpText<help>; |
| 8 |
} |
| 9 |
|
| 10 |
def grp_coff : OptionGroup<"kind">, HelpText<"OPTIONS (COFF specific)">; |
| 11 |
def grp_macho : OptionGroup<"kind">, HelpText<"OPTIONS (Mach-O specific)">; |
| 12 |
|
| 13 |
def help : Flag<["--"], "help">; |
| 14 |
def h : Flag<["-"], "h">, Alias<help>; |
| 15 |
|
| 16 |
def allow_broken_links |
| 17 |
: Flag<["--"], "allow-broken-links">, |
| 18 |
HelpText<"Allow the tool to remove sections even if it would leave " |
| 19 |
"invalid section references. The appropriate sh_link fields " |
| 20 |
"will be set to zero.">; |
| 21 |
|
| 22 |
def enable_deterministic_archives |
| 23 |
: Flag<["--"], "enable-deterministic-archives">, |
| 24 |
HelpText<"Enable deterministic mode when operating on archives (use " |
| 25 |
"zero for UIDs, GIDs, and timestamps).">; |
| 26 |
|
| 27 |
defm extract_section |
| 28 |
: Eq<"extract-section", |
| 29 |
"Extract section named <section> into standalone object in file <file>">, |
| 30 |
MetaVarName<"section=file">; |
| 31 |
|
| 32 |
def D : Flag<["-"], "D">, |
| 33 |
Alias<enable_deterministic_archives>, |
| 34 |
HelpText<"Alias for --enable-deterministic-archives">; |
| 35 |
|
| 36 |
def disable_deterministic_archives |
| 37 |
: Flag<["--"], "disable-deterministic-archives">, |
| 38 |
HelpText<"Disable deterministic mode when operating on archives (use " |
| 39 |
"real values for UIDs, GIDs, and timestamps).">; |
| 40 |
def U : Flag<["-"], "U">, |
| 41 |
Alias<disable_deterministic_archives>, |
| 42 |
HelpText<"Alias for --disable-deterministic-archives">; |
| 43 |
|
| 44 |
def preserve_dates : Flag<["--"], "preserve-dates">, |
| 45 |
HelpText<"Preserve access and modification timestamps">; |
| 46 |
def p : Flag<["-"], "p">, |
| 47 |
Alias<preserve_dates>, |
| 48 |
HelpText<"Alias for --preserve-dates">; |
| 49 |
|
| 50 |
def strip_all : Flag<["--"], "strip-all">, |
| 51 |
HelpText<"For ELF, remove all symbols and non-alloc sections not within " |
| 52 |
"segments, except for .gnu.warning*, .ARM.attribute, and the section name table. " |
| 53 |
"For COFF and Mach-O, remove all symbols, debug sections, and relocations">; |
| 54 |
|
| 55 |
def strip_all_gnu |
| 56 |
: Flag<["--"], "strip-all-gnu">, |
| 57 |
HelpText<"Remove all symbols, debug sections and relocations. Compatible with GNU's --strip-all">; |
| 58 |
|
| 59 |
def strip_debug : Flag<["--"], "strip-debug">, |
| 60 |
HelpText<"Remove all debug sections">; |
| 61 |
def g : Flag<["-"], "g">, |
| 62 |
Alias<strip_debug>, |
| 63 |
HelpText<"Alias for --strip-debug">; |
| 64 |
|
| 65 |
def strip_unneeded : Flag<["--"], "strip-unneeded">, |
| 66 |
HelpText<"Remove all symbols not needed by relocations">; |
| 67 |
|
| 68 |
defm remove_section : Eq<"remove-section", "Remove <section>">, |
| 69 |
MetaVarName<"section">; |
| 70 |
def R : JoinedOrSeparate<["-"], "R">, |
| 71 |
Alias<remove_section>, |
| 72 |
HelpText<"Alias for --remove-section">; |
| 73 |
|
| 74 |
def strip_sections |
| 75 |
: Flag<["--"], "strip-sections">, |
| 76 |
HelpText<"Remove all section headers and all section data not within segments">; |
| 77 |
|
| 78 |
defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">, |
| 79 |
MetaVarName<"symbol">; |
| 80 |
def N : JoinedOrSeparate<["-"], "N">, |
| 81 |
Alias<strip_symbol>, |
| 82 |
HelpText<"Alias for --strip-symbol">; |
| 83 |
|
| 84 |
defm keep_section : Eq<"keep-section", "Keep <section>">, |
| 85 |
MetaVarName<"section">; |
| 86 |
|
| 87 |
defm keep_symbol : Eq<"keep-symbol", "When removing symbols, do not remove <symbol>">, |
| 88 |
MetaVarName<"symbol">; |
| 89 |
def K : JoinedOrSeparate<["-"], "K">, |
| 90 |
Alias<keep_symbol>, |
| 91 |
HelpText<"Alias for --keep-symbol">; |
| 92 |
|
| 93 |
def keep_file_symbols : Flag<["--"], "keep-file-symbols">, |
| 94 |
HelpText<"Keep symbols of type STT_FILE, even if they would otherwise be stripped">; |
| 95 |
|
| 96 |
def keep_undefined : Flag<["--"], "keep-undefined">, |
| 97 |
HelpText<"Do not remove undefined symbols">, Group<grp_macho>; |
| 98 |
|
| 99 |
def only_keep_debug |
| 100 |
: Flag<["--"], "only-keep-debug">, |
| 101 |
HelpText< |
| 102 |
"Produce a debug file as the output that only preserves contents of " |
| 103 |
"sections useful for debugging purposes">; |
| 104 |
|
| 105 |
def discard_locals : Flag<["--"], "discard-locals">, |
| 106 |
HelpText<"Remove local symbols starting with .L">; |
| 107 |
def X : Flag<["-"], "X">, |
| 108 |
Alias<discard_locals>, |
| 109 |
HelpText<"Alias for --discard-locals">; |
| 110 |
|
| 111 |
def discard_all |
| 112 |
: Flag<["--"], "discard-all">, |
| 113 |
HelpText<"Remove most local symbols. Different file formats may limit this to a subset. " |
| 114 |
"For ELF, file and section symbols are not discarded. " |
| 115 |
"Additionally, remove all debug sections">; |
| 116 |
def x : Flag<["-"], "x">, |
| 117 |
Alias<discard_all>, |
| 118 |
HelpText<"Alias for --discard-all">; |
| 119 |
|
| 120 |
def regex |
| 121 |
: Flag<["--"], "regex">, |
| 122 |
HelpText<"Permit regular expressions in name comparison">; |
| 123 |
|
| 124 |
def version : Flag<["--"], "version">, |
| 125 |
HelpText<"Print the version and exit.">; |
| 126 |
def V : Flag<["-"], "V">, |
| 127 |
Alias<version>, |
| 128 |
HelpText<"Alias for --version">; |
| 129 |
|
| 130 |
def wildcard |
| 131 |
: Flag<["--"], "wildcard">, |
| 132 |
HelpText<"Allow wildcard syntax for symbol-related flags. Incompatible " |
| 133 |
"with --regex. Allows using '*' to match any number of " |
| 134 |
"characters, '?' to match any single character, '\' to escape " |
| 135 |
"special characters, and '[]' to define character classes. " |
| 136 |
"Wildcards beginning with '!' will prevent a match, for example " |
| 137 |
"\"-N '*' -N '!x'\" will strip all symbols except for \"x\".">; |
| 138 |
def w : Flag<["-"], "w">, Alias<wildcard>, HelpText<"Alias for --wildcard">; |