2018-05-08 03:32:09 +08:00
|
|
|
include "llvm/Option/OptParser.td"
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
multiclass Eq<string name, string help> {
|
2018-05-08 03:32:09 +08:00
|
|
|
def NAME: Separate<["--", "-"], name>;
|
2018-11-02 01:20:40 +08:00
|
|
|
def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
|
|
|
|
HelpText<help>;
|
2018-05-08 03:32:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def help : Flag<["-", "--"], "help">;
|
|
|
|
|
2018-11-02 01:36:37 +08:00
|
|
|
def enable_deterministic_archives
|
|
|
|
: Flag<["-", "--"], "enable-deterministic-archives">,
|
|
|
|
HelpText<"Enable deterministic mode when stripping archives (use zero "
|
|
|
|
"for UIDs, GIDs, and timestamps).">;
|
|
|
|
def D : Flag<["-"], "D">,
|
|
|
|
Alias<enable_deterministic_archives>,
|
|
|
|
HelpText<"Alias for --enable-deterministic-archives">;
|
|
|
|
|
|
|
|
def disable_deterministic_archives
|
|
|
|
: Flag<["-", "--"], "disable-deterministic-archives">,
|
|
|
|
HelpText<"Disable deterministic mode when stripping archives (use real "
|
|
|
|
"values for UIDs, GIDs, and timestamps).">;
|
|
|
|
def U : Flag<["-"], "U">,
|
|
|
|
Alias<disable_deterministic_archives>,
|
|
|
|
HelpText<"Alias for --disable-deterministic-archives">;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm output : Eq<"o", "Write output to <file>">,
|
|
|
|
MetaVarName<"output">;
|
2018-06-01 04:42:13 +08:00
|
|
|
|
2018-08-17 02:29:40 +08:00
|
|
|
def preserve_dates : Flag<[ "-", "--" ], "preserve-dates">,
|
|
|
|
HelpText<"Preserve access and modification timestamps">;
|
|
|
|
|
|
|
|
def p : Flag<[ "-" ], "p">, Alias<preserve_dates>;
|
|
|
|
|
2018-07-13 01:42:17 +08:00
|
|
|
def strip_all : Flag<["-", "--"], "strip-all">,
|
|
|
|
HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
|
|
|
|
|
[llvm-strip] Support -s alias for --strip-all. Make both strip and objcopy case sensitive to support both -s (--strip-all) and -S (--strip-debug).
Summary:
GNU strip supports both `-s` and `-S` as aliases for `--strip-all` and `--strip-debug`, respectfully.
As part of this, it turns out that strip/objcopy were accepting case insensitive command line args. I'm not sure if there was an explicit reason for this. The only others uses of this are llvm-cvtres/llvm-mt/llvm-lib, which are all tools specific for windows support. Forcing case sensitivity allows both aliases to exist, but seems like a good idea anyway.
And as a surprise test case adjustment, the llvm-strip unit test was running with `-keep=unavailable_symbol`, despite `keep` not be a valid flag for strip. This is because there is a flag `-K` which, when case insensitivity is permitted, allows it to be interpreted as `-K` = `eep=unavailable_symbol` (e.g. to allow `-Kfoo` == `--keep-symbol=foo`).
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jakehehrlich
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53163
llvm-svn: 345068
2018-10-24 02:46:33 +08:00
|
|
|
def s : Flag<["-"], "s">,
|
|
|
|
Alias<strip_all>;
|
|
|
|
|
2018-11-02 01:48:46 +08:00
|
|
|
def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
|
|
|
|
HelpText<"Compatible with GNU strip's --strip-all">;
|
|
|
|
|
2018-05-08 03:32:09 +08:00
|
|
|
def strip_debug : Flag<["-", "--"], "strip-debug">,
|
|
|
|
HelpText<"Remove debugging symbols only">;
|
|
|
|
|
2018-06-05 02:55:41 +08:00
|
|
|
def d : Flag<["-"], "d">,
|
|
|
|
Alias<strip_debug>;
|
|
|
|
|
|
|
|
def g : Flag<["-"], "g">,
|
|
|
|
Alias<strip_debug>;
|
|
|
|
|
|
|
|
def S : Flag<["-"], "S">,
|
|
|
|
Alias<strip_debug>;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm remove_section : Eq<"remove-section", "Remove <section>">,
|
|
|
|
MetaVarName<"section">;
|
2018-05-11 13:27:06 +08:00
|
|
|
|
|
|
|
def R : JoinedOrSeparate<["-"], "R">,
|
|
|
|
Alias<remove_section>;
|
2018-05-24 03:44:19 +08:00
|
|
|
|
2018-11-02 01:48:46 +08:00
|
|
|
defm keep : Eq<"keep", "Keep <section>">, MetaVarName<"section">;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
|
|
|
|
MetaVarName<"symbol">;
|
2018-05-24 03:44:19 +08:00
|
|
|
|
|
|
|
def K : JoinedOrSeparate<["-"], "K">,
|
|
|
|
Alias<keep_symbol>;
|
2018-06-07 05:23:19 +08:00
|
|
|
|
|
|
|
def discard_all : Flag<["-", "--"], "discard-all">,
|
|
|
|
HelpText<"Remove all local symbols except file and section symbols">;
|
2018-09-21 08:47:31 +08:00
|
|
|
|
|
|
|
def version : Flag<[ "-", "--" ], "version">,
|
|
|
|
HelpText<"Print the version and exit.">;
|
|
|
|
|
2018-06-07 05:23:19 +08:00
|
|
|
def x : Flag<["-"], "x">,
|
|
|
|
Alias<discard_all>;
|
2018-06-07 18:05:25 +08:00
|
|
|
|
|
|
|
def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
|
|
|
|
HelpText<"Remove all symbols not needed by relocations">;
|