Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 1 | include "CommonOpts.td" |
James Henderson | 66a9d0f | 2019-04-18 09:13:30 +0000 | [diff] [blame] | 2 | |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 3 | defm binary_architecture |
| 4 | : Eq<"binary-architecture", "Used when transforming an architecture-less " |
| 5 | "format (such as binary) to another format">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 6 | def B : JoinedOrSeparate<["-"], "B">, |
| 7 | Alias<binary_architecture>, |
| 8 | HelpText<"Alias for --binary-architecture">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 9 | |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 10 | defm target : Eq<"target", "Format of the input and output file">, |
Jordan Rupprecht | bb4588e | 2018-10-12 00:36:01 +0000 | [diff] [blame] | 11 | Values<"binary">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 12 | def F : JoinedOrSeparate<["-"], "F">, |
| 13 | Alias<target>, |
| 14 | HelpText<"Alias for --target">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 15 | |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 16 | defm input_target : Eq<"input-target", "Format of the input file">, |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 17 | Values<"binary">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 18 | def I : JoinedOrSeparate<["-"], "I">, |
| 19 | Alias<input_target>, |
| 20 | HelpText<"Alias for --input-target">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 21 | |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 22 | defm output_target : Eq<"output-target", "Format of the output file">, |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 23 | Values<"binary">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 24 | def O : JoinedOrSeparate<["-"], "O">, |
| 25 | Alias<output_target>, |
| 26 | HelpText<"Alias for --output-target">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 27 | |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 28 | def compress_debug_sections : Flag<["--"], "compress-debug-sections">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 29 | def compress_debug_sections_eq |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 30 | : Joined<["--"], "compress-debug-sections=">, |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 31 | MetaVarName<"[ zlib | zlib-gnu ]">, |
| 32 | HelpText<"Compress DWARF debug sections using specified style. Supported " |
| 33 | "styles: 'zlib-gnu' and 'zlib'">; |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 34 | def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, |
Puyan Lotfi | af04864 | 2018-10-01 10:29:41 +0000 | [diff] [blame] | 35 | HelpText<"Decompress DWARF debug sections.">; |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 36 | defm split_dwo |
| 37 | : Eq<"split-dwo", "Equivalent to extract-dwo on the input file to " |
| 38 | "<dwo-file>, then strip-dwo on the input file">, |
| 39 | MetaVarName<"dwo-file">; |
Jordan Rupprecht | d1767dc | 2018-08-16 18:29:40 +0000 | [diff] [blame] | 40 | |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 41 | defm add_gnu_debuglink |
| 42 | : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">, |
| 43 | MetaVarName<"debug-file">; |
Jordan Rupprecht | d1767dc | 2018-08-16 18:29:40 +0000 | [diff] [blame] | 44 | |
Jordan Rupprecht | d67c1e1 | 2018-08-01 16:23:22 +0000 | [diff] [blame] | 45 | defm rename_section |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 46 | : Eq<"rename-section", |
| 47 | "Renames a section from old to new, optionally with specified flags. " |
| 48 | "Flags supported for GNU compatibility: alloc, load, noload, " |
| 49 | "readonly, debug, code, data, rom, share, contents, merge, strings.">, |
| 50 | MetaVarName<"old=new[,flag1,...]">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 51 | defm redefine_symbol |
| 52 | : Eq<"redefine-sym", "Change the name of a symbol old to new">, |
| 53 | MetaVarName<"old=new">; |
Eugene Leviant | 340cb87 | 2019-02-08 10:33:16 +0000 | [diff] [blame] | 54 | defm redefine_symbols |
| 55 | : Eq<"redefine-syms", |
| 56 | "Reads a list of symbol pairs from <filename> and runs as if " |
| 57 | "--redefine-sym=<old>=<new> is set for each one. <filename> " |
| 58 | "contains two symbols per line separated with whitespace and may " |
| 59 | "contain comments beginning with '#'. Leading and trailing " |
| 60 | "whitespace is stripped from each line. May be repeated to read " |
| 61 | "symbols from many files.">, |
| 62 | MetaVarName<"filename">; |
| 63 | |
Jake Ehrlich | 85985ed | 2018-12-06 02:03:53 +0000 | [diff] [blame] | 64 | defm only_section : Eq<"only-section", "Remove all but <section>">, |
| 65 | MetaVarName<"section">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 66 | def j : JoinedOrSeparate<["-"], "j">, |
| 67 | Alias<only_section>, |
| 68 | HelpText<"Alias for --only-section">; |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 69 | defm add_section |
| 70 | : Eq<"add-section", |
| 71 | "Make a section named <section> with the contents of <file>.">, |
| 72 | MetaVarName<"section=file">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 73 | |
Jordan Rupprecht | c892741 | 2019-01-29 15:05:38 +0000 | [diff] [blame] | 74 | defm set_section_flags |
| 75 | : Eq<"set-section-flags", |
| 76 | "Set section flags for a given section. Flags supported for GNU " |
| 77 | "compatibility: alloc, load, noload, readonly, debug, code, data, " |
| 78 | "rom, share, contents, merge, strings.">, |
| 79 | MetaVarName<"section=flag1[,flag2,...]">; |
| 80 | |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 81 | def S : Flag<["-"], "S">, |
| 82 | Alias<strip_all>, |
| 83 | HelpText<"Alias for --strip-all">; |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 84 | def strip_dwo : Flag<["--"], "strip-dwo">, |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 85 | HelpText<"Remove all DWARF .dwo sections from file">; |
James Henderson | b5de5e2 | 2019-03-14 11:47:41 +0000 | [diff] [blame] | 86 | def strip_non_alloc |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 87 | : Flag<["--"], "strip-non-alloc">, |
James Henderson | b5de5e2 | 2019-03-14 11:47:41 +0000 | [diff] [blame] | 88 | HelpText<"Remove all non-allocated sections outside segments">; |
James Henderson | b5de5e2 | 2019-03-14 11:47:41 +0000 | [diff] [blame] | 89 | defm strip_unneeded_symbol |
Eugene Leviant | 2db1062 | 2019-02-13 07:34:54 +0000 | [diff] [blame] | 90 | : Eq<"strip-unneeded-symbol", |
| 91 | "Remove symbol <symbol> if it is not needed by relocations">, |
| 92 | MetaVarName<"symbol">; |
| 93 | defm strip_unneeded_symbols |
| 94 | : Eq<"strip-unneeded-symbols", |
| 95 | "Reads a list of symbols from <filename> and removes them " |
| 96 | "if they are not needed by relocations">, |
| 97 | MetaVarName<"filename">; |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 98 | |
| 99 | def extract_dwo |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 100 | : Flag<["--"], "extract-dwo">, |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 101 | HelpText< |
| 102 | "Remove all sections that are not DWARF .dwo sections from file">; |
| 103 | |
Peter Collingbourne | 8d58a98 | 2019-06-07 17:57:48 +0000 | [diff] [blame] | 104 | defm extract_partition |
| 105 | : Eq<"extract-partition", "Extract named partition from input file">, |
| 106 | MetaVarName<"name">; |
| 107 | def extract_main_partition |
| 108 | : Flag<["--"], "extract-main-partition">, |
| 109 | HelpText<"Extract main partition from the input file">; |
| 110 | |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 111 | def localize_hidden |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 112 | : Flag<["--"], "localize-hidden">, |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 113 | HelpText< |
| 114 | "Mark all symbols that have hidden or internal visibility as local">; |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 115 | defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">, |
| 116 | MetaVarName<"symbol">; |
Eugene Leviant | e08fe35 | 2019-02-08 14:37:54 +0000 | [diff] [blame] | 117 | defm localize_symbols |
| 118 | : Eq<"localize-symbols", |
| 119 | "Reads a list of symbols from <filename> and marks them local.">, |
| 120 | MetaVarName<"filename">; |
| 121 | |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 122 | def L : JoinedOrSeparate<["-"], "L">, |
| 123 | Alias<localize_symbol>, |
| 124 | HelpText<"Alias for --localize-symbol">; |
Jordan Rupprecht | be8ebcc | 2018-08-17 22:34:48 +0000 | [diff] [blame] | 125 | |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 126 | defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">, |
| 127 | MetaVarName<"symbol">; |
Eugene Leviant | e08fe35 | 2019-02-08 14:37:54 +0000 | [diff] [blame] | 128 | |
| 129 | defm globalize_symbols |
| 130 | : Eq<"globalize-symbols", |
| 131 | "Reads a list of symbols from <filename> and marks them global.">, |
| 132 | MetaVarName<"filename">; |
| 133 | |
Jordan Rupprecht | be8ebcc | 2018-08-17 22:34:48 +0000 | [diff] [blame] | 134 | defm keep_global_symbol |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 135 | : Eq<"keep-global-symbol", |
| 136 | "Convert all symbols except <symbol> to local. May be repeated to " |
| 137 | "convert all except a set of symbols to local.">, |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 138 | MetaVarName<"symbol">; |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 139 | def G : JoinedOrSeparate<["-"], "G">, |
| 140 | Alias<keep_global_symbol>, |
| 141 | HelpText<"Alias for --keep-global-symbol">; |
Jordan Rupprecht | be8ebcc | 2018-08-17 22:34:48 +0000 | [diff] [blame] | 142 | |
| 143 | defm keep_global_symbols |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 144 | : Eq<"keep-global-symbols", |
| 145 | "Reads a list of symbols from <filename> and runs as if " |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 146 | "--keep-global-symbol=<symbol> is set for each one. <filename> " |
| 147 | "contains one symbol per line and may contain comments beginning with " |
| 148 | "'#'. Leading and trailing whitespace is stripped from each line. May " |
| 149 | "be repeated to read symbols from many files.">, |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 150 | MetaVarName<"filename">; |
Jordan Rupprecht | be8ebcc | 2018-08-17 22:34:48 +0000 | [diff] [blame] | 151 | |
Fangrui Song | ab205a3 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 152 | defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">, |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 153 | MetaVarName<"symbol">; |
Eugene Leviant | e08fe35 | 2019-02-08 14:37:54 +0000 | [diff] [blame] | 154 | defm weaken_symbols |
| 155 | : Eq<"weaken-symbols", |
| 156 | "Reads a list of symbols from <filename> and marks them weak.">, |
| 157 | MetaVarName<"filename">; |
| 158 | |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 159 | def W : JoinedOrSeparate<["-"], "W">, |
| 160 | Alias<weaken_symbol>, |
| 161 | HelpText<"Alias for --weaken-symbol">; |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 162 | def weaken : Flag<["--"], "weaken">, |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 163 | HelpText<"Mark all global symbols as weak">; |
Jordan Rupprecht | d0f7bcf | 2019-01-30 14:58:13 +0000 | [diff] [blame] | 164 | |
Eugene Leviant | e08fe35 | 2019-02-08 14:37:54 +0000 | [diff] [blame] | 165 | defm strip_symbols |
| 166 | : Eq<"strip-symbols", |
| 167 | "Reads a list of symbols from <filename> and removes them.">, |
| 168 | MetaVarName<"filename">; |
| 169 | |
Yi Kong | f2baddb | 2019-04-01 18:12:43 +0000 | [diff] [blame] | 170 | defm keep_symbols |
| 171 | : Eq<"keep-symbols", |
| 172 | "Reads a list of symbols from <filename> and runs as if " |
| 173 | "--keep-symbol=<symbol> is set for each one. <filename> " |
| 174 | "contains one symbol per line and may contain comments beginning with " |
| 175 | "'#'. Leading and trailing whitespace is stripped from each line. May " |
| 176 | "be repeated to read symbols from many files.">, |
| 177 | MetaVarName<"filename">; |
| 178 | |
Jordan Rupprecht | 56c0ee0 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 179 | defm dump_section |
| 180 | : Eq<"dump-section", |
| 181 | "Dump contents of section named <section> into file <file>">, |
| 182 | MetaVarName<"section=file">; |
| 183 | defm prefix_symbols |
| 184 | : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">, |
| 185 | MetaVarName<"prefix">; |
| 186 | |
James Henderson | fa11fb3 | 2019-05-08 09:49:35 +0000 | [diff] [blame] | 187 | defm prefix_alloc_sections |
| 188 | : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">, |
| 189 | MetaVarName<"prefix">; |
| 190 | |
Jake Ehrlich | 8ad7779 | 2018-12-03 19:49:23 +0000 | [diff] [blame] | 191 | defm build_id_link_dir |
| 192 | : Eq<"build-id-link-dir", "Set directory for --build-id-link-input and " |
| 193 | "--build-id-link-output to <dir>">, |
| 194 | MetaVarName<"dir">; |
| 195 | defm build_id_link_input |
| 196 | : Eq<"build-id-link-input", "Hard-link the input to <dir>/xx/xxx<suffix> " |
| 197 | "name derived from hex build ID">, |
| 198 | MetaVarName<"suffix">; |
| 199 | defm build_id_link_output |
| 200 | : Eq<"build-id-link-output", "Hard-link the output to <dir>/xx/xxx<suffix> " |
| 201 | "name derived from hex build ID">, |
| 202 | MetaVarName<"suffix">; |
Eugene Leviant | f324f6d | 2019-02-06 11:00:07 +0000 | [diff] [blame] | 203 | |
Eugene Leviant | 53350d0 | 2019-02-26 09:24:22 +0000 | [diff] [blame] | 204 | defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides " |
| 205 | "any previous --change-start or --adjust-start values.">, |
| 206 | MetaVarName<"addr">; |
| 207 | defm change_start : Eq<"change-start", "Add <incr> to the start address. Can be " |
| 208 | "specified multiple times, all values will be applied " |
| 209 | "cumulatively.">, |
| 210 | MetaVarName<"incr">; |
Fangrui Song | 2db79e9 | 2019-04-26 02:10:10 +0000 | [diff] [blame] | 211 | def adjust_start : JoinedOrSeparate<["--"], "adjust-start">, |
Michael Pozulp | 9cf1eab | 2019-08-15 04:45:41 +0000 | [diff] [blame^] | 212 | Alias<change_start>, |
| 213 | HelpText<"Alias for --change-start">; |
Eugene Leviant | 53350d0 | 2019-02-26 09:24:22 +0000 | [diff] [blame] | 214 | |
Eugene Leviant | 51c1f64 | 2019-02-25 14:12:41 +0000 | [diff] [blame] | 215 | defm add_symbol |
| 216 | : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: " |
| 217 | "global, local, weak, default, hidden, file, section, object, " |
| 218 | "function, indirect-function. Accepted but ignored for " |
| 219 | "compatibility: debug, constructor, warning, indirect, synthetic, " |
| 220 | "unique-object, before.">, |
| 221 | MetaVarName<"name=[section:]value[,flags]">; |