xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objcopy/StripOpts.td (revision c14a5a8800a0f7a007f8cd197b4cad4d26a78f8c)
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* and .ARM.attribute sections are not "
44                          "removed">;
45def s : Flag<["-"], "s">, Alias<strip_all>;
46def no_strip_all : Flag<["--"], "no-strip-all">,
47                   HelpText<"Disable --strip-all">;
48
49def strip_all_gnu : Flag<["--"], "strip-all-gnu">,
50                    HelpText<"Compatible with GNU strip's --strip-all">;
51def strip_debug : Flag<["--"], "strip-debug">,
52                  HelpText<"Remove debugging symbols only">;
53def d : Flag<["-"], "d">, Alias<strip_debug>;
54def g : Flag<["-"], "g">, Alias<strip_debug>;
55def S : Flag<["-"], "S">, Alias<strip_debug>;
56def strip_unneeded : Flag<["--"], "strip-unneeded">,
57                     HelpText<"Remove all symbols not needed by relocations">;
58
59defm remove_section : Eq<"remove-section", "Remove <section>">,
60                      MetaVarName<"section">;
61def R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>;
62
63defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,
64                    MetaVarName<"symbol">;
65def N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
66
67defm keep_section : Eq<"keep-section", "Keep <section>">,
68                    MetaVarName<"section">;
69defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
70                   MetaVarName<"symbol">;
71def keep_file_symbols : Flag<["--"], "keep-file-symbols">,
72                        HelpText<"Do not remove file symbols">;
73
74def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
75
76def only_keep_debug
77    : Flag<["--"], "only-keep-debug">,
78      HelpText<"Clear sections that would not be stripped by --strip-debug. "
79               "Currently only implemented for COFF.">;
80
81def discard_locals : Flag<["--"], "discard-locals">,
82                     HelpText<"Remove compiler-generated local symbols, (e.g. "
83                              "symbols starting with .L)">;
84def X : Flag<["-"], "X">, Alias<discard_locals>;
85
86def discard_all
87    : Flag<["--"], "discard-all">,
88      HelpText<"Remove all local symbols except file and section symbols">;
89def x : Flag<["-"], "x">, Alias<discard_all>;
90
91def regex
92    : Flag<["--"], "regex">,
93      HelpText<"Permit regular expressions in name comparison">;
94
95def version : Flag<["--"], "version">,
96              HelpText<"Print the version and exit.">;
97def V : Flag<["-"], "V">, Alias<version>;
98