1include "CommonOpts.td"
2
3defm binary_architecture
4    : Eq<"binary-architecture", "Ignored for compatibility">;
5def B : JoinedOrSeparate<["-"], "B">,
6        Alias<binary_architecture>,
7        HelpText<"Alias for --binary-architecture">;
8
9defm target : Eq<"target", "Format of the input and output file">,
10              Values<"binary">;
11def F : JoinedOrSeparate<["-"], "F">,
12        Alias<target>,
13        HelpText<"Alias for --target">;
14
15defm input_target : Eq<"input-target", "Format of the input file">,
16                    Values<"binary">;
17def I : JoinedOrSeparate<["-"], "I">,
18        Alias<input_target>,
19        HelpText<"Alias for --input-target">;
20
21defm output_target : Eq<"output-target", "Format of the output file">,
22                     Values<"binary">;
23def O : JoinedOrSeparate<["-"], "O">,
24        Alias<output_target>,
25        HelpText<"Alias for --output-target">;
26
27defm 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
32def compress_debug_sections
33    : Joined<["--"], "compress-debug-sections=">,
34      MetaVarName<"format">,
35      HelpText<"Compress DWARF debug sections using specified format. Supported "
36               "formats: zlib, zstd. Select zlib if <format> is omitted">;
37def : Flag<["--"], "compress-debug-sections">, Alias<compress_debug_sections>,
38      AliasArgs<["zlib"]>;
39def decompress_debug_sections : Flag<["--"], "decompress-debug-sections">,
40                                HelpText<"Decompress DWARF debug sections.">;
41defm split_dwo
42    : Eq<"split-dwo", "Equivalent to extract-dwo on the input file to "
43                      "<dwo-file>, then strip-dwo on the input file">,
44      MetaVarName<"dwo-file">;
45
46defm add_gnu_debuglink
47    : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
48      MetaVarName<"debug-file">;
49
50defm rename_section
51    : Eq<"rename-section",
52         "Renames a section from old to new, optionally with specified flags. "
53         "Flags supported for GNU compatibility: alloc, load, noload, "
54         "readonly, exclude, debug, code, data, rom, share, contents, merge, "
55         "strings.">,
56      MetaVarName<"old=new[,flag1,...]">;
57defm redefine_symbol
58    : Eq<"redefine-sym", "Change the name of a symbol old to new">,
59      MetaVarName<"old=new">;
60defm redefine_symbols
61    : Eq<"redefine-syms",
62         "Reads a list of symbol pairs from <filename> and runs as if "
63         "--redefine-sym=<old>=<new> is set for each one. <filename> "
64         "contains two symbols per line separated with whitespace and may "
65         "contain comments beginning with '#'. Leading and trailing "
66         "whitespace is stripped from each line. May be repeated to read "
67         "symbols from many files.">,
68      MetaVarName<"filename">;
69
70defm only_section : Eq<"only-section", "Remove all but <section>">,
71                    MetaVarName<"section">;
72def j : JoinedOrSeparate<["-"], "j">,
73        Alias<only_section>,
74        HelpText<"Alias for --only-section">;
75defm add_section
76    : Eq<"add-section",
77         "Make a section named <section> with the contents of <file>.">,
78      MetaVarName<"section=file">;
79
80defm set_section_alignment
81    : Eq<"set-section-alignment", "Set alignment for a given section.">,
82      MetaVarName<"section=align">;
83
84defm set_section_flags
85    : Eq<"set-section-flags",
86         "Set section flags for a given section. Flags supported for GNU "
87         "compatibility: alloc, load, noload, readonly, exclude, debug, code, "
88         "data, rom, share, contents, merge, strings.">,
89      MetaVarName<"section=flag1[,flag2,...]">;
90
91defm set_section_type
92    : Eq<"set-section-type",
93         "Set the type of section <section> to the integer <type>">,
94      MetaVarName<"section=type">;
95
96def S : Flag<["-"], "S">,
97        Alias<strip_all>,
98        HelpText<"Alias for --strip-all">;
99def strip_dwo : Flag<["--"], "strip-dwo">,
100                HelpText<"Remove all DWARF .dwo sections from file">;
101def strip_non_alloc
102    : Flag<["--"], "strip-non-alloc">,
103      HelpText<"Remove all non-allocated sections outside segments">;
104defm strip_unneeded_symbol
105    : Eq<"strip-unneeded-symbol",
106         "Remove symbol <symbol> if it is not needed by relocations">,
107      MetaVarName<"symbol">;
108defm strip_unneeded_symbols
109    : Eq<"strip-unneeded-symbols",
110         "Reads a list of symbols from <filename> and removes them "
111         "if they are not needed by relocations">,
112      MetaVarName<"filename">;
113
114defm subsystem
115    : Eq<"subsystem",
116         "Set PE subsystem and version">,
117      MetaVarName<"name[:version]">;
118
119def extract_dwo
120    : Flag<["--"], "extract-dwo">,
121      HelpText<
122          "Remove all sections that are not DWARF .dwo sections from file">;
123
124defm extract_partition
125    : Eq<"extract-partition", "Extract named partition from input file">,
126      MetaVarName<"name">;
127def extract_main_partition
128    : Flag<["--"], "extract-main-partition">,
129      HelpText<"Extract main partition from the input file">;
130
131def localize_hidden
132    : Flag<["--"], "localize-hidden">,
133      HelpText<
134          "Mark all symbols that have hidden or internal visibility as local">;
135defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
136                       MetaVarName<"symbol">;
137defm localize_symbols
138    : Eq<"localize-symbols",
139         "Reads a list of symbols from <filename> and marks them local.">,
140      MetaVarName<"filename">;
141
142def L : JoinedOrSeparate<["-"], "L">,
143        Alias<localize_symbol>,
144        HelpText<"Alias for --localize-symbol">;
145
146defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
147                        MetaVarName<"symbol">;
148
149defm globalize_symbols
150    : Eq<"globalize-symbols",
151         "Reads a list of symbols from <filename> and marks them global.">,
152      MetaVarName<"filename">;
153
154defm keep_global_symbol
155    : Eq<"keep-global-symbol",
156         "Convert all symbols except <symbol> to local. May be repeated to "
157         "convert all except a set of symbols to local.">,
158      MetaVarName<"symbol">;
159def G : JoinedOrSeparate<["-"], "G">,
160        Alias<keep_global_symbol>,
161        HelpText<"Alias for --keep-global-symbol">;
162
163defm keep_global_symbols
164    : Eq<"keep-global-symbols",
165         "Reads a list of symbols from <filename> and runs as if "
166         "--keep-global-symbol=<symbol> is set for each one. <filename> "
167         "contains one symbol per line and may contain comments beginning with "
168         "'#'. Leading and trailing whitespace is stripped from each line. May "
169         "be repeated to read symbols from many files.">,
170      MetaVarName<"filename">;
171
172defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
173                     MetaVarName<"symbol">;
174defm weaken_symbols
175    : Eq<"weaken-symbols",
176         "Reads a list of symbols from <filename> and marks them weak.">,
177      MetaVarName<"filename">;
178
179def W : JoinedOrSeparate<["-"], "W">,
180        Alias<weaken_symbol>,
181        HelpText<"Alias for --weaken-symbol">;
182def weaken : Flag<["--"], "weaken">,
183             HelpText<"Mark all global symbols as weak">;
184
185defm strip_symbols
186    : Eq<"strip-symbols",
187         "Reads a list of symbols from <filename> and removes them.">,
188      MetaVarName<"filename">;
189
190defm keep_symbols
191    : Eq<"keep-symbols",
192         "Reads a list of symbols from <filename> and runs as if "
193         "--keep-symbol=<symbol> is set for each one. <filename> "
194         "contains one symbol per line and may contain comments beginning with "
195         "'#'. Leading and trailing whitespace is stripped from each line. May "
196         "be repeated to read symbols from many files.">,
197      MetaVarName<"filename">;
198
199defm dump_section
200    : Eq<"dump-section",
201         "Dump contents of section named <section> into file <file>">,
202      MetaVarName<"section=file">;
203defm prefix_symbols
204    : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
205      MetaVarName<"prefix">;
206
207defm prefix_alloc_sections
208    : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
209      MetaVarName<"prefix">;
210
211defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
212                    "any previous --change-start or --adjust-start values.">,
213                 MetaVarName<"addr">;
214defm change_start : Eq<"change-start", "Add <incr> to the start address. Can be "
215                       "specified multiple times, all values will be applied "
216                       "cumulatively.">,
217                    MetaVarName<"incr">;
218def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
219                   Alias<change_start>,
220                   HelpText<"Alias for --change-start">;
221
222defm add_symbol
223    : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
224         "global, local, weak, default, hidden, protected, file, section, object, "
225         "function, indirect-function. Accepted but ignored for "
226         "compatibility: debug, constructor, warning, indirect, synthetic, "
227         "unique-object, before.">,
228      MetaVarName<"name=[section:]value[,flags]">;
229
230defm update_section
231    : Eq<"update-section", "Replace the contents of section <name> with contents from a file <file>.">,
232      MetaVarName<"name=file">;
233