Alexander Shaposhnikov | 409ea28 | 2018-05-07 19:32:09 +0000 | [diff] [blame] | 1 | include "llvm/Option/OptParser.td" |
| 2 | |
Fangrui Song | d919ed9 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 3 | multiclass Eq<string name, string help> { |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 4 | def NAME : Separate<["--", "-"], name>; |
| 5 | def NAME #_eq : Joined<["--", "-"], name #"=">, |
| 6 | Alias<!cast<Separate>(NAME)>, |
| 7 | HelpText<help>; |
Alexander Shaposhnikov | 409ea28 | 2018-05-07 19:32:09 +0000 | [diff] [blame] | 8 | } |
| 9 | |
| 10 | def help : Flag<["-", "--"], "help">; |
| 11 | |
Jordan Rupprecht | 167fb18 | 2018-11-01 17:36:37 +0000 | [diff] [blame] | 12 | def enable_deterministic_archives |
| 13 | : Flag<["-", "--"], "enable-deterministic-archives">, |
| 14 | HelpText<"Enable deterministic mode when stripping archives (use zero " |
| 15 | "for UIDs, GIDs, and timestamps).">; |
| 16 | def D : Flag<["-"], "D">, |
| 17 | Alias<enable_deterministic_archives>, |
| 18 | HelpText<"Alias for --enable-deterministic-archives">; |
| 19 | |
| 20 | def disable_deterministic_archives |
| 21 | : Flag<["-", "--"], "disable-deterministic-archives">, |
| 22 | HelpText<"Disable deterministic mode when stripping archives (use real " |
| 23 | "values for UIDs, GIDs, and timestamps).">; |
| 24 | def U : Flag<["-"], "U">, |
| 25 | Alias<disable_deterministic_archives>, |
| 26 | HelpText<"Alias for --disable-deterministic-archives">; |
| 27 | |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 28 | defm output : Eq<"o", "Write output to <file>">, MetaVarName<"output">; |
Alexander Shaposhnikov | 9eb9307 | 2018-05-31 20:42:13 +0000 | [diff] [blame] | 29 | |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 30 | def preserve_dates : Flag<["-", "--"], "preserve-dates">, |
Jordan Rupprecht | 7b455c4 | 2018-08-16 18:29:40 +0000 | [diff] [blame] | 31 | HelpText<"Preserve access and modification timestamps">; |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 32 | def p : Flag<["-"], "p">, Alias<preserve_dates>; |
Jordan Rupprecht | 7b455c4 | 2018-08-16 18:29:40 +0000 | [diff] [blame] | 33 | |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 34 | def strip_all |
| 35 | : Flag<["-", "--"], "strip-all">, |
| 36 | HelpText< |
| 37 | "Remove non-allocated sections other than .gnu.warning* sections">; |
| 38 | def s : Flag<["-"], "s">, Alias<strip_all>; |
Jordan Rupprecht | 863ec6da | 2018-10-23 18:46:33 +0000 | [diff] [blame] | 39 | |
Jordan Rupprecht | 9a78ad0 | 2018-11-01 17:48:46 +0000 | [diff] [blame] | 40 | def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">, |
| 41 | HelpText<"Compatible with GNU strip's --strip-all">; |
Alexander Shaposhnikov | 409ea28 | 2018-05-07 19:32:09 +0000 | [diff] [blame] | 42 | def strip_debug : Flag<["-", "--"], "strip-debug">, |
| 43 | HelpText<"Remove debugging symbols only">; |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 44 | def d : Flag<["-"], "d">, Alias<strip_debug>; |
| 45 | def g : Flag<["-"], "g">, Alias<strip_debug>; |
| 46 | def S : Flag<["-"], "S">, Alias<strip_debug>; |
| 47 | def strip_unneeded : Flag<["-", "--"], "strip-unneeded">, |
| 48 | HelpText<"Remove all symbols not needed by relocations">; |
Alexander Shaposhnikov | 711621f | 2018-06-04 18:55:41 +0000 | [diff] [blame] | 49 | |
Fangrui Song | d919ed9 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 50 | defm remove_section : Eq<"remove-section", "Remove <section>">, |
| 51 | MetaVarName<"section">; |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 52 | def R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>; |
Alexander Shaposhnikov | 49011d2 | 2018-05-23 19:44:19 +0000 | [diff] [blame] | 53 | |
Jordan Rupprecht | 65bac06 | 2018-11-13 19:32:27 +0000 | [diff] [blame] | 54 | defm keep_section : Eq<"keep-section", "Keep <section>">, |
| 55 | MetaVarName<"section">; |
Fangrui Song | d919ed9 | 2018-11-01 17:20:40 +0000 | [diff] [blame] | 56 | defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">, |
| 57 | MetaVarName<"symbol">; |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 58 | def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>; |
Alexander Shaposhnikov | 49011d2 | 2018-05-23 19:44:19 +0000 | [diff] [blame] | 59 | |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 60 | def discard_all |
| 61 | : Flag<["-", "--"], "discard-all">, |
| 62 | HelpText<"Remove all local symbols except file and section symbols">; |
| 63 | def x : Flag<["-"], "x">, Alias<discard_all>; |
Alexander Shaposhnikov | ad593b0 | 2018-06-06 21:23:19 +0000 | [diff] [blame] | 64 | |
Jordan Rupprecht | 78ba7a6 | 2018-11-01 21:38:14 +0000 | [diff] [blame] | 65 | def version : Flag<["-", "--"], "version">, |
Jordan Rupprecht | 5b1329d | 2018-09-21 00:47:31 +0000 | [diff] [blame] | 66 | HelpText<"Print the version and exit.">; |
Martin Storsjo | 3eeed74 | 2018-11-28 06:51:50 +0000 | [diff] [blame] | 67 | def V : Flag<["-"], "V">, Alias<version>; |