xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td (revision 643ac419fafba89f5adda0e0ea75b538727453fb)
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
108defm subsystem
109    : Eq<"subsystem",
110         "Set PE subsystem and version">,
111      MetaVarName<"name[:version]">;
112
113def extract_dwo
114    : Flag<["--"], "extract-dwo">,
115      HelpText<
116          "Remove all sections that are not DWARF .dwo sections from file">;
117
118defm extract_partition
119    : Eq<"extract-partition", "Extract named partition from input file">,
120      MetaVarName<"name">;
121def extract_main_partition
122    : Flag<["--"], "extract-main-partition">,
123      HelpText<"Extract main partition from the input file">;
124
125def localize_hidden
126    : Flag<["--"], "localize-hidden">,
127      HelpText<
128          "Mark all symbols that have hidden or internal visibility as local">;
129defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
130                       MetaVarName<"symbol">;
131defm localize_symbols
132    : Eq<"localize-symbols",
133         "Reads a list of symbols from <filename> and marks them local.">,
134      MetaVarName<"filename">;
135
136def L : JoinedOrSeparate<["-"], "L">,
137        Alias<localize_symbol>,
138        HelpText<"Alias for --localize-symbol">;
139
140defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
141                        MetaVarName<"symbol">;
142
143defm globalize_symbols
144    : Eq<"globalize-symbols",
145         "Reads a list of symbols from <filename> and marks them global.">,
146      MetaVarName<"filename">;
147
148defm keep_global_symbol
149    : Eq<"keep-global-symbol",
150         "Convert all symbols except <symbol> to local. May be repeated to "
151         "convert all except a set of symbols to local.">,
152      MetaVarName<"symbol">;
153def G : JoinedOrSeparate<["-"], "G">,
154        Alias<keep_global_symbol>,
155        HelpText<"Alias for --keep-global-symbol">;
156
157defm keep_global_symbols
158    : Eq<"keep-global-symbols",
159         "Reads a list of symbols from <filename> and runs as if "
160         "--keep-global-symbol=<symbol> is set for each one. <filename> "
161         "contains one symbol per line and may contain comments beginning with "
162         "'#'. Leading and trailing whitespace is stripped from each line. May "
163         "be repeated to read symbols from many files.">,
164      MetaVarName<"filename">;
165
166defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
167                     MetaVarName<"symbol">;
168defm weaken_symbols
169    : Eq<"weaken-symbols",
170         "Reads a list of symbols from <filename> and marks them weak.">,
171      MetaVarName<"filename">;
172
173def W : JoinedOrSeparate<["-"], "W">,
174        Alias<weaken_symbol>,
175        HelpText<"Alias for --weaken-symbol">;
176def weaken : Flag<["--"], "weaken">,
177             HelpText<"Mark all global symbols as weak">;
178
179defm strip_symbols
180    : Eq<"strip-symbols",
181         "Reads a list of symbols from <filename> and removes them.">,
182      MetaVarName<"filename">;
183
184defm keep_symbols
185    : Eq<"keep-symbols",
186         "Reads a list of symbols from <filename> and runs as if "
187         "--keep-symbol=<symbol> is set for each one. <filename> "
188         "contains one symbol per line and may contain comments beginning with "
189         "'#'. Leading and trailing whitespace is stripped from each line. May "
190         "be repeated to read symbols from many files.">,
191      MetaVarName<"filename">;
192
193defm dump_section
194    : Eq<"dump-section",
195         "Dump contents of section named <section> into file <file>">,
196      MetaVarName<"section=file">;
197defm prefix_symbols
198    : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
199      MetaVarName<"prefix">;
200
201defm prefix_alloc_sections
202    : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
203      MetaVarName<"prefix">;
204
205defm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
206                    "any previous --change-start or --adjust-start values.">,
207                 MetaVarName<"addr">;
208defm change_start : Eq<"change-start", "Add <incr> to the start address. Can be "
209                       "specified multiple times, all values will be applied "
210                       "cumulatively.">,
211                    MetaVarName<"incr">;
212def adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
213                   Alias<change_start>,
214                   HelpText<"Alias for --change-start">;
215
216defm add_symbol
217    : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
218         "global, local, weak, default, hidden, protected, file, section, object, "
219         "function, indirect-function. Accepted but ignored for "
220         "compatibility: debug, constructor, warning, indirect, synthetic, "
221         "unique-object, before.">,
222      MetaVarName<"name=[section:]value[,flags]">;
223
224defm update_section
225    : Eq<"update-section", "Add section <name> with contents from a file <file>.">,
226      MetaVarName<"name=file">;
227