1*0b57cec5SDimitry Andricinclude "llvm/Option/OptParser.td" 2*0b57cec5SDimitry Andric 3*0b57cec5SDimitry Andricmulticlass Eq<string name, string help> { 4*0b57cec5SDimitry Andric def NAME : Separate<["--"], name>; 5*0b57cec5SDimitry Andric def NAME #_eq : Joined<["--"], name #"=">, 6*0b57cec5SDimitry Andric Alias<!cast<Separate>(NAME)>, 7*0b57cec5SDimitry Andric HelpText<help>; 8*0b57cec5SDimitry Andric} 9*0b57cec5SDimitry Andric 10*0b57cec5SDimitry Andricdef help : Flag<["--"], "help">; 11*0b57cec5SDimitry Andricdef h : Flag<["-"], "h">, Alias<help>; 12*0b57cec5SDimitry Andric 13*0b57cec5SDimitry Andricdef allow_broken_links 14*0b57cec5SDimitry Andric : Flag<["--"], "allow-broken-links">, 15*0b57cec5SDimitry Andric HelpText<"Allow llvm-objcopy to remove sections even if it would leave " 16*0b57cec5SDimitry Andric "invalid section references. The appropriate sh_link fields " 17*0b57cec5SDimitry Andric "will be set to zero.">; 18*0b57cec5SDimitry Andric 19*0b57cec5SDimitry Andricdefm binary_architecture 20*0b57cec5SDimitry Andric : Eq<"binary-architecture", "Used when transforming an architecture-less " 21*0b57cec5SDimitry Andric "format (such as binary) to another format">; 22*0b57cec5SDimitry Andricdef B : JoinedOrSeparate<["-"], "B">, Alias<binary_architecture>; 23*0b57cec5SDimitry Andric 24*0b57cec5SDimitry Andricdefm target : Eq<"target", "Format of the input and output file">, 25*0b57cec5SDimitry Andric Values<"binary">; 26*0b57cec5SDimitry Andricdef F : JoinedOrSeparate<["-"], "F">, Alias<target>; 27*0b57cec5SDimitry Andric 28*0b57cec5SDimitry Andricdefm input_target : Eq<"input-target", "Format of the input file">, 29*0b57cec5SDimitry Andric Values<"binary">; 30*0b57cec5SDimitry Andricdef I : JoinedOrSeparate<["-"], "I">, Alias<input_target>; 31*0b57cec5SDimitry Andric 32*0b57cec5SDimitry Andricdefm output_target : Eq<"output-target", "Format of the output file">, 33*0b57cec5SDimitry Andric Values<"binary">; 34*0b57cec5SDimitry Andricdef O : JoinedOrSeparate<["-"], "O">, Alias<output_target>; 35*0b57cec5SDimitry Andric 36*0b57cec5SDimitry Andricdef compress_debug_sections : Flag<["--"], "compress-debug-sections">; 37*0b57cec5SDimitry Andricdef compress_debug_sections_eq 38*0b57cec5SDimitry Andric : Joined<["--"], "compress-debug-sections=">, 39*0b57cec5SDimitry Andric MetaVarName<"[ zlib | zlib-gnu ]">, 40*0b57cec5SDimitry Andric HelpText<"Compress DWARF debug sections using specified style. Supported " 41*0b57cec5SDimitry Andric "styles: 'zlib-gnu' and 'zlib'">; 42*0b57cec5SDimitry Andricdef decompress_debug_sections : Flag<["--"], "decompress-debug-sections">, 43*0b57cec5SDimitry Andric HelpText<"Decompress DWARF debug sections.">; 44*0b57cec5SDimitry Andricdefm split_dwo 45*0b57cec5SDimitry Andric : Eq<"split-dwo", "Equivalent to extract-dwo on the input file to " 46*0b57cec5SDimitry Andric "<dwo-file>, then strip-dwo on the input file">, 47*0b57cec5SDimitry Andric MetaVarName<"dwo-file">; 48*0b57cec5SDimitry Andric 49*0b57cec5SDimitry Andricdef enable_deterministic_archives 50*0b57cec5SDimitry Andric : Flag<["--"], "enable-deterministic-archives">, 51*0b57cec5SDimitry Andric HelpText<"Enable deterministic mode when copying archives (use zero for " 52*0b57cec5SDimitry Andric "UIDs, GIDs, and timestamps).">; 53*0b57cec5SDimitry Andricdef D : Flag<["-"], "D">, 54*0b57cec5SDimitry Andric Alias<enable_deterministic_archives>, 55*0b57cec5SDimitry Andric HelpText<"Alias for --enable-deterministic-archives">; 56*0b57cec5SDimitry Andric 57*0b57cec5SDimitry Andricdef disable_deterministic_archives 58*0b57cec5SDimitry Andric : Flag<["--"], "disable-deterministic-archives">, 59*0b57cec5SDimitry Andric HelpText<"Disable deterministic mode when copying archives (use real " 60*0b57cec5SDimitry Andric "values for UIDs, GIDs, and timestamps).">; 61*0b57cec5SDimitry Andricdef U : Flag<["-"], "U">, 62*0b57cec5SDimitry Andric Alias<disable_deterministic_archives>, 63*0b57cec5SDimitry Andric HelpText<"Alias for --disable-deterministic-archives">; 64*0b57cec5SDimitry Andric 65*0b57cec5SDimitry Andricdef preserve_dates : Flag<["--"], "preserve-dates">, 66*0b57cec5SDimitry Andric HelpText<"Preserve access and modification timestamps">; 67*0b57cec5SDimitry Andricdef p : Flag<["-"], "p">, Alias<preserve_dates>; 68*0b57cec5SDimitry Andric 69*0b57cec5SDimitry Andricdefm add_gnu_debuglink 70*0b57cec5SDimitry Andric : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">, 71*0b57cec5SDimitry Andric MetaVarName<"debug-file">; 72*0b57cec5SDimitry Andric 73*0b57cec5SDimitry Andricdefm remove_section : Eq<"remove-section", "Remove <section>">, 74*0b57cec5SDimitry Andric MetaVarName<"section">; 75*0b57cec5SDimitry Andricdef R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>; 76*0b57cec5SDimitry Andric 77*0b57cec5SDimitry Andricdefm rename_section 78*0b57cec5SDimitry Andric : Eq<"rename-section", 79*0b57cec5SDimitry Andric "Renames a section from old to new, optionally with specified flags. " 80*0b57cec5SDimitry Andric "Flags supported for GNU compatibility: alloc, load, noload, " 81*0b57cec5SDimitry Andric "readonly, debug, code, data, rom, share, contents, merge, strings.">, 82*0b57cec5SDimitry Andric MetaVarName<"old=new[,flag1,...]">; 83*0b57cec5SDimitry Andricdefm redefine_symbol 84*0b57cec5SDimitry Andric : Eq<"redefine-sym", "Change the name of a symbol old to new">, 85*0b57cec5SDimitry Andric MetaVarName<"old=new">; 86*0b57cec5SDimitry Andricdefm redefine_symbols 87*0b57cec5SDimitry Andric : Eq<"redefine-syms", 88*0b57cec5SDimitry Andric "Reads a list of symbol pairs from <filename> and runs as if " 89*0b57cec5SDimitry Andric "--redefine-sym=<old>=<new> is set for each one. <filename> " 90*0b57cec5SDimitry Andric "contains two symbols per line separated with whitespace and may " 91*0b57cec5SDimitry Andric "contain comments beginning with '#'. Leading and trailing " 92*0b57cec5SDimitry Andric "whitespace is stripped from each line. May be repeated to read " 93*0b57cec5SDimitry Andric "symbols from many files.">, 94*0b57cec5SDimitry Andric MetaVarName<"filename">; 95*0b57cec5SDimitry Andric 96*0b57cec5SDimitry Andricdefm keep_section : Eq<"keep-section", "Keep <section>">, 97*0b57cec5SDimitry Andric MetaVarName<"section">; 98*0b57cec5SDimitry Andricdefm only_section : Eq<"only-section", "Remove all but <section>">, 99*0b57cec5SDimitry Andric MetaVarName<"section">; 100*0b57cec5SDimitry Andricdef j : JoinedOrSeparate<["-"], "j">, Alias<only_section>; 101*0b57cec5SDimitry Andricdefm add_section 102*0b57cec5SDimitry Andric : Eq<"add-section", 103*0b57cec5SDimitry Andric "Make a section named <section> with the contents of <file>.">, 104*0b57cec5SDimitry Andric MetaVarName<"section=file">; 105*0b57cec5SDimitry Andric 106*0b57cec5SDimitry Andricdefm set_section_flags 107*0b57cec5SDimitry Andric : Eq<"set-section-flags", 108*0b57cec5SDimitry Andric "Set section flags for a given section. Flags supported for GNU " 109*0b57cec5SDimitry Andric "compatibility: alloc, load, noload, readonly, debug, code, data, " 110*0b57cec5SDimitry Andric "rom, share, contents, merge, strings.">, 111*0b57cec5SDimitry Andric MetaVarName<"section=flag1[,flag2,...]">; 112*0b57cec5SDimitry Andric 113*0b57cec5SDimitry Andricdef strip_all : Flag<["--"], "strip-all">, 114*0b57cec5SDimitry Andric HelpText<"Remove non-allocated sections outside segments. " 115*0b57cec5SDimitry Andric ".gnu.warning* sections are not removed">; 116*0b57cec5SDimitry Andricdef S : Flag<["-"], "S">, Alias<strip_all>; 117*0b57cec5SDimitry Andricdef strip_all_gnu : Flag<["--"], "strip-all-gnu">, 118*0b57cec5SDimitry Andric HelpText<"Compatible with GNU objcopy's --strip-all">; 119*0b57cec5SDimitry Andricdef strip_debug : Flag<["--"], "strip-debug">, 120*0b57cec5SDimitry Andric HelpText<"Remove all debug information">; 121*0b57cec5SDimitry Andricdef g : Flag<["-"], "g">, Alias<strip_debug>, 122*0b57cec5SDimitry Andric HelpText<"Alias for --strip-debug">; 123*0b57cec5SDimitry Andricdef strip_dwo : Flag<["--"], "strip-dwo">, 124*0b57cec5SDimitry Andric HelpText<"Remove all DWARF .dwo sections from file">; 125*0b57cec5SDimitry Andricdef strip_sections 126*0b57cec5SDimitry Andric : Flag<["--"], "strip-sections">, 127*0b57cec5SDimitry Andric HelpText<"Remove all section headers and all sections not in segments">; 128*0b57cec5SDimitry Andricdef strip_non_alloc 129*0b57cec5SDimitry Andric : Flag<["--"], "strip-non-alloc">, 130*0b57cec5SDimitry Andric HelpText<"Remove all non-allocated sections outside segments">; 131*0b57cec5SDimitry Andricdef strip_unneeded : Flag<["--"], "strip-unneeded">, 132*0b57cec5SDimitry Andric HelpText<"Remove all symbols not needed by relocations">; 133*0b57cec5SDimitry Andricdefm strip_unneeded_symbol 134*0b57cec5SDimitry Andric : Eq<"strip-unneeded-symbol", 135*0b57cec5SDimitry Andric "Remove symbol <symbol> if it is not needed by relocations">, 136*0b57cec5SDimitry Andric MetaVarName<"symbol">; 137*0b57cec5SDimitry Andricdefm strip_unneeded_symbols 138*0b57cec5SDimitry Andric : Eq<"strip-unneeded-symbols", 139*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and removes them " 140*0b57cec5SDimitry Andric "if they are not needed by relocations">, 141*0b57cec5SDimitry Andric MetaVarName<"filename">; 142*0b57cec5SDimitry Andric 143*0b57cec5SDimitry Andricdef extract_dwo 144*0b57cec5SDimitry Andric : Flag<["--"], "extract-dwo">, 145*0b57cec5SDimitry Andric HelpText< 146*0b57cec5SDimitry Andric "Remove all sections that are not DWARF .dwo sections from file">; 147*0b57cec5SDimitry Andric 148*0b57cec5SDimitry Andricdefm extract_partition 149*0b57cec5SDimitry Andric : Eq<"extract-partition", "Extract named partition from input file">, 150*0b57cec5SDimitry Andric MetaVarName<"name">; 151*0b57cec5SDimitry Andricdef extract_main_partition 152*0b57cec5SDimitry Andric : Flag<["--"], "extract-main-partition">, 153*0b57cec5SDimitry Andric HelpText<"Extract main partition from the input file">; 154*0b57cec5SDimitry Andric 155*0b57cec5SDimitry Andricdef localize_hidden 156*0b57cec5SDimitry Andric : Flag<["--"], "localize-hidden">, 157*0b57cec5SDimitry Andric HelpText< 158*0b57cec5SDimitry Andric "Mark all symbols that have hidden or internal visibility as local">; 159*0b57cec5SDimitry Andricdefm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">, 160*0b57cec5SDimitry Andric MetaVarName<"symbol">; 161*0b57cec5SDimitry Andricdefm localize_symbols 162*0b57cec5SDimitry Andric : Eq<"localize-symbols", 163*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and marks them local.">, 164*0b57cec5SDimitry Andric MetaVarName<"filename">; 165*0b57cec5SDimitry Andric 166*0b57cec5SDimitry Andricdef L : JoinedOrSeparate<["-"], "L">, Alias<localize_symbol>; 167*0b57cec5SDimitry Andric 168*0b57cec5SDimitry Andricdefm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">, 169*0b57cec5SDimitry Andric MetaVarName<"symbol">; 170*0b57cec5SDimitry Andric 171*0b57cec5SDimitry Andricdefm globalize_symbols 172*0b57cec5SDimitry Andric : Eq<"globalize-symbols", 173*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and marks them global.">, 174*0b57cec5SDimitry Andric MetaVarName<"filename">; 175*0b57cec5SDimitry Andric 176*0b57cec5SDimitry Andricdefm keep_global_symbol 177*0b57cec5SDimitry Andric : Eq<"keep-global-symbol", 178*0b57cec5SDimitry Andric "Convert all symbols except <symbol> to local. May be repeated to " 179*0b57cec5SDimitry Andric "convert all except a set of symbols to local.">, 180*0b57cec5SDimitry Andric MetaVarName<"symbol">; 181*0b57cec5SDimitry Andricdef G : JoinedOrSeparate<["-"], "G">, Alias<keep_global_symbol>; 182*0b57cec5SDimitry Andric 183*0b57cec5SDimitry Andricdefm keep_global_symbols 184*0b57cec5SDimitry Andric : Eq<"keep-global-symbols", 185*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and runs as if " 186*0b57cec5SDimitry Andric "--keep-global-symbol=<symbol> is set for each one. <filename> " 187*0b57cec5SDimitry Andric "contains one symbol per line and may contain comments beginning with " 188*0b57cec5SDimitry Andric "'#'. Leading and trailing whitespace is stripped from each line. May " 189*0b57cec5SDimitry Andric "be repeated to read symbols from many files.">, 190*0b57cec5SDimitry Andric MetaVarName<"filename">; 191*0b57cec5SDimitry Andric 192*0b57cec5SDimitry Andricdefm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">, 193*0b57cec5SDimitry Andric MetaVarName<"symbol">; 194*0b57cec5SDimitry Andricdefm weaken_symbols 195*0b57cec5SDimitry Andric : Eq<"weaken-symbols", 196*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and marks them weak.">, 197*0b57cec5SDimitry Andric MetaVarName<"filename">; 198*0b57cec5SDimitry Andric 199*0b57cec5SDimitry Andricdef W : JoinedOrSeparate<["-"], "W">, Alias<weaken_symbol>; 200*0b57cec5SDimitry Andricdef weaken : Flag<["--"], "weaken">, 201*0b57cec5SDimitry Andric HelpText<"Mark all global symbols as weak">; 202*0b57cec5SDimitry Andric 203*0b57cec5SDimitry Andricdef discard_locals : Flag<["--"], "discard-locals">, 204*0b57cec5SDimitry Andric HelpText<"Remove compiler-generated local symbols, (e.g. " 205*0b57cec5SDimitry Andric "symbols starting with .L)">; 206*0b57cec5SDimitry Andricdef X : Flag<["-"], "X">, Alias<discard_locals>; 207*0b57cec5SDimitry Andric 208*0b57cec5SDimitry Andricdef discard_all 209*0b57cec5SDimitry Andric : Flag<["--"], "discard-all">, 210*0b57cec5SDimitry Andric HelpText<"Remove all local symbols except file and section symbols">; 211*0b57cec5SDimitry Andricdef x : Flag<["-"], "x">, Alias<discard_all>; 212*0b57cec5SDimitry Andricdefm strip_symbol : Eq<"strip-symbol", "Remove symbol <symbol>">, 213*0b57cec5SDimitry Andric MetaVarName<"symbol">; 214*0b57cec5SDimitry Andricdefm strip_symbols 215*0b57cec5SDimitry Andric : Eq<"strip-symbols", 216*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and removes them.">, 217*0b57cec5SDimitry Andric MetaVarName<"filename">; 218*0b57cec5SDimitry Andric 219*0b57cec5SDimitry Andricdef N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>; 220*0b57cec5SDimitry Andricdefm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">, 221*0b57cec5SDimitry Andric MetaVarName<"symbol">; 222*0b57cec5SDimitry Andricdef K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>; 223*0b57cec5SDimitry Andric 224*0b57cec5SDimitry Andricdefm keep_symbols 225*0b57cec5SDimitry Andric : Eq<"keep-symbols", 226*0b57cec5SDimitry Andric "Reads a list of symbols from <filename> and runs as if " 227*0b57cec5SDimitry Andric "--keep-symbol=<symbol> is set for each one. <filename> " 228*0b57cec5SDimitry Andric "contains one symbol per line and may contain comments beginning with " 229*0b57cec5SDimitry Andric "'#'. Leading and trailing whitespace is stripped from each line. May " 230*0b57cec5SDimitry Andric "be repeated to read symbols from many files.">, 231*0b57cec5SDimitry Andric MetaVarName<"filename">; 232*0b57cec5SDimitry Andric 233*0b57cec5SDimitry Andricdef only_keep_debug 234*0b57cec5SDimitry Andric : Flag<["--"], "only-keep-debug">, 235*0b57cec5SDimitry Andric HelpText<"Clear sections that would not be stripped by --strip-debug. " 236*0b57cec5SDimitry Andric "Currently only implemented for COFF.">; 237*0b57cec5SDimitry Andric 238*0b57cec5SDimitry Andricdef keep_file_symbols : Flag<["--"], "keep-file-symbols">, 239*0b57cec5SDimitry Andric HelpText<"Do not remove file symbols">; 240*0b57cec5SDimitry Andricdefm dump_section 241*0b57cec5SDimitry Andric : Eq<"dump-section", 242*0b57cec5SDimitry Andric "Dump contents of section named <section> into file <file>">, 243*0b57cec5SDimitry Andric MetaVarName<"section=file">; 244*0b57cec5SDimitry Andricdefm prefix_symbols 245*0b57cec5SDimitry Andric : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">, 246*0b57cec5SDimitry Andric MetaVarName<"prefix">; 247*0b57cec5SDimitry Andric 248*0b57cec5SDimitry Andricdefm prefix_alloc_sections 249*0b57cec5SDimitry Andric : Eq<"prefix-alloc-sections", "Add <prefix> to the start of every allocated section name">, 250*0b57cec5SDimitry Andric MetaVarName<"prefix">; 251*0b57cec5SDimitry Andric 252*0b57cec5SDimitry Andricdef version : Flag<["--"], "version">, 253*0b57cec5SDimitry Andric HelpText<"Print the version and exit.">; 254*0b57cec5SDimitry Andricdef V : Flag<["-"], "V">, Alias<version>; 255*0b57cec5SDimitry Andricdefm build_id_link_dir 256*0b57cec5SDimitry Andric : Eq<"build-id-link-dir", "Set directory for --build-id-link-input and " 257*0b57cec5SDimitry Andric "--build-id-link-output to <dir>">, 258*0b57cec5SDimitry Andric MetaVarName<"dir">; 259*0b57cec5SDimitry Andricdefm build_id_link_input 260*0b57cec5SDimitry Andric : Eq<"build-id-link-input", "Hard-link the input to <dir>/xx/xxx<suffix> " 261*0b57cec5SDimitry Andric "name derived from hex build ID">, 262*0b57cec5SDimitry Andric MetaVarName<"suffix">; 263*0b57cec5SDimitry Andricdefm build_id_link_output 264*0b57cec5SDimitry Andric : Eq<"build-id-link-output", "Hard-link the output to <dir>/xx/xxx<suffix> " 265*0b57cec5SDimitry Andric "name derived from hex build ID">, 266*0b57cec5SDimitry Andric MetaVarName<"suffix">; 267*0b57cec5SDimitry Andric 268*0b57cec5SDimitry Andricdef regex 269*0b57cec5SDimitry Andric : Flag<["--"], "regex">, 270*0b57cec5SDimitry Andric HelpText<"Permit regular expressions in name comparison">; 271*0b57cec5SDimitry Andric 272*0b57cec5SDimitry Andricdefm set_start : Eq<"set-start", "Set the start address to <addr>. Overrides " 273*0b57cec5SDimitry Andric "any previous --change-start or --adjust-start values.">, 274*0b57cec5SDimitry Andric MetaVarName<"addr">; 275*0b57cec5SDimitry Andricdefm change_start : Eq<"change-start", "Add <incr> to the start address. Can be " 276*0b57cec5SDimitry Andric "specified multiple times, all values will be applied " 277*0b57cec5SDimitry Andric "cumulatively.">, 278*0b57cec5SDimitry Andric MetaVarName<"incr">; 279*0b57cec5SDimitry Andricdef adjust_start : JoinedOrSeparate<["--"], "adjust-start">, 280*0b57cec5SDimitry Andric Alias<change_start>; 281*0b57cec5SDimitry Andric 282*0b57cec5SDimitry Andricdefm add_symbol 283*0b57cec5SDimitry Andric : Eq<"add-symbol", "Add new symbol <name> to .symtab. Accepted flags: " 284*0b57cec5SDimitry Andric "global, local, weak, default, hidden, file, section, object, " 285*0b57cec5SDimitry Andric "function, indirect-function. Accepted but ignored for " 286*0b57cec5SDimitry Andric "compatibility: debug, constructor, warning, indirect, synthetic, " 287*0b57cec5SDimitry Andric "unique-object, before.">, 288*0b57cec5SDimitry Andric MetaVarName<"name=[section:]value[,flags]">; 289