Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 1 | include "llvm/Option/OptParser.td" |
| 2 | |
| 3 | multiclass Eq<string name> { |
| 4 | def NAME: Separate<["--", "-"], name>; |
| 5 | def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>; |
| 6 | } |
| 7 | |
| 8 | def help : Flag<["-", "--"], "help">; |
| 9 | defm binary_architecture : Eq<"binary-architecture">, |
| 10 | HelpText<"Used when transforming an architecture-less format (such as binary) to another format">; |
| 11 | def B : JoinedOrSeparate<["-"], "B">, |
| 12 | Alias<binary_architecture>; |
| 13 | defm input_target : Eq<"input-target">, |
| 14 | HelpText<"Format of the input file">, |
| 15 | Values<"binary">; |
| 16 | defm output_target : Eq<"output-target">, |
| 17 | HelpText<"Format of the output file">, |
| 18 | Values<"binary">; |
| 19 | def O : JoinedOrSeparate<["-"], "O">, |
| 20 | Alias<output_target>; |
| 21 | defm split_dwo : Eq<"split-dwo">, |
| 22 | MetaVarName<"dwo-file">, |
| 23 | HelpText<"Equivalent to extract-dwo on the input file to <dwo-file>, then strip-dwo on the input file">; |
| 24 | defm add_gnu_debuglink : Eq<"add-gnu-debuglink">, |
| 25 | MetaVarName<"debug-file">, |
Alexander Shaposhnikov | b3bfd3b | 2018-04-24 21:44:13 +0000 | [diff] [blame] | 26 | HelpText<"Add a .gnu_debuglink for <debug-file>">; |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 27 | defm remove_section : Eq<"remove-section">, |
| 28 | MetaVarName<"section">, |
| 29 | HelpText<"Remove <section>">; |
Jordan Rupprecht | d67c1e1 | 2018-08-01 16:23:22 +0000 | [diff] [blame^] | 30 | defm rename_section |
| 31 | : Eq<"rename-section">, |
| 32 | MetaVarName<"old=new[,flag1,...]">, |
| 33 | HelpText< |
| 34 | "Renames a section from old to new, optionally with specified flags. " |
| 35 | "Flags supported for GNU compatibility: alloc, load, noload, " |
| 36 | "readonly, debug, code, data, rom, share, contents, merge, strings.">; |
Alexander Shaposhnikov | 40e9bdf | 2018-04-26 18:28:17 +0000 | [diff] [blame] | 37 | defm redefine_symbol : Eq<"redefine-sym">, |
| 38 | MetaVarName<"old=new">, |
| 39 | HelpText<"Change the name of a symbol old to new">; |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 40 | def R : JoinedOrSeparate<["-"], "R">, |
| 41 | Alias<remove_section>; |
| 42 | defm keep : Eq<"keep">, |
| 43 | MetaVarName<"section">, |
| 44 | HelpText<"Keep <section>">; |
| 45 | defm only_keep : Eq<"only-keep">, |
| 46 | MetaVarName<"section">, |
| 47 | HelpText<"Remove all but <section>">; |
| 48 | def j : JoinedOrSeparate<["-"], "j">, |
| 49 | Alias<only_keep>; |
| 50 | defm add_section : Eq<"add-section">, |
| 51 | MetaVarName<"section=file">, |
| 52 | HelpText<"Make a section named <section> with the contents of <file>.">; |
| 53 | def strip_all : Flag<["-", "--"], "strip-all">, |
Alexander Shaposhnikov | b3bfd3b | 2018-04-24 21:44:13 +0000 | [diff] [blame] | 54 | HelpText<"Remove non-allocated sections other than .gnu.warning* sections">; |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 55 | def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">, |
| 56 | HelpText<"Compaitable with GNU objcopy's --strip-all">; |
| 57 | def strip_debug : Flag<["-", "--"], "strip-debug">, |
Alexander Shaposhnikov | b3bfd3b | 2018-04-24 21:44:13 +0000 | [diff] [blame] | 58 | HelpText<"Remove all debug information">; |
Alexander Shaposhnikov | d688479 | 2018-04-24 05:43:32 +0000 | [diff] [blame] | 59 | def strip_dwo : Flag<["-", "--"], "strip-dwo">, |
| 60 | HelpText<"Remove all DWARF .dwo sections from file">; |
| 61 | def strip_sections : Flag<["-", "--"], "strip-sections">, |
| 62 | HelpText<"Remove all section headers">; |
| 63 | def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">, |
| 64 | HelpText<"Remove all non-allocated sections">; |
| 65 | def extract_dwo : Flag<["-", "--"], "extract-dwo">, |
| 66 | HelpText<"Remove all sections that are not DWARF .dwo sections from file">; |
| 67 | def localize_hidden : Flag<["-", "--"], "localize-hidden">, |
| 68 | HelpText<"Mark all symbols that have hidden or internal visibility as local">; |
Paul Semel | b492494 | 2018-04-26 17:44:43 +0000 | [diff] [blame] | 69 | defm localize_symbol : Eq<"localize-symbol">, |
Alexander Shaposhnikov | 40e9bdf | 2018-04-26 18:28:17 +0000 | [diff] [blame] | 70 | MetaVarName<"symbol">, |
| 71 | HelpText<"Mark <symbol> as local">; |
Paul Semel | b492494 | 2018-04-26 17:44:43 +0000 | [diff] [blame] | 72 | def L : JoinedOrSeparate<["-"], "L">, |
| 73 | Alias<localize_symbol>; |
Paul Semel | ee5be79 | 2018-04-27 19:09:44 +0000 | [diff] [blame] | 74 | defm globalize_symbol : Eq<"globalize-symbol">, |
| 75 | MetaVarName<"symbol">, |
| 76 | HelpText<"Mark <symbol> as global">; |
Paul Semel | 3a8a56b | 2018-04-27 19:16:27 +0000 | [diff] [blame] | 77 | defm weaken_symbol : Eq<"weaken-symbol">, |
| 78 | MetaVarName<"symbol">, |
| 79 | HelpText<"Mark <symbol> as weak">; |
| 80 | def W : JoinedOrSeparate<["-"], "W">, |
| 81 | Alias<weaken_symbol>; |
Paul Semel | 2c0510f | 2018-05-02 20:14:49 +0000 | [diff] [blame] | 82 | def weaken : Flag<["-", "--"], "weaken">, |
| 83 | HelpText<"Mark all global symbols as weak">; |
Paul Semel | 41695f8 | 2018-05-02 20:19:22 +0000 | [diff] [blame] | 84 | def discard_all : Flag<["-", "--"], "discard-all">, |
| 85 | HelpText<"Remove all local symbols except file and section symbols">; |
| 86 | def x : Flag<["-"], "x">, |
| 87 | Alias<discard_all>; |
Paul Semel | 4246a46 | 2018-05-09 21:36:54 +0000 | [diff] [blame] | 88 | defm strip_symbol : Eq<"strip-symbol">, |
| 89 | MetaVarName<"symbol">, |
| 90 | HelpText<"Remove symbol <symbol>">; |
| 91 | def N : JoinedOrSeparate<["-"], "N">, |
| 92 | Alias<strip_symbol>; |
Paul Semel | 5d97c82 | 2018-05-15 14:09:37 +0000 | [diff] [blame] | 93 | defm keep_symbol : Eq<"keep-symbol">, |
| 94 | MetaVarName<"symbol">, |
| 95 | HelpText<"Do not remove symbol <symbol>">; |
| 96 | def K : JoinedOrSeparate<["-"], "K">, |
| 97 | Alias<keep_symbol>; |
Jake Ehrlich | e40398a | 2018-05-15 20:53:53 +0000 | [diff] [blame] | 98 | def only_keep_debug : Flag<["-", "--"], "only-keep-debug">, |
| 99 | HelpText<"Currently ignored. Only for compaitability with GNU objcopy.">; |
Paul Semel | 99dda0b | 2018-05-25 11:01:25 +0000 | [diff] [blame] | 100 | def strip_unneeded : Flag<["-", "--"], "strip-unneeded">, |
| 101 | HelpText<"Remove all symbols not needed by relocations">; |
Paul Semel | cf51c80 | 2018-05-26 08:10:37 +0000 | [diff] [blame] | 102 | def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">, |
| 103 | HelpText<"Do not remove file symbols">; |