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