Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 1 | include "llvm/Option/OptParser.td" |
| 2 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 3 | // Convenience classes for long options which only accept two dashes. For lld |
| 4 | // specific or newer long options, we prefer two dashes to avoid collision with |
| 5 | // short options. For many others, we have to accept both forms to be compatible |
| 6 | // with GNU ld. |
| 7 | class FF<string name> : Flag<["--"], name>; |
| 8 | class JJ<string name>: Joined<["--"], name>; |
| 9 | |
| 10 | multiclass EEq<string name, string help> { |
| 11 | def NAME: Separate<["--"], name>; |
| 12 | def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>, |
| 13 | HelpText<help>; |
| 14 | } |
| 15 | |
| 16 | multiclass BB<string name, string help1, string help2> { |
| 17 | def NAME: Flag<["--"], name>, HelpText<help1>; |
| 18 | def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>; |
| 19 | } |
| 20 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 21 | // For options whose names are multiple letters, either one dash or |
| 22 | // two can precede the option name except those that start with 'o'. |
| 23 | class F<string name>: Flag<["--", "-"], name>; |
| 24 | class J<string name>: Joined<["--", "-"], name>; |
| 25 | class S<string name>: Separate<["--", "-"], name>; |
| 26 | |
Sam Clegg | ad980a7 | 2018-10-22 08:34:37 | [diff] [blame] | 27 | multiclass Eq<string name, string help> { |
| 28 | def NAME: Separate<["--", "-"], name>; |
| 29 | def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>, |
| 30 | HelpText<help>; |
Sam Clegg | 31de2f0 | 2017-12-07 03:19:53 | [diff] [blame] | 31 | } |
| 32 | |
Nicholas Wilson | 08cff61 | 2018-03-13 13:12:03 | [diff] [blame] | 33 | multiclass B<string name, string help1, string help2> { |
| 34 | def NAME: Flag<["--", "-"], name>, HelpText<help1>; |
| 35 | def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>; |
| 36 | } |
| 37 | |
Sam Clegg | bfb7534 | 2018-11-15 00:37:21 | [diff] [blame] | 38 | // The following flags are shared with the ELF linker |
Sam Clegg | 2513407 | 2020-10-07 21:48:37 | [diff] [blame] | 39 | def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; |
| 40 | |
YAMAMOTO Takashi | 2b6c6bb | 2024-06-11 23:45:53 | [diff] [blame] | 41 | def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">; |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 42 | |
YAMAMOTO Takashi | 2b6c6bb | 2024-06-11 23:45:53 | [diff] [blame] | 43 | def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries (default)">; |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 44 | |
mzukovec | 0367305 | 2024-09-04 15:50:10 | [diff] [blame] | 45 | defm allow_multiple_definition: B<"allow-multiple-definition", |
| 46 | "Allow multiple definitions", |
| 47 | "Do not allow multiple definitions (default)">; |
| 48 | |
Derek Schuff | c7af9ae | 2023-03-02 23:52:25 | [diff] [blame] | 49 | def build_id: F<"build-id">, HelpText<"Alias for --build-id=fast">; |
| 50 | |
| 51 | def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">, |
| 52 | MetaVarName<"[fast,sha1,uuid,0x<hexstring>]">; |
| 53 | |
Nico Weber | baa2aa2 | 2020-11-17 17:15:42 | [diff] [blame] | 54 | defm color_diagnostics: B<"color-diagnostics", |
| 55 | "Alias for --color-diagnostics=always", |
| 56 | "Alias for --color-diagnostics=never">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 57 | def color_diagnostics_eq: J<"color-diagnostics=">, |
Nico Weber | baa2aa2 | 2020-11-17 17:15:42 | [diff] [blame] | 58 | HelpText<"Use colors in diagnostics (default: auto)">, |
| 59 | MetaVarName<"[auto,always,never]">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 60 | |
Sam Clegg | 30161dc | 2018-08-17 19:42:46 | [diff] [blame] | 61 | def compress_relocations: F<"compress-relocations">, |
| 62 | HelpText<"Compress the relocation targets in the code section.">; |
| 63 | |
Nicholas Wilson | 08cff61 | 2018-03-13 13:12:03 | [diff] [blame] | 64 | defm demangle: B<"demangle", |
Sam Clegg | 888b130 | 2024-07-18 01:26:59 | [diff] [blame] | 65 | "Demangle symbol names (default)", |
Nicholas Wilson | 08cff61 | 2018-03-13 13:12:03 | [diff] [blame] | 66 | "Do not demangle symbol names">; |
| 67 | |
Sam Clegg | 35be7ff | 2019-05-24 13:28:27 | [diff] [blame] | 68 | def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; |
| 69 | |
Sam Clegg | 206884b | 2020-05-01 16:14:59 | [diff] [blame] | 70 | def error_unresolved_symbols: F<"error-unresolved-symbols">, |
| 71 | HelpText<"Report unresolved symbols as errors">; |
| 72 | |
Sam Clegg | 305b034 | 2018-09-27 21:06:25 | [diff] [blame] | 73 | defm export_dynamic: B<"export-dynamic", |
| 74 | "Put symbols in the dynamic symbol table", |
| 75 | "Do not put symbols in the dynamic symbol table (default)">; |
Sam Clegg | 4e62418 | 2018-09-25 21:50:15 | [diff] [blame] | 76 | |
Sam Clegg | 1926139 | 2024-01-22 18:04:26 | [diff] [blame] | 77 | def end_lib: F<"end-lib">, |
| 78 | HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; |
| 79 | |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 80 | def entry: S<"entry">, MetaVarName<"<entry>">, |
| 81 | HelpText<"Name of entry point symbol">; |
| 82 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 83 | defm error_limit: |
| 84 | EEq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 85 | |
Sam Clegg | 888b130 | 2024-07-18 01:26:59 | [diff] [blame] | 86 | defm fatal_warnings: B<"fatal-warnings", |
| 87 | "Treat warnings as errors", |
| 88 | "Do not treat warnings as errors (default)">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 89 | |
Nicholas Wilson | 88d9ffc | 2018-03-13 13:16:15 | [diff] [blame] | 90 | defm gc_sections: B<"gc-sections", |
Sam Clegg | 888b130 | 2024-07-18 01:26:59 | [diff] [blame] | 91 | "Enable garbage collection of unused sections (defualt)", |
Nicholas Wilson | 88d9ffc | 2018-03-13 13:16:15 | [diff] [blame] | 92 | "Disable garbage collection of unused sections">; |
Sam Clegg | 0362633 | 2018-01-31 01:45:47 | [diff] [blame] | 93 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 94 | defm merge_data_segments: BB<"merge-data-segments", |
Sam Clegg | 888b130 | 2024-07-18 01:26:59 | [diff] [blame] | 95 | "Enable merging data segments (default)", |
Sam Clegg | 6684476 | 2018-05-10 18:23:51 | [diff] [blame] | 96 | "Disable merging data segments">; |
| 97 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 98 | def help: F<"help">, HelpText<"Print option help">; |
| 99 | |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 100 | def library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">, |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 101 | HelpText<"Root name of library to use">; |
| 102 | |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 103 | def library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">, |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 104 | HelpText<"Add a directory to the library search path">; |
| 105 | |
Wouter van Oortmerssen | b9a539c | 2020-06-15 22:31:10 | [diff] [blame] | 106 | def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; |
| 107 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 108 | defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 109 | |
Sam Clegg | cc2da55 | 2020-03-27 23:52:27 | [diff] [blame] | 110 | defm Map: Eq<"Map", "Print a link map to the specified file">; |
| 111 | |
mzukovec | 0367305 | 2024-09-04 15:50:10 | [diff] [blame] | 112 | def noinhibit_exec: F<"noinhibit-exec">, |
| 113 | HelpText<"Retain the executable output file whenever it is still usable">; |
| 114 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 115 | def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, |
| 116 | HelpText<"Path to file to write output">; |
| 117 | |
Sam Clegg | fb983cd | 2018-05-18 23:28:05 | [diff] [blame] | 118 | def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">; |
| 119 | |
Sam Clegg | bfb7534 | 2018-11-15 00:37:21 | [diff] [blame] | 120 | defm pie: B<"pie", |
| 121 | "Create a position independent executable", |
| 122 | "Do not create a position independent executable (default)">; |
| 123 | |
Nicholas Wilson | 88d9ffc | 2018-03-13 13:16:15 | [diff] [blame] | 124 | defm print_gc_sections: B<"print-gc-sections", |
| 125 | "List removed unused sections", |
Sam Clegg | 888b130 | 2024-07-18 01:26:59 | [diff] [blame] | 126 | "Do not list removed unused sections (default)">; |
Sam Clegg | 0362633 | 2018-01-31 01:45:47 | [diff] [blame] | 127 | |
Sam Clegg | cc2da55 | 2020-03-27 23:52:27 | [diff] [blame] | 128 | def print_map: F<"print-map">, |
| 129 | HelpText<"Print a link map to the standard output">; |
| 130 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 131 | def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; |
| 132 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 133 | defm reproduce: EEq<"reproduce", "Dump linker invocation and input files for debugging">; |
Rui Ueyama | 35150bb | 2019-05-21 11:52:14 | [diff] [blame] | 134 | |
Hood Chatham | 80ea31c | 2025-02-28 19:12:52 | [diff] [blame] | 135 | defm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">; |
| 136 | |
Sam Clegg | 928e9e1 | 2020-03-04 19:29:45 | [diff] [blame] | 137 | defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">, |
| 138 | MetaVarName<"[posix,windows]">; |
| 139 | |
Sam Clegg | bfb7534 | 2018-11-15 00:37:21 | [diff] [blame] | 140 | def shared: F<"shared">, HelpText<"Build a shared object">; |
| 141 | |
Sam Clegg | 1926139 | 2024-01-22 18:04:26 | [diff] [blame] | 142 | def start_lib: F<"start-lib">, |
| 143 | HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; |
| 144 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 145 | def strip_all: F<"strip-all">, HelpText<"Strip all symbols">; |
| 146 | |
| 147 | def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">; |
| 148 | |
Fangrui Song | eb4663d | 2020-03-17 19:40:19 | [diff] [blame] | 149 | defm threads |
| 150 | : Eq<"threads", "Number of threads. '1' disables multi-threading. By " |
| 151 | "default all available hardware threads are used">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 152 | |
Sam Clegg | 1f3f774 | 2019-02-06 02:35:18 | [diff] [blame] | 153 | def trace: F<"trace">, HelpText<"Print the names of the input files">; |
| 154 | |
| 155 | defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">; |
| 156 | |
Sam Clegg | ad980a7 | 2018-10-22 08:34:37 | [diff] [blame] | 157 | defm undefined: Eq<"undefined", "Force undefined symbol during linking">; |
Sam Clegg | 31de2f0 | 2017-12-07 03:19:53 | [diff] [blame] | 158 | |
Sam Clegg | 206884b | 2020-05-01 16:14:59 | [diff] [blame] | 159 | defm unresolved_symbols: |
| 160 | Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">; |
| 161 | |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 162 | def v: Flag<["-"], "v">, HelpText<"Display the version number">; |
| 163 | |
| 164 | def verbose: F<"verbose">, HelpText<"Verbose mode">; |
| 165 | |
| 166 | def version: F<"version">, HelpText<"Display the version number and exit">; |
| 167 | |
Sam Clegg | 206884b | 2020-05-01 16:14:59 | [diff] [blame] | 168 | def warn_unresolved_symbols: F<"warn-unresolved-symbols">, |
| 169 | HelpText<"Report unresolved symbols as warnings">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 170 | |
Sam Clegg | a5ca34e | 2019-05-24 14:14:25 | [diff] [blame] | 171 | defm wrap: Eq<"wrap", "Use wrapper functions for symbol">, |
| 172 | MetaVarName<"<symbol>=<symbol>">; |
| 173 | |
Sam Clegg | 206884b | 2020-05-01 16:14:59 | [diff] [blame] | 174 | def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">, |
| 175 | HelpText<"Linker option extensions">; |
| 176 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 177 | // The follow flags are unique to wasm |
| 178 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 179 | def allow_undefined: F<"allow-undefined">, |
Nico Weber | 9f90347 | 2021-10-27 13:52:17 | [diff] [blame] | 180 | HelpText<"Allow undefined symbols in linked binary. " |
| 181 | "This options is equivalent to --import-undefined " |
| 182 | "and --unresolved-symbols=ignore-all">; |
Sam Clegg | 758633f | 2021-05-27 21:27:10 | [diff] [blame] | 183 | |
| 184 | def import_undefined: F<"import-undefined">, |
| 185 | HelpText<"Turn undefined symbols into imports where possible">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 186 | |
| 187 | def allow_undefined_file: J<"allow-undefined-file=">, |
| 188 | HelpText<"Allow symbols listed in <file> to be undefined in linked binary">; |
| 189 | |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 190 | def allow_undefined_file_s: Separate<["-"], "allow-undefined-file">, |
| 191 | Alias<allow_undefined_file>; |
| 192 | |
Sam Clegg | ad980a7 | 2018-10-22 08:34:37 | [diff] [blame] | 193 | defm export: Eq<"export", "Force a symbol to be exported">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 194 | |
Sam Clegg | a6f4064 | 2021-04-05 15:00:30 | [diff] [blame] | 195 | defm export_if_defined: Eq<"export-if-defined", |
| 196 | "Force a symbol to be exported, if it is defined in the input">; |
| 197 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 198 | def export_all: FF<"export-all">, |
Sam Clegg | 177b458 | 2018-06-07 01:27:07 | [diff] [blame] | 199 | HelpText<"Export all symbols (normally combined with --no-gc-sections)">; |
| 200 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 201 | def export_table: FF<"export-table">, |
Nicholas Wilson | 874eedd | 2018-03-27 17:38:51 | [diff] [blame] | 202 | HelpText<"Export function table to the environment">; |
| 203 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 204 | def growable_table: FF<"growable-table">, |
Jacob Gravelle | 92ed86d | 2019-08-27 22:58:21 | [diff] [blame] | 205 | HelpText<"Remove maximum size from function table, allowing table to grow">; |
| 206 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 207 | def global_base: JJ<"global-base=">, |
Sam Clegg | 93adcb7 | 2023-08-25 20:56:16 | [diff] [blame] | 208 | HelpText<"Memory offset at which to place global data (Defaults to 1024)">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 209 | |
Sam Clegg | 89d5635 | 2023-05-04 23:04:04 | [diff] [blame] | 210 | defm keep_section: Eq<"keep-section", |
| 211 | "Preserve a section even when --strip-all is given. This is useful for compiler drivers such as clang or emcc that, for example, depend on the features section for post-link processing. Can be specified multiple times to keep multiple sections">; |
| 212 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 213 | def import_memory: FF<"import-memory">, |
Dan Gohman | d4c8a0e | 2022-10-04 19:50:10 | [diff] [blame] | 214 | HelpText<"Import the module's memory from the default module of \"env\" with the name \"memory\".">; |
| 215 | def import_memory_with_name: JJ<"import-memory=">, |
| 216 | HelpText<"Import the module's memory from the passed module with the passed name.">, |
| 217 | MetaVarName<"<module>,<name>">; |
| 218 | |
| 219 | def export_memory: FF<"export-memory">, |
| 220 | HelpText<"Export the module's memory with the default name of \"memory\"">; |
| 221 | def export_memory_with_name: JJ<"export-memory=">, |
| 222 | HelpText<"Export the module's memory with the passed name">; |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 223 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 224 | def shared_memory: FF<"shared-memory">, |
Derek Schuff | 3bea8bc | 2018-11-06 17:59:32 | [diff] [blame] | 225 | HelpText<"Use shared linear memory">; |
| 226 | |
Sam Clegg | 8e44f03 | 2023-05-27 01:17:45 | [diff] [blame] | 227 | defm soname: Eq<"soname", "Set the module name in the generated name section">; |
| 228 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 229 | def import_table: FF<"import-table">, |
Nicholas Wilson | 874eedd | 2018-03-27 17:38:51 | [diff] [blame] | 230 | HelpText<"Import function table from the environment">; |
| 231 | |
SingleAccretion | b2cdf3c | 2023-12-15 18:16:38 | [diff] [blame] | 232 | def initial_heap: JJ<"initial-heap=">, |
| 233 | HelpText<"Initial size of the heap">; |
| 234 | |
Nick Fitzgerald | 6018930 | 2025-03-04 17:39:30 | [diff] [blame] | 235 | def page_size: JJ<"page-size=">, |
| 236 | HelpText<"The Wasm page size (Defaults to 65536)">; |
| 237 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 238 | def initial_memory: JJ<"initial-memory=">, |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 239 | HelpText<"Initial size of the linear memory">; |
| 240 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 241 | def max_memory: JJ<"max-memory=">, |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 242 | HelpText<"Maximum size of the linear memory">; |
| 243 | |
SingleAccretion | cb4f94d | 2024-02-25 16:43:11 | [diff] [blame] | 244 | def no_growable_memory: FF<"no-growable-memory">, |
| 245 | HelpText<"Set maximum size of the linear memory to its initial size">; |
| 246 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 247 | def no_entry: FF<"no-entry">, |
Sam Clegg | b839f15 | 2018-01-28 19:57:04 | [diff] [blame] | 248 | HelpText<"Do not output any entry point">; |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 249 | |
Sam Clegg | 22b7b84 | 2024-07-12 20:26:52 | [diff] [blame] | 250 | def no_shlib_sigcheck: FF<"no-shlib-sigcheck">, |
| 251 | HelpText<"Do not check signatures of functions defined in shared libraries.">; |
| 252 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 253 | def stack_first: FF<"stack-first">, |
Sam Clegg | a0f095e | 2018-05-03 17:21:53 | [diff] [blame] | 254 | HelpText<"Place stack at start of linear memory rather than after data">; |
| 255 | |
Sam Clegg | 93adcb7 | 2023-08-25 20:56:16 | [diff] [blame] | 256 | def table_base: JJ<"table-base=">, |
| 257 | HelpText<"Table offset at which to place address taken functions (Defaults to 1)">; |
| 258 | |
Sam Clegg | 8adf7ac | 2018-07-23 23:51:19 | [diff] [blame] | 259 | defm whole_archive: B<"whole-archive", |
| 260 | "Force load of all members in a static library", |
| 261 | "Do not force load of all members in a static library (default)">; |
| 262 | |
Sam Clegg | 8aef04f | 2023-03-06 17:18:03 | [diff] [blame] | 263 | def why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">; |
| 264 | |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 265 | defm check_features: BB<"check-features", |
Thomas Lively | 82de51a | 2019-03-26 04:11:05 | [diff] [blame] | 266 | "Check feature compatibility of linked objects (default)", |
| 267 | "Ignore feature compatibility of linked objects">; |
| 268 | |
| 269 | def features: CommaJoined<["--", "-"], "features=">, |
| 270 | HelpText<"Comma-separated used features, inferred from input objects by default.">; |
| 271 | |
Sam Clegg | c07e838 | 2022-10-12 23:39:47 | [diff] [blame] | 272 | def extra_features: CommaJoined<["--", "-"], "extra-features=">, |
| 273 | HelpText<"Comma-separated list of features to add to the default set of features inferred from input objects.">; |
| 274 | |
Sam Clegg | c94d393 | 2017-11-17 18:14:09 | [diff] [blame] | 275 | // Aliases |
Sam Clegg | 305b034 | 2018-09-27 21:06:25 | [diff] [blame] | 276 | def: JoinedOrSeparate<["-"], "e">, Alias<entry>; |
| 277 | def: J<"entry=">, Alias<entry>; |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 278 | def: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">; |
| 279 | def: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">; |
| 280 | def: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; |
| 281 | def: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; |
| 282 | def: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; |
Sam Clegg | 305b034 | 2018-09-27 21:06:25 | [diff] [blame] | 283 | def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">; |
| 284 | def: Flag<["-"], "i">, Alias<initial_memory>; |
Sam Clegg | 0a9756f | 2022-10-03 15:31:23 | [diff] [blame] | 285 | def: Separate<["--", "-"], "library">, Alias<library>; |
| 286 | def: Joined<["--", "-"], "library=">, Alias<library>; |
| 287 | def: Separate<["--", "-"], "library-path">, Alias<library_path>; |
| 288 | def: Joined<["--", "-"], "library-path=">, Alias<library_path>; |
Sam Clegg | cc2da55 | 2020-03-27 23:52:27 | [diff] [blame] | 289 | def: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">; |
Sam Clegg | 305b034 | 2018-09-27 21:06:25 | [diff] [blame] | 290 | def: Flag<["-"], "r">, Alias<relocatable>; |
Sam Clegg | 59d52f8 | 2018-10-31 19:30:43 | [diff] [blame] | 291 | def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">; |
| 292 | def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">; |
Sam Clegg | 1f3f774 | 2019-02-06 02:35:18 | [diff] [blame] | 293 | def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">; |
| 294 | def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">; |
Sam Clegg | 305b034 | 2018-09-27 21:06:25 | [diff] [blame] | 295 | def: JoinedOrSeparate<["-"], "u">, Alias<undefined>; |
Sam Clegg | 0764e55 | 2024-10-22 17:47:57 | [diff] [blame] | 296 | def: Flag<["-"], "V">, Alias<v>, HelpText<"Alias for -v">; |
Sam Clegg | c729c1b | 2018-05-30 18:07:52 | [diff] [blame] | 297 | |
| 298 | // LTO-related options. |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 299 | def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">, |
Sam Clegg | c729c1b | 2018-05-30 18:07:52 | [diff] [blame] | 300 | HelpText<"Optimization level for LTO">; |
Scott Linder | 45ee0a9 | 2023-02-15 17:12:47 | [diff] [blame] | 301 | def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">, |
| 302 | HelpText<"Codegen optimization level for LTO">; |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 303 | def lto_partitions: JJ<"lto-partitions=">, |
Sam Clegg | c729c1b | 2018-05-30 18:07:52 | [diff] [blame] | 304 | HelpText<"Number of LTO codegen partitions">; |
Sam Clegg | 9a450a0 | 2024-11-01 23:34:06 | [diff] [blame] | 305 | def lto_obj_path_eq: JJ<"lto-obj-path=">; |
Sam Clegg | c729c1b | 2018-05-30 18:07:52 | [diff] [blame] | 306 | def disable_verify: F<"disable-verify">; |
Sam Clegg | 299b0e5 | 2021-01-18 19:39:28 | [diff] [blame] | 307 | def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">; |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 308 | def thinlto_cache_dir: JJ<"thinlto-cache-dir=">, |
Sam Clegg | c729c1b | 2018-05-30 18:07:52 | [diff] [blame] | 309 | HelpText<"Path to ThinLTO cached object file directory">; |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 310 | defm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">; |
Sam Clegg | 9a450a0 | 2024-11-01 23:34:06 | [diff] [blame] | 311 | def thinlto_emit_index_files: FF<"thinlto-emit-index-files">; |
| 312 | def thinlto_emit_imports_files: FF<"thinlto-emit-imports-files">; |
| 313 | def thinlto_index_only: FF<"thinlto-index-only">; |
| 314 | def thinlto_index_only_eq: JJ<"thinlto-index-only=">; |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 315 | def thinlto_jobs: JJ<"thinlto-jobs=">, |
Fangrui Song | eb4663d | 2020-03-17 19:40:19 | [diff] [blame] | 316 | HelpText<"Number of ThinLTO jobs. Default to --threads=">; |
Sam Clegg | b70eb86 | 2024-11-09 00:48:30 | [diff] [blame] | 317 | def thinlto_object_suffix_replace_eq: JJ<"thinlto-object-suffix-replace=">; |
| 318 | def thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">; |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 319 | def lto_debug_pass_manager: FF<"lto-debug-pass-manager">, |
Arthur Eubanks | 1314a49 | 2020-12-01 20:22:27 | [diff] [blame] | 320 | HelpText<"Debug new pass manager">; |
Dan Gohman | 46a3268 | 2020-06-12 19:05:40 | [diff] [blame] | 321 | |
| 322 | // Experimental PIC mode. |
Sam Clegg | 87628f5 | 2022-05-26 21:05:05 | [diff] [blame] | 323 | def experimental_pic: FF<"experimental-pic">, |
Dan Gohman | 46a3268 | 2020-06-12 19:05:40 | [diff] [blame] | 324 | HelpText<"Enable Experimental PIC">; |