1 include "llvm/Option/OptParser.td"
3 class F<string name>: Flag<["--", "-"], name>;
4 class J<string name>: Joined<["--", "-"], name>;
5 class S<string name>: Separate<["--", "-"], name>;
7 multiclass Eq<string name, string help> {
8 def NAME: Separate<["--", "-"], name>;
9 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
13 multiclass EqLong<string name, string help> {
14 def NAME: Separate<["--"], name>;
15 def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
19 multiclass EqNoHelp<string name> {
20 def NAME: Separate<["--", "-"], name>;
21 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>;
24 multiclass B<string name, string help1, string help2> {
25 def NAME: Flag<["--", "-"], name>, HelpText<help1>;
26 def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
29 multiclass B_disable<string name, string help1, string help2> {
30 def NAME: Flag<["--", "-"], name>, HelpText<help1>;
31 def disable_ # NAME: Flag<["--", "-"], "disable-" # name>, HelpText<help2>;
34 multiclass B_enable_disable<string name, string help1, string help2> {
35 def enable_ # NAME: Flag<["--", "-"], "enable-" # name>, HelpText<help1>;
36 def disable_ # NAME: Flag<["--", "-"], "disable-" # name>, HelpText<help2>;
39 def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
40 HelpText<"Add a directory to the library search path">;
41 defm allow_multiple_definition: B<"allow-multiple-definition",
42 "Allow multiple definitions",
43 "Do not allow multiple definitions (default)">;
44 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
45 def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
46 defm demangle: B<"demangle",
47 "Demangle symbol names (default)",
48 "Do not demangle symbol names">;
49 def disable_auto_import: F<"disable-auto-import">,
50 HelpText<"Don't automatically import data symbols from other DLLs without dllimport">;
51 def disable_runtime_pseudo_reloc: F<"disable-runtime-pseudo-reloc">,
52 HelpText<"Don't do automatic imports that require runtime fixups">;
53 def disable_stdcall_fixup: F<"disable-stdcall-fixup">,
54 HelpText<"Don't resolve stdcall/fastcall/vectorcall to undecorated symbols">;
55 defm dynamicbase: B_disable<"dynamicbase", "Enable ASLR", "Disable ASLR">;
56 def enable_auto_import: F<"enable-auto-import">,
57 HelpText<"Automatically import data symbols from other DLLs where needed">;
58 def enable_runtime_pseudo_reloc: F<"enable-runtime-pseudo-reloc">,
59 HelpText<"Allow automatic imports that require runtime fixups">;
60 def enable_stdcall_fixup: F<"enable-stdcall-fixup">,
61 HelpText<"Resolve stdcall/fastcall/vectorcall to undecorated symbols without warnings">;
62 defm entry: Eq<"entry", "Name of entry point symbol">, MetaVarName<"<entry>">;
63 def exclude_all_symbols: F<"exclude-all-symbols">,
64 HelpText<"Don't automatically export any symbols">;
65 defm exclude_symbols: Eq<"exclude-symbols",
66 "Exclude symbols from automatic export">, MetaVarName<"<symbol[,symbol,...]>">;
67 def export_all_symbols: F<"export-all-symbols">,
68 HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
69 defm fatal_warnings: B<"fatal-warnings",
70 "Treat warnings as errors",
71 "Do not treat warnings as errors (default)">;
72 defm file_alignment: Eq<"file-alignment", "Set file alignment">;
73 defm gc_sections: B<"gc-sections",
74 "Remove unused sections",
75 "Don't remove unused sections">;
76 defm heap: Eq<"heap", "Set size of the initial heap">;
77 def help: F<"help">, HelpText<"Print option help">;
78 defm high_entropy_va: B_disable<"high-entropy-va",
79 "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">;
80 defm icf: Eq<"icf", "Identical code folding">;
81 defm image_base: Eq<"image-base", "Base address of the program">;
82 defm insert_timestamp: B<"insert-timestamp",
83 "Include PE header timestamp",
84 "Don't include PE header timestamp">;
85 def kill_at: F<"kill-at">, HelpText<"Remove @n from exported symbols">;
86 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
87 HelpText<"Root name of library to use">;
88 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
89 defm major_os_version: EqLong<"major-os-version",
90 "Set the OS and subsystem major version">;
91 defm major_subsystem_version: EqLong<"major-subsystem-version",
92 "Set the OS and subsystem major version">;
93 defm map: Eq<"Map", "Output a linker map">;
94 defm minor_os_version: EqLong<"minor-os-version",
95 "Set the OS and subsystem minor version">;
96 defm minor_subsystem_version: EqLong<"minor-subsystem-version",
97 "Set the OS and subsystem minor version">;
98 defm no_seh: B_disable<"no-seh",
99 "Set the 'no SEH' flag in the executable", "Don't set the 'no SEH' flag">;
100 defm nxcompat: B_disable<"nxcompat",
101 "Set the 'nxcompat' flag in the executable", "Don't set the 'nxcompat' flag">;
102 def large_address_aware: Flag<["--"], "large-address-aware">,
103 HelpText<"Enable large addresses">;
104 def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
105 HelpText<"Path to file to write output">;
106 defm out_implib: Eq<"out-implib", "Import library name">;
107 defm output_def: Eq<"output-def", "Output def file">;
108 defm reloc_section: B_enable_disable<"reloc-section",
109 "Enable base relocations", "Disable base relocations">;
110 defm section_alignment: Eq<"section-alignment", "Set section alignment">;
111 def shared: F<"shared">, HelpText<"Build a shared object">;
112 defm subs: Eq<"subsystem", "Specify subsystem">;
113 defm stack: Eq<"stack", "Set size of the initial stack">;
114 def strip_all: F<"strip-all">,
115 HelpText<"Omit all symbol information from the output binary">;
116 def strip_debug: F<"strip-debug">,
117 HelpText<"Omit all debug information, but keep symbol information">;
118 defm reproduce: Eq<"reproduce",
119 "Write a tar file containing input files and command line options to reproduce link">;
120 defm require_defined: Eq<"require-defined",
121 "Force symbol to be added to symbol table as an undefined one">;
122 defm tsaware: B_disable<"tsaware",
123 "Set the 'Terminal Server aware' flag", "Don't set the 'Terminal Server aware' flag">;
124 defm undefined: Eq<"undefined", "Include symbol in the link, if available">;
125 defm whole_archive: B<"whole-archive",
126 "Include all object files for following archives",
127 "No longer include all object files for following archives">;
128 def v: Flag<["-"], "v">, HelpText<"Display the version number">;
129 def verbose: F<"verbose">, HelpText<"Verbose mode">;
130 def version: F<"version">, HelpText<"Display the version number and exit">;
131 defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
132 MetaVarName<"<symbol>">;
134 // LLD specific options
135 def _HASH_HASH_HASH : Flag<["-"], "###">,
136 HelpText<"Print (but do not run) the commands to run for this compilation">;
137 def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">;
138 defm delayload: Eq<"delayload", "DLL to load only on demand">;
139 defm mllvm: EqNoHelp<"mllvm">;
140 defm pdb: Eq<"pdb", "Output PDB debug info file, chosen implicitly if the argument is empty">;
141 defm thinlto_cache_dir: EqLong<"thinlto-cache-dir",
142 "Path to ThinLTO cached object file directory">;
143 defm Xlink : Eq<"Xlink", "Pass <arg> to the COFF linker">, MetaVarName<"<arg>">;
146 def alias_Bdynamic_call_shared: Flag<["-"], "call_shared">, Alias<Bdynamic>;
147 def alias_Bdynamic_dy: Flag<["-"], "dy">, Alias<Bdynamic>;
148 def alias_Bstatic_dn: Flag<["-"], "dn">, Alias<Bstatic>;
149 def alias_Bstatic_non_shared: Flag<["-"], "non_shared">, Alias<Bstatic>;
150 def alias_Bstatic_static: Flag<["-"], "static">, Alias<Bstatic>;
151 def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>;
152 def alias_no_dynamicbase: F<"no-dynamicbase">, Alias<disable_dynamicbase>;
153 def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>;
154 def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>;
155 def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
158 def: Joined<["-"], "O">;
161 def: F<"disable-auto-image-base">;
162 def: F<"enable-auto-image-base">;
164 def: Flag<["--"], "full-shutdown">;
165 defm: EqNoHelp<"major-image-version">;
166 defm: EqNoHelp<"minor-image-version">;
167 def: F<"no-undefined">;
168 def: F<"pic-executable">;
169 defm: EqNoHelp<"plugin">;
170 defm: EqNoHelp<"plugin-opt">;
171 defm: EqNoHelp<"sysroot">;
172 def: F<"start-group">;