1include "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">,
26                         HelpText<"Add a .gnu_debuglink for <debug-file>">;
27defm remove_section : Eq<"remove-section">,
28                      MetaVarName<"section">,
29                      HelpText<"Remove <section>">;
30defm rename_section : Eq<"rename-section">,
31                      MetaVarName<"old=new">,
32                      HelpText<"Renames a section from old to new">;
33defm redefine_symbol : Eq<"redefine-sym">,
34                       MetaVarName<"old=new">,
35                       HelpText<"Change the name of a symbol old to new">;
36def R : JoinedOrSeparate<["-"], "R">,
37        Alias<remove_section>;
38defm keep : Eq<"keep">,
39            MetaVarName<"section">,
40            HelpText<"Keep <section>">;
41defm only_keep : Eq<"only-keep">,
42                 MetaVarName<"section">,
43                 HelpText<"Remove all but <section>">;
44def j : JoinedOrSeparate<["-"], "j">,
45                      Alias<only_keep>;
46defm add_section : Eq<"add-section">,
47                   MetaVarName<"section=file">,
48                   HelpText<"Make a section named <section> with the contents of <file>.">;
49def strip_all : Flag<["-", "--"], "strip-all">,
50                HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
51def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
52                    HelpText<"Compaitable with GNU objcopy's --strip-all">;
53def strip_debug : Flag<["-", "--"], "strip-debug">,
54                  HelpText<"Remove all debug information">;
55def strip_dwo : Flag<["-", "--"], "strip-dwo">,
56                HelpText<"Remove all DWARF .dwo sections from file">;
57def strip_sections : Flag<["-", "--"], "strip-sections">,
58                     HelpText<"Remove all section headers">;
59def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
60                      HelpText<"Remove all non-allocated sections">;
61def extract_dwo : Flag<["-", "--"], "extract-dwo">,
62                  HelpText<"Remove all sections that are not DWARF .dwo sections from file">;
63def localize_hidden : Flag<["-", "--"], "localize-hidden">,
64                      HelpText<"Mark all symbols that have hidden or internal visibility as local">;
65defm localize_symbol : Eq<"localize-symbol">,
66                       MetaVarName<"symbol">,
67                       HelpText<"Mark <symbol> as local">;
68def L : JoinedOrSeparate<["-"], "L">,
69        Alias<localize_symbol>;
70defm globalize_symbol : Eq<"globalize-symbol">,
71                       MetaVarName<"symbol">,
72                       HelpText<"Mark <symbol> as global">;
73defm weaken_symbol : Eq<"weaken-symbol">,
74                       MetaVarName<"symbol">,
75                       HelpText<"Mark <symbol> as weak">;
76def W : JoinedOrSeparate<["-"], "W">,
77        Alias<weaken_symbol>;
78def weaken : Flag<["-", "--"], "weaken">,
79                  HelpText<"Mark all global symbols as weak">;
80def discard_all : Flag<["-", "--"], "discard-all">,
81                      HelpText<"Remove all local symbols except file and section symbols">;
82def x : Flag<["-"], "x">,
83        Alias<discard_all>;
84defm strip_symbol : Eq<"strip-symbol">,
85                       MetaVarName<"symbol">,
86                       HelpText<"Remove symbol <symbol>">;
87def N : JoinedOrSeparate<["-"], "N">,
88        Alias<strip_symbol>;
89defm keep_symbol : Eq<"keep-symbol">,
90                       MetaVarName<"symbol">,
91                       HelpText<"Do not remove symbol <symbol>">;
92def K : JoinedOrSeparate<["-"], "K">,
93        Alias<keep_symbol>;
94def only_keep_debug : Flag<["-", "--"], "only-keep-debug">,
95                          HelpText<"Currently ignored. Only for compaitability with GNU objcopy.">;
96def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
97                      HelpText<"Remove all symbols not needed by relocations">;
98def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
99                      HelpText<"Do not remove file symbols">;
100