blob: 82fea817e6e0d309ec61ccb50470e468a4d4acd8 [file] [log] [blame]
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +00001include "llvm/Option/OptParser.td"
2
3multiclass Eq<string name> {
4 def NAME: Separate<["--", "-"], name>;
5 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
6}
7
8def help : Flag<["-", "--"], "help">;
9defm binary_architecture : Eq<"binary-architecture">,
10 HelpText<"Used when transforming an architecture-less format (such as binary) to another format">;
11def B : JoinedOrSeparate<["-"], "B">,
12 Alias<binary_architecture>;
13defm input_target : Eq<"input-target">,
14 HelpText<"Format of the input file">,
15 Values<"binary">;
16defm output_target : Eq<"output-target">,
17 HelpText<"Format of the output file">,
18 Values<"binary">;
19def O : JoinedOrSeparate<["-"], "O">,
20 Alias<output_target>;
21defm split_dwo : Eq<"split-dwo">,
22 MetaVarName<"dwo-file">,
23 HelpText<"Equivalent to extract-dwo on the input file to <dwo-file>, then strip-dwo on the input file">;
24defm add_gnu_debuglink : Eq<"add-gnu-debuglink">,
25 MetaVarName<"debug-file">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000026 HelpText<"Add a .gnu_debuglink for <debug-file>">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000027defm remove_section : Eq<"remove-section">,
28 MetaVarName<"section">,
29 HelpText<"Remove <section>">;
Jordan Rupprechtd67c1e12018-08-01 16:23:22 +000030defm rename_section
31 : Eq<"rename-section">,
32 MetaVarName<"old=new[,flag1,...]">,
33 HelpText<
34 "Renames a section from old to new, optionally with specified flags. "
35 "Flags supported for GNU compatibility: alloc, load, noload, "
36 "readonly, debug, code, data, rom, share, contents, merge, strings.">;
Alexander Shaposhnikov40e9bdf2018-04-26 18:28:17 +000037defm redefine_symbol : Eq<"redefine-sym">,
38 MetaVarName<"old=new">,
39 HelpText<"Change the name of a symbol old to new">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000040def R : JoinedOrSeparate<["-"], "R">,
41 Alias<remove_section>;
42defm keep : Eq<"keep">,
43 MetaVarName<"section">,
44 HelpText<"Keep <section>">;
45defm only_keep : Eq<"only-keep">,
46 MetaVarName<"section">,
47 HelpText<"Remove all but <section>">;
48def j : JoinedOrSeparate<["-"], "j">,
49 Alias<only_keep>;
50defm add_section : Eq<"add-section">,
51 MetaVarName<"section=file">,
52 HelpText<"Make a section named <section> with the contents of <file>.">;
53def strip_all : Flag<["-", "--"], "strip-all">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000054 HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000055def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
56 HelpText<"Compaitable with GNU objcopy's --strip-all">;
57def strip_debug : Flag<["-", "--"], "strip-debug">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000058 HelpText<"Remove all debug information">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000059def strip_dwo : Flag<["-", "--"], "strip-dwo">,
60 HelpText<"Remove all DWARF .dwo sections from file">;
61def strip_sections : Flag<["-", "--"], "strip-sections">,
62 HelpText<"Remove all section headers">;
63def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
64 HelpText<"Remove all non-allocated sections">;
65def extract_dwo : Flag<["-", "--"], "extract-dwo">,
66 HelpText<"Remove all sections that are not DWARF .dwo sections from file">;
67def localize_hidden : Flag<["-", "--"], "localize-hidden">,
68 HelpText<"Mark all symbols that have hidden or internal visibility as local">;
Paul Semelb4924942018-04-26 17:44:43 +000069defm localize_symbol : Eq<"localize-symbol">,
Alexander Shaposhnikov40e9bdf2018-04-26 18:28:17 +000070 MetaVarName<"symbol">,
71 HelpText<"Mark <symbol> as local">;
Paul Semelb4924942018-04-26 17:44:43 +000072def L : JoinedOrSeparate<["-"], "L">,
73 Alias<localize_symbol>;
Paul Semelee5be792018-04-27 19:09:44 +000074defm globalize_symbol : Eq<"globalize-symbol">,
75 MetaVarName<"symbol">,
76 HelpText<"Mark <symbol> as global">;
Paul Semel3a8a56b2018-04-27 19:16:27 +000077defm weaken_symbol : Eq<"weaken-symbol">,
78 MetaVarName<"symbol">,
79 HelpText<"Mark <symbol> as weak">;
80def W : JoinedOrSeparate<["-"], "W">,
81 Alias<weaken_symbol>;
Paul Semel2c0510f2018-05-02 20:14:49 +000082def weaken : Flag<["-", "--"], "weaken">,
83 HelpText<"Mark all global symbols as weak">;
Paul Semel41695f82018-05-02 20:19:22 +000084def discard_all : Flag<["-", "--"], "discard-all">,
85 HelpText<"Remove all local symbols except file and section symbols">;
86def x : Flag<["-"], "x">,
87 Alias<discard_all>;
Paul Semel4246a462018-05-09 21:36:54 +000088defm strip_symbol : Eq<"strip-symbol">,
89 MetaVarName<"symbol">,
90 HelpText<"Remove symbol <symbol>">;
91def N : JoinedOrSeparate<["-"], "N">,
92 Alias<strip_symbol>;
Paul Semel5d97c822018-05-15 14:09:37 +000093defm keep_symbol : Eq<"keep-symbol">,
94 MetaVarName<"symbol">,
95 HelpText<"Do not remove symbol <symbol>">;
96def K : JoinedOrSeparate<["-"], "K">,
97 Alias<keep_symbol>;
Jake Ehrliche40398a2018-05-15 20:53:53 +000098def only_keep_debug : Flag<["-", "--"], "only-keep-debug">,
99 HelpText<"Currently ignored. Only for compaitability with GNU objcopy.">;
Paul Semel99dda0b2018-05-25 11:01:25 +0000100def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
101 HelpText<"Remove all symbols not needed by relocations">;
Paul Semelcf51c802018-05-26 08:10:37 +0000102def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
103 HelpText<"Do not remove file symbols">;