| 1 |
include "CommonOpts.td" |
| 2 |
|
| 3 |
multiclass B<string name, string help1, string help2> { |
| 4 |
def NAME: Flag<["--"], name>, HelpText<help1>; |
| 5 |
def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>; |
| 6 |
} |
| 7 |
|
| 8 |
defm binary_architecture |
| 9 |
: Eq<"binary-architecture", "Ignored for compatibility">; |
| 10 |
def B : JoinedOrSeparate<["-"], "B">, |
| 11 |
Alias<binary_architecture>, |
| 12 |
HelpText<"Alias for --binary-architecture">; |
| 13 |
|
| 14 |
defm target : Eq<"target", "Equivalent to --input-target and --output-target for the specified format">, |
| 15 |
Values<"binary">; |
| 16 |
def F : JoinedOrSeparate<["-"], "F">, |
| 17 |
Alias<target>, |
| 18 |
HelpText<"Alias for --target">; |
| 19 |
|
| 20 |
defm input_target : Eq<"input-target", "Read the input as the specified format">, MetaVarName<"format">; |
| 21 |
def I : JoinedOrSeparate<["-"], "I">, |
| 22 |
Alias<input_target>, |
| 23 |
HelpText<"Alias for --input-target">; |
| 24 |
|
| 25 |
defm output_target : Eq<"output-target", "Write the output as the specified format">, MetaVarName<"format">; |
| 26 |
def O : JoinedOrSeparate<["-"], "O">, |
| 27 |
Alias<output_target>, |
| 28 |
HelpText<"Alias for --output-target">; |
| 29 |
|
| 30 |
defm new_symbol_visibility |
| 31 |
: Eq<"new-symbol-visibility", "Specify the visibility of symbols automatically " |
| 32 |
"created when using binary input or --add-symbol. The default is 'default'">; |
| 33 |
|
| 34 |
def compress_debug_sections |
| 35 |
: Joined<["--"], "compress-debug-sections=">, |
| 36 |
MetaVarName<"format">, |
| 37 |
HelpText<"Compress DWARF debug sections using specified format. Supported " |
| 38 |
"formats: zlib, zstd. Select zlib if <format> is omitted">; |
| 39 |
def : Flag<["--"], "compress-debug-sections">, Alias<compress_debug_sections>, |
| 40 |
AliasArgs<["zlib"]>; |
| 41 |
def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, |
| 42 |
HelpText<"Decompress DWARF debug sections">; |
| 43 |
defm compress_sections |
| 44 |
: Eq<"compress-sections", |
| 45 |
"Compress or decompress sections using specified format. Supported " |
| 46 |
"formats: zlib, zstd. Specify 'none' for decompression">, |
| 47 |
MetaVarName<"<section-glob>=<format>">; |
| 48 |
|
| 49 |
defm split_dwo |
| 50 |
: Eq<"split-dwo", "Equivalent to --extract-dwo and <dwo-file> as the output file and no other options, " |
| 51 |
"and then --strip-dwo on the input file">, |
| 52 |
MetaVarName<"dwo-file">; |
| 53 |
|
| 54 |
defm add_gnu_debuglink |
| 55 |
: Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">, |
| 56 |
MetaVarName<"debug-file">; |
| 57 |
|
| 58 |
defm rename_section |
| 59 |
: Eq<"rename-section", |
| 60 |
"Rename sections called <old> to <new>, and apply any specified <flag> values. " |
| 61 |
"See --set-section-flags for a list of supported flags">, |
| 62 |
MetaVarName<"old=new[,flag1,...]">; |
| 63 |
defm redefine_symbol |
| 64 |
: Eq<"redefine-sym", "Change the name of a symbol old to new">, |
| 65 |
MetaVarName<"old=new">; |
| 66 |
defm redefine_symbols |
| 67 |
: Eq<"redefine-syms", |
| 68 |
"Read a list of symbol pairs from <filename> and run as if " |
| 69 |
"--redefine-sym=<old>=<new> is set for each one. <filename> " |
| 70 |
"contains two symbols per line separated with whitespace and may " |
| 71 |
"contain comments beginning with '#'. Leading and trailing " |
| 72 |
"whitespace is stripped from each line. May be repeated to read " |
| 73 |
"symbols from many files">, |
| 74 |
MetaVarName<"filename">; |
| 75 |
|
| 76 |
defm only_section : Eq<"only-section", "Remove all but <section>">, |
| 77 |
MetaVarName<"section">; |
| 78 |
def j : JoinedOrSeparate<["-"], "j">, |
| 79 |
Alias<only_section>, |
| 80 |
HelpText<"Alias for --only-section">; |
| 81 |
defm add_section |
| 82 |
: Eq<"add-section", |
| 83 |
"Add a section named <section> with the contents of <file>">, |
| 84 |
MetaVarName<"section=file">; |
| 85 |
|
| 86 |
defm set_section_alignment |
| 87 |
: Eq<"set-section-alignment", "Set alignment for a given section">, |
| 88 |
MetaVarName<"section=align">; |
| 89 |
|
| 90 |
defm set_section_flags |
| 91 |
: Eq<"set-section-flags", |
| 92 |
"Set section properties based on the specified <flags>. Supported flag names are: " |
| 93 |
"alloc, load, noload, readonly, exclude, debug, code, " |
| 94 |
"data, rom, share, contents, merge, strings, large">, |
| 95 |
MetaVarName<"section=flag1[,flag2,...]">; |
| 96 |
|
| 97 |
defm set_section_type |
| 98 |
: Eq<"set-section-type", |
| 99 |
"Set the type of section <section> to the integer <type>">, |
| 100 |
MetaVarName<"section=type">; |
| 101 |
|
| 102 |
defm set_symbol_visibility |
| 103 |
: Eq<"set-symbol-visibility", |
| 104 |
"Change the visibility of a symbol to the specified value">, |
| 105 |
MetaVarName<"symbol=visibility">; |
| 106 |
defm set_symbols_visibility |
| 107 |
: Eq<"set-symbols-visibility", |
| 108 |
"Read a list of symbols from <filename> and change their " |
| 109 |
"visibility to the specified value. Visibility values: default, " |
| 110 |
"internal, hidden, protected">, |
| 111 |
MetaVarName<"filename=visibility">; |
| 112 |
|
| 113 |
def S : Flag<["-"], "S">, |
| 114 |
Alias<strip_all>, |
| 115 |
HelpText<"Alias for --strip-all">; |
| 116 |
def strip_dwo : Flag<["--"], "strip-dwo">, |
| 117 |
HelpText<"Remove all DWARF .dwo sections">; |
| 118 |
def strip_non_alloc |
| 119 |
: Flag<["--"], "strip-non-alloc">, |
| 120 |
HelpText<"Remove all non-allocated sections that are not within segments">; |
| 121 |
defm strip_unneeded_symbol |
| 122 |
: Eq<"strip-unneeded-symbol", |
| 123 |
"Remove all symbols named <symbol> that are local or undefined and " |
| 124 |
"are not required by any relocation">, |
| 125 |
MetaVarName<"symbol">; |
| 126 |
defm strip_unneeded_symbols |
| 127 |
: Eq<"strip-unneeded-symbols", |
| 128 |
"Remove all symbols whose names appear in the file <file>, if they " |
| 129 |
"are local or undefined and are not required by any relocation">, |
| 130 |
MetaVarName<"filename">; |
| 131 |
|
| 132 |
defm subsystem |
| 133 |
: Eq<"subsystem", |
| 134 |
"Set the PE subsystem, and optionally subsystem version">, |
| 135 |
MetaVarName<"name[:version]">, Group<grp_coff>; |
| 136 |
|
| 137 |
def extract_dwo |
| 138 |
: Flag<["--"], "extract-dwo">, |
| 139 |
HelpText< |
| 140 |
"Remove all sections that are not DWARF .dwo sections from file">; |
| 141 |
|
| 142 |
defm extract_partition |
| 143 |
: Eq<"extract-partition", "Extract named partition from input file">, |
| 144 |
MetaVarName<"name">; |
| 145 |
def extract_main_partition |
| 146 |
: Flag<["--"], "extract-main-partition">, |
| 147 |
HelpText<"Extract main partition from the input file">; |
| 148 |
|
| 149 |
def localize_hidden |
| 150 |
: Flag<["--"], "localize-hidden">, |
| 151 |
HelpText< |
| 152 |
"Mark all symbols that have hidden or internal visibility as local">; |
| 153 |
defm localize_symbol |
| 154 |
: Eq<"localize-symbol", "Mark any defined non-common symbol named <symbol> as local">, |
| 155 |
MetaVarName<"symbol">; |
| 156 |
defm localize_symbols |
| 157 |
: Eq<"localize-symbols", |
| 158 |
"Read a list of names from <filename> and mark any defined non-common " |
| 159 |
"symbols with those names as local">, |
| 160 |
MetaVarName<"filename">; |
| 161 |
|
| 162 |
def L : JoinedOrSeparate<["-"], "L">, |
| 163 |
Alias<localize_symbol>, |
| 164 |
HelpText<"Alias for --localize-symbol">; |
| 165 |
|
| 166 |
defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">, |
| 167 |
MetaVarName<"symbol">; |
| 168 |
|
| 169 |
defm globalize_symbols |
| 170 |
: Eq<"globalize-symbols", |
| 171 |
"Read a list of symbols from <filename> and mark defined symbols" |
| 172 |
" with those names as global">, |
| 173 |
MetaVarName<"filename">; |
| 174 |
|
| 175 |
defm keep_global_symbol |
| 176 |
: Eq<"keep-global-symbol", |
| 177 |
"Mark all symbols local, except for symbols with the name <symbol>. " |
| 178 |
"Can be specified multiple times to ignore multiple symbols">, |
| 179 |
MetaVarName<"symbol">; |
| 180 |
def G : JoinedOrSeparate<["-"], "G">, |
| 181 |
Alias<keep_global_symbol>, |
| 182 |
HelpText<"Alias for --keep-global-symbol">; |
| 183 |
|
| 184 |
defm verify_note_sections : B<"verify-note-sections", |
| 185 |
"Validate note sections", |
| 186 |
"Don't validate note sections">; |
| 187 |
|
| 188 |
defm keep_global_symbols |
| 189 |
: Eq<"keep-global-symbols", |
| 190 |
"Read a list of symbols from <filename> and run as if " |
| 191 |
"--keep-global-symbol=<symbol> is set for each one. <filename> " |
| 192 |
"contains one symbol per line and may contain comments beginning with " |
| 193 |
"'#'. Leading and trailing whitespace is stripped from each line. May " |
| 194 |
"be repeated to read symbols from many files">, |
| 195 |
MetaVarName<"filename">; |
| 196 |
|
| 197 |
defm weaken_symbol : Eq<"weaken-symbol", "Mark global symbols named <symbol> as weak">, |
| 198 |
MetaVarName<"symbol">; |
| 199 |
defm weaken_symbols |
| 200 |
: Eq<"weaken-symbols", |
| 201 |
"Read a list of symbols from <filename> and mark global symbols with those names as weak">, |
| 202 |
MetaVarName<"filename">; |
| 203 |
|
| 204 |
def W : JoinedOrSeparate<["-"], "W">, |
| 205 |
Alias<weaken_symbol>, |
| 206 |
HelpText<"Alias for --weaken-symbol">; |
| 207 |
def weaken : Flag<["--"], "weaken">, |
| 208 |
HelpText<"Mark all defined global symbols as weak">; |
| 209 |
|
| 210 |
defm strip_symbols |
| 211 |
: Eq<"strip-symbols", |
| 212 |
"Remove all symbols whose names appear in the file <filename>">, |
| 213 |
MetaVarName<"filename">; |
| 214 |
|
| 215 |
defm keep_symbols |
| 216 |
: Eq<"keep-symbols", |
| 217 |
"Read a list of symbols from <filename> and run as if " |
| 218 |
"--keep-symbol=<symbol> is set for each one. <filename> " |
| 219 |
"contains one symbol per line and may contain comments beginning with " |
| 220 |
"'#'. Leading and trailing whitespace is stripped from each line. May " |
| 221 |
"be repeated to read symbols from many files">, |
| 222 |
MetaVarName<"filename">; |
| 223 |
|
| 224 |
defm skip_symbol : Eq<"skip-symbol", "Do not change parameters of symbol <symbol> " |
| 225 |
"when executing other options that can change the symbol's " |
| 226 |
"name, binding or visibility">, |
| 227 |
MetaVarName<"symbol">; |
| 228 |
|
| 229 |
defm skip_symbols |
| 230 |
: Eq<"skip-symbols", |
| 231 |
"Read a list of symbols from <filename> and run as if " |
| 232 |
"--skip-symbol=<symbol> is set for each one. <filename> " |
| 233 |
"contains one symbol per line and may contain comments beginning with " |
| 234 |
"'#'. Leading and trailing whitespace is stripped from each line. May " |
| 235 |
"be repeated to read symbols from many files">, |
| 236 |
MetaVarName<"filename">; |
| 237 |
|
| 238 |
defm dump_section |
| 239 |
: Eq<"dump-section", |
| 240 |
"Dump contents of section named <section> into file <file>">, |
| 241 |
MetaVarName<"section=file">; |
| 242 |
defm prefix_symbols |
| 243 |
: Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">, |
| 244 |
MetaVarName<"prefix">; |
| 245 |
defm remove_symbol_prefix |
| 246 |
: Eq<"remove-symbol-prefix", |
| 247 |
"Remove <prefix> from the start of every symbol name. No-op for symbols that do not start " |
| 248 |
"with <prefix>">, |
| 249 |
MetaVarName<"prefix">; |
| 250 |
|
| 251 |
defm prefix_alloc_sections |
| 252 |
: Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">, |
| 253 |
MetaVarName<"prefix">; |
| 254 |
|
| 255 |
defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides " |
| 256 |
"any previous --change-start or --adjust-start values">, |
| 257 |
MetaVarName<"addr">; |
| 258 |
defm change_start : Eq<"change-start", "Add <incr> to the start address. Can be " |
| 259 |
"specified multiple times, all values will be applied " |
| 260 |
"cumulatively">, |
| 261 |
MetaVarName<"incr">; |
| 262 |
def adjust_start : JoinedOrSeparate<["--"], "adjust-start">, |
| 263 |
Alias<change_start>, |
| 264 |
HelpText<"Alias for --change-start">; |
| 265 |
|
| 266 |
defm change_section_lma |
| 267 |
: Eq<"change-section-lma", "Shift LMA of non-zero-sized sections in the program header by <val>">, |
| 268 |
MetaVarName<"*{+|-}val">; |
| 269 |
|
| 270 |
defm change_section_address |
| 271 |
: Eq<"change-section-address", "Set the address of the <section> to, or adjust it by, <val>">, |
| 272 |
MetaVarName<"sectionpattern{=|+|-}val">; |
| 273 |
def adjust_section_vma : JoinedOrSeparate<["--"], "adjust-section-vma">, |
| 274 |
Alias<change_section_address>, |
| 275 |
HelpText<"Alias for --change-section-address">; |
| 276 |
|
| 277 |
defm add_symbol |
| 278 |
: Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: " |
| 279 |
"global, local, weak, default, hidden, protected, file, section, object, " |
| 280 |
"function, indirect-function. Accepted but ignored for " |
| 281 |
"compatibility: debug, constructor, warning, indirect, synthetic, " |
| 282 |
"unique-object, before">, |
| 283 |
MetaVarName<"name=[section:]value[,flags]">; |
| 284 |
|
| 285 |
defm update_section |
| 286 |
: Eq<"update-section", "Replace the contents of section <name> with contents from a file <file>">, |
| 287 |
MetaVarName<"name=file">; |
| 288 |
|
| 289 |
defm gap_fill |
| 290 |
: Eq<"gap-fill", "Fill the gaps between sections with <value> instead of zero. " |
| 291 |
"<value> must be an unsigned 8-bit integer. " |
| 292 |
"This option is only supported for ELF input and binary output">, |
| 293 |
MetaVarName<"value">; |
| 294 |
|
| 295 |
defm pad_to |
| 296 |
: Eq<"pad-to", "Pad the output up to the load address <address>, using a value " |
| 297 |
"of zero or the value specified by the --gap-fill option. " |
| 298 |
"This option is only supported for ELF input and binary output">, |
| 299 |
MetaVarName<"address">; |
| 300 |
|
| 301 |
defm remove_note |
| 302 |
: Eq<"remove-note", "Remove note(s) with <type_id> and optional <name>">, |
| 303 |
MetaVarName<"[name/]type_id">; |