1include "llvm/Option/OptParser.td" 2 3// For options whose names are multiple letters, either one dash or 4// two can precede the option name except those that start with 'o'. 5class F<string name>: Flag<["--", "-"], name>; 6class J<string name>: Joined<["--", "-"], name>; 7class S<string name>: Separate<["--", "-"], name>; 8 9multiclass Eq<string name, string help> { 10 def NAME: Separate<["--", "-"], name>; 11 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>, 12 HelpText<help>; 13} 14 15multiclass B<string name, string help1, string help2> { 16 def NAME: Flag<["--", "-"], name>, HelpText<help1>; 17 def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>; 18} 19 20// The following flags are shared with the ELF linker 21def color_diagnostics: F<"color-diagnostics">, 22 HelpText<"Use colors in diagnostics">; 23 24def color_diagnostics_eq: J<"color-diagnostics=">, 25 HelpText<"Use colors in diagnostics; one of 'always', 'never', 'auto'">; 26 27def compress_relocations: F<"compress-relocations">, 28 HelpText<"Compress the relocation targets in the code section.">; 29 30defm demangle: B<"demangle", 31 "Demangle symbol names", 32 "Do not demangle symbol names">; 33 34def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; 35 36defm export_dynamic: B<"export-dynamic", 37 "Put symbols in the dynamic symbol table", 38 "Do not put symbols in the dynamic symbol table (default)">; 39 40def entry: S<"entry">, MetaVarName<"<entry>">, 41 HelpText<"Name of entry point symbol">; 42 43def error_limit: J<"error-limit=">, 44 HelpText<"Maximum number of errors to emit before stopping (0 = no limit)">; 45 46def fatal_warnings: F<"fatal-warnings">, 47 HelpText<"Treat warnings as errors">; 48 49defm gc_sections: B<"gc-sections", 50 "Enable garbage collection of unused sections", 51 "Disable garbage collection of unused sections">; 52 53defm merge_data_segments: B<"merge-data-segments", 54 "Enable merging data segments", 55 "Disable merging data segments">; 56 57def help: F<"help">, HelpText<"Print option help">; 58 59def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">, 60 HelpText<"Root name of library to use">; 61 62def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">, 63 HelpText<"Add a directory to the library search path">; 64 65def mllvm: S<"mllvm">, HelpText<"Options to pass to LLVM">; 66 67def no_color_diagnostics: F<"no-color-diagnostics">, 68 HelpText<"Do not use colors in diagnostics">; 69 70def no_fatal_warnings: F<"no-fatal-warnings">; 71 72def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, 73 HelpText<"Path to file to write output">; 74 75def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">; 76 77defm pie: B<"pie", 78 "Create a position independent executable", 79 "Do not create a position independent executable (default)">; 80 81defm print_gc_sections: B<"print-gc-sections", 82 "List removed unused sections", 83 "Do not list removed unused sections">; 84 85def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; 86 87defm reproduce: Eq<"reproduce", "Dump linker invocation and input files for debugging">; 88 89defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">, 90 MetaVarName<"[posix,windows]">; 91 92def shared: F<"shared">, HelpText<"Build a shared object">; 93 94def strip_all: F<"strip-all">, HelpText<"Strip all symbols">; 95 96def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">; 97 98defm threads 99 : Eq<"threads", "Number of threads. '1' disables multi-threading. By " 100 "default all available hardware threads are used">; 101 102def trace: F<"trace">, HelpText<"Print the names of the input files">; 103 104defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">; 105 106defm undefined: Eq<"undefined", "Force undefined symbol during linking">; 107 108def v: Flag<["-"], "v">, HelpText<"Display the version number">; 109 110def verbose: F<"verbose">, HelpText<"Verbose mode">; 111 112def version: F<"version">, HelpText<"Display the version number and exit">; 113 114def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">, 115 HelpText<"Linker option extensions">; 116 117defm wrap: Eq<"wrap", "Use wrapper functions for symbol">, 118 MetaVarName<"<symbol>=<symbol>">; 119 120// The follow flags are unique to wasm 121 122def allow_undefined: F<"allow-undefined">, 123 HelpText<"Allow undefined symbols in linked binary">; 124 125def allow_undefined_file: J<"allow-undefined-file=">, 126 HelpText<"Allow symbols listed in <file> to be undefined in linked binary">; 127 128def allow_undefined_file_s: Separate<["-"], "allow-undefined-file">, 129 Alias<allow_undefined_file>; 130 131defm export: Eq<"export", "Force a symbol to be exported">; 132 133def export_all: F<"export-all">, 134 HelpText<"Export all symbols (normally combined with --no-gc-sections)">; 135 136def export_table: F<"export-table">, 137 HelpText<"Export function table to the environment">; 138 139def growable_table: F<"growable-table">, 140 HelpText<"Remove maximum size from function table, allowing table to grow">; 141 142def global_base: J<"global-base=">, 143 HelpText<"Where to start to place global data">; 144 145def import_memory: F<"import-memory">, 146 HelpText<"Import memory from the environment">; 147 148def shared_memory: F<"shared-memory">, 149 HelpText<"Use shared linear memory">; 150 151def import_table: F<"import-table">, 152 HelpText<"Import function table from the environment">; 153 154def initial_memory: J<"initial-memory=">, 155 HelpText<"Initial size of the linear memory">; 156 157def max_memory: J<"max-memory=">, 158 HelpText<"Maximum size of the linear memory">; 159 160def no_entry: F<"no-entry">, 161 HelpText<"Do not output any entry point">; 162 163def stack_first: F<"stack-first">, 164 HelpText<"Place stack at start of linear memory rather than after data">; 165 166defm whole_archive: B<"whole-archive", 167 "Force load of all members in a static library", 168 "Do not force load of all members in a static library (default)">; 169 170defm check_features: B<"check-features", 171 "Check feature compatibility of linked objects (default)", 172 "Ignore feature compatibility of linked objects">; 173 174def features: CommaJoined<["--", "-"], "features=">, 175 HelpText<"Comma-separated used features, inferred from input objects by default.">; 176 177// Aliases 178def: JoinedOrSeparate<["-"], "e">, Alias<entry>; 179def: J<"entry=">, Alias<entry>; 180def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">; 181def: Flag<["-"], "i">, Alias<initial_memory>; 182def: Flag<["-"], "m">, Alias<max_memory>; 183def: Flag<["-"], "r">, Alias<relocatable>; 184def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">; 185def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">; 186def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">; 187def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">; 188def: JoinedOrSeparate<["-"], "u">, Alias<undefined>; 189 190// LTO-related options. 191def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">, 192 HelpText<"Optimization level for LTO">; 193def lto_partitions: J<"lto-partitions=">, 194 HelpText<"Number of LTO codegen partitions">; 195def disable_verify: F<"disable-verify">; 196def save_temps: F<"save-temps">; 197def thinlto_cache_dir: J<"thinlto-cache-dir=">, 198 HelpText<"Path to ThinLTO cached object file directory">; 199defm thinlto_cache_policy: Eq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">; 200def thinlto_jobs: J<"thinlto-jobs=">, 201 HelpText<"Number of ThinLTO jobs. Default to --threads=">; 202