xref: /freebsd-src/contrib/llvm-project/llvm/tools/llvm-objcopy/StripOpts.td (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
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 llvm-strip 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 stripping archives (use zero "
22               "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 stripping archives (use real "
30               "values for UIDs, GIDs, and timestamps).">;
31def U : Flag<["-"], "U">,
32        Alias<disable_deterministic_archives>,
33        HelpText<"Alias for --disable-deterministic-archives">;
34
35def output : JoinedOrSeparate<["-"], "o">, HelpText<"Write output to <file>">;
36
37def preserve_dates : Flag<["--"], "preserve-dates">,
38                     HelpText<"Preserve access and modification timestamps">;
39def p : Flag<["-"], "p">, Alias<preserve_dates>;
40
41def strip_all : Flag<["--"], "strip-all">,
42                HelpText<"Remove non-allocated sections outside segments. "
43                         ".gnu.warning* sections are not removed">;
44def s : Flag<["-"], "s">, Alias<strip_all>;
45def no_strip_all : Flag<["--"], "no-strip-all">,
46                   HelpText<"Disable --strip-all">;
47
48def strip_all_gnu : Flag<["--"], "strip-all-gnu">,
49                    HelpText<"Compatible with GNU strip's --strip-all">;
50def strip_debug : Flag<["--"], "strip-debug">,
51                  HelpText<"Remove debugging symbols only">;
52def d : Flag<["-"], "d">, Alias<strip_debug>;
53def g : Flag<["-"], "g">, Alias<strip_debug>;
54def S : Flag<["-"], "S">, Alias<strip_debug>;
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">, Alias<remove_section>;
61
62defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,
63                    MetaVarName<"symbol">;
64def N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
65
66defm keep_section : Eq<"keep-section", "Keep <section>">,
67                    MetaVarName<"section">;
68defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
69                   MetaVarName<"symbol">;
70def keep_file_symbols : Flag<["--"], "keep-file-symbols">,
71                        HelpText<"Do not remove file symbols">;
72
73def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
74
75def only_keep_debug
76    : Flag<["--"], "only-keep-debug">,
77      HelpText<"Clear sections that would not be stripped by --strip-debug. "
78               "Currently only implemented for COFF.">;
79
80def discard_locals : Flag<["--"], "discard-locals">,
81                     HelpText<"Remove compiler-generated local symbols, (e.g. "
82                              "symbols starting with .L)">;
83def X : Flag<["-"], "X">, Alias<discard_locals>;
84
85def discard_all
86    : Flag<["--"], "discard-all">,
87      HelpText<"Remove all local symbols except file and section symbols">;
88def x : Flag<["-"], "x">, Alias<discard_all>;
89
90def regex
91    : Flag<["--"], "regex">,
92      HelpText<"Permit regular expressions in name comparison">;
93
94def version : Flag<["--"], "version">,
95              HelpText<"Print the version and exit.">;
96def V : Flag<["-"], "V">, Alias<version>;
97