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