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