xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objcopy/ObjcopyOpts.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
18bcb0991SDimitry Andricinclude "CommonOpts.td"
20b57cec5SDimitry Andric
3*0fca6ea1SDimitry Andricmulticlass B<string name, string help1, string help2> {
4*0fca6ea1SDimitry Andric  def NAME: Flag<["--"], name>, HelpText<help1>;
5*0fca6ea1SDimitry Andric  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
6*0fca6ea1SDimitry Andric}
7*0fca6ea1SDimitry Andric
80b57cec5SDimitry Andricdefm binary_architecture
98bcb0991SDimitry Andric    : Eq<"binary-architecture", "Ignored for compatibility">;
108bcb0991SDimitry Andricdef B : JoinedOrSeparate<["-"], "B">,
118bcb0991SDimitry Andric        Alias<binary_architecture>,
128bcb0991SDimitry Andric        HelpText<"Alias for --binary-architecture">;
130b57cec5SDimitry Andric
14*0fca6ea1SDimitry Andricdefm target : Eq<"target", "Equivalent to --input-target and --output-target for the specified format">,
150b57cec5SDimitry Andric              Values<"binary">;
168bcb0991SDimitry Andricdef F : JoinedOrSeparate<["-"], "F">,
178bcb0991SDimitry Andric        Alias<target>,
188bcb0991SDimitry Andric        HelpText<"Alias for --target">;
190b57cec5SDimitry Andric
20*0fca6ea1SDimitry Andricdefm input_target : Eq<"input-target", "Read the input as the specified format">, MetaVarName<"format">;
218bcb0991SDimitry Andricdef I : JoinedOrSeparate<["-"], "I">,
228bcb0991SDimitry Andric        Alias<input_target>,
238bcb0991SDimitry Andric        HelpText<"Alias for --input-target">;
240b57cec5SDimitry Andric
25*0fca6ea1SDimitry Andricdefm output_target : Eq<"output-target", "Write the output as the specified format">, MetaVarName<"format">;
268bcb0991SDimitry Andricdef O : JoinedOrSeparate<["-"], "O">,
278bcb0991SDimitry Andric        Alias<output_target>,
288bcb0991SDimitry Andric        HelpText<"Alias for --output-target">;
298bcb0991SDimitry Andric
30*0fca6ea1SDimitry Andricdefm new_symbol_visibility
31*0fca6ea1SDimitry Andric    : Eq<"new-symbol-visibility", "Specify the visibility of symbols automatically "
32*0fca6ea1SDimitry Andric         "created when using binary input or --add-symbol. The default is 'default'">;
330b57cec5SDimitry Andric
34972a253aSDimitry Andricdef compress_debug_sections
350b57cec5SDimitry Andric    : Joined<["--"], "compress-debug-sections=">,
36972a253aSDimitry Andric      MetaVarName<"format">,
37972a253aSDimitry Andric      HelpText<"Compress DWARF debug sections using specified format. Supported "
38bdd1243dSDimitry Andric               "formats: zlib, zstd. Select zlib if <format> is omitted">;
39972a253aSDimitry Andricdef : Flag<["--"], "compress-debug-sections">, Alias<compress_debug_sections>,
40972a253aSDimitry Andric      AliasArgs<["zlib"]>;
410b57cec5SDimitry Andricdef decompress_debug_sections : Flag<["--"], "decompress-debug-sections">,
4206c3fb27SDimitry Andric                                HelpText<"Decompress DWARF debug sections">;
43*0fca6ea1SDimitry Andricdefm compress_sections
44*0fca6ea1SDimitry Andric    : Eq<"compress-sections",
45*0fca6ea1SDimitry Andric         "Compress or decompress sections using specified format. Supported "
46*0fca6ea1SDimitry Andric         "formats: zlib, zstd. Specify 'none' for decompression">,
47*0fca6ea1SDimitry Andric      MetaVarName<"<section-glob>=<format>">;
48*0fca6ea1SDimitry Andric
490b57cec5SDimitry Andricdefm split_dwo
50*0fca6ea1SDimitry Andric    : Eq<"split-dwo", "Equivalent to --extract-dwo and <dwo-file> as the output file and no other options, "
51*0fca6ea1SDimitry Andric                      "and then --strip-dwo on the input file">,
520b57cec5SDimitry Andric      MetaVarName<"dwo-file">;
530b57cec5SDimitry Andric
540b57cec5SDimitry Andricdefm add_gnu_debuglink
550b57cec5SDimitry Andric    : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
560b57cec5SDimitry Andric      MetaVarName<"debug-file">;
570b57cec5SDimitry Andric
580b57cec5SDimitry Andricdefm rename_section
590b57cec5SDimitry Andric    : Eq<"rename-section",
60*0fca6ea1SDimitry Andric         "Rename sections called <old> to <new>, and apply any specified <flag> values. "
61*0fca6ea1SDimitry Andric         "See --set-section-flags for a list of supported flags">,
620b57cec5SDimitry Andric      MetaVarName<"old=new[,flag1,...]">;
630b57cec5SDimitry Andricdefm redefine_symbol
640b57cec5SDimitry Andric    : Eq<"redefine-sym", "Change the name of a symbol old to new">,
650b57cec5SDimitry Andric      MetaVarName<"old=new">;
660b57cec5SDimitry Andricdefm redefine_symbols
670b57cec5SDimitry Andric    : Eq<"redefine-syms",
68*0fca6ea1SDimitry Andric         "Read a list of symbol pairs from <filename> and run as if "
690b57cec5SDimitry Andric         "--redefine-sym=<old>=<new> is set for each one. <filename> "
700b57cec5SDimitry Andric         "contains two symbols per line separated with whitespace and may "
710b57cec5SDimitry Andric         "contain comments beginning with '#'. Leading and trailing "
720b57cec5SDimitry Andric         "whitespace is stripped from each line. May be repeated to read "
7306c3fb27SDimitry Andric         "symbols from many files">,
740b57cec5SDimitry Andric      MetaVarName<"filename">;
750b57cec5SDimitry Andric
760b57cec5SDimitry Andricdefm only_section : Eq<"only-section", "Remove all but <section>">,
770b57cec5SDimitry Andric                    MetaVarName<"section">;
788bcb0991SDimitry Andricdef j : JoinedOrSeparate<["-"], "j">,
798bcb0991SDimitry Andric        Alias<only_section>,
808bcb0991SDimitry Andric        HelpText<"Alias for --only-section">;
810b57cec5SDimitry Andricdefm add_section
820b57cec5SDimitry Andric    : Eq<"add-section",
83*0fca6ea1SDimitry Andric         "Add a section named <section> with the contents of <file>">,
840b57cec5SDimitry Andric      MetaVarName<"section=file">;
850b57cec5SDimitry Andric
868bcb0991SDimitry Andricdefm set_section_alignment
8706c3fb27SDimitry Andric    : Eq<"set-section-alignment", "Set alignment for a given section">,
888bcb0991SDimitry Andric      MetaVarName<"section=align">;
898bcb0991SDimitry Andric
900b57cec5SDimitry Andricdefm set_section_flags
910b57cec5SDimitry Andric    : Eq<"set-section-flags",
92*0fca6ea1SDimitry Andric         "Set section properties based on the specified <flags>. Supported flag names are: "
93*0fca6ea1SDimitry Andric         "alloc, load, noload, readonly, exclude, debug, code, "
945f757f3fSDimitry Andric         "data, rom, share, contents, merge, strings, large">,
950b57cec5SDimitry Andric      MetaVarName<"section=flag1[,flag2,...]">;
960b57cec5SDimitry Andric
97753f127fSDimitry Andricdefm set_section_type
98753f127fSDimitry Andric    : Eq<"set-section-type",
99753f127fSDimitry Andric         "Set the type of section <section> to the integer <type>">,
100753f127fSDimitry Andric      MetaVarName<"section=type">;
101753f127fSDimitry Andric
102*0fca6ea1SDimitry Andricdefm set_symbol_visibility
103*0fca6ea1SDimitry Andric    : Eq<"set-symbol-visibility",
104*0fca6ea1SDimitry Andric         "Change the visibility of a symbol to the specified value">,
105*0fca6ea1SDimitry Andric      MetaVarName<"symbol=visibility">;
106*0fca6ea1SDimitry Andricdefm set_symbols_visibility
107*0fca6ea1SDimitry Andric    : Eq<"set-symbols-visibility",
108*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and change their "
109*0fca6ea1SDimitry Andric         "visibility to the specified value. Visibility values: default, "
110*0fca6ea1SDimitry Andric         "internal, hidden, protected">,
111*0fca6ea1SDimitry Andric      MetaVarName<"filename=visibility">;
112*0fca6ea1SDimitry Andric
1138bcb0991SDimitry Andricdef S : Flag<["-"], "S">,
1148bcb0991SDimitry Andric        Alias<strip_all>,
1158bcb0991SDimitry Andric        HelpText<"Alias for --strip-all">;
1160b57cec5SDimitry Andricdef strip_dwo : Flag<["--"], "strip-dwo">,
117*0fca6ea1SDimitry Andric                HelpText<"Remove all DWARF .dwo sections">;
1180b57cec5SDimitry Andricdef strip_non_alloc
1190b57cec5SDimitry Andric    : Flag<["--"], "strip-non-alloc">,
120*0fca6ea1SDimitry Andric      HelpText<"Remove all non-allocated sections that are not within segments">;
1210b57cec5SDimitry Andricdefm strip_unneeded_symbol
1220b57cec5SDimitry Andric    : Eq<"strip-unneeded-symbol",
123*0fca6ea1SDimitry Andric         "Remove all symbols named <symbol> that are local or undefined and "
124*0fca6ea1SDimitry Andric         "are not required by any relocation">,
1250b57cec5SDimitry Andric      MetaVarName<"symbol">;
1260b57cec5SDimitry Andricdefm strip_unneeded_symbols
1270b57cec5SDimitry Andric    : Eq<"strip-unneeded-symbols",
128*0fca6ea1SDimitry Andric         "Remove all symbols whose names appear in the file <file>, if they "
129*0fca6ea1SDimitry Andric         "are local or undefined and are not required by any relocation">,
1300b57cec5SDimitry Andric      MetaVarName<"filename">;
1310b57cec5SDimitry Andric
13204eeddc0SDimitry Andricdefm subsystem
13304eeddc0SDimitry Andric    : Eq<"subsystem",
134*0fca6ea1SDimitry Andric         "Set the PE subsystem, and optionally subsystem version">,
135*0fca6ea1SDimitry Andric      MetaVarName<"name[:version]">, Group<grp_coff>;
13604eeddc0SDimitry Andric
1370b57cec5SDimitry Andricdef extract_dwo
1380b57cec5SDimitry Andric    : Flag<["--"], "extract-dwo">,
1390b57cec5SDimitry Andric      HelpText<
1400b57cec5SDimitry Andric          "Remove all sections that are not DWARF .dwo sections from file">;
1410b57cec5SDimitry Andric
1420b57cec5SDimitry Andricdefm extract_partition
1430b57cec5SDimitry Andric    : Eq<"extract-partition", "Extract named partition from input file">,
1440b57cec5SDimitry Andric      MetaVarName<"name">;
1450b57cec5SDimitry Andricdef extract_main_partition
1460b57cec5SDimitry Andric    : Flag<["--"], "extract-main-partition">,
1470b57cec5SDimitry Andric      HelpText<"Extract main partition from the input file">;
1480b57cec5SDimitry Andric
1490b57cec5SDimitry Andricdef localize_hidden
1500b57cec5SDimitry Andric    : Flag<["--"], "localize-hidden">,
1510b57cec5SDimitry Andric      HelpText<
1520b57cec5SDimitry Andric          "Mark all symbols that have hidden or internal visibility as local">;
153*0fca6ea1SDimitry Andricdefm localize_symbol
154*0fca6ea1SDimitry Andric    : Eq<"localize-symbol", "Mark any defined non-common symbol named <symbol> as local">,
1550b57cec5SDimitry Andric      MetaVarName<"symbol">;
1560b57cec5SDimitry Andricdefm localize_symbols
1570b57cec5SDimitry Andric    : Eq<"localize-symbols",
158*0fca6ea1SDimitry Andric         "Read a list of names from <filename> and mark any defined non-common "
159*0fca6ea1SDimitry Andric         "symbols with those names as local">,
1600b57cec5SDimitry Andric      MetaVarName<"filename">;
1610b57cec5SDimitry Andric
1628bcb0991SDimitry Andricdef L : JoinedOrSeparate<["-"], "L">,
1638bcb0991SDimitry Andric        Alias<localize_symbol>,
1648bcb0991SDimitry Andric        HelpText<"Alias for --localize-symbol">;
1650b57cec5SDimitry Andric
1660b57cec5SDimitry Andricdefm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
1670b57cec5SDimitry Andric                        MetaVarName<"symbol">;
1680b57cec5SDimitry Andric
1690b57cec5SDimitry Andricdefm globalize_symbols
1700b57cec5SDimitry Andric    : Eq<"globalize-symbols",
171*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and mark defined symbols"
172*0fca6ea1SDimitry Andric         " with those names as global">,
1730b57cec5SDimitry Andric      MetaVarName<"filename">;
1740b57cec5SDimitry Andric
1750b57cec5SDimitry Andricdefm keep_global_symbol
1760b57cec5SDimitry Andric    : Eq<"keep-global-symbol",
177*0fca6ea1SDimitry Andric         "Mark all symbols local, except for symbols with the name <symbol>. "
178*0fca6ea1SDimitry Andric         "Can be specified multiple times to ignore multiple symbols">,
1790b57cec5SDimitry Andric      MetaVarName<"symbol">;
1808bcb0991SDimitry Andricdef G : JoinedOrSeparate<["-"], "G">,
1818bcb0991SDimitry Andric        Alias<keep_global_symbol>,
1828bcb0991SDimitry Andric        HelpText<"Alias for --keep-global-symbol">;
1830b57cec5SDimitry Andric
184*0fca6ea1SDimitry Andricdefm verify_note_sections : B<"verify-note-sections",
185*0fca6ea1SDimitry Andric                              "Validate note sections",
186*0fca6ea1SDimitry Andric                              "Don't validate note sections">;
187*0fca6ea1SDimitry Andric
1880b57cec5SDimitry Andricdefm keep_global_symbols
1890b57cec5SDimitry Andric    : Eq<"keep-global-symbols",
190*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and run as if "
1910b57cec5SDimitry Andric         "--keep-global-symbol=<symbol> is set for each one. <filename> "
1920b57cec5SDimitry Andric         "contains one symbol per line and may contain comments beginning with "
1930b57cec5SDimitry Andric         "'#'. Leading and trailing whitespace is stripped from each line. May "
19406c3fb27SDimitry Andric         "be repeated to read symbols from many files">,
1950b57cec5SDimitry Andric      MetaVarName<"filename">;
1960b57cec5SDimitry Andric
197*0fca6ea1SDimitry Andricdefm weaken_symbol : Eq<"weaken-symbol", "Mark global symbols named <symbol> as weak">,
1980b57cec5SDimitry Andric                     MetaVarName<"symbol">;
1990b57cec5SDimitry Andricdefm weaken_symbols
2000b57cec5SDimitry Andric    : Eq<"weaken-symbols",
201*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and mark global symbols with those names as weak">,
2020b57cec5SDimitry Andric      MetaVarName<"filename">;
2030b57cec5SDimitry Andric
2048bcb0991SDimitry Andricdef W : JoinedOrSeparate<["-"], "W">,
2058bcb0991SDimitry Andric        Alias<weaken_symbol>,
2068bcb0991SDimitry Andric        HelpText<"Alias for --weaken-symbol">;
2070b57cec5SDimitry Andricdef weaken : Flag<["--"], "weaken">,
208*0fca6ea1SDimitry Andric             HelpText<"Mark all defined global symbols as weak">;
2090b57cec5SDimitry Andric
2100b57cec5SDimitry Andricdefm strip_symbols
2110b57cec5SDimitry Andric    : Eq<"strip-symbols",
212*0fca6ea1SDimitry Andric         "Remove all symbols whose names appear in the file <filename>">,
2130b57cec5SDimitry Andric      MetaVarName<"filename">;
2140b57cec5SDimitry Andric
2150b57cec5SDimitry Andricdefm keep_symbols
2160b57cec5SDimitry Andric    : Eq<"keep-symbols",
217*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and run as if "
2180b57cec5SDimitry Andric         "--keep-symbol=<symbol> is set for each one. <filename> "
2190b57cec5SDimitry Andric         "contains one symbol per line and may contain comments beginning with "
2200b57cec5SDimitry Andric         "'#'. Leading and trailing whitespace is stripped from each line. May "
22106c3fb27SDimitry Andric         "be repeated to read symbols from many files">,
2220b57cec5SDimitry Andric      MetaVarName<"filename">;
2230b57cec5SDimitry Andric
224*0fca6ea1SDimitry Andricdefm skip_symbol : Eq<"skip-symbol", "Do not change parameters of symbol <symbol> "
225*0fca6ea1SDimitry Andric                        "when executing other options that can change the symbol's "
226*0fca6ea1SDimitry Andric                        "name, binding or visibility">,
227*0fca6ea1SDimitry Andric                     MetaVarName<"symbol">;
228*0fca6ea1SDimitry Andric
229*0fca6ea1SDimitry Andricdefm skip_symbols
230*0fca6ea1SDimitry Andric    : Eq<"skip-symbols",
231*0fca6ea1SDimitry Andric         "Read a list of symbols from <filename> and run as if "
232*0fca6ea1SDimitry Andric         "--skip-symbol=<symbol> is set for each one. <filename> "
233*0fca6ea1SDimitry Andric         "contains one symbol per line and may contain comments beginning with "
234*0fca6ea1SDimitry Andric         "'#'. Leading and trailing whitespace is stripped from each line. May "
235*0fca6ea1SDimitry Andric         "be repeated to read symbols from many files">,
236*0fca6ea1SDimitry Andric      MetaVarName<"filename">;
237*0fca6ea1SDimitry Andric
2380b57cec5SDimitry Andricdefm dump_section
2390b57cec5SDimitry Andric    : Eq<"dump-section",
2400b57cec5SDimitry Andric         "Dump contents of section named <section> into file <file>">,
2410b57cec5SDimitry Andric      MetaVarName<"section=file">;
2420b57cec5SDimitry Andricdefm prefix_symbols
2430b57cec5SDimitry Andric    : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
2440b57cec5SDimitry Andric      MetaVarName<"prefix">;
245*0fca6ea1SDimitry Andricdefm remove_symbol_prefix
246*0fca6ea1SDimitry Andric    : Eq<"remove-symbol-prefix",
247*0fca6ea1SDimitry Andric         "Remove <prefix> from the start of every symbol name. No-op for symbols that do not start "
248*0fca6ea1SDimitry Andric         "with <prefix>">,
249*0fca6ea1SDimitry Andric      MetaVarName<"prefix">;
2500b57cec5SDimitry Andric
2510b57cec5SDimitry Andricdefm prefix_alloc_sections
2520b57cec5SDimitry Andric    : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">,
2530b57cec5SDimitry Andric      MetaVarName<"prefix">;
2540b57cec5SDimitry Andric
2550b57cec5SDimitry Andricdefm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides "
25606c3fb27SDimitry Andric                    "any previous --change-start or --adjust-start values">,
2570b57cec5SDimitry Andric                 MetaVarName<"addr">;
2580b57cec5SDimitry Andricdefm change_start : Eq<"change-start", "Add <incr> to the start address. Can be "
2590b57cec5SDimitry Andric                       "specified multiple times, all values will be applied "
26006c3fb27SDimitry Andric                       "cumulatively">,
2610b57cec5SDimitry Andric                    MetaVarName<"incr">;
2620b57cec5SDimitry Andricdef adjust_start : JoinedOrSeparate<["--"], "adjust-start">,
2638bcb0991SDimitry Andric                   Alias<change_start>,
2648bcb0991SDimitry Andric                   HelpText<"Alias for --change-start">;
2650b57cec5SDimitry Andric
266*0fca6ea1SDimitry Andricdefm change_section_lma
267*0fca6ea1SDimitry Andric    : Eq<"change-section-lma", "Shift LMA of non-zero-sized sections in the program header by <val>">,
268*0fca6ea1SDimitry Andric      MetaVarName<"*{+|-}val">;
269*0fca6ea1SDimitry Andric
2700b57cec5SDimitry Andricdefm add_symbol
2710b57cec5SDimitry Andric    : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: "
2728bcb0991SDimitry Andric         "global, local, weak, default, hidden, protected, file, section, object, "
2730b57cec5SDimitry Andric         "function, indirect-function. Accepted but ignored for "
2740b57cec5SDimitry Andric         "compatibility: debug, constructor, warning, indirect, synthetic, "
27506c3fb27SDimitry Andric         "unique-object, before">,
2760b57cec5SDimitry Andric      MetaVarName<"name=[section:]value[,flags]">;
277349cc55cSDimitry Andric
278349cc55cSDimitry Andricdefm update_section
27906c3fb27SDimitry Andric    : Eq<"update-section", "Replace the contents of section <name> with contents from a file <file>">,
280349cc55cSDimitry Andric      MetaVarName<"name=file">;
2815f757f3fSDimitry Andric
2825f757f3fSDimitry Andricdefm gap_fill
2835f757f3fSDimitry Andric    : Eq<"gap-fill", "Fill the gaps between sections with <value> instead of zero. "
2845f757f3fSDimitry Andric                     "<value> must be an unsigned 8-bit integer. "
2855f757f3fSDimitry Andric                     "This option is only supported for ELF input and binary output">,
2865f757f3fSDimitry Andric      MetaVarName<"value">;
2875f757f3fSDimitry Andric
2885f757f3fSDimitry Andricdefm pad_to
2895f757f3fSDimitry Andric    : Eq<"pad-to", "Pad the output up to the load address <address>, using a value "
2905f757f3fSDimitry Andric                   "of zero or the value specified by the --gap-fill option. "
2915f757f3fSDimitry Andric                   "This option is only supported for ELF input and binary output">,
2925f757f3fSDimitry Andric      MetaVarName<"address">;
293