2018-05-08 03:32:09 +08:00
|
|
|
include "llvm/Option/OptParser.td"
|
|
|
|
|
|
|
|
multiclass Eq<string name> {
|
|
|
|
def NAME: Separate<["--", "-"], name>;
|
|
|
|
def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
|
|
|
|
}
|
|
|
|
|
|
|
|
def help : Flag<["-", "--"], "help">;
|
|
|
|
|
2018-06-01 04:42:13 +08:00
|
|
|
defm output : Eq<"o">,
|
|
|
|
MetaVarName<"output">,
|
|
|
|
HelpText<"Write output to <file>">;
|
|
|
|
|
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-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-05-11 13:27:06 +08:00
|
|
|
defm remove_section : Eq<"remove-section">,
|
|
|
|
MetaVarName<"section">,
|
|
|
|
HelpText<"Remove <section>">;
|
|
|
|
|
|
|
|
def R : JoinedOrSeparate<["-"], "R">,
|
|
|
|
Alias<remove_section>;
|
2018-05-24 03:44:19 +08:00
|
|
|
|
|
|
|
defm keep_symbol : Eq<"keep-symbol">,
|
|
|
|
MetaVarName<"symbol">,
|
|
|
|
HelpText<"Do not remove symbol <symbol>">;
|
|
|
|
|
|
|
|
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">;
|