]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-objcopy/ObjcopyOpts.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-objcopy / ObjcopyOpts.td
1 include "llvm/Option/OptParser.td"
2
3 multiclass 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
10 def help : Flag<["-", "--"], "help">;
11
12 defm binary_architecture
13     : Eq<"binary-architecture", "Used when transforming an architecture-less "
14                                 "format (such as binary) to another format">;
15 def B : JoinedOrSeparate<["-"], "B">, Alias<binary_architecture>;
16
17 defm target : Eq<"target", "Format of the input and output file">,
18               Values<"binary">;
19 def F : JoinedOrSeparate<["-"], "F">, Alias<target>;
20
21 defm input_target : Eq<"input-target", "Format of the input file">,
22                     Values<"binary">;
23 def I : JoinedOrSeparate<["-"], "I">, Alias<input_target>;
24
25 defm output_target : Eq<"output-target", "Format of the output file">,
26                      Values<"binary">;
27 def O : JoinedOrSeparate<["-"], "O">, Alias<output_target>;
28
29 def compress_debug_sections : Flag<["--", "-"], "compress-debug-sections">;
30 def compress_debug_sections_eq
31     : Joined<["--", "-"], "compress-debug-sections=">,
32       MetaVarName<"[ zlib | zlib-gnu ]">,
33       HelpText<"Compress DWARF debug sections using specified style. Supported "
34                "styles: 'zlib-gnu' and 'zlib'">;
35 def decompress_debug_sections : Flag<["-", "--"], "decompress-debug-sections">,
36                                 HelpText<"Decompress DWARF debug sections.">;
37 defm split_dwo
38     : Eq<"split-dwo", "Equivalent to extract-dwo on the input file to "
39                       "<dwo-file>, then strip-dwo on the input file">,
40       MetaVarName<"dwo-file">;
41
42 def enable_deterministic_archives
43     : Flag<["-", "--"], "enable-deterministic-archives">,
44       HelpText<"Enable deterministic mode when copying archives (use zero for "
45                "UIDs, GIDs, and timestamps).">;
46 def D : Flag<["-"], "D">,
47         Alias<enable_deterministic_archives>,
48         HelpText<"Alias for --enable-deterministic-archives">;
49
50 def disable_deterministic_archives
51     : Flag<["-", "--"], "disable-deterministic-archives">,
52       HelpText<"Disable deterministic mode when copying archives (use real "
53                "values for UIDs, GIDs, and timestamps).">;
54 def U : Flag<["-"], "U">,
55         Alias<disable_deterministic_archives>,
56         HelpText<"Alias for --disable-deterministic-archives">;
57
58 def preserve_dates : Flag<["-", "--"], "preserve-dates">,
59                      HelpText<"Preserve access and modification timestamps">;
60 def p : Flag<["-"], "p">, Alias<preserve_dates>;
61
62 defm add_gnu_debuglink
63     : Eq<"add-gnu-debuglink", "Add a .gnu_debuglink for <debug-file>">,
64       MetaVarName<"debug-file">;
65
66 defm remove_section : Eq<"remove-section", "Remove <section>">,
67                       MetaVarName<"section">;
68 def R : JoinedOrSeparate<["-"], "R">, Alias<remove_section>;
69
70 defm rename_section
71     : Eq<"rename-section",
72          "Renames a section from old to new, optionally with specified flags. "
73          "Flags supported for GNU compatibility: alloc, load, noload, "
74          "readonly, debug, code, data, rom, share, contents, merge, strings.">,
75       MetaVarName<"old=new[,flag1,...]">;
76 defm redefine_symbol
77     : Eq<"redefine-sym", "Change the name of a symbol old to new">,
78       MetaVarName<"old=new">;
79 defm keep_section : Eq<"keep-section", "Keep <section>">,
80                     MetaVarName<"section">;
81 defm only_section : Eq<"only-section", "Remove all but <section>">,
82                     MetaVarName<"section">;
83 def j : JoinedOrSeparate<["-"], "j">, Alias<only_section>;
84 defm add_section
85     : Eq<"add-section",
86          "Make a section named <section> with the contents of <file>.">,
87       MetaVarName<"section=file">;
88
89 def strip_all
90     : Flag<["-", "--"], "strip-all">,
91       HelpText<
92           "Remove non-allocated sections other than .gnu.warning* sections">;
93 def S : Flag<["-"], "S">, Alias<strip_all>;
94 def strip_all_gnu : Flag<["-", "--"], "strip-all-gnu">,
95                     HelpText<"Compatible with GNU objcopy's --strip-all">;
96 def strip_debug : Flag<["-", "--"], "strip-debug">,
97                   HelpText<"Remove all debug information">;
98 def strip_dwo : Flag<["-", "--"], "strip-dwo">,
99                 HelpText<"Remove all DWARF .dwo sections from file">;
100 def strip_sections : Flag<["-", "--"], "strip-sections">,
101                      HelpText<"Remove all section headers">;
102 def strip_non_alloc : Flag<["-", "--"], "strip-non-alloc">,
103                       HelpText<"Remove all non-allocated sections">;
104 def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
105                      HelpText<"Remove all symbols not needed by relocations">;
106
107 def extract_dwo
108     : Flag<["-", "--"], "extract-dwo">,
109       HelpText<
110           "Remove all sections that are not DWARF .dwo sections from file">;
111
112 def localize_hidden
113     : Flag<["-", "--"], "localize-hidden">,
114       HelpText<
115           "Mark all symbols that have hidden or internal visibility as local">;
116 defm localize_symbol : Eq<"localize-symbol", "Mark <symbol> as local">,
117                        MetaVarName<"symbol">;
118 def L : JoinedOrSeparate<["-"], "L">, Alias<localize_symbol>;
119
120 defm globalize_symbol : Eq<"globalize-symbol", "Mark <symbol> as global">,
121                         MetaVarName<"symbol">;
122 defm keep_global_symbol
123     : Eq<"keep-global-symbol",
124          "Convert all symbols except <symbol> to local. May be repeated to "
125          "convert all except a set of symbols to local.">,
126       MetaVarName<"symbol">;
127 def G : JoinedOrSeparate<["-"], "G">, Alias<keep_global_symbol>;
128
129 defm keep_global_symbols
130     : Eq<"keep-global-symbols",
131          "Reads a list of symbols from <filename> and runs as if "
132          "--keep-global-symbol=<symbol> is set for each one. <filename> "
133          "contains one symbol per line and may contain comments beginning with "
134          "'#'. Leading and trailing whitespace is stripped from each line. May "
135          "be repeated to read symbols from many files.">,
136       MetaVarName<"filename">;
137
138 defm weaken_symbol : Eq<"weaken-symbol", "Mark <symbol> as weak">,
139                      MetaVarName<"symbol">;
140 def W : JoinedOrSeparate<["-"], "W">, Alias<weaken_symbol>;
141 def weaken : Flag<["-", "--"], "weaken">,
142              HelpText<"Mark all global symbols as weak">;
143 def discard_all
144     : Flag<["-", "--"], "discard-all">,
145       HelpText<"Remove all local symbols except file and section symbols">;
146 def x : Flag<["-"], "x">, Alias<discard_all>;
147 defm strip_symbol : Eq<"strip-symbol", "Remove symbol <symbol>">,
148                     MetaVarName<"symbol">;
149 def N : JoinedOrSeparate<["-"], "N">, Alias<strip_symbol>;
150 defm keep_symbol : Eq<"keep-symbol", "Do not remove symbol <symbol>">,
151                    MetaVarName<"symbol">;
152 def K : JoinedOrSeparate<["-"], "K">, Alias<keep_symbol>;
153 def only_keep_debug
154     : Flag<["-", "--"], "only-keep-debug">,
155       HelpText<"Currently ignored. Only for compatibility with GNU objcopy.">;
156 def keep_file_symbols : Flag<["-", "--"], "keep-file-symbols">,
157                         HelpText<"Do not remove file symbols">;
158 defm dump_section
159     : Eq<"dump-section",
160          "Dump contents of section named <section> into file <file>">,
161       MetaVarName<"section=file">;
162 defm prefix_symbols
163     : Eq<"prefix-symbols", "Add <prefix> to the start of every symbol name">,
164       MetaVarName<"prefix">;
165
166 def version : Flag<["-", "--"], "version">,
167               HelpText<"Print the version and exit.">;
168 def V : Flag<["-"], "V">, Alias<version>;
169 defm build_id_link_dir
170     : Eq<"build-id-link-dir", "Set directory for --build-id-link-input and "
171                               "--build-id-link-output to <dir>">,
172       MetaVarName<"dir">;
173 defm build_id_link_input
174     : Eq<"build-id-link-input", "Hard-link the input to <dir>/xx/xxx<suffix> "
175                                 "name derived from hex build ID">,
176       MetaVarName<"suffix">;
177 defm build_id_link_output
178     : Eq<"build-id-link-output", "Hard-link the output to <dir>/xx/xxx<suffix> "
179                                  "name derived from hex build ID">,
180       MetaVarName<"suffix">;