brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.1 KiB · ccba9f1 Raw
331 lines · plain
1include "llvm/Option/OptParser.td"2 3// Convenience classes for long options which only accept two dashes. For lld4// specific or newer long options, we prefer two dashes to avoid collision with5// short options. For many others, we have to accept both forms to be compatible6// with GNU ld.7class FF<string name> : Flag<["--"], name>;8class JJ<string name>: Joined<["--"], name>;9 10multiclass 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 16multiclass 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 21// For options whose names are multiple letters, either one dash or22// two can precede the option name except those that start with 'o'.23class F<string name>: Flag<["--", "-"], name>;24class J<string name>: Joined<["--", "-"], name>;25class S<string name>: Separate<["--", "-"], name>;26 27multiclass Eq<string name, string help> {28  def NAME: Separate<["--", "-"], name>;29  def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,30    HelpText<help>;31}32 33multiclass 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 38// The following flags are shared with the ELF linker39def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">;40 41def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;42 43def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries (default)">;44 45defm allow_multiple_definition: B<"allow-multiple-definition",46    "Allow multiple definitions",47    "Do not allow multiple definitions (default)">;48 49def build_id: F<"build-id">, HelpText<"Alias for --build-id=fast">;50 51def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">,52  MetaVarName<"[fast,sha1,uuid,0x<hexstring>]">;53 54defm color_diagnostics: B<"color-diagnostics",55  "Alias for --color-diagnostics=always",56  "Alias for --color-diagnostics=never">;57def color_diagnostics_eq: J<"color-diagnostics=">,58  HelpText<"Use colors in diagnostics (default: auto)">,59  MetaVarName<"[auto,always,never]">;60 61def compress_relocations: F<"compress-relocations">,62  HelpText<"Compress the relocation targets in the code section.">;63 64defm demangle: B<"demangle",65    "Demangle symbol names (default)",66    "Do not demangle symbol names">;67 68def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">;69 70def error_unresolved_symbols: F<"error-unresolved-symbols">,71  HelpText<"Report unresolved symbols as errors">;72 73defm export_dynamic: B<"export-dynamic",74    "Put symbols in the dynamic symbol table",75    "Do not put symbols in the dynamic symbol table (default)">;76 77def 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 80def entry: S<"entry">, MetaVarName<"<entry>">,81  HelpText<"Name of entry point symbol">;82 83defm error_limit:84  EEq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">;85 86defm fatal_warnings: B<"fatal-warnings",87    "Treat warnings as errors",88    "Do not treat warnings as errors (default)">;89 90defm gc_sections: B<"gc-sections",91    "Enable garbage collection of unused sections (defualt)",92    "Disable garbage collection of unused sections">;93 94defm merge_data_segments: BB<"merge-data-segments",95    "Enable merging data segments (default)",96    "Disable merging data segments">;97 98def help: F<"help">, HelpText<"Print option help">;99 100def library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,101  HelpText<"Root name of library to use">;102 103def library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,104  HelpText<"Add a directory to the library search path">;105 106def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;107 108defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;109 110defm Map: Eq<"Map", "Print a link map to the specified file">;111 112def noinhibit_exec: F<"noinhibit-exec">,113  HelpText<"Retain the executable output file whenever it is still usable">;114 115def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,116  HelpText<"Path to file to write output">;117 118def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;119 120defm pie: B<"pie",121    "Create a position independent executable",122    "Do not create a position independent executable (default)">;123 124defm print_gc_sections: B<"print-gc-sections",125    "List removed unused sections",126    "Do not list removed unused sections (default)">;127 128def print_map: F<"print-map">,129  HelpText<"Print a link map to the standard output">;130 131def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;132 133defm reproduce: EEq<"reproduce", "Dump linker invocation and input files for debugging">;134 135defm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">;136 137defm rsp_quoting: Eq<"rsp-quoting", "Quoting style for response files">,138  MetaVarName<"[posix,windows]">;139 140def shared: F<"shared">, HelpText<"Build a shared object">;141 142defm version_script: Eq<"version-script",143    "Read a GNU version script. On wasm, symbol versioning is collapsed "144    "(versions are ignored); only the global:/local: export-visibility "145    "semantics are honored to control which symbols a shared module exports.">;146 147def start_lib: F<"start-lib">,148  HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;149 150def strip_all: F<"strip-all">, HelpText<"Strip all symbols">;151 152def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;153 154defm threads155    : Eq<"threads", "Number of threads. '1' disables multi-threading. By "156                    "default all available hardware threads are used">;157 158def trace: F<"trace">, HelpText<"Print the names of the input files">;159 160defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">;161 162defm undefined: Eq<"undefined", "Force undefined symbol during linking">;163 164defm unresolved_symbols:165  Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">;166 167def v: Flag<["-"], "v">, HelpText<"Display the version number">;168 169def verbose: F<"verbose">, HelpText<"Verbose mode">;170 171def version: F<"version">, HelpText<"Display the version number and exit">;172 173def warn_unresolved_symbols: F<"warn-unresolved-symbols">,174  HelpText<"Report unresolved symbols as warnings">;175 176defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,177  MetaVarName<"<symbol>=<symbol>">;178 179def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,180  HelpText<"Linker option extensions">;181 182// The follow flags are unique to wasm183 184def allow_undefined: F<"allow-undefined">,185  HelpText<"Allow undefined symbols in linked binary. "186           "This options is equivalent to --import-undefined "187           "and --unresolved-symbols=ignore-all">;188 189def import_undefined: F<"import-undefined">,190  HelpText<"Turn undefined symbols into imports where possible">;191 192def allow_undefined_file: J<"allow-undefined-file=">,193  HelpText<"Allow symbols listed in <file> to be undefined in linked binary">;194 195def allow_undefined_file_s: Separate<["-"], "allow-undefined-file">,196  Alias<allow_undefined_file>;197 198defm export: Eq<"export", "Force a symbol to be exported">;199 200defm export_if_defined: Eq<"export-if-defined",201     "Force a symbol to be exported, if it is defined in the input">;202 203def export_all: FF<"export-all">,204  HelpText<"Export all symbols (normally combined with --no-gc-sections)">;205 206def export_table: FF<"export-table">,207  HelpText<"Export function table to the environment">;208 209def growable_table: FF<"growable-table">,210  HelpText<"Remove maximum size from function table, allowing table to grow">;211 212def global_base: JJ<"global-base=">,213  HelpText<"Memory offset at which to place global data (Defaults to 1024)">;214 215defm keep_section: Eq<"keep-section",216     "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">;217 218def import_memory: FF<"import-memory">,219  HelpText<"Import the module's memory from the default module of \"env\" with the name \"memory\".">;220def import_memory_with_name: JJ<"import-memory=">,221  HelpText<"Import the module's memory from the passed module with the passed name.">,222  MetaVarName<"<module>,<name>">;223 224def export_memory: FF<"export-memory">,225  HelpText<"Export the module's memory with the default name of \"memory\"">;226def export_memory_with_name: JJ<"export-memory=">,227  HelpText<"Export the module's memory with the passed name">;228 229def shared_memory: FF<"shared-memory">,230  HelpText<"Use shared linear memory">;231 232defm soname: Eq<"soname", "Set the module name in the generated name section">;233 234def import_table: FF<"import-table">,235  HelpText<"Import function table from the environment">;236 237def initial_heap: JJ<"initial-heap=">,238  HelpText<"Initial size of the heap">;239 240def page_size: JJ<"page-size=">,241  HelpText<"The Wasm page size (Defaults to 65536)">;242 243def initial_memory: JJ<"initial-memory=">,244  HelpText<"Initial size of the linear memory">;245 246def max_memory: JJ<"max-memory=">,247  HelpText<"Maximum size of the linear memory">;248 249def no_growable_memory: FF<"no-growable-memory">,250  HelpText<"Set maximum size of the linear memory to its initial size">;251 252def no_entry: FF<"no-entry">,253  HelpText<"Do not output any entry point">;254 255def no_shlib_sigcheck: FF<"no-shlib-sigcheck">,256  HelpText<"Do not check signatures of functions defined in shared libraries.">;257 258defm stack_first: B<"stack-first",259    "Place stack at start of linear memory (default)",260    "Place the stack after static data region">;261 262def table_base: JJ<"table-base=">,263  HelpText<"Table offset at which to place address taken functions (Defaults to 1)">;264 265defm whole_archive: B<"whole-archive",266    "Force load of all members in a static library",267    "Do not force load of all members in a static library (default)">;268 269def why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">;270 271defm check_features: BB<"check-features",272    "Check feature compatibility of linked objects (default)",273    "Ignore feature compatibility of linked objects">;274 275def features: CommaJoined<["--", "-"], "features=">,276  HelpText<"Comma-separated used features, inferred from input objects by default.">;277 278def extra_features: CommaJoined<["--", "-"], "extra-features=">,279  HelpText<"Comma-separated list of features to add to the default set of features inferred from input objects.">;280 281// Aliases282def: JoinedOrSeparate<["-"], "e">, Alias<entry>;283def: J<"entry=">, Alias<entry>;284def: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;285def: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;286def: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;287def: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;288def: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;289def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;290def: Flag<["-"], "i">, Alias<initial_memory>;291def: Separate<["--", "-"], "library">, Alias<library>;292def: Joined<["--", "-"], "library=">, Alias<library>;293def: Separate<["--", "-"], "library-path">, Alias<library_path>;294def: Joined<["--", "-"], "library-path=">, Alias<library_path>;295def: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">;296def: Flag<["-"], "r">, Alias<relocatable>;297def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">;298def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">;299def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">;300def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">;301def: JoinedOrSeparate<["-"], "u">, Alias<undefined>;302def: Flag<["-"], "V">, Alias<v>, HelpText<"Alias for -v">;303 304// LTO-related options.305def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,306  HelpText<"Optimization level for LTO">;307def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">,308  HelpText<"Codegen optimization level for LTO">;309def lto_partitions: JJ<"lto-partitions=">,310  HelpText<"Number of LTO codegen partitions">;311def lto_obj_path_eq: JJ<"lto-obj-path=">;312def disable_verify: F<"disable-verify">;313def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">;314def thinlto_cache_dir: JJ<"thinlto-cache-dir=">,315  HelpText<"Path to ThinLTO cached object file directory">;316defm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;317def thinlto_emit_index_files: FF<"thinlto-emit-index-files">;318def thinlto_emit_imports_files: FF<"thinlto-emit-imports-files">;319def thinlto_index_only: FF<"thinlto-index-only">;320def thinlto_index_only_eq: JJ<"thinlto-index-only=">;321def thinlto_jobs: JJ<"thinlto-jobs=">,322  HelpText<"Number of ThinLTO jobs. Default to --threads=">;323def thinlto_object_suffix_replace_eq: JJ<"thinlto-object-suffix-replace=">;324def thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">;325def lto_debug_pass_manager: FF<"lto-debug-pass-manager">,326  HelpText<"Debug new pass manager">;327 328// Experimental PIC mode.329def experimental_pic: FF<"experimental-pic">,330  HelpText<"Enable Experimental PIC">;331