blob: 3a3c82c4573a83f664e70fd3ea90fa1e3b874d6e [file] [log] [blame]
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +00001include "llvm/Option/OptParser.td"
2
3multiclass Eq<string name> {
4 def NAME: Separate<["--", "-"], name>;
5 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
6}
7
8def help : Flag<["-", "--"], "help">;
9defm binary_architecture : Eq<"binary-architecture">,
10 HelpText<"Used when transforming an architecture-less format (such as binary) to another format">;
11def B : JoinedOrSeparate<["-"], "B">,
12 Alias<binary_architecture>;
13defm input_target : Eq<"input-target">,
14 HelpText<"Format of the input file">,
15 Values<"binary">;
Jordan Rupprecht175ef5f2018-08-01 20:59:39 +000016def I : JoinedOrSeparate<[ "-" ], "I">, Alias<input_target>;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000017defm output_target : Eq<"output-target">,
18 HelpText<"Format of the output file">,
19 Values<"binary">;
Puyan Lotfi99124cc2018-09-07 08:10:22 +000020def compress_debug_sections : Flag<["--", "-"], "compress-debug-sections">;
21def compress_debug_sections_eq : Joined<["--", "-"], "compress-debug-sections=">,
22 MetaVarName<"[ zlib | zlib-gnu ]">,
23 HelpText<"Compress DWARF debug sections using "
24 "specified style. Supported styles: "
25 "'zlib-gnu' and 'zlib'">;
Puyan Lotfiaf048642018-10-01 10:29:41 +000026def decompress_debug_sections : Flag<["-", "--"], "decompress-debug-sections">,
27 HelpText<"Decompress DWARF debug sections.">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000028def O : JoinedOrSeparate<["-"], "O">,
29 Alias<output_target>;
30defm split_dwo : Eq<"split-dwo">,
31 MetaVarName<"dwo-file">,
32 HelpText<"Equivalent to extract-dwo on the input file to <dwo-file>, then strip-dwo on the input file">;
Jordan Rupprechtd1767dc2018-08-16 18:29:40 +000033
34def preserve_dates : Flag<[ "-", "--" ], "preserve-dates">,
35 HelpText<"Preserve access and modification timestamps">;
36
37def p : Flag<[ "-" ], "p">, Alias<preserve_dates>;
38
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000039defm add_gnu_debuglink : Eq<"add-gnu-debuglink">,
40 MetaVarName<"debug-file">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000041 HelpText<"Add a .gnu_debuglink for <debug-file>">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000042defm remove_section : Eq<"remove-section">,
43 MetaVarName<"section">,
44 HelpText<"Remove <section>">;
Jordan Rupprechtd67c1e12018-08-01 16:23:22 +000045defm rename_section
46 : Eq<"rename-section">,
47 MetaVarName<"old=new[,flag1,...]">,
48 HelpText<
49 "Renames a section from old to new, optionally with specified flags. "
50 "Flags supported for GNU compatibility: alloc, load, noload, "
51 "readonly, debug, code, data, rom, share, contents, merge, strings.">;
Alexander Shaposhnikov40e9bdf2018-04-26 18:28:17 +000052defm redefine_symbol : Eq<"redefine-sym">,
53 MetaVarName<"old=new">,
54 HelpText<"Change the name of a symbol old to new">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000055def R : JoinedOrSeparate<["-"], "R">,
56 Alias<remove_section>;
57defm keep : Eq<"keep">,
58 MetaVarName<"section">,
59 HelpText<"Keep <section>">;
60defm only_keep : Eq<"only-keep">,
61 MetaVarName<"section">,
62 HelpText<"Remove all but <section>">;
63def j : JoinedOrSeparate<["-"], "j">,
64 Alias<only_keep>;
65defm add_section : Eq<"add-section">,
66 MetaVarName<"section=file">,
67 HelpText<"Make a section named <section> with the contents of <file>.">;
68def strip_all : Flag<["-", "--"], "strip-all">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000069 HelpText<"Remove non-allocated sections other than .gnu.warning* sections">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000070def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
71 HelpText<"Compaitable with GNU objcopy's --strip-all">;
Alexander Shaposhnikov1de445c2018-09-17 09:45:12 +000072def S : Flag<["-"], "S">,
73 Alias<strip_all_gnu>;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000074def strip_debug : Flag<["-", "--"], "strip-debug">,
Alexander Shaposhnikovb3bfd3b2018-04-24 21:44:13 +000075 HelpText<"Remove all debug information">;
Alexander Shaposhnikovd6884792018-04-24 05:43:32 +000076def strip_dwo : Flag<["-", "--"], "strip-dwo">,
77 HelpText<"Remove all DWARF .dwo sections from file">;
78def strip_sections : Flag<["-", "--"], "strip-sections">,
79 HelpText<"Remove all section headers">;
80def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
81 HelpText<"Remove all non-allocated sections">;
82def extract_dwo : Flag<["-", "--"], "extract-dwo">,
83 HelpText<"Remove all sections that are not DWARF .dwo sections from file">;
84def localize_hidden : Flag<["-", "--"], "localize-hidden">,
85 HelpText<"Mark all symbols that have hidden or internal visibility as local">;
Paul Semelb4924942018-04-26 17:44:43 +000086defm localize_symbol : Eq<"localize-symbol">,
Alexander Shaposhnikov40e9bdf2018-04-26 18:28:17 +000087 MetaVarName<"symbol">,
88 HelpText<"Mark <symbol> as local">;
Paul Semelb4924942018-04-26 17:44:43 +000089def L : JoinedOrSeparate<["-"], "L">,
90 Alias<localize_symbol>;
Paul Semelee5be792018-04-27 19:09:44 +000091defm globalize_symbol : Eq<"globalize-symbol">,
92 MetaVarName<"symbol">,
93 HelpText<"Mark <symbol> as global">;
Jordan Rupprechtbe8ebcc2018-08-17 22:34:48 +000094
95defm keep_global_symbol
96 : Eq<"keep-global-symbol">,
97 MetaVarName<"symbol">,
98 HelpText<"Convert all symbols except <symbol> to local. May be repeated "
99 "to convert all except a set of symbols to local.">;
100def G : JoinedOrSeparate<[ "-" ], "G">, Alias<keep_global_symbol>;
101
102defm keep_global_symbols
103 : Eq<"keep-global-symbols">,
104 MetaVarName<"filename">,
105 HelpText<
106 "Reads a list of symbols from <filename> and runs as if "
107 "--keep-global-symbol=<symbol> is set for each one. <filename> "
108 "contains one symbol per line and may contain comments beginning "
109 "with '#'. Leading and trailing whitespace is stripped from each "
110 "line. May be repeated to read symbols from many files.">;
111
Jordan Rupprecht7b1c8162018-09-21 00:47:31 +0000112def version : Flag<[ "-", "--" ], "version">,
113 HelpText<"Print the version and exit.">;
114
Paul Semel3a8a56b2018-04-27 19:16:27 +0000115defm weaken_symbol : Eq<"weaken-symbol">,
116 MetaVarName<"symbol">,
117 HelpText<"Mark <symbol> as weak">;
118def W : JoinedOrSeparate<["-"], "W">,
119 Alias<weaken_symbol>;
Paul Semel2c0510f2018-05-02 20:14:49 +0000120def weaken : Flag<["-", "--"], "weaken">,
121 HelpText<"Mark all global symbols as weak">;
Paul Semel41695f82018-05-02 20:19:22 +0000122def discard_all : Flag<["-", "--"], "discard-all">,
123 HelpText<"Remove all local symbols except file and section symbols">;
124def x : Flag<["-"], "x">,
125 Alias<discard_all>;
Paul Semel4246a462018-05-09 21:36:54 +0000126defm strip_symbol : Eq<"strip-symbol">,
127 MetaVarName<"symbol">,
128 HelpText<"Remove symbol <symbol>">;
129def N : JoinedOrSeparate<["-"], "N">,
130 Alias<strip_symbol>;
Paul Semel5d97c822018-05-15 14:09:37 +0000131defm keep_symbol : Eq<"keep-symbol">,
132 MetaVarName<"symbol">,
133 HelpText<"Do not remove symbol <symbol>">;
134def K : JoinedOrSeparate<["-"], "K">,
135 Alias<keep_symbol>;
Jake Ehrliche40398a2018-05-15 20:53:53 +0000136def only_keep_debug : Flag<["-", "--"], "only-keep-debug">,
137 HelpText<"Currently ignored. Only for compaitability with GNU objcopy.">;
Paul Semel99dda0b2018-05-25 11:01:25 +0000138def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
139 HelpText<"Remove all symbols not needed by relocations">;
Paul Semelcf51c802018-05-26 08:10:37 +0000140def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
141 HelpText<"Do not remove file symbols">;
Paul Semela42dec72018-08-09 17:05:21 +0000142defm dump_section : Eq<"dump-section">,
143 MetaVarName<"section=file">,
144 HelpText<"Dump contents of section named <section> into file <file>">;
Paul Semel7a3dc2c2018-08-09 17:49:04 +0000145defm prefix_symbols : Eq<"prefix-symbols">,
146 MetaVarName<"prefix">,
147 HelpText<"Add <prefix> to the start of every symbol name">;