xref: /netbsd-src/external/apache2/llvm/dist/llvm/tools/llvm-objcopy/CommonOpts.td (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1include "llvm/Option/OptParser.td"
2
3multiclass Eq<string name, string help> {
4  def NAME : Separate<["--"], name>;
5  def NAME #_eq : Joined<["--"], name #"=">,
6                  Alias<!cast<Separate>(NAME)>,
7                  HelpText<help>;
8}
9
10def help : Flag<["--"], "help">;
11def h : Flag<["-"], "h">, Alias<help>;
12
13def allow_broken_links
14    : Flag<["--"], "allow-broken-links">,
15      HelpText<"Allow the tool to remove sections even if it would leave "
16               "invalid section references. The appropriate sh_link fields "
17               "will be set to zero.">;
18
19def enable_deterministic_archives
20    : Flag<["--"], "enable-deterministic-archives">,
21      HelpText<"Enable deterministic mode when operating on archives (use "
22               "zero for UIDs, GIDs, and timestamps).">;
23def D : Flag<["-"], "D">,
24        Alias<enable_deterministic_archives>,
25        HelpText<"Alias for --enable-deterministic-archives">;
26
27def disable_deterministic_archives
28    : Flag<["--"], "disable-deterministic-archives">,
29      HelpText<"Disable deterministic mode when operating on archives (use "
30               "real values for UIDs, GIDs, and timestamps).">;
31def U : Flag<["-"], "U">,
32        Alias<disable_deterministic_archives>,
33        HelpText<"Alias for --disable-deterministic-archives">;
34
35def preserve_dates : Flag<["--"], "preserve-dates">,
36                     HelpText<"Preserve access and modification timestamps">;
37def p : Flag<["-"], "p">,
38        Alias<preserve_dates>,
39        HelpText<"Alias for --preserve-dates">;
40
41def strip_all : Flag<["--"], "strip-all">,
42                HelpText<"Remove non-allocated sections outside segments. "
43                         ".gnu.warning* sections are not removed">;
44
45def strip_all_gnu
46    : Flag<["--"], "strip-all-gnu">,
47      HelpText<"Compatible with GNU's --strip-all">;
48
49def strip_debug : Flag<["--"], "strip-debug">,
50                  HelpText<"Remove all debug sections">;
51def g : Flag<["-"], "g">,
52        Alias<strip_debug>,
53        HelpText<"Alias for --strip-debug">;
54
55def strip_unneeded : Flag<["--"], "strip-unneeded">,
56                     HelpText<"Remove all symbols not needed by relocations">;
57
58defm remove_section : Eq<"remove-section", "Remove <section>">,
59                      MetaVarName<"section">;
60def R : JoinedOrSeparate<["-"], "R">,
61        Alias<remove_section>,
62        HelpText<"Alias for --remove-section">;
63
64def strip_sections
65    : Flag<["--"], "strip-sections">,
66      HelpText<"Remove all section headers and all sections not in segments">;
67
68defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,
69                    MetaVarName<"symbol">;
70def N : JoinedOrSeparate<["-"], "N">,
71        Alias<strip_symbol>,
72        HelpText<"Alias for --strip-symbol">;
73
74defm keep_section : Eq<"keep-section", "Keep <section>">,
75                    MetaVarName<"section">;
76
77defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
78                   MetaVarName<"symbol">;
79def K : JoinedOrSeparate<["-"], "K">,
80        Alias<keep_symbol>,
81        HelpText<"Alias for --keep-symbol">;
82
83def keep_file_symbols : Flag<["--"], "keep-file-symbols">,
84                        HelpText<"Do not remove file symbols">;
85
86def only_keep_debug
87    : Flag<["--"], "only-keep-debug">,
88      HelpText<"Clear sections that would not be stripped by --strip-debug. "
89               "Currently only implemented for COFF.">;
90
91def discard_locals : Flag<["--"], "discard-locals">,
92                     HelpText<"Remove compiler-generated local symbols, (e.g. "
93                              "symbols starting with .L)">;
94def X : Flag<["-"], "X">,
95        Alias<discard_locals>,
96        HelpText<"Alias for --discard-locals">;
97
98def discard_all
99    : Flag<["--"], "discard-all">,
100      HelpText<"Remove all local symbols except file and section symbols">;
101def x : Flag<["-"], "x">,
102        Alias<discard_all>,
103        HelpText<"Alias for --discard-all">;
104
105def regex
106    : Flag<["--"], "regex">,
107      HelpText<"Permit regular expressions in name comparison">;
108
109def version : Flag<["--"], "version">,
110              HelpText<"Print the version and exit.">;
111def V : Flag<["-"], "V">,
112        Alias<version>,
113        HelpText<"Alias for --version">;
114
115def wildcard
116    : Flag<["--"], "wildcard">,
117      HelpText<"Allow wildcard syntax for symbol-related flags. Incompatible "
118               "with --regex. Allows using '*' to match any number of "
119               "characters, '?' to match any single character, '\' to escape "
120               "special characters, and '[]' to define character classes. "
121               "Wildcards beginning with '!' will prevent a match, for example "
122               "\"-N '*' -N '!x'\" will strip all symbols except for \"x\".">;
123def w : Flag<["-"], "w">, Alias<wildcard>, HelpText<"Alias for --wildcard">;
124