CommonOpts.td 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. include "llvm/Option/OptParser.td"
  2. multiclass Eq<string name, string help> {
  3. def NAME : Separate<["--"], name>;
  4. def NAME #_eq : Joined<["--"], name #"=">,
  5. Alias<!cast<Separate>(NAME)>,
  6. HelpText<help>;
  7. }
  8. def help : Flag<["--"], "help">;
  9. def h : Flag<["-"], "h">, Alias<help>;
  10. def allow_broken_links
  11. : Flag<["--"], "allow-broken-links">,
  12. HelpText<"Allow the tool to remove sections even if it would leave "
  13. "invalid section references. The appropriate sh_link fields "
  14. "will be set to zero.">;
  15. def enable_deterministic_archives
  16. : Flag<["--"], "enable-deterministic-archives">,
  17. HelpText<"Enable deterministic mode when operating on archives (use "
  18. "zero for UIDs, GIDs, and timestamps).">;
  19. def D : Flag<["-"], "D">,
  20. Alias<enable_deterministic_archives>,
  21. HelpText<"Alias for --enable-deterministic-archives">;
  22. def disable_deterministic_archives
  23. : Flag<["--"], "disable-deterministic-archives">,
  24. HelpText<"Disable deterministic mode when operating on archives (use "
  25. "real values for UIDs, GIDs, and timestamps).">;
  26. def U : Flag<["-"], "U">,
  27. Alias<disable_deterministic_archives>,
  28. HelpText<"Alias for --disable-deterministic-archives">;
  29. def preserve_dates : Flag<["--"], "preserve-dates">,
  30. HelpText<"Preserve access and modification timestamps">;
  31. def p : Flag<["-"], "p">,
  32. Alias<preserve_dates>,
  33. HelpText<"Alias for --preserve-dates">;
  34. def strip_all : Flag<["--"], "strip-all">,
  35. HelpText<"Remove non-allocated sections outside segments. "
  36. ".gnu.warning* and .ARM.attribute sections are not "
  37. "removed">;
  38. def strip_all_gnu
  39. : Flag<["--"], "strip-all-gnu">,
  40. HelpText<"Compatible with GNU's --strip-all">;
  41. def strip_debug : Flag<["--"], "strip-debug">,
  42. HelpText<"Remove all debug sections">;
  43. def g : Flag<["-"], "g">,
  44. Alias<strip_debug>,
  45. HelpText<"Alias for --strip-debug">;
  46. def strip_unneeded : Flag<["--"], "strip-unneeded">,
  47. HelpText<"Remove all symbols not needed by relocations">;
  48. defm remove_section : Eq<"remove-section", "Remove <section>">,
  49. MetaVarName<"section">;
  50. def R : JoinedOrSeparate<["-"], "R">,
  51. Alias<remove_section>,
  52. HelpText<"Alias for --remove-section">;
  53. def strip_sections
  54. : Flag<["--"], "strip-sections">,
  55. HelpText<"Remove all section headers and all sections not in segments">;
  56. defm strip_symbol : Eq<"strip-symbol", "Strip <symbol>">,
  57. MetaVarName<"symbol">;
  58. def N : JoinedOrSeparate<["-"], "N">,
  59. Alias<strip_symbol>,
  60. HelpText<"Alias for --strip-symbol">;
  61. defm keep_section : Eq<"keep-section", "Keep <section>">,
  62. MetaVarName<"section">;
  63. defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
  64. MetaVarName<"symbol">;
  65. def K : JoinedOrSeparate<["-"], "K">,
  66. Alias<keep_symbol>,
  67. HelpText<"Alias for --keep-symbol">;
  68. def keep_file_symbols : Flag<["--"], "keep-file-symbols">,
  69. HelpText<"Do not remove file symbols">;
  70. def only_keep_debug
  71. : Flag<["--"], "only-keep-debug">,
  72. HelpText<
  73. "Produce a debug file as the output that only preserves contents of "
  74. "sections useful for debugging purposes">;
  75. def discard_locals : Flag<["--"], "discard-locals">,
  76. HelpText<"Remove compiler-generated local symbols, (e.g. "
  77. "symbols starting with .L)">;
  78. def X : Flag<["-"], "X">,
  79. Alias<discard_locals>,
  80. HelpText<"Alias for --discard-locals">;
  81. def discard_all
  82. : Flag<["--"], "discard-all">,
  83. HelpText<"Remove all local symbols except file and section symbols">;
  84. def x : Flag<["-"], "x">,
  85. Alias<discard_all>,
  86. HelpText<"Alias for --discard-all">;
  87. def regex
  88. : Flag<["--"], "regex">,
  89. HelpText<"Permit regular expressions in name comparison">;
  90. def version : Flag<["--"], "version">,
  91. HelpText<"Print the version and exit.">;
  92. def V : Flag<["-"], "V">,
  93. Alias<version>,
  94. HelpText<"Alias for --version">;
  95. def wildcard
  96. : Flag<["--"], "wildcard">,
  97. HelpText<"Allow wildcard syntax for symbol-related flags. Incompatible "
  98. "with --regex. Allows using '*' to match any number of "
  99. "characters, '?' to match any single character, '\' to escape "
  100. "special characters, and '[]' to define character classes. "
  101. "Wildcards beginning with '!' will prevent a match, for example "
  102. "\"-N '*' -N '!x'\" will strip all symbols except for \"x\".">;
  103. def w : Flag<["-"], "w">, Alias<wildcard>, HelpText<"Alias for --wildcard">;