xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td (revision 19261079b74319502c6ffa1249920079f0f69a72)
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, debug, code, data, rom, share, contents, merge, strings.">,
54      MetaVarName<"old=new[,flag1,...]">;
55defm redefine_symbol
56    : Eq<"redefine-sym", "Change the name of a symbol old to new">,
57      MetaVarName<"old=new">;
58defm 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
68defm only_section : Eq<"only-section", "Remove all but <section>">,
69                    MetaVarName<"section">;
70def j : JoinedOrSeparate<["-"], "j">,
71        Alias<only_section>,
72        HelpText<"Alias for --only-section">;
73defm add_section
74    : Eq<"add-section",
75         "Make a section named <section> with the contents of <file>.">,
76      MetaVarName<"section=file">;
77
78defm set_section_alignment
79    : Eq<"set-section-alignment", "Set alignment for a given section.">,
80      MetaVarName<"section=align">;
81
82defm 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
89def S : Flag<["-"], "S">,
90        Alias<strip_all>,
91        HelpText<"Alias for --strip-all">;
92def strip_dwo : Flag<["--"], "strip-dwo">,
93                HelpText<"Remove all DWARF .dwo sections from file">;
94def strip_non_alloc
95    : Flag<["--"], "strip-non-alloc">,
96      HelpText<"Remove all non-allocated sections outside segments">;
97defm strip_unneeded_symbol
98    : 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">;
106
107def extract_dwo
108    : Flag<["--"], "extract-dwo">,
109      HelpText<
110          "Remove all sections that are not DWARF .dwo sections from file">;
111
112defm 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
119def localize_hidden
120    : Flag<["--"], "localize-hidden">,
121      HelpText<
122          "Mark all symbols that have hidden or internal visibility as local">;
123defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
124                       MetaVarName<"symbol">;
125defm localize_symbols
126    : Eq<"localize-symbols",
127         "Reads a list of symbols from <filename> and marks them local.">,
128      MetaVarName<"filename">;
129
130def L : JoinedOrSeparate<["-"], "L">,
131        Alias<localize_symbol>,
132        HelpText<"Alias for --localize-symbol">;
133
134defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
135                        MetaVarName<"symbol">;
136
137defm globalize_symbols
138    : Eq<"globalize-symbols",
139         "Reads a list of symbols from <filename> and marks them global.">,
140      MetaVarName<"filename">;
141
142defm keep_global_symbol
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.">,
146      MetaVarName<"symbol">;
147def G : JoinedOrSeparate<["-"], "G">,
148        Alias<keep_global_symbol>,
149        HelpText<"Alias for --keep-global-symbol">;
150
151defm keep_global_symbols
152    : Eq<"keep-global-symbols",
153         "Reads a list of symbols from <filename> and runs as if "
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.">,
158      MetaVarName<"filename">;
159
160defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
161                     MetaVarName<"symbol">;
162defm weaken_symbols
163    : Eq<"weaken-symbols",
164         "Reads a list of symbols from <filename> and marks them weak.">,
165      MetaVarName<"filename">;
166
167def W : JoinedOrSeparate<["-"], "W">,
168        Alias<weaken_symbol>,
169        HelpText<"Alias for --weaken-symbol">;
170def weaken : Flag<["--"], "weaken">,
171             HelpText<"Mark all global symbols as weak">;
172
173defm strip_symbols
174    : Eq<"strip-symbols",
175         "Reads a list of symbols from <filename> and removes them.">,
176      MetaVarName<"filename">;
177
178defm 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
187defm 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
195defm prefix_alloc_sections
196    : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
197      MetaVarName<"prefix">;
198
199defm 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">;
211
212defm 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">;
219def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
220                   Alias<change_start>,
221                   HelpText<"Alias for --change-start">;
222
223defm add_symbol
224    : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
225         "global, local, weak, default, hidden, protected, file, section, object, "
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]">;
230