Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 1 | include "llvm/Option/OptParser.td" |
| 2 | |
| 3 | class F<string name>: Flag<["--", "-"], name>; |
| 4 | class J<string name>: Joined<["--", "-"], name>; |
| 5 | class S<string name>: Separate<["--", "-"], name>; |
| 6 | |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 7 | multiclass 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 | |
| 13 | multiclass 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 | |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 19 | def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">, |
| 20 | HelpText<"Add a directory to the library search path">; |
Martin Storsjo | d79a4b7 | 2019-01-29 19:24:32 | [diff] [blame] | 21 | def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">; |
| 22 | def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">; |
Martin Storsjo | 094d8c0 | 2017-11-15 08:18:11 | [diff] [blame] | 23 | def dynamicbase: F<"dynamicbase">, HelpText<"Enable ASLR">; |
Martin Storsjo | 0e5530a | 2019-08-14 09:35:44 | [diff] [blame] | 24 | defm entry: Eq<"entry", "Name of entry point symbol">, MetaVarName<"<entry>">; |
Martin Storsjo | 9705898 | 2019-02-19 21:57:49 | [diff] [blame] | 25 | def exclude_all_symbols: F<"exclude-all-symbols">, |
| 26 | HelpText<"Don't automatically export any symbols">; |
Martin Storsjo | a84a477 | 2017-10-12 05:37:18 | [diff] [blame] | 27 | def export_all_symbols: F<"export-all-symbols">, |
| 28 | HelpText<"Export all symbols even if a def file or dllexport attributes are used">; |
Martin Storsjo | b190fd2 | 2017-11-15 08:18:20 | [diff] [blame] | 29 | def gc_sections: F<"gc-sections">, HelpText<"Remove unused sections">; |
Martin Storsjo | 9ae0d22 | 2019-05-17 11:07:38 | [diff] [blame] | 30 | def help: F<"help">, HelpText<"Print option help">; |
Martin Storsjo | b190fd2 | 2017-11-15 08:18:20 | [diff] [blame] | 31 | def icf: J<"icf=">, HelpText<"Identical code folding">; |
Martin Storsjo | e916868 | 2017-11-15 08:18:15 | [diff] [blame] | 32 | def image_base: S<"image-base">, HelpText<"Base address of the program">; |
Martin Storsjo | dfb2fcd | 2019-02-06 21:05:29 | [diff] [blame] | 33 | def insert_timestamp: F<"insert-timestamp">, |
| 34 | HelpText<"Include PE header timestamp">; |
Martin Storsjo | fb36e6e | 2018-03-14 20:17:24 | [diff] [blame] | 35 | def kill_at: F<"kill-at">, HelpText<"Remove @n from exported symbols">; |
Rui Ueyama | c3e4602 | 2017-09-11 20:54:51 | [diff] [blame] | 36 | def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">, |
| 37 | HelpText<"Root name of library to use">; |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 38 | def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 39 | defm major_os_version: EqLong<"major-os-version", |
| 40 | "Set the OS and subsystem major version">; |
| 41 | defm major_subsystem_version: EqLong<"major-subsystem-version", |
| 42 | "Set the OS and subsystem major version">; |
| 43 | defm map: Eq<"Map", "Output a linker map">; |
| 44 | defm minor_os_version: EqLong<"minor-os-version", |
| 45 | "Set the OS and subsystem minor version">; |
| 46 | defm minor_subsystem_version: EqLong<"minor-subsystem-version", |
| 47 | "Set the OS and subsystem minor version">; |
Martin Storsjo | 537a718 | 2019-02-05 08:16:06 | [diff] [blame] | 48 | def no_insert_timestamp: F<"no-insert-timestamp">, |
| 49 | HelpText<"Don't include PE header timestamp">; |
Martin Storsjo | 32e1626 | 2017-09-13 07:28:09 | [diff] [blame] | 50 | def no_whole_archive: F<"no-whole-archive">, |
| 51 | HelpText<"No longer include all object files for following archives">; |
Martin Storsjo | 3c8d4b5 | 2017-11-15 08:18:06 | [diff] [blame] | 52 | def large_address_aware: Flag<["--"], "large-address-aware">, |
| 53 | HelpText<"Enable large addresses">; |
Martin Storsjo | b190fd2 | 2017-11-15 08:18:20 | [diff] [blame] | 54 | def no_gc_sections: F<"no-gc-sections">, HelpText<"Don't remove unused sections">; |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 55 | def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, |
| 56 | HelpText<"Path to file to write output">; |
Martin Storsjo | 0e5530a | 2019-08-14 09:35:44 | [diff] [blame] | 57 | defm out_implib: Eq<"out-implib", "Import library name">; |
| 58 | defm output_def: Eq<"output-def", "Output def file">; |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 59 | def shared: F<"shared">, HelpText<"Build a shared object">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 60 | defm subs: Eq<"subsystem", "Specify subsystem">; |
Rui Ueyama | 1f4cdcf | 2017-09-14 18:33:21 | [diff] [blame] | 61 | def stack: S<"stack">; |
Martin Storsjo | 068512d | 2017-11-03 22:10:37 | [diff] [blame] | 62 | def strip_all: F<"strip-all">, |
| 63 | HelpText<"Omit all symbol information from the output binary">; |
Martin Storsjo | c082674 | 2018-06-29 06:08:31 | [diff] [blame] | 64 | def strip_debug: F<"strip-debug">, |
| 65 | HelpText<"Omit all debug information, but keep symbol information">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 66 | defm undefined: Eq<"undefined", "Include symbol in the link, if available">; |
Martin Storsjo | 32e1626 | 2017-09-13 07:28:09 | [diff] [blame] | 67 | def whole_archive: F<"whole-archive">, |
| 68 | HelpText<"Include all object files for following archives">; |
Martin Storsjo | 6863dfa | 2019-05-17 11:07:42 | [diff] [blame] | 69 | def v: Flag<["-"], "v">, HelpText<"Display the version number">; |
Martin Storsjo | a79762a | 2017-09-11 20:43:39 | [diff] [blame] | 70 | def verbose: F<"verbose">, HelpText<"Verbose mode">; |
Martin Storsjo | 6863dfa | 2019-05-17 11:07:42 | [diff] [blame] | 71 | def version: F<"version">, HelpText<"Display the version number and exit">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 72 | defm require_defined: Eq<"require-defined", |
| 73 | "Force symbol to be added to symbol table as an undefined one">; |
Martin Storsjo | a79762a | 2017-09-11 20:43:39 | [diff] [blame] | 74 | |
| 75 | // LLD specific options |
| 76 | def _HASH_HASH_HASH : Flag<["-"], "###">, |
| 77 | HelpText<"Print (but do not run) the commands to run for this compilation">; |
Martin Storsjo | 2c1f3ea | 2019-04-19 13:50:43 | [diff] [blame] | 78 | def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the executable">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 79 | defm delayload: Eq<"delayload", "DLL to load only on demand">; |
Martin Storsjo | 107b548 | 2017-11-03 07:18:37 | [diff] [blame] | 80 | def mllvm: S<"mllvm">; |
Martin Storsjo | ce26ad7 | 2019-08-14 09:35:40 | [diff] [blame] | 81 | defm pdb: Eq<"pdb", "Output PDB debug info file, chosen implicitly if the argument is empty">; |
Martin Storsjo | 107b548 | 2017-11-03 07:18:37 | [diff] [blame] | 82 | def Xlink : J<"Xlink=">, MetaVarName<"<arg>">, |
| 83 | HelpText<"Pass <arg> to the COFF linker">; |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 84 | |
Martell Malone | 894dbbe | 2017-09-11 17:02:59 | [diff] [blame] | 85 | // Alias |
| 86 | def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>; |
Martin Storsjo | 068512d | 2017-11-03 22:10:37 | [diff] [blame] | 87 | def alias_strip_s: Flag<["-"], "s">, Alias<strip_all>; |
Martin Storsjo | c082674 | 2018-06-29 06:08:31 | [diff] [blame] | 88 | def alias_strip_S: Flag<["-"], "S">, Alias<strip_debug>; |
Martin Storsjo | 0e5530a | 2019-08-14 09:35:44 | [diff] [blame] | 89 | def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; |
Martin Storsjo | 5d1862b | 2019-01-29 08:38:48 | [diff] [blame] | 90 | |
| 91 | // Ignored options |
Martin Storsjo | d79a4b7 | 2019-01-29 19:24:32 | [diff] [blame] | 92 | def: Joined<["-"], "O">; |
| 93 | def: F<"build-id">; |
| 94 | def: F<"disable-auto-image-base">; |
| 95 | def: F<"enable-auto-image-base">; |
Martin Storsjo | 6ff6a8f | 2019-05-17 11:07:46 | [diff] [blame] | 96 | def: F<"enable-auto-import">, HelpText<"Ignored; listed for libtool compatibility">; |
Martin Storsjo | d79a4b7 | 2019-01-29 19:24:32 | [diff] [blame] | 97 | def: F<"end-group">; |
| 98 | def: Flag<["--"], "full-shutdown">; |
| 99 | def: F<"high-entropy-va">; |
| 100 | def: S<"major-image-version">; |
| 101 | def: S<"minor-image-version">; |
| 102 | def: F<"no-seh">; |
| 103 | def: F<"nxcompat">; |
| 104 | def: F<"pic-executable">; |
Martin Storsjo | 5d1862b | 2019-01-29 08:38:48 | [diff] [blame] | 105 | def: S<"plugin">; |
| 106 | def: J<"plugin=">; |
| 107 | def: S<"plugin-opt">; |
| 108 | def: J<"plugin-opt=">; |
Martin Storsjo | d79a4b7 | 2019-01-29 19:24:32 | [diff] [blame] | 109 | def: J<"sysroot">; |
| 110 | def: F<"start-group">; |
| 111 | def: F<"tsaware">; |