2018-04-24 13:43:32 +08:00
|
|
|
include "llvm/Option/OptParser.td"
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
multiclass Eq<string name, string help> {
|
2018-11-02 05:38:14 +08:00
|
|
|
def NAME : Separate<["--", "-"], name>;
|
|
|
|
def NAME #_eq : Joined<["--", "-"], name #"=">,
|
|
|
|
Alias<!cast<Separate>(NAME)>,
|
|
|
|
HelpText<help>;
|
2018-04-24 13:43:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def help : Flag<["-", "--"], "help">;
|
2018-11-02 05:38:14 +08:00
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm binary_architecture
|
|
|
|
: Eq<"binary-architecture", "Used when transforming an architecture-less "
|
|
|
|
"format (such as binary) to another format">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def B : JoinedOrSeparate<["-"], "B">, Alias<binary_architecture>;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm target : Eq<"target", "Format of the input and output file">,
|
2018-10-12 08:36:01 +08:00
|
|
|
Values<"binary">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def F : JoinedOrSeparate<["-"], "F">, Alias<target>;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm input_target : Eq<"input-target", "Format of the input file">,
|
2018-04-24 13:43:32 +08:00
|
|
|
Values<"binary">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def I : JoinedOrSeparate<["-"], "I">, Alias<input_target>;
|
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm output_target : Eq<"output-target", "Format of the output file">,
|
2018-04-24 13:43:32 +08:00
|
|
|
Values<"binary">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def O : JoinedOrSeparate<["-"], "O">, Alias<output_target>;
|
|
|
|
|
2018-09-07 16:10:22 +08:00
|
|
|
def compress_debug_sections : Flag<["--", "-"], "compress-debug-sections">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def compress_debug_sections_eq
|
|
|
|
: Joined<["--", "-"], "compress-debug-sections=">,
|
|
|
|
MetaVarName<"[ zlib | zlib-gnu ]">,
|
|
|
|
HelpText<"Compress DWARF debug sections using specified style. Supported "
|
|
|
|
"styles: 'zlib-gnu' and 'zlib'">;
|
2018-10-01 18:29:41 +08:00
|
|
|
def decompress_debug_sections : Flag<["-", "--"], "decompress-debug-sections">,
|
|
|
|
HelpText<"Decompress DWARF debug sections.">;
|
2018-11-02 01:20:40 +08:00
|
|
|
defm split_dwo
|
|
|
|
: Eq<"split-dwo", "Equivalent to extract-dwo on the input file to "
|
|
|
|
"<dwo-file>, then strip-dwo on the input file">,
|
|
|
|
MetaVarName<"dwo-file">;
|
2018-08-17 02:29:40 +08:00
|
|
|
|
2018-11-02 01:36:37 +08:00
|
|
|
def enable_deterministic_archives
|
|
|
|
: Flag<["-", "--"], "enable-deterministic-archives">,
|
|
|
|
HelpText<"Enable deterministic mode when copying 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 copying 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 05:38:14 +08:00
|
|
|
def preserve_dates : Flag<["-", "--"], "preserve-dates">,
|
2018-08-17 02:29:40 +08:00
|
|
|
HelpText<"Preserve access and modification timestamps">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def p : Flag<["-"], "p">, Alias<preserve_dates>;
|
2018-08-17 02:29:40 +08:00
|
|
|
|
2018-11-02 05:38:14 +08:00
|
|
|
defm add_gnu_debuglink
|
|
|
|
: Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
|
|
|
|
MetaVarName<"debug-file">;
|
2018-08-17 02:29:40 +08:00
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm remove_section : Eq<"remove-section", "Remove <section>">,
|
|
|
|
MetaVarName<"section">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>;
|
|
|
|
|
2018-08-02 00:23:22 +08:00
|
|
|
defm rename_section
|
2018-11-02 01:20:40 +08:00
|
|
|
: Eq<"rename-section",
|
|
|
|
"Renames a section from old to new, optionally with specified flags. "
|
|
|
|
"Flags supported for GNU compatibility: alloc, load, noload, "
|
|
|
|
"readonly, debug, code, data, rom, share, contents, merge, strings.">,
|
|
|
|
MetaVarName<"old=new[,flag1,...]">;
|
2018-11-02 05:38:14 +08:00
|
|
|
defm redefine_symbol
|
|
|
|
: Eq<"redefine-sym", "Change the name of a symbol old to new">,
|
|
|
|
MetaVarName<"old=new">;
|
[llvm-objcopy] Rename --keep to --keep-section.
Summary:
llvm-objcopy/strip support `--keep` (for sections) and `--keep-symbols` (for symbols). For consistency and clarity, rename `--keep` to `--keep-section`.
In fact, for GNU compatability, -K is --keep-symbol, so it's weird that the alias `-K` is not the same as the short-ish `--keep`.
Reviewers: jakehehrlich, jhenderson, alexshap, MaskRay, espindola
Reviewed By: jakehehrlich, MaskRay
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D54477
llvm-svn: 346782
2018-11-14 03:32:27 +08:00
|
|
|
defm keep_section : Eq<"keep-section", "Keep <section>">,
|
|
|
|
MetaVarName<"section">;
|
2018-12-06 10:03:53 +08:00
|
|
|
defm only_section : Eq<"only-section", "Remove all but <section>">,
|
|
|
|
MetaVarName<"section">;
|
|
|
|
def j : JoinedOrSeparate<["-"], "j">, Alias<only_section>;
|
2018-11-02 01:20:40 +08:00
|
|
|
defm add_section
|
|
|
|
: Eq<"add-section",
|
|
|
|
"Make a section named <section> with the contents of <file>.">,
|
|
|
|
MetaVarName<"section=file">;
|
2018-11-02 05:38:14 +08:00
|
|
|
|
|
|
|
def strip_all
|
|
|
|
: Flag<["-", "--"], "strip-all">,
|
|
|
|
HelpText<
|
|
|
|
"Remove non-allocated sections other than .gnu.warning* sections">;
|
|
|
|
def S : Flag<["-"], "S">, Alias<strip_all>;
|
2018-04-24 13:43:32 +08:00
|
|
|
def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
|
2018-11-02 01:48:46 +08:00
|
|
|
HelpText<"Compatible with GNU objcopy's --strip-all">;
|
2018-04-24 13:43:32 +08:00
|
|
|
def strip_debug : Flag<["-", "--"], "strip-debug">,
|
2018-04-25 05:44:13 +08:00
|
|
|
HelpText<"Remove all debug information">;
|
2018-04-24 13:43:32 +08:00
|
|
|
def strip_dwo : Flag<["-", "--"], "strip-dwo">,
|
|
|
|
HelpText<"Remove all DWARF .dwo sections from file">;
|
|
|
|
def strip_sections : Flag<["-", "--"], "strip-sections">,
|
|
|
|
HelpText<"Remove all section headers">;
|
|
|
|
def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
|
|
|
|
HelpText<"Remove all non-allocated sections">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
|
|
|
|
HelpText<"Remove all symbols not needed by relocations">;
|
|
|
|
|
|
|
|
def extract_dwo
|
|
|
|
: Flag<["-", "--"], "extract-dwo">,
|
|
|
|
HelpText<
|
|
|
|
"Remove all sections that are not DWARF .dwo sections from file">;
|
|
|
|
|
|
|
|
def localize_hidden
|
|
|
|
: Flag<["-", "--"], "localize-hidden">,
|
|
|
|
HelpText<
|
|
|
|
"Mark all symbols that have hidden or internal visibility as local">;
|
2018-11-02 01:20:40 +08:00
|
|
|
defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
|
|
|
|
MetaVarName<"symbol">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def L : JoinedOrSeparate<["-"], "L">, Alias<localize_symbol>;
|
2018-08-18 06:34:48 +08:00
|
|
|
|
2018-11-02 05:38:14 +08:00
|
|
|
defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
|
|
|
|
MetaVarName<"symbol">;
|
2018-08-18 06:34:48 +08:00
|
|
|
defm keep_global_symbol
|
2018-11-02 05:38:14 +08:00
|
|
|
: Eq<"keep-global-symbol",
|
|
|
|
"Convert all symbols except <symbol> to local. May be repeated to "
|
|
|
|
"convert all except a set of symbols to local.">,
|
2018-11-02 01:20:40 +08:00
|
|
|
MetaVarName<"symbol">;
|
2018-11-02 05:38:14 +08:00
|
|
|
def G : JoinedOrSeparate<["-"], "G">, Alias<keep_global_symbol>;
|
2018-08-18 06:34:48 +08:00
|
|
|
|
|
|
|
defm keep_global_symbols
|
2018-11-02 01:20:40 +08:00
|
|
|
: Eq<"keep-global-symbols",
|
|
|
|
"Reads a list of symbols from <filename> and runs as if "
|
2018-11-02 05:38:14 +08:00
|
|
|
"--keep-global-symbol=<symbol> is set for each one. <filename> "
|
|
|
|
"contains one symbol per line and may contain comments beginning with "
|
|
|
|
"'#'. Leading and trailing whitespace is stripped from each line. May "
|
|
|
|
"be repeated to read symbols from many files.">,
|
2018-11-02 01:20:40 +08:00
|
|
|
MetaVarName<"filename">;
|
2018-08-18 06:34:48 +08:00
|
|
|
|
2018-11-02 01:20:40 +08:00
|
|
|
defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
|
2018-11-02 05:38:14 +08:00
|
|
|
MetaVarName<"symbol">;
|
|
|
|
def W : JoinedOrSeparate<["-"], "W">, Alias<weaken_symbol>;
|
2018-05-03 04:14:49 +08:00
|
|
|
def weaken : Flag<["-", "--"], "weaken">,
|
2018-11-02 05:38:14 +08:00
|
|
|
HelpText<"Mark all global symbols as weak">;
|
|
|
|
def discard_all
|
|
|
|
: Flag<["-", "--"], "discard-all">,
|
|
|
|
HelpText<"Remove all local symbols except file and section symbols">;
|
|
|
|
def x : Flag<["-"], "x">, Alias<discard_all>;
|
2018-11-02 01:20:40 +08:00
|
|
|
defm strip_symbol : Eq<"strip-symbol", "Remove symbol <symbol>">,
|
2018-11-02 05:38:14 +08:00
|
|
|
MetaVarName<"symbol">;
|
|
|
|
def N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
|
2018-11-02 01:20:40 +08:00
|
|
|
defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
|
2018-11-02 05:38:14 +08:00
|
|
|
MetaVarName<"symbol">;
|
|
|
|
def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
|
|
|
|
def only_keep_debug
|
|
|
|
: Flag<["-", "--"], "only-keep-debug">,
|
|
|
|
HelpText<"Currently ignored. Only for compatibility with GNU objcopy.">;
|
2018-05-26 16:10:37 +08:00
|
|
|
def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
|
2018-11-02 05:38:14 +08:00
|
|
|
HelpText<"Do not remove file symbols">;
|
|
|
|
defm dump_section
|
|
|
|
: Eq<"dump-section",
|
|
|
|
"Dump contents of section named <section> into file <file>">,
|
|
|
|
MetaVarName<"section=file">;
|
|
|
|
defm prefix_symbols
|
|
|
|
: Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
|
|
|
|
MetaVarName<"prefix">;
|
|
|
|
|
|
|
|
def version : Flag<["-", "--"], "version">,
|
|
|
|
HelpText<"Print the version and exit.">;
|
2018-11-28 14:51:50 +08:00
|
|
|
def V : Flag<["-"], "V">, Alias<version>;
|
2018-12-04 03:49:23 +08:00
|
|
|
defm build_id_link_dir
|
|
|
|
: Eq<"build-id-link-dir", "Set directory for --build-id-link-input and "
|
|
|
|
"--build-id-link-output to <dir>">,
|
|
|
|
MetaVarName<"dir">;
|
|
|
|
defm build_id_link_input
|
|
|
|
: Eq<"build-id-link-input", "Hard-link the input to <dir>/xx/xxx<suffix> "
|
|
|
|
"name derived from hex build ID">,
|
|
|
|
MetaVarName<"suffix">;
|
|
|
|
defm build_id_link_output
|
|
|
|
: Eq<"build-id-link-output", "Hard-link the output to <dir>/xx/xxx<suffix> "
|
|
|
|
"name derived from hex build ID">,
|
|
|
|
MetaVarName<"suffix">;
|