139 lines · plain
1include "llvm/Option/OptParser.td"2 3multiclass Eq<string name, string help> {4 def NAME : Separate<["--"], name>;5 def NAME #_eq : Joined<["--"], name #"=">,6 Alias<!cast<Separate>(NAME)>,7 HelpText<help>;8}9 10def grp_coff : OptionGroup<"kind">, HelpText<"OPTIONS (COFF specific)">;11def grp_macho : OptionGroup<"kind">, HelpText<"OPTIONS (Mach-O specific)">;12 13def help : Flag<["--"], "help">;14def h : Flag<["-"], "h">, Alias<help>;15 16def allow_broken_links17 : Flag<["--"], "allow-broken-links">,18 HelpText<"Allow the tool to remove sections even if it would leave "19 "invalid section references. The appropriate sh_link fields "20 "will be set to zero.">;21 22def enable_deterministic_archives23 : Flag<["--"], "enable-deterministic-archives">,24 HelpText<"Enable deterministic mode when operating on archives (use "25 "zero for UIDs, GIDs, and timestamps).">;26 27defm extract_section28 : Eq<"extract-section",29 "Extract section named <section> into standalone object in file <file>">,30 MetaVarName<"section=file">;31 32def D : Flag<["-"], "D">,33 Alias<enable_deterministic_archives>,34 HelpText<"Alias for --enable-deterministic-archives">;35 36def disable_deterministic_archives37 : Flag<["--"], "disable-deterministic-archives">,38 HelpText<"Disable deterministic mode when operating on archives (use "39 "real values for UIDs, GIDs, and timestamps).">;40def U : Flag<["-"], "U">,41 Alias<disable_deterministic_archives>,42 HelpText<"Alias for --disable-deterministic-archives">;43 44def preserve_dates : Flag<["--"], "preserve-dates">,45 HelpText<"Preserve access and modification timestamps">;46def p : Flag<["-"], "p">,47 Alias<preserve_dates>,48 HelpText<"Alias for --preserve-dates">;49 50def strip_all : Flag<["--"], "strip-all">,51 HelpText<"For ELF, remove all symbols and non-alloc sections not within "52 "segments, except for .gnu.warning*, .ARM.attribute, and the section name table. "53 "For COFF and Mach-O, remove all symbols, debug sections, and relocations">;54 55def strip_all_gnu56 : Flag<["--"], "strip-all-gnu">,57 HelpText<"Remove all symbols, debug sections and relocations. Compatible with GNU's --strip-all">;58 59def strip_debug : Flag<["--"], "strip-debug">,60 HelpText<"Remove all debug sections">;61def g : Flag<["-"], "g">,62 Alias<strip_debug>,63 HelpText<"Alias for --strip-debug">;64 65def strip_unneeded : Flag<["--"], "strip-unneeded">,66 HelpText<"Remove all symbols not needed by relocations">;67 68defm remove_section : Eq<"remove-section", "Remove <section>">,69 MetaVarName<"section">;70def R : JoinedOrSeparate<["-"], "R">,71 Alias<remove_section>,72 HelpText<"Alias for --remove-section">;73 74def strip_sections75 : Flag<["--"], "strip-sections">,76 HelpText<"Remove all section headers and all section data not within segments">;77 78defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,79 MetaVarName<"symbol">;80def N : JoinedOrSeparate<["-"], "N">,81 Alias<strip_symbol>,82 HelpText<"Alias for --strip-symbol">;83 84defm keep_section : Eq<"keep-section", "Keep <section>">,85 MetaVarName<"section">;86 87defm keep_symbol : Eq<"keep-symbol", "When removing symbols, do not remove <symbol>">,88 MetaVarName<"symbol">;89def K : JoinedOrSeparate<["-"], "K">,90 Alias<keep_symbol>,91 HelpText<"Alias for --keep-symbol">;92 93def keep_file_symbols : Flag<["--"], "keep-file-symbols">,94 HelpText<"Keep symbols of type STT_FILE, even if they would otherwise be stripped">;95 96def keep_undefined : Flag<["--"], "keep-undefined">,97 HelpText<"Do not remove undefined symbols">, Group<grp_macho>;98 99def only_keep_debug100 : Flag<["--"], "only-keep-debug">,101 HelpText<102 "Produce a debug file as the output that only preserves contents of "103 "sections useful for debugging purposes">;104 105def discard_locals : Flag<["--"], "discard-locals">,106 HelpText<"Remove local symbols starting with .L">;107def X : Flag<["-"], "X">,108 Alias<discard_locals>,109 HelpText<"Alias for --discard-locals">;110 111def discard_all112 : Flag<["--"], "discard-all">,113 HelpText<"Remove most local symbols. Different file formats may limit this to a subset. "114 "For ELF, file and section symbols are not discarded. "115 "Additionally, remove all debug sections">;116def x : Flag<["-"], "x">,117 Alias<discard_all>,118 HelpText<"Alias for --discard-all">;119 120def regex121 : Flag<["--"], "regex">,122 HelpText<"Permit regular expressions in name comparison">;123 124def version : Flag<["--"], "version">,125 HelpText<"Print the version and exit.">;126def V : Flag<["-"], "V">,127 Alias<version>,128 HelpText<"Alias for --version">;129 130def wildcard131 : Flag<["--"], "wildcard">,132 HelpText<"Allow wildcard syntax for symbol-related flags. Incompatible "133 "with --regex. Allows using '*' to match any number of "134 "characters, '?' to match any single character, '\' to escape "135 "special characters, and '[]' to define character classes. "136 "Wildcards beginning with '!' will prevent a match, for example "137 "\"-N '*' -N '!x'\" will strip all symbols except for \"x\".">;138def w : Flag<["-"], "w">, Alias<wildcard>, HelpText<"Alias for --wildcard">;139