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