Home | History | Annotate | Download | only in llvm-objcopy
      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">,
     26                          HelpText<"Add a .gnu_debuglink for <debug-file>">;
     27 defm remove_section : Eq<"remove-section">,
     28                       MetaVarName<"section">,
     29                       HelpText<"Remove <section>">;
     30 defm rename_section : Eq<"rename-section">,
     31                       MetaVarName<"old=new">,
     32                       HelpText<"Renames a section from old to new">;
     33 defm redefine_symbol : Eq<"redefine-sym">,
     34                        MetaVarName<"old=new">,
     35                        HelpText<"Change the name of a symbol old to new">;
     36 def R : JoinedOrSeparate<["-"], "R">,
     37         Alias<remove_section>;
     38 defm keep : Eq<"keep">,
     39             MetaVarName<"section">,
     40             HelpText<"Keep <section>">;
     41 defm only_keep : Eq<"only-keep">,
     42                  MetaVarName<"section">,
     43                  HelpText<"Remove all but <section>">;
     44 def j : JoinedOrSeparate<["-"], "j">,
     45                       Alias<only_keep>;
     46 defm add_section : Eq<"add-section">,
     47                    MetaVarName<"section=file">,
     48                    HelpText<"Make a section named <section> with the contents of <file>.">;
     49 def strip_all : Flag<["-", "--"], "strip-all">,
     50                 HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
     51 def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
     52                     HelpText<"Compaitable with GNU objcopy's --strip-all">;
     53 def strip_debug : Flag<["-", "--"], "strip-debug">,
     54                   HelpText<"Remove all debug information">;
     55 def strip_dwo : Flag<["-", "--"], "strip-dwo">,
     56                 HelpText<"Remove all DWARF .dwo sections from file">;
     57 def strip_sections : Flag<["-", "--"], "strip-sections">,
     58                      HelpText<"Remove all section headers">;
     59 def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
     60                       HelpText<"Remove all non-allocated sections">;
     61 def extract_dwo : Flag<["-", "--"], "extract-dwo">,
     62                   HelpText<"Remove all sections that are not DWARF .dwo sections from file">;
     63 def localize_hidden : Flag<["-", "--"], "localize-hidden">,
     64                       HelpText<"Mark all symbols that have hidden or internal visibility as local">;
     65 defm localize_symbol : Eq<"localize-symbol">,
     66                        MetaVarName<"symbol">,
     67                        HelpText<"Mark <symbol> as local">;
     68 def L : JoinedOrSeparate<["-"], "L">,
     69         Alias<localize_symbol>;
     70 defm globalize_symbol : Eq<"globalize-symbol">,
     71                        MetaVarName<"symbol">,
     72                        HelpText<"Mark <symbol> as global">;
     73 defm weaken_symbol : Eq<"weaken-symbol">,
     74                        MetaVarName<"symbol">,
     75                        HelpText<"Mark <symbol> as weak">;
     76 def W : JoinedOrSeparate<["-"], "W">,
     77         Alias<weaken_symbol>;
     78 def weaken : Flag<["-", "--"], "weaken">,
     79                   HelpText<"Mark all global symbols as weak">;
     80 def discard_all : Flag<["-", "--"], "discard-all">,
     81                       HelpText<"Remove all local symbols except file and section symbols">;
     82 def x : Flag<["-"], "x">,
     83         Alias<discard_all>;
     84 defm strip_symbol : Eq<"strip-symbol">,
     85                        MetaVarName<"symbol">,
     86                        HelpText<"Remove symbol <symbol>">;
     87 def N : JoinedOrSeparate<["-"], "N">,
     88         Alias<strip_symbol>;
     89 defm keep_symbol : Eq<"keep-symbol">,
     90                        MetaVarName<"symbol">,
     91                        HelpText<"Do not remove symbol <symbol>">;
     92 def K : JoinedOrSeparate<["-"], "K">,
     93         Alias<keep_symbol>;
     94 def only_keep_debug : Flag<["-", "--"], "only-keep-debug">,
     95                           HelpText<"Currently ignored. Only for compaitability with GNU objcopy.">;
     96 def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
     97                       HelpText<"Remove all symbols not needed by relocations">;
     98 def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
     99                       HelpText<"Do not remove file symbols">;
    100