blob: 20e98511e10b5e45389e6254dbed556602bf6912 [file] [log] [blame]
Michael Pozulp9cf1eab2019-08-15 04:45:41 +00001include "CommonOpts.td"
James Henderson66a9d0f2019-04-18 09:13:30 +00002
Fangrui Songab205a32018-11-01 17:20:40 +00003defm binary_architecture
4 : Eq<"binary-architecture", "Used when transforming an architecture-less "
5 "format (such as binary) to another format">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +00006def B : JoinedOrSeparate<["-"], "B">,
7 Alias<binary_architecture>,
8 HelpText<"Alias for --binary-architecture">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +00009
Fangrui Songab205a32018-11-01 17:20:40 +000010defm target : Eq<"target", "Format of the input and output file">,
Jordan Rupprechtbb4588e2018-10-12 00:36:01 +000011 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000012def F : JoinedOrSeparate<["-"], "F">,
13 Alias<target>,
14 HelpText<"Alias for --target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000015
Fangrui Songab205a32018-11-01 17:20:40 +000016defm input_target : Eq<"input-target", "Format of the input file">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000017 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000018def I : JoinedOrSeparate<["-"], "I">,
19 Alias<input_target>,
20 HelpText<"Alias for --input-target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000021
Fangrui Songab205a32018-11-01 17:20:40 +000022defm output_target : Eq<"output-target", "Format of the output file">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000023 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000024def O : JoinedOrSeparate<["-"], "O">,
25 Alias<output_target>,
26 HelpText<"Alias for --output-target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000027
Fangrui Song2db79e92019-04-26 02:10:10 +000028def compress_debug_sections : Flag<["--"], "compress-debug-sections">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000029def compress_debug_sections_eq
Fangrui Song2db79e92019-04-26 02:10:10 +000030 : Joined<["--"], "compress-debug-sections=">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000031 MetaVarName<"[ zlib | zlib-gnu ]">,
32 HelpText<"Compress DWARF debug sections using specified style. Supported "
33 "styles: 'zlib-gnu' and 'zlib'">;
Fangrui Song2db79e92019-04-26 02:10:10 +000034def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">,
Puyan Lotfiaf048642018-10-01 10:29:41 +000035 HelpText<"Decompress DWARF debug sections.">;
Fangrui Songab205a32018-11-01 17:20:40 +000036defm 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 Rupprechtd1767dc2018-08-16 18:29:40 +000040
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000041defm add_gnu_debuglink
42 : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
43 MetaVarName<"debug-file">;
Jordan Rupprechtd1767dc2018-08-16 18:29:40 +000044
Jordan Rupprechtd67c1e12018-08-01 16:23:22 +000045defm rename_section
Fangrui Songab205a32018-11-01 17:20:40 +000046 : 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 Rupprecht56c0ee02018-11-01 21:38:14 +000051defm redefine_symbol
52 : Eq<"redefine-sym", "Change the name of a symbol old to new">,
53 MetaVarName<"old=new">;
Eugene Leviant340cb872019-02-08 10:33:16 +000054defm 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 Ehrlich85985ed2018-12-06 02:03:53 +000064defm only_section : Eq<"only-section", "Remove all but <section>">,
65 MetaVarName<"section">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000066def j : JoinedOrSeparate<["-"], "j">,
67 Alias<only_section>,
68 HelpText<"Alias for --only-section">;
Fangrui Songab205a32018-11-01 17:20:40 +000069defm add_section
70 : Eq<"add-section",
71 "Make a section named <section> with the contents of <file>.">,
72 MetaVarName<"section=file">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000073
Jordan Rupprechtc8927412019-01-29 15:05:38 +000074defm 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 Pozulp9cf1eab2019-08-15 04:45:41 +000081def S : Flag<["-"], "S">,
82 Alias<strip_all>,
83 HelpText<"Alias for --strip-all">;
Fangrui Song2db79e92019-04-26 02:10:10 +000084def strip_dwo : Flag<["--"], "strip-dwo">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000085 HelpText<"Remove all DWARF .dwo sections from file">;
James Hendersonb5de5e22019-03-14 11:47:41 +000086def strip_non_alloc
Fangrui Song2db79e92019-04-26 02:10:10 +000087 : Flag<["--"], "strip-non-alloc">,
James Hendersonb5de5e22019-03-14 11:47:41 +000088 HelpText<"Remove all non-allocated sections outside segments">;
James Hendersonb5de5e22019-03-14 11:47:41 +000089defm strip_unneeded_symbol
Eugene Leviant2db10622019-02-13 07:34:54 +000090 : Eq<"strip-unneeded-symbol",
91 "Remove symbol <symbol> if it is not needed by relocations">,
92 MetaVarName<"symbol">;
93defm 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 Rupprecht56c0ee02018-11-01 21:38:14 +000098
99def extract_dwo
Fangrui Song2db79e92019-04-26 02:10:10 +0000100 : Flag<["--"], "extract-dwo">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000101 HelpText<
102 "Remove all sections that are not DWARF .dwo sections from file">;
103
Peter Collingbourne8d58a982019-06-07 17:57:48 +0000104defm extract_partition
105 : Eq<"extract-partition", "Extract named partition from input file">,
106 MetaVarName<"name">;
107def extract_main_partition
108 : Flag<["--"], "extract-main-partition">,
109 HelpText<"Extract main partition from the input file">;
110
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000111def localize_hidden
Fangrui Song2db79e92019-04-26 02:10:10 +0000112 : Flag<["--"], "localize-hidden">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000113 HelpText<
114 "Mark all symbols that have hidden or internal visibility as local">;
Fangrui Songab205a32018-11-01 17:20:40 +0000115defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
116 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000117defm localize_symbols
118 : Eq<"localize-symbols",
119 "Reads a list of symbols from <filename> and marks them local.">,
120 MetaVarName<"filename">;
121
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000122def L : JoinedOrSeparate<["-"], "L">,
123 Alias<localize_symbol>,
124 HelpText<"Alias for --localize-symbol">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000125
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000126defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
127 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000128
129defm globalize_symbols
130 : Eq<"globalize-symbols",
131 "Reads a list of symbols from <filename> and marks them global.">,
132 MetaVarName<"filename">;
133
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000134defm keep_global_symbol
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000135 : 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 Songab205a32018-11-01 17:20:40 +0000138 MetaVarName<"symbol">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000139def G : JoinedOrSeparate<["-"], "G">,
140 Alias<keep_global_symbol>,
141 HelpText<"Alias for --keep-global-symbol">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000142
143defm keep_global_symbols
Fangrui Songab205a32018-11-01 17:20:40 +0000144 : Eq<"keep-global-symbols",
145 "Reads a list of symbols from <filename> and runs as if "
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000146 "--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 Songab205a32018-11-01 17:20:40 +0000150 MetaVarName<"filename">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000151
Fangrui Songab205a32018-11-01 17:20:40 +0000152defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000153 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000154defm weaken_symbols
155 : Eq<"weaken-symbols",
156 "Reads a list of symbols from <filename> and marks them weak.">,
157 MetaVarName<"filename">;
158
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000159def W : JoinedOrSeparate<["-"], "W">,
160 Alias<weaken_symbol>,
161 HelpText<"Alias for --weaken-symbol">;
Fangrui Song2db79e92019-04-26 02:10:10 +0000162def weaken : Flag<["--"], "weaken">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000163 HelpText<"Mark all global symbols as weak">;
Jordan Rupprechtd0f7bcf2019-01-30 14:58:13 +0000164
Eugene Leviante08fe352019-02-08 14:37:54 +0000165defm strip_symbols
166 : Eq<"strip-symbols",
167 "Reads a list of symbols from <filename> and removes them.">,
168 MetaVarName<"filename">;
169
Yi Kongf2baddb2019-04-01 18:12:43 +0000170defm 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 Rupprecht56c0ee02018-11-01 21:38:14 +0000179defm dump_section
180 : Eq<"dump-section",
181 "Dump contents of section named <section> into file <file>">,
182 MetaVarName<"section=file">;
183defm prefix_symbols
184 : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
185 MetaVarName<"prefix">;
186
James Hendersonfa11fb32019-05-08 09:49:35 +0000187defm prefix_alloc_sections
188 : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
189 MetaVarName<"prefix">;
190
Jake Ehrlich8ad77792018-12-03 19:49:23 +0000191defm 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">;
195defm 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">;
199defm 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 Leviantf324f6d2019-02-06 11:00:07 +0000203
Eugene Leviant53350d02019-02-26 09:24:22 +0000204defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
205 "any previous --change-start or --adjust-start values.">,
206 MetaVarName<"addr">;
207defm 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 Song2db79e92019-04-26 02:10:10 +0000211def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000212 Alias<change_start>,
213 HelpText<"Alias for --change-start">;
Eugene Leviant53350d02019-02-26 09:24:22 +0000214
Eugene Leviant51c1f642019-02-25 14:12:41 +0000215defm 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]">;