blob: 9e6b6f0005cd1fceb9781b1829ea4c3c6e928419 [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
Fangrui Song2f519d72019-09-14 01:36:31 +00004 : Eq<"binary-architecture", "Ignored for compatibility">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +00005def B : JoinedOrSeparate<["-"], "B">,
6 Alias<binary_architecture>,
7 HelpText<"Alias for --binary-architecture">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +00008
Fangrui Songab205a32018-11-01 17:20:40 +00009defm target : Eq<"target", "Format of the input and output file">,
Jordan Rupprechtbb4588e2018-10-12 00:36:01 +000010 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000011def F : JoinedOrSeparate<["-"], "F">,
12 Alias<target>,
13 HelpText<"Alias for --target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000014
Fangrui Songab205a32018-11-01 17:20:40 +000015defm input_target : Eq<"input-target", "Format of the input file">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000016 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000017def I : JoinedOrSeparate<["-"], "I">,
18 Alias<input_target>,
19 HelpText<"Alias for --input-target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000020
Fangrui Songab205a32018-11-01 17:20:40 +000021defm output_target : Eq<"output-target", "Format of the output file">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000022 Values<"binary">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000023def O : JoinedOrSeparate<["-"], "O">,
24 Alias<output_target>,
25 HelpText<"Alias for --output-target">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000026
Chris Jacksonfa1fe932019-08-30 10:17:16 +000027defm 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 Song2db79e92019-04-26 02:10:10 +000032def compress_debug_sections : Flag<["--"], "compress-debug-sections">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000033def compress_debug_sections_eq
Fangrui Song2db79e92019-04-26 02:10:10 +000034 : Joined<["--"], "compress-debug-sections=">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000035 MetaVarName<"[ zlib | zlib-gnu ]">,
36 HelpText<"Compress DWARF debug sections using specified style. Supported "
37 "styles: 'zlib-gnu' and 'zlib'">;
Fangrui Song2db79e92019-04-26 02:10:10 +000038def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">,
Puyan Lotfiaf048642018-10-01 10:29:41 +000039 HelpText<"Decompress DWARF debug sections.">;
Fangrui Songab205a32018-11-01 17:20:40 +000040defm 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 Rupprechtd1767dc2018-08-16 18:29:40 +000044
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000045defm add_gnu_debuglink
46 : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
47 MetaVarName<"debug-file">;
Jordan Rupprechtd1767dc2018-08-16 18:29:40 +000048
Jordan Rupprechtd67c1e12018-08-01 16:23:22 +000049defm rename_section
Fangrui Songab205a32018-11-01 17:20:40 +000050 : 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 Rupprecht56c0ee02018-11-01 21:38:14 +000055defm redefine_symbol
56 : Eq<"redefine-sym", "Change the name of a symbol old to new">,
57 MetaVarName<"old=new">;
Eugene Leviant340cb872019-02-08 10:33:16 +000058defm 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 Ehrlich85985ed2018-12-06 02:03:53 +000068defm only_section : Eq<"only-section", "Remove all but <section>">,
69 MetaVarName<"section">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +000070def j : JoinedOrSeparate<["-"], "j">,
71 Alias<only_section>,
72 HelpText<"Alias for --only-section">;
Fangrui Songab205a32018-11-01 17:20:40 +000073defm add_section
74 : Eq<"add-section",
75 "Make a section named <section> with the contents of <file>.">,
76 MetaVarName<"section=file">;
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +000077
Fangrui Song671fb342019-10-02 12:41:25 +000078defm set_section_alignment
79 : Eq<"set-section-alignment", "Set alignment for a given section.">,
80 MetaVarName<"section=align">;
81
Jordan Rupprechtc8927412019-01-29 15:05:38 +000082defm 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 Pozulp9cf1eab2019-08-15 04:45:41 +000089def S : Flag<["-"], "S">,
90 Alias<strip_all>,
91 HelpText<"Alias for --strip-all">;
Fangrui Song2db79e92019-04-26 02:10:10 +000092def strip_dwo : Flag<["--"], "strip-dwo">,
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000093 HelpText<"Remove all DWARF .dwo sections from file">;
James Hendersonb5de5e22019-03-14 11:47:41 +000094def strip_non_alloc
Fangrui Song2db79e92019-04-26 02:10:10 +000095 : Flag<["--"], "strip-non-alloc">,
James Hendersonb5de5e22019-03-14 11:47:41 +000096 HelpText<"Remove all non-allocated sections outside segments">;
James Hendersonb5de5e22019-03-14 11:47:41 +000097defm strip_unneeded_symbol
Eugene Leviant2db10622019-02-13 07:34:54 +000098 : Eq<"strip-unneeded-symbol",
99 "Remove symbol <symbol> if it is not needed by relocations">,
100 MetaVarName<"symbol">;
101defm 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 Rupprecht56c0ee02018-11-01 21:38:14 +0000106
107def extract_dwo
Fangrui Song2db79e92019-04-26 02:10:10 +0000108 : Flag<["--"], "extract-dwo">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000109 HelpText<
110 "Remove all sections that are not DWARF .dwo sections from file">;
111
Peter Collingbourne8d58a982019-06-07 17:57:48 +0000112defm extract_partition
113 : Eq<"extract-partition", "Extract named partition from input file">,
114 MetaVarName<"name">;
115def extract_main_partition
116 : Flag<["--"], "extract-main-partition">,
117 HelpText<"Extract main partition from the input file">;
118
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000119def localize_hidden
Fangrui Song2db79e92019-04-26 02:10:10 +0000120 : Flag<["--"], "localize-hidden">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000121 HelpText<
122 "Mark all symbols that have hidden or internal visibility as local">;
Fangrui Songab205a32018-11-01 17:20:40 +0000123defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
124 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000125defm localize_symbols
126 : Eq<"localize-symbols",
127 "Reads a list of symbols from <filename> and marks them local.">,
128 MetaVarName<"filename">;
129
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000130def L : JoinedOrSeparate<["-"], "L">,
131 Alias<localize_symbol>,
132 HelpText<"Alias for --localize-symbol">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000133
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000134defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
135 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000136
137defm globalize_symbols
138 : Eq<"globalize-symbols",
139 "Reads a list of symbols from <filename> and marks them global.">,
140 MetaVarName<"filename">;
141
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000142defm keep_global_symbol
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000143 : 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 Songab205a32018-11-01 17:20:40 +0000146 MetaVarName<"symbol">;
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000147def G : JoinedOrSeparate<["-"], "G">,
148 Alias<keep_global_symbol>,
149 HelpText<"Alias for --keep-global-symbol">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000150
151defm keep_global_symbols
Fangrui Songab205a32018-11-01 17:20:40 +0000152 : Eq<"keep-global-symbols",
153 "Reads a list of symbols from <filename> and runs as if "
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000154 "--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 Songab205a32018-11-01 17:20:40 +0000158 MetaVarName<"filename">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +0000159
Fangrui Songab205a32018-11-01 17:20:40 +0000160defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000161 MetaVarName<"symbol">;
Eugene Leviante08fe352019-02-08 14:37:54 +0000162defm weaken_symbols
163 : Eq<"weaken-symbols",
164 "Reads a list of symbols from <filename> and marks them weak.">,
165 MetaVarName<"filename">;
166
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000167def W : JoinedOrSeparate<["-"], "W">,
168 Alias<weaken_symbol>,
169 HelpText<"Alias for --weaken-symbol">;
Fangrui Song2db79e92019-04-26 02:10:10 +0000170def weaken : Flag<["--"], "weaken">,
Jordan Rupprecht56c0ee02018-11-01 21:38:14 +0000171 HelpText<"Mark all global symbols as weak">;
Jordan Rupprechtd0f7bcf2019-01-30 14:58:13 +0000172
Eugene Leviante08fe352019-02-08 14:37:54 +0000173defm strip_symbols
174 : Eq<"strip-symbols",
175 "Reads a list of symbols from <filename> and removes them.">,
176 MetaVarName<"filename">;
177
Yi Kongf2baddb2019-04-01 18:12:43 +0000178defm 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 Rupprecht56c0ee02018-11-01 21:38:14 +0000187defm dump_section
188 : Eq<"dump-section",
189 "Dump contents of section named <section> into file <file>">,
190 MetaVarName<"section=file">;
191defm prefix_symbols
192 : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
193 MetaVarName<"prefix">;
194
James Hendersonfa11fb32019-05-08 09:49:35 +0000195defm prefix_alloc_sections
196 : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
197 MetaVarName<"prefix">;
198
Jake Ehrlich8ad77792018-12-03 19:49:23 +0000199defm 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">;
203defm 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">;
207defm 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 Leviantf324f6d2019-02-06 11:00:07 +0000211
Eugene Leviant53350d02019-02-26 09:24:22 +0000212defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
213 "any previous --change-start or --adjust-start values.">,
214 MetaVarName<"addr">;
215defm 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 Song2db79e92019-04-26 02:10:10 +0000219def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
Michael Pozulp9cf1eab2019-08-15 04:45:41 +0000220 Alias<change_start>,
221 HelpText<"Alias for --change-start">;
Eugene Leviant53350d02019-02-26 09:24:22 +0000222
Eugene Leviant51c1f642019-02-25 14:12:41 +0000223defm add_symbol
224 : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
Chris Jacksone5cdfbc2019-08-15 09:45:09 +0000225 "global, local, weak, default, hidden, protected, file, section, object, "
Eugene Leviant51c1f642019-02-25 14:12:41 +0000226 "function, indirect-function. Accepted but ignored for "
227 "compatibility: debug, constructor, warning, indirect, synthetic, "
228 "unique-object, before.">,
229 MetaVarName<"name=[section:]value[,flags]">;