1include "llvm/Option/OptParser.td" 2 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. 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 or 22// two can precede the option name except those that start with 'o'. 23class F<string name>: Flag<["--", "-"], name>; 24class J<string name>: Joined<["--", "-"], name>; 25 26multiclass Eq<string name, string help> { 27 def NAME: Separate<["--", "-"], name>; 28 def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>, 29 HelpText<help>; 30} 31 32multiclass B<string name, string help1, string help2> { 33 def NAME: Flag<["--", "-"], name>, HelpText<help1>; 34 def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>; 35} 36 37defm auxiliary: Eq<"auxiliary", "Set DT_AUXILIARY field to the specified name">; 38 39def be8: F<"be8">, HelpText<"write a Big Endian ELF file using BE8 format (AArch32 only)">; 40 41def Bno_symbolic: F<"Bno-symbolic">, HelpText<"Don't bind default visibility defined symbols locally for -shared (default)">; 42 43def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind default visibility defined symbols locally for -shared">; 44 45def Bsymbolic_functions: F<"Bsymbolic-functions">, 46 HelpText<"Bind default visibility defined function symbols locally for -shared">; 47 48def Bsymbolic_non_weak_functions: F<"Bsymbolic-non-weak-functions">, 49 HelpText<"Bind default visibility defined STB_GLOBAL function symbols locally for -shared">; 50 51def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries (default)">; 52 53def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">; 54 55def build_id: J<"build-id=">, HelpText<"Generate build ID note">, 56 MetaVarName<"[fast,md5,sha1,uuid,0x<hexstring>]">; 57def : F<"build-id">, Alias<build_id>, AliasArgs<["fast"]>, HelpText<"Alias for --build-id=fast">; 58 59defm check_sections: B<"check-sections", 60 "Check section addresses for overlaps (default)", 61 "Do not check section addresses for overlaps">; 62 63defm compress_debug_sections: 64 Eq<"compress-debug-sections", "Compress DWARF debug sections">, 65 MetaVarName<"[none,zlib,zstd]">; 66 67defm defsym: Eq<"defsym", "Define a symbol alias">, MetaVarName<"<symbol>=<value>">; 68 69defm optimize_bb_jumps: BB<"optimize-bb-jumps", 70 "Remove direct jumps at the end to the next basic block", 71 "Do not remove any direct jumps at the end to the next basic block (default)">; 72 73defm fortran_common : BB<"fortran-common", 74 "Search archive members for definitions to override COMMON symbols (default)", 75 "Do not search archive members for definitions to override COMMON symbols">; 76 77defm split_stack_adjust_size 78 : Eq<"split-stack-adjust-size", 79 "Specify adjustment to stack size when a split-stack function calls a " 80 "non-split-stack function">, 81 MetaVarName<"<value>">; 82 83def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">; 84 85def cmse_implib: FF<"cmse-implib">, 86 HelpText<"Make the output library to be a CMSE secure code import library">; 87 88defm in_implib: EEq<"in-implib", 89 "Read an existing CMSE secure code import library and preserve entry function addresses in the " 90 "resulting new CMSE secure code import library (optional when creating a CMSE secure image)">, 91 MetaVarName<"<file>">; 92 93defm out_implib: EEq<"out-implib", 94 "Output the CMSE secure code import library to <file> (required when creating a CMSE secure image)">, 95 MetaVarName<"<file>">; 96 97defm Tbss: Eq<"Tbss", "Same as --section-start with .bss as the sectionname">; 98 99defm Tdata: Eq<"Tdata", "Same as --section-start with .data as the sectionname">; 100 101defm Ttext: Eq<"Ttext", "Same as --section-start with .text as the sectionname">; 102 103def Ttext_segment: Separate<["-", "--"], "Ttext-segment">; 104 105defm allow_multiple_definition: B<"allow-multiple-definition", 106 "Allow multiple definitions", 107 "Do not allow multiple definitions (default)">; 108 109defm allow_shlib_undefined: B<"allow-shlib-undefined", 110 "Allow unresolved references in shared libraries (default when linking a shared library)", 111 "Do not allow unresolved references in shared libraries (default when linking an executable)">; 112 113defm apply_dynamic_relocs: BB<"apply-dynamic-relocs", 114 "Apply link-time values for dynamic relocations", 115 "Do not apply link-time values for dynamic relocations (default)">; 116 117defm dependent_libraries: BB<"dependent-libraries", 118 "Process dependent library specifiers from input files (default)", 119 "Ignore dependent library specifiers from input files">; 120 121defm as_needed: B<"as-needed", 122 "Only set DT_NEEDED for shared libraries if used", 123 "Always set DT_NEEDED for shared libraries (default)">; 124 125defm call_graph_ordering_file: 126 Eq<"call-graph-ordering-file", "Layout sections to optimize the given callgraph">; 127 128defm call_graph_profile_sort: BB<"call-graph-profile-sort", 129 "Reorder sections with call graph profile (default)", 130 "Do not reorder sections with call graph profile">; 131 132// --chroot doesn't have a help text because it is an internal option. 133def chroot: Separate<["--"], "chroot">; 134 135def color_diagnostics: JJ<"color-diagnostics=">, 136 HelpText<"Use colors in diagnostics (default: auto)">, 137 MetaVarName<"[auto,always,never]">; 138def : Flag<["--"], "color-diagnostics">, Alias<color_diagnostics>, AliasArgs<["always"]>, 139 HelpText<"Alias for --color-diagnostics=always">; 140def : Flag<["--"], "no-color-diagnostics">, Alias<color_diagnostics>, AliasArgs<["never"]>, 141 HelpText<"Alias for --color-diagnostics=never">; 142 143def cref: FF<"cref">, 144 HelpText<"Output cross reference table. If -Map is specified, print to the map file">; 145 146defm demangle: B<"demangle", 147 "Demangle symbol names (default)", 148 "Do not demangle symbol names">; 149 150defm dependency_file: EEq<"dependency-file", "Write a dependency file">, 151 MetaVarName<"<file>">; 152 153def disable_new_dtags: F<"disable-new-dtags">, 154 HelpText<"Disable new dynamic tags">; 155 156def discard_all: F<"discard-all">, HelpText<"Delete all local symbols">; 157 158def discard_locals: F<"discard-locals">, 159 HelpText<"Delete temporary local symbols">; 160 161def discard_none: F<"discard-none">, 162 HelpText<"Keep all symbols in the symbol table">; 163 164defm dynamic_linker: Eq<"dynamic-linker", "Which dynamic linker to use">; 165 166defm dynamic_list : Eq<"dynamic-list", 167 "Similar to --export-dynamic-symbol-list. When creating a shared object, " 168 "this additionally implies -Bsymbolic but does not set DF_SYMBOLIC">, 169 MetaVarName<"<file>">; 170 171def eb: F<"EB">, HelpText<"Select the big-endian format in OUTPUT_FORMAT">; 172def el: F<"EL">, HelpText<"Select the little-endian format in OUTPUT_FORMAT">; 173 174defm eh_frame_hdr: B<"eh-frame-hdr", 175 "Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header", 176 "Do not create .eh_frame_hdr section">; 177 178def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; 179 180def enable_new_dtags: F<"enable-new-dtags">, 181 HelpText<"Enable new dynamic tags (default)">; 182 183def end_group: F<"end-group">, 184 HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">; 185 186def end_lib: F<"end-lib">, 187 HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; 188 189defm entry: Eq<"entry", "Name of entry point symbol">, 190 MetaVarName<"<entry>">; 191 192defm error_limit: 193 EEq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">; 194 195def error_unresolved_symbols: F<"error-unresolved-symbols">, 196 HelpText<"Report unresolved symbols as errors">; 197 198defm error_handling_script: EEq<"error-handling-script", 199 "Specify an error handling script">; 200 201defm exclude_libs: Eq<"exclude-libs", "Exclude static libraries from automatic export">; 202 203defm execute_only: BB<"execute-only", 204 "Mark executable sections unreadable", 205 "Mark executable sections readable (default)">; 206 207defm export_dynamic: B<"export-dynamic", 208 "Put symbols in the dynamic symbol table", 209 "Do not put symbols in the dynamic symbol table (default)">; 210 211defm export_dynamic_symbol : EEq<"export-dynamic-symbol", 212 "(executable) Put matched symbols in the dynamic symbol table. " 213 "(shared object) References to matched non-local STV_DEFAULT symbols " 214 "shouldn't be bound to definitions within the shared object. " 215 "Does not imply -Bsymbolic.">, 216 MetaVarName<"glob">; 217 218defm export_dynamic_symbol_list : EEq<"export-dynamic-symbol-list", 219 "Read a list of dynamic symbol patterns. Apply --export-dynamic-symbol on each pattern">, 220 MetaVarName<"file">; 221 222defm fatal_warnings: B<"fatal-warnings", 223 "Treat warnings as errors", 224 "Do not treat warnings as errors (default)">; 225 226defm filter: Eq<"filter", "Set DT_FILTER field to the specified name">; 227 228defm fini: Eq<"fini", "Specify a finalizer function">, MetaVarName<"<symbol>">; 229 230def fix_cortex_a53_843419: F<"fix-cortex-a53-843419">, 231 HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">; 232 233def fix_cortex_a8: F<"fix-cortex-a8">, 234 HelpText<"Apply fixes for ARM Cortex-A8 erratum 657417">; 235 236defm format: Eq<"format", "Change the input format of the inputs following this option">, 237 MetaVarName<"[default,elf,binary]">; 238 239defm gc_sections: B<"gc-sections", 240 "Enable garbage collection of unused sections", 241 "Disable garbage collection of unused sections (default)">; 242 243defm gdb_index: BB<"gdb-index", 244 "Generate .gdb_index section", 245 "Do not generate .gdb_index section (default)">; 246 247defm gnu_unique: BB<"gnu-unique", 248 "Enable STB_GNU_UNIQUE symbol binding (default)", 249 "Disable STB_GNU_UNIQUE symbol binding">; 250 251defm hash_style: Eq<"hash-style", "Specify hash style (sysv, gnu or both)">; 252 253def help: F<"help">, HelpText<"Print option help">; 254 255def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">; 256 257def icf_safe: F<"icf=safe">, HelpText<"Enable safe identical code folding">; 258 259def icf_none: F<"icf=none">, HelpText<"Disable identical code folding (default)">; 260 261def ignore_function_address_equality: FF<"ignore-function-address-equality">, 262 HelpText<"lld can break the address equality of functions">; 263 264def ignore_data_address_equality: FF<"ignore-data-address-equality">, 265 HelpText<"lld can break the address equality of data">; 266 267defm image_base: EEq<"image-base", "Set the base address">; 268 269defm init: Eq<"init", "Specify an initializer function">, 270 MetaVarName<"<symbol>">; 271 272defm just_symbols: Eq<"just-symbols", "Just link symbols">; 273 274defm keep_unique: Eq<"keep-unique", "Do not fold this symbol during ICF">; 275 276def library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libname>">, 277 HelpText<"Search for library <libname>">; 278def library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">, 279 HelpText<"Add <dir> to the library search path">; 280 281def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; 282 283defm Map: Eq<"Map", "Print a link map to the specified file">; 284 285defm merge_exidx_entries: B<"merge-exidx-entries", 286 "Enable merging .ARM.exidx entries (default)", 287 "Disable merging .ARM.exidx entries">; 288 289defm mmap_output_file: BB<"mmap-output-file", 290 "Mmap the output file for writing (default)", 291 "Do not mmap the output file for writing">; 292 293def nmagic: F<"nmagic">, MetaVarName<"<magic>">, 294 HelpText<"Do not page align sections, link against static libraries.">; 295 296def nostdlib: F<"nostdlib">, 297 HelpText<"Only search directories specified on the command line">; 298 299def no_dynamic_linker: F<"no-dynamic-linker">, 300 HelpText<"Inhibit output of .interp section">; 301 302def noinhibit_exec: F<"noinhibit-exec">, 303 HelpText<"Retain the executable output file whenever it is still usable">; 304 305def no_nmagic: F<"no-nmagic">, MetaVarName<"<magic>">, 306 HelpText<"Page align sections (default)">; 307 308def no_omagic: F<"no-omagic">, MetaVarName<"<magic>">, 309 HelpText<"Do not set the text data sections to be writable, page align sections (default)">; 310 311def no_undefined: F<"no-undefined">, 312 HelpText<"Report unresolved symbols even if the linker is creating a shared library">; 313 314def no_warnings: FF<"no-warnings">, HelpText<"Suppress warnings and cancel --fatal-warnings">; 315def : Flag<["-"], "w">, Alias<no_warnings>, HelpText<"Alias for --no-warnings">; 316 317def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, 318 HelpText<"Path to file to write output">; 319 320defm oformat: EEq<"oformat", "Specify the binary format for the output object file">, 321 MetaVarName<"[elf,binary]">; 322 323def omagic: FF<"omagic">, MetaVarName<"<magic>">, 324 HelpText<"Set the text and data sections to be readable and writable, do not page align sections, link against static libraries">; 325 326defm orphan_handling: 327 Eq<"orphan-handling", "Control how orphan sections are handled when linker script used">; 328 329defm pack_dyn_relocs: 330 EEq<"pack-dyn-relocs", "Pack dynamic relocations in the given format">, 331 MetaVarName<"[none,android,relr,android+relr]">; 332 333defm use_android_relr_tags: BB<"use-android-relr-tags", 334 "Use SHT_ANDROID_RELR / DT_ANDROID_RELR* tags instead of SHT_RELR / DT_RELR*", 335 "Use SHT_RELR / DT_RELR* tags (default)">; 336 337def pic_veneer: F<"pic-veneer">, 338 HelpText<"Always generate position independent thunks (veneers)">; 339 340defm pie: B<"pie", 341 "Create a position independent executable", 342 "Do not create a position independent executable (default)">; 343 344defm print_gc_sections: B<"print-gc-sections", 345 "List removed unused sections", 346 "Do not list removed unused sections (default)">; 347 348defm print_icf_sections: B<"print-icf-sections", 349 "List identical folded sections", 350 "Do not list identical folded sections (default)">; 351 352def print_archive_stats: J<"print-archive-stats=">, 353 HelpText<"Write archive usage statistics to the specified file. " 354 "Print the numbers of members and extracted members for each archive">; 355 356defm print_symbol_order: Eq<"print-symbol-order", 357 "Print a symbol order specified by --call-graph-ordering-file into the specified file">; 358 359def pop_state: F<"pop-state">, 360 HelpText<"Restore the states saved by --push-state">; 361 362def push_state: F<"push-state">, 363 HelpText<"Save the current state of --as-needed, -static and --whole-archive">; 364 365def print_map: F<"print-map">, 366 HelpText<"Print a link map to the standard output">; 367 368def print_memory_usage: F<"print-memory-usage">, 369 HelpText<"Report target memory usage">; 370 371defm relax: BB<"relax", 372 "Enable target-specific relaxations if supported (default)", 373 "Disable target-specific relaxations">; 374 375defm relax_gp: BB<"relax-gp", 376 "Enable global pointer relaxation", 377 "Disable global pointer relaxation (default)">; 378 379defm remap_inputs: EEq<"remap-inputs", 380 "Remap input files matching <from-glob> to <to-file>">, 381 MetaVarName<"<from-glob>=<to-file>">; 382 383def remap_inputs_file: JJ<"remap-inputs-file=">, 384 HelpText<"Each line contains 'from-glob=to-file'. An input file matching <from-glob> is remapped to <to-file>">, 385 MetaVarName<"<file>">; 386 387defm reproduce: 388 EEq<"reproduce", 389 "Write tar file containing inputs and command to reproduce link">; 390 391defm rosegment: BB<"rosegment", 392 "Put read-only non-executable sections in their own segment (default)", 393 "Do not put read-only non-executable sections in their own segment">; 394 395defm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">; 396 397def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; 398 399defm retain_symbols_file: 400 Eq<"retain-symbols-file", "Retain only the symbols listed in the file">, 401 MetaVarName<"<file>">; 402 403defm script: Eq<"script", "Read linker script">; 404 405defm section_start: Eq<"section-start", "Set address of section">, 406 MetaVarName<"<address>">; 407 408def shared: F<"shared">, HelpText<"Build a shared object">; 409 410defm soname: Eq<"soname", "Set DT_SONAME">; 411 412defm sort_section: 413 Eq<"sort-section", "Specifies sections sorting rule when linkerscript is used">; 414 415def start_group: F<"start-group">, 416 HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">; 417 418def start_lib: F<"start-lib">, 419 HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; 420 421def strip_all: F<"strip-all">, HelpText<"Strip all symbols. Implies --strip-debug">; 422 423def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">; 424 425defm symbol_ordering_file: 426 EEq<"symbol-ordering-file", "Layout sections to place symbols in the order specified by symbol ordering file">; 427 428defm sysroot: Eq<"sysroot", "Set the system root">; 429 430def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">; 431 432def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32 (default)">; 433 434defm target2: 435 Eq<"target2", "Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">, 436 MetaVarName<"<type>">; 437 438defm threads 439 : EEq<"threads", 440 "Number of threads. '1' disables multi-threading. By default all " 441 "available hardware threads are used">; 442 443def time_trace_eq: JJ<"time-trace=">, MetaVarName<"<file>">, 444 HelpText<"Record time trace to <file>">; 445def : FF<"time-trace">, Alias<time_trace_eq>, 446 HelpText<"Record time trace to file next to output">; 447 448defm time_trace_granularity: EEq<"time-trace-granularity", 449 "Minimum time granularity (in microseconds) traced by time profiler">; 450 451defm toc_optimize : BB<"toc-optimize", 452 "(PowerPC64) Enable TOC related optimizations (default)", 453 "(PowerPC64) Disable TOC related optimizations">; 454 455defm pcrel_optimize : BB<"pcrel-optimize", 456 "(PowerPC64) Enable PC-relative optimizations (default)", 457 "(PowerPC64) Disable PC-relative optimizations">; 458 459def trace: F<"trace">, HelpText<"Print the names of the input files">; 460 461defm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">; 462 463defm undefined: Eq<"undefined", "Force undefined symbol during linking">, 464 MetaVarName<"<symbol>">; 465 466defm undefined_glob: EEq<"undefined-glob", "Force undefined symbol during linking">, 467 MetaVarName<"<pattern>">; 468 469def unique: F<"unique">, HelpText<"Creates a separate output section for every orphan input section">; 470 471defm unresolved_symbols: 472 Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">; 473 474defm undefined_version: B<"undefined-version", 475 "Allow unused version in version script (disabled by default)", 476 "Report version scripts that refer undefined symbols">; 477 478defm rsp_quoting: EEq<"rsp-quoting", "Quoting style for response files">, 479 MetaVarName<"[posix,windows]">; 480 481def v: Flag<["-"], "v">, HelpText<"Display the version number">; 482 483def verbose: F<"verbose">, HelpText<"Verbose mode">; 484 485def version: F<"version">, HelpText<"Display the version number and exit">; 486 487def power10_stubs_eq: JJ<"power10-stubs=">, MetaVarName<"<mode>">, 488 HelpText<"Whether to use Power10 instructions in call stubs for R_PPC64_REL24_NOTOC and TOC/NOTOC " 489 "interworking (yes (default): use; no: don't use). \"auto\" is currently the same as \"yes\"">; 490def power10_stubs: FF<"power10-stubs">, Alias<power10_stubs_eq>, AliasArgs<["yes"]>, 491 HelpText<"Alias for --power10-stubs=auto">; 492def no_power10_stubs: FF<"no-power10-stubs">, Alias<power10_stubs_eq>, AliasArgs<["no"]>, 493 HelpText<"Alias for --power10-stubs=no">; 494 495defm version_script: Eq<"version-script", "Read a version script">; 496 497defm warn_backrefs: BB<"warn-backrefs", 498 "Warn about backward symbol references to extract archive members", 499 "Do not warn about backward symbol references to extract archive members (default)">; 500 501defm warn_backrefs_exclude 502 : EEq<"warn-backrefs-exclude", 503 "Glob describing an archive (or an object file within --start-lib) " 504 "which should be ignored for --warn-backrefs.">, 505 MetaVarName<"<glob>">; 506 507defm warn_common: B<"warn-common", 508 "Warn about duplicate common symbols", 509 "Do not warn about duplicate common symbols (default)">; 510 511defm warn_ifunc_textrel: BB<"warn-ifunc-textrel", 512 "Warn about using ifunc symbols with text relocations", 513 "Do not warn about using ifunc symbols with text relocations (default)">; 514 515defm warn_symbol_ordering: BB<"warn-symbol-ordering", 516 "Warn about problems with the symbol ordering file (default)", 517 "Do not warn about problems with the symbol ordering file">; 518 519def warn_unresolved_symbols: F<"warn-unresolved-symbols">, 520 HelpText<"Report unresolved symbols as warnings">; 521 522defm whole_archive: B<"whole-archive", 523 "Force load of all members in a static library", 524 "Do not force load of all members in a static library (default)">; 525 526def why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">; 527 528defm wrap : Eq<"wrap", "Redirect symbol references to __wrap_symbol and " 529 "__real_symbol references to symbol">, 530 MetaVarName<"<symbol>">; 531 532def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">, 533 HelpText<"Linker option extensions">; 534 535def visual_studio_diagnostics_format : FF<"vs-diagnostics">, 536HelpText<"Format diagnostics for Visual Studio compatibility">; 537 538def package_metadata: JJ<"package-metadata=">, HelpText<"Emit package metadata note">; 539 540// Aliases 541def: Separate<["-"], "f">, Alias<auxiliary>, HelpText<"Alias for --auxiliary">; 542def: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">; 543def: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">; 544def: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; 545def: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; 546def: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">; 547def: Flag<["-"], "x">, Alias<discard_all>, HelpText<"Alias for --discard-all">; 548def: Flag<["-"], "X">, Alias<discard_locals>, HelpText<"Alias for --discard-locals">; 549def: Flag<["-"], "q">, Alias<emit_relocs>, HelpText<"Alias for --emit-relocs">; 550def: Flag<["-"], ")">, Alias<end_group>, HelpText<"Alias for --end-group">; 551def: JoinedOrSeparate<["-"], "e">, Alias<entry>, HelpText<"Alias for --entry">; 552def: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">; 553def: Separate<["-"], "F">, Alias<filter>, HelpText<"Alias for --filter">; 554def: Separate<["-"], "b">, Alias<format>, HelpText<"Alias for --format">; 555def: Separate<["--", "-"], "library">, Alias<library>; 556def: Joined<["--", "-"], "library=">, Alias<library>; 557def: Separate<["--", "-"], "library-path">, Alias<library_path>; 558def: Joined<["--", "-"], "library-path=">, Alias<library_path>; 559def: Flag<["-"], "n">, Alias<nmagic>, HelpText<"Alias for --nmagic">; 560def: Flag<["-"], "N">, Alias<omagic>, HelpText<"Alias for --omagic">; 561def: Joined<["--"], "output=">, Alias<o>, HelpText<"Alias for -o">; 562def: Separate<["--"], "output">, Alias<o>, HelpText<"Alias for -o">; 563def: F<"pic-executable">, Alias<pie>, HelpText<"Alias for --pie">; 564def: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">; 565def: Flag<["-"], "r">, Alias<relocatable>, HelpText<"Alias for --relocatable">; 566def: JoinedOrSeparate<["-"], "R">, Alias<rpath>, HelpText<"Alias for --rpath">; 567def: JoinedOrSeparate<["-"], "T">, Alias<script>, HelpText<"Alias for --script">; 568def: F<"Bshareable">, Alias<shared>, HelpText<"Alias for --shared">; 569def: JoinedOrSeparate<["-"], "h">, Alias<soname>, HelpText<"Alias for --soname">; 570def: Flag<["-"], "(">, Alias<start_group>, HelpText<"Alias for --start-group">; 571def: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">; 572def: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">; 573def: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">; 574def: Joined<["-", "--"], "Ttext-segment=">, Alias<Ttext_segment>; 575def: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">; 576def: JoinedOrSeparate<["-"], "u">, Alias<undefined>, HelpText<"Alias for --undefined">; 577def: Flag<["-"], "V">, Alias<v>, HelpText<"Alias for -v">; 578 579// LTO-related options. 580 581def lto: JJ<"lto=">, HelpText<"Set LTO backend">, 582 MetaVarName<"[full,thin]">; 583def lto_aa_pipeline: JJ<"lto-aa-pipeline=">, 584 HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">; 585def lto_debug_pass_manager: FF<"lto-debug-pass-manager">, 586 HelpText<"Debug new pass manager">; 587def lto_emit_asm: FF<"lto-emit-asm">, 588 HelpText<"Emit assembly code">; 589def lto_newpm_passes: JJ<"lto-newpm-passes=">, 590 HelpText<"Passes to run during LTO">; 591def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">, 592 HelpText<"Optimization level for LTO">; 593def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">, 594 HelpText<"Codegen optimization level for LTO">; 595def lto_partitions: JJ<"lto-partitions=">, 596 HelpText<"Number of LTO codegen partitions">; 597def lto_cs_profile_generate: FF<"lto-cs-profile-generate">, 598 HelpText<"Perform context sensitive PGO instrumentation">; 599def lto_cs_profile_file: JJ<"lto-cs-profile-file=">, 600 HelpText<"Context sensitive profile file path">; 601defm lto_pgo_warn_mismatch: BB<"lto-pgo-warn-mismatch", 602 "turn on warnings about profile cfg mismatch (default)", 603 "turn off warnings about profile cfg mismatch">; 604def lto_obj_path_eq: JJ<"lto-obj-path=">; 605def lto_sample_profile: JJ<"lto-sample-profile=">, 606 HelpText<"Sample profile file path">; 607defm lto_whole_program_visibility: BB<"lto-whole-program-visibility", 608 "Asserts that the LTO link has whole program visibility", 609 "Asserts that the LTO link does not have whole program visibility">; 610def disable_verify: F<"disable-verify">; 611defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">; 612def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">, 613 HelpText<"YAML output file for optimization remarks">; 614defm opt_remarks_hotness_threshold: EEq<"opt-remarks-hotness-threshold", 615 "Minimum profile count required for an optimization remark to be output." 616 " Use 'auto' to apply the threshold from profile summary.">, 617 MetaVarName<"<value>">; 618def opt_remarks_passes: Separate<["--"], "opt-remarks-passes">, 619 HelpText<"Regex for the passes that need to be serialized to the output file">; 620def opt_remarks_with_hotness: FF<"opt-remarks-with-hotness">, 621 HelpText<"Include hotness information in the optimization remarks file">; 622def opt_remarks_format: Separate<["--"], "opt-remarks-format">, 623 HelpText<"The format used for serializing remarks (default: YAML)">; 624def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">; 625def save_temps_eq: JJ<"save-temps=">, HelpText<"Save select intermediate LTO compilation results">, 626 Values<"resolution,preopt,promote,internalize,import,opt,precodegen,prelink,combinedindex">; 627def lto_basic_block_sections: JJ<"lto-basic-block-sections=">, 628 HelpText<"Enable basic block sections for LTO">; 629defm lto_unique_basic_block_section_names: BB<"lto-unique-basic-block-section-names", 630 "Give unique names to every basic block section for LTO", 631 "Do not give unique names to every basic block section for LTO (default)">; 632defm shuffle_sections: EEq<"shuffle-sections", 633 "Shuffle matched sections using the given seed before mapping them to the output sections. " 634 "If -1, reverse the section order. If 0, use a random seed">, 635 MetaVarName<"<section-glob>=<seed>">; 636def thinlto_cache_dir: JJ<"thinlto-cache-dir=">, 637 HelpText<"Path to ThinLTO cached object file directory">; 638defm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">; 639def thinlto_emit_imports_files: FF<"thinlto-emit-imports-files">; 640def thinlto_emit_index_files: FF<"thinlto-emit-index-files">; 641def thinlto_index_only: FF<"thinlto-index-only">; 642def thinlto_index_only_eq: JJ<"thinlto-index-only=">; 643def thinlto_jobs_eq: JJ<"thinlto-jobs=">, 644 HelpText<"Number of ThinLTO jobs. Default to --threads=">; 645def thinlto_object_suffix_replace_eq: JJ<"thinlto-object-suffix-replace=">; 646def thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">; 647def thinlto_single_module_eq: JJ<"thinlto-single-module=">, 648 HelpText<"Specify a single module to compile in ThinLTO mode, for debugging only">; 649 650def: J<"plugin-opt=O">, Alias<lto_O>, HelpText<"Alias for --lto-O">; 651def: F<"plugin-opt=debug-pass-manager">, 652 Alias<lto_debug_pass_manager>, HelpText<"Alias for --lto-debug-pass-manager">; 653def: F<"plugin-opt=disable-verify">, Alias<disable_verify>, HelpText<"Alias for --disable-verify">; 654def plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">, 655 HelpText<"Directory to store .dwo files when LTO and debug fission are used">; 656def plugin_opt_emit_asm: F<"plugin-opt=emit-asm">, 657 Alias<lto_emit_asm>, HelpText<"Alias for --lto-emit-asm">; 658def plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">; 659def: J<"plugin-opt=jobs=">, Alias<thinlto_jobs_eq>, HelpText<"Alias for --thinlto-jobs=">; 660def: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for --lto-partitions">; 661def plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">; 662def: F<"plugin-opt=cs-profile-generate">, 663 Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">; 664def: J<"plugin-opt=cs-profile-path=">, 665 Alias<lto_cs_profile_file>, HelpText<"Alias for --lto-cs-profile-file">; 666def: J<"plugin-opt=obj-path=">, 667 Alias<lto_obj_path_eq>, 668 HelpText<"Alias for --lto-obj-path=">; 669def plugin_opt_opaque_pointers: F<"plugin-opt=opaque-pointers">, 670 HelpText<"Use opaque pointers in IR during LTO (default)">; 671def: J<"plugin-opt=opt-remarks-filename=">, 672 Alias<opt_remarks_filename>, 673 HelpText<"Alias for --opt-remarks-filename">; 674def: J<"plugin-opt=opt-remarks-passes=">, 675 Alias<opt_remarks_passes>, 676 HelpText<"Alias for --opt-remarks-passes">; 677def: J<"plugin-opt=opt-remarks-format=">, 678 Alias<opt_remarks_format>, 679 HelpText<"Alias for --opt-remarks-format">; 680def: F<"plugin-opt=opt-remarks-with-hotness">, 681 Alias<opt_remarks_with_hotness>, 682 HelpText<"Alias for --opt-remarks-with_hotness">; 683def: J<"plugin-opt=opt-remarks-hotness-threshold=">, 684 Alias<opt_remarks_hotness_threshold>, 685 HelpText<"Alias for --opt-remarks-hotness-threshold">; 686def: J<"plugin-opt=sample-profile=">, 687 Alias<lto_sample_profile>, HelpText<"Alias for --lto-sample-profile">; 688def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for --save-temps">; 689def plugin_opt_stats_file: J<"plugin-opt=stats-file=">, 690 HelpText<"Filename to write LTO statistics to">; 691def: F<"plugin-opt=thinlto-emit-imports-files">, 692 Alias<thinlto_emit_imports_files>, 693 HelpText<"Alias for --thinlto-emit-imports-files">; 694def: F<"plugin-opt=thinlto-index-only">, 695 Alias<thinlto_index_only>, 696 HelpText<"Alias for --thinlto-index-only">; 697def: J<"plugin-opt=thinlto-index-only=">, 698 Alias<thinlto_index_only_eq>, 699 HelpText<"Alias for --thinlto-index-only=">; 700def: J<"plugin-opt=thinlto-object-suffix-replace=">, 701 Alias<thinlto_object_suffix_replace_eq>, 702 HelpText<"Alias for --thinlto-object-suffix-replace=">; 703def: J<"plugin-opt=thinlto-prefix-replace=">, 704 Alias<thinlto_prefix_replace_eq>, 705 HelpText<"Alias for --thinlto-prefix-replace=">; 706 707// Ignore LTO plugin-related options. 708// clang -flto passes -plugin and -plugin-opt to the linker. This is required 709// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't 710// rely on a plugin. Instead of detecting which linker is used on clang side we 711// just ignore the option on lld side as it's easier. In fact, the linker could 712// be called 'ld' and understanding which linker is used would require parsing of 713// --version output. 714defm plugin: Eq<"plugin", "Ignored for compatibility with GNU linkers">; 715 716def plugin_opt_eq_minus: J<"plugin-opt=-">, 717 HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">; 718def: J<"plugin-opt=thinlto">; 719 720// Ignore GCC collect2 LTO plugin related options. Note that we don't support 721// GCC LTO, but GCC collect2 passes these options even in non-LTO mode. 722def: J<"plugin-opt=-fresolution=">; 723def: J<"plugin-opt=-pass-through=">; 724// This may be either an unhandled LLVMgold.so feature or GCC passed 725// -plugin-opt=path/to/{liblto_plugin.so,lto-wrapper} 726def plugin_opt_eq : J<"plugin-opt=">; 727 728// Options listed below are silently ignored for now for compatibility. 729def: Flag<["-"], "d">; 730def: Flag<["-"], "g">; 731def: F<"long-plt">; 732def: FF<"no-add-needed">; 733def: F<"no-copy-dt-needed-entries">; 734def: F<"no-ctors-in-init-array">; 735def: F<"no-keep-memory">; 736def: F<"no-warn-mismatch">; 737def: Separate<["--", "-"], "rpath-link">; 738def: J<"rpath-link=">; 739def: F<"secure-plt">; 740def: F<"sort-common">; 741def: F<"stats">; 742def: F<"warn-execstack">; 743def: F<"warn-once">; 744def: F<"warn-shared-textrel">; 745def: JoinedOrSeparate<["-"], "G">; 746 747// Hidden option used for testing MIPS multi-GOT implementation. 748defm mips_got_size: 749 Eq<"mips-got-size", "Max size of a single MIPS GOT. 0x10000 by default.">, 750 Flags<[HelpHidden]>; 751 752// Hidden option used to opt-in to additional output checks. 753defm check_dynamic_relocations: BB<"check-dynamic-relocations", 754 "Perform additional validation of the written dynamic relocations", 755 "Do not perform additional validation of the written dynamic relocations">, 756 Flags<[HelpHidden]>; 757 758defm load_pass_plugins: EEq<"load-pass-plugin", "Load passes from plugin library">; 759 760// Hidden options, used by clang's -fsanitize=memtag-* options to emit an ELF 761// note to designate what kinds of memory (stack/heap) should be protected using 762// ARM's MTE on armv8.5+. A binary's desire for stack MTE can't be obtained 763// implicitly, so we have a specific bit in the note to signal to the loader to 764// remap the stack as PROT_MTE. 765defm android_memtag_stack: BB<"android-memtag-stack", 766 "Instruct the dynamic loader to prepare for MTE stack instrumentation", "">; 767defm android_memtag_heap: BB<"android-memtag-heap", 768 "Instruct the dynamic loader to enable MTE protection for the heap", "">; 769defm android_memtag_mode: EEq<"android-memtag-mode", 770 "Instruct the dynamic loader to start under MTE mode {async, sync, none}">; 771