xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-objcopy/StripOpts.td (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andricinclude "llvm/Option/OptParser.td"
2*0b57cec5SDimitry Andric
3*0b57cec5SDimitry Andricmulticlass Eq<string name, string help> {
4*0b57cec5SDimitry Andric  def NAME : Separate<["--"], name>;
5*0b57cec5SDimitry Andric  def NAME #_eq : Joined<["--"], name #"=">,
6*0b57cec5SDimitry Andric                  Alias<!cast<Separate>(NAME)>,
7*0b57cec5SDimitry Andric                  HelpText<help>;
8*0b57cec5SDimitry Andric}
9*0b57cec5SDimitry Andric
10*0b57cec5SDimitry Andricdef help : Flag<["--"], "help">;
11*0b57cec5SDimitry Andricdef h : Flag<["-"], "h">, Alias<help>;
12*0b57cec5SDimitry Andric
13*0b57cec5SDimitry Andricdef allow_broken_links
14*0b57cec5SDimitry Andric    : Flag<["--"], "allow-broken-links">,
15*0b57cec5SDimitry Andric      HelpText<"Allow llvm-strip to remove sections even if it would leave "
16*0b57cec5SDimitry Andric               "invalid section references. The appropriate sh_link fields "
17*0b57cec5SDimitry Andric               "will be set to zero.">;
18*0b57cec5SDimitry Andric
19*0b57cec5SDimitry Andricdef enable_deterministic_archives
20*0b57cec5SDimitry Andric    : Flag<["--"], "enable-deterministic-archives">,
21*0b57cec5SDimitry Andric      HelpText<"Enable deterministic mode when stripping archives (use zero "
22*0b57cec5SDimitry Andric               "for UIDs, GIDs, and timestamps).">;
23*0b57cec5SDimitry Andricdef D : Flag<["-"], "D">,
24*0b57cec5SDimitry Andric        Alias<enable_deterministic_archives>,
25*0b57cec5SDimitry Andric        HelpText<"Alias for --enable-deterministic-archives">;
26*0b57cec5SDimitry Andric
27*0b57cec5SDimitry Andricdef disable_deterministic_archives
28*0b57cec5SDimitry Andric    : Flag<["--"], "disable-deterministic-archives">,
29*0b57cec5SDimitry Andric      HelpText<"Disable deterministic mode when stripping archives (use real "
30*0b57cec5SDimitry Andric               "values for UIDs, GIDs, and timestamps).">;
31*0b57cec5SDimitry Andricdef U : Flag<["-"], "U">,
32*0b57cec5SDimitry Andric        Alias<disable_deterministic_archives>,
33*0b57cec5SDimitry Andric        HelpText<"Alias for --disable-deterministic-archives">;
34*0b57cec5SDimitry Andric
35*0b57cec5SDimitry Andricdef output : JoinedOrSeparate<["-"], "o">, HelpText<"Write output to <file>">;
36*0b57cec5SDimitry Andric
37*0b57cec5SDimitry Andricdef preserve_dates : Flag<["--"], "preserve-dates">,
38*0b57cec5SDimitry Andric                     HelpText<"Preserve access and modification timestamps">;
39*0b57cec5SDimitry Andricdef p : Flag<["-"], "p">, Alias<preserve_dates>;
40*0b57cec5SDimitry Andric
41*0b57cec5SDimitry Andricdef strip_all : Flag<["--"], "strip-all">,
42*0b57cec5SDimitry Andric                HelpText<"Remove non-allocated sections outside segments. "
43*0b57cec5SDimitry Andric                         ".gnu.warning* sections are not removed">;
44*0b57cec5SDimitry Andricdef s : Flag<["-"], "s">, Alias<strip_all>;
45*0b57cec5SDimitry Andricdef no_strip_all : Flag<["--"], "no-strip-all">,
46*0b57cec5SDimitry Andric                   HelpText<"Disable --strip-all">;
47*0b57cec5SDimitry Andric
48*0b57cec5SDimitry Andricdef strip_all_gnu : Flag<["--"], "strip-all-gnu">,
49*0b57cec5SDimitry Andric                    HelpText<"Compatible with GNU strip's --strip-all">;
50*0b57cec5SDimitry Andricdef strip_debug : Flag<["--"], "strip-debug">,
51*0b57cec5SDimitry Andric                  HelpText<"Remove debugging symbols only">;
52*0b57cec5SDimitry Andricdef d : Flag<["-"], "d">, Alias<strip_debug>;
53*0b57cec5SDimitry Andricdef g : Flag<["-"], "g">, Alias<strip_debug>;
54*0b57cec5SDimitry Andricdef S : Flag<["-"], "S">, Alias<strip_debug>;
55*0b57cec5SDimitry Andricdef strip_unneeded : Flag<["--"], "strip-unneeded">,
56*0b57cec5SDimitry Andric                     HelpText<"Remove all symbols not needed by relocations">;
57*0b57cec5SDimitry Andric
58*0b57cec5SDimitry Andricdefm remove_section : Eq<"remove-section", "Remove <section>">,
59*0b57cec5SDimitry Andric                      MetaVarName<"section">;
60*0b57cec5SDimitry Andricdef R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>;
61*0b57cec5SDimitry Andric
62*0b57cec5SDimitry Andricdefm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,
63*0b57cec5SDimitry Andric                    MetaVarName<"symbol">;
64*0b57cec5SDimitry Andricdef N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
65*0b57cec5SDimitry Andric
66*0b57cec5SDimitry Andricdefm keep_section : Eq<"keep-section", "Keep <section>">,
67*0b57cec5SDimitry Andric                    MetaVarName<"section">;
68*0b57cec5SDimitry Andricdefm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
69*0b57cec5SDimitry Andric                   MetaVarName<"symbol">;
70*0b57cec5SDimitry Andricdef keep_file_symbols : Flag<["--"], "keep-file-symbols">,
71*0b57cec5SDimitry Andric                        HelpText<"Do not remove file symbols">;
72*0b57cec5SDimitry Andric
73*0b57cec5SDimitry Andricdef K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
74*0b57cec5SDimitry Andric
75*0b57cec5SDimitry Andricdef only_keep_debug
76*0b57cec5SDimitry Andric    : Flag<["--"], "only-keep-debug">,
77*0b57cec5SDimitry Andric      HelpText<"Clear sections that would not be stripped by --strip-debug. "
78*0b57cec5SDimitry Andric               "Currently only implemented for COFF.">;
79*0b57cec5SDimitry Andric
80*0b57cec5SDimitry Andricdef discard_locals : Flag<["--"], "discard-locals">,
81*0b57cec5SDimitry Andric                     HelpText<"Remove compiler-generated local symbols, (e.g. "
82*0b57cec5SDimitry Andric                              "symbols starting with .L)">;
83*0b57cec5SDimitry Andricdef X : Flag<["-"], "X">, Alias<discard_locals>;
84*0b57cec5SDimitry Andric
85*0b57cec5SDimitry Andricdef discard_all
86*0b57cec5SDimitry Andric    : Flag<["--"], "discard-all">,
87*0b57cec5SDimitry Andric      HelpText<"Remove all local symbols except file and section symbols">;
88*0b57cec5SDimitry Andricdef x : Flag<["-"], "x">, Alias<discard_all>;
89*0b57cec5SDimitry Andric
90*0b57cec5SDimitry Andricdef regex
91*0b57cec5SDimitry Andric    : Flag<["--"], "regex">,
92*0b57cec5SDimitry Andric      HelpText<"Permit regular expressions in name comparison">;
93*0b57cec5SDimitry Andric
94*0b57cec5SDimitry Andricdef version : Flag<["--"], "version">,
95*0b57cec5SDimitry Andric              HelpText<"Print the version and exit.">;
96*0b57cec5SDimitry Andricdef V : Flag<["-"], "V">, Alias<version>;
97