xref: /freebsd/contrib/llvm-project/lld/ELF/Options.td (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andricinclude "llvm/Option/OptParser.td"
20b57cec5SDimitry Andric
35ffd83dbSDimitry Andric// Convenience classes for long options which only accept two dashes. For lld
45ffd83dbSDimitry Andric// specific or newer long options, we prefer two dashes to avoid collision with
55ffd83dbSDimitry Andric// short options. For many others, we have to accept both forms to be compatible
65ffd83dbSDimitry Andric// with GNU ld.
75ffd83dbSDimitry Andricclass FF<string name> : Flag<["--"], name>;
85ffd83dbSDimitry Andricclass JJ<string name>: Joined<["--"], name>;
95ffd83dbSDimitry Andric
105ffd83dbSDimitry Andricmulticlass EEq<string name, string help> {
115ffd83dbSDimitry Andric  def NAME: Separate<["--"], name>;
125ffd83dbSDimitry Andric  def NAME # _eq: Joined<["--"], name # "=">, Alias<!cast<Separate>(NAME)>,
135ffd83dbSDimitry Andric    HelpText<help>;
145ffd83dbSDimitry Andric}
155ffd83dbSDimitry Andric
165ffd83dbSDimitry Andricmulticlass BB<string name, string help1, string help2> {
175ffd83dbSDimitry Andric  def NAME: Flag<["--"], name>, HelpText<help1>;
185ffd83dbSDimitry Andric  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
195ffd83dbSDimitry Andric}
205ffd83dbSDimitry Andric
210b57cec5SDimitry Andric// For options whose names are multiple letters, either one dash or
220b57cec5SDimitry Andric// two can precede the option name except those that start with 'o'.
230b57cec5SDimitry Andricclass F<string name>: Flag<["--", "-"], name>;
240b57cec5SDimitry Andricclass J<string name>: Joined<["--", "-"], name>;
250b57cec5SDimitry Andric
260b57cec5SDimitry Andricmulticlass Eq<string name, string help> {
270b57cec5SDimitry Andric  def NAME: Separate<["--", "-"], name>;
280b57cec5SDimitry Andric  def NAME # _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>,
290b57cec5SDimitry Andric    HelpText<help>;
300b57cec5SDimitry Andric}
310b57cec5SDimitry Andric
320b57cec5SDimitry Andricmulticlass B<string name, string help1, string help2> {
330b57cec5SDimitry Andric  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
340b57cec5SDimitry Andric  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
350b57cec5SDimitry Andric}
360b57cec5SDimitry Andric
370b57cec5SDimitry Andricdefm auxiliary: Eq<"auxiliary", "Set DT_AUXILIARY field to the specified name">;
380b57cec5SDimitry Andric
3906c3fb27SDimitry Andricdef be8: F<"be8">, HelpText<"write a Big Endian ELF file using BE8 format (AArch32 only)">;
4006c3fb27SDimitry Andric
41fe6060f1SDimitry Andricdef Bno_symbolic: F<"Bno-symbolic">, HelpText<"Don't bind default visibility defined symbols locally for -shared (default)">;
42fe6060f1SDimitry Andric
43fe6060f1SDimitry Andricdef Bsymbolic: F<"Bsymbolic">, HelpText<"Bind default visibility defined symbols locally for -shared">;
440b57cec5SDimitry Andric
455f757f3fSDimitry Andricdef Bsymbolic_non_weak: F<"Bsymbolic-non-weak">,
465f757f3fSDimitry Andric  HelpText<"Bind default visibility defined STB_GLOBAL symbols locally for -shared">;
475f757f3fSDimitry Andric
480b57cec5SDimitry Andricdef Bsymbolic_functions: F<"Bsymbolic-functions">,
49fe6060f1SDimitry Andric  HelpText<"Bind default visibility defined function symbols locally for -shared">;
500b57cec5SDimitry Andric
516e75b2fbSDimitry Andricdef Bsymbolic_non_weak_functions: F<"Bsymbolic-non-weak-functions">,
526e75b2fbSDimitry Andric  HelpText<"Bind default visibility defined STB_GLOBAL function symbols locally for -shared">;
536e75b2fbSDimitry Andric
540b57cec5SDimitry Andricdef Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries (default)">;
550b57cec5SDimitry Andric
560b57cec5SDimitry Andricdef Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
570b57cec5SDimitry Andric
58972a253aSDimitry Andricdef build_id: J<"build-id=">, HelpText<"Generate build ID note">,
590b57cec5SDimitry Andric  MetaVarName<"[fast,md5,sha1,uuid,0x<hexstring>]">;
60*0fca6ea1SDimitry Andricdef : F<"build-id">, Alias<build_id>, AliasArgs<["sha1"]>, HelpText<"Alias for --build-id=sha1">;
610b57cec5SDimitry Andric
620b57cec5SDimitry Andricdefm check_sections: B<"check-sections",
630b57cec5SDimitry Andric    "Check section addresses for overlaps (default)",
640b57cec5SDimitry Andric    "Do not check section addresses for overlaps">;
650b57cec5SDimitry Andric
660b57cec5SDimitry Andricdefm compress_debug_sections:
670b57cec5SDimitry Andric  Eq<"compress-debug-sections", "Compress DWARF debug sections">,
68bdd1243dSDimitry Andric  MetaVarName<"[none,zlib,zstd]">;
690b57cec5SDimitry Andric
70*0fca6ea1SDimitry Andricdefm compress_sections: EEq<"compress-sections",
71*0fca6ea1SDimitry Andric  "Compress output sections that match the glob and do not have the SHF_ALLOC flag. "
72*0fca6ea1SDimitry Andric  "The sections remain uncompressed if compressed content would be larger. "
73*0fca6ea1SDimitry Andric  "The compression level is <level> (if specified) or a default speed-focused level">,
74*0fca6ea1SDimitry Andric  MetaVarName<"<section-glob>={none,zlib,zstd}[:level]">;
75*0fca6ea1SDimitry Andric
760b57cec5SDimitry Andricdefm defsym: Eq<"defsym", "Define a symbol alias">, MetaVarName<"<symbol>=<value>">;
770b57cec5SDimitry Andric
785ffd83dbSDimitry Andricdefm optimize_bb_jumps: BB<"optimize-bb-jumps",
795ffd83dbSDimitry Andric    "Remove direct jumps at the end to the next basic block",
805ffd83dbSDimitry Andric    "Do not remove any direct jumps at the end to the next basic block (default)">;
815ffd83dbSDimitry Andric
82e8d8bef9SDimitry Andricdefm fortran_common : BB<"fortran-common",
83e8d8bef9SDimitry Andric    "Search archive members for definitions to override COMMON symbols (default)",
84e8d8bef9SDimitry Andric    "Do not search archive members for definitions to override COMMON symbols">;
85e8d8bef9SDimitry Andric
860b57cec5SDimitry Andricdefm split_stack_adjust_size
870b57cec5SDimitry Andric    : Eq<"split-stack-adjust-size",
880b57cec5SDimitry Andric         "Specify adjustment to stack size when a split-stack function calls a "
890b57cec5SDimitry Andric         "non-split-stack function">,
900b57cec5SDimitry Andric      MetaVarName<"<value>">;
910b57cec5SDimitry Andric
920b57cec5SDimitry Andricdef O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">;
930b57cec5SDimitry Andric
9406c3fb27SDimitry Andricdef cmse_implib: FF<"cmse-implib">,
9506c3fb27SDimitry Andric  HelpText<"Make the output library to be a CMSE secure code import library">;
9606c3fb27SDimitry Andric
9706c3fb27SDimitry Andricdefm in_implib: EEq<"in-implib",
9806c3fb27SDimitry Andric    "Read an existing CMSE secure code import library and preserve entry function addresses in the "
9906c3fb27SDimitry Andric    "resulting new CMSE secure code import library (optional when creating a CMSE secure image)">,
10006c3fb27SDimitry Andric  MetaVarName<"<file>">;
10106c3fb27SDimitry Andric
10206c3fb27SDimitry Andricdefm out_implib: EEq<"out-implib",
10306c3fb27SDimitry Andric    "Output the CMSE secure code import library to <file> (required when creating a CMSE secure image)">,
10406c3fb27SDimitry Andric  MetaVarName<"<file>">;
10506c3fb27SDimitry Andric
1060b57cec5SDimitry Andricdefm Tbss: Eq<"Tbss", "Same as --section-start with .bss as the sectionname">;
1070b57cec5SDimitry Andric
1080b57cec5SDimitry Andricdefm Tdata: Eq<"Tdata", "Same as --section-start with .data as the sectionname">;
1090b57cec5SDimitry Andric
1100b57cec5SDimitry Andricdefm Ttext: Eq<"Ttext", "Same as --section-start with .text as the sectionname">;
1110b57cec5SDimitry Andric
112480093f4SDimitry Andricdef Ttext_segment: Separate<["-", "--"], "Ttext-segment">;
113480093f4SDimitry Andric
1140b57cec5SDimitry Andricdefm allow_multiple_definition: B<"allow-multiple-definition",
1150b57cec5SDimitry Andric    "Allow multiple definitions",
1160b57cec5SDimitry Andric    "Do not allow multiple definitions (default)">;
1170b57cec5SDimitry Andric
1180b57cec5SDimitry Andricdefm allow_shlib_undefined: B<"allow-shlib-undefined",
1190b57cec5SDimitry Andric    "Allow unresolved references in shared libraries (default when linking a shared library)",
1200b57cec5SDimitry Andric    "Do not allow unresolved references in shared libraries (default when linking an executable)">;
1210b57cec5SDimitry Andric
1225ffd83dbSDimitry Andricdefm apply_dynamic_relocs: BB<"apply-dynamic-relocs",
1230b57cec5SDimitry Andric    "Apply link-time values for dynamic relocations",
1240b57cec5SDimitry Andric    "Do not apply link-time values for dynamic relocations (default)">;
1250b57cec5SDimitry Andric
1265ffd83dbSDimitry Andricdefm dependent_libraries: BB<"dependent-libraries",
1270b57cec5SDimitry Andric    "Process dependent library specifiers from input files (default)",
1280b57cec5SDimitry Andric    "Ignore dependent library specifiers from input files">;
1290b57cec5SDimitry Andric
1300b57cec5SDimitry Andricdefm as_needed: B<"as-needed",
1310b57cec5SDimitry Andric    "Only set DT_NEEDED for shared libraries if used",
1320b57cec5SDimitry Andric    "Always set DT_NEEDED for shared libraries (default)">;
1330b57cec5SDimitry Andric
1340b57cec5SDimitry Andricdefm call_graph_ordering_file:
1350b57cec5SDimitry Andric  Eq<"call-graph-ordering-file", "Layout sections to optimize the given callgraph">;
1360b57cec5SDimitry Andric
1375f757f3fSDimitry Andricdef call_graph_profile_sort: JJ<"call-graph-profile-sort=">,
1385f757f3fSDimitry Andric  HelpText<"Reorder input sections with call graph profile using the specified algorithm (default: cdsort)">,
1395f757f3fSDimitry Andric  MetaVarName<"[none,hfsort,cdsort]">,
1405f757f3fSDimitry Andric  Values<"none,hfsort,cdsort">;
1415f757f3fSDimitry Andricdef : FF<"no-call-graph-profile-sort">, Alias<call_graph_profile_sort>, AliasArgs<["none"]>,
1425f757f3fSDimitry Andric  Flags<[HelpHidden]>;
1430b57cec5SDimitry Andric
144349cc55cSDimitry Andric// --chroot doesn't have a help text because it is an internal option.
145349cc55cSDimitry Andricdef chroot: Separate<["--"], "chroot">;
1460b57cec5SDimitry Andric
147972a253aSDimitry Andricdef color_diagnostics: JJ<"color-diagnostics=">,
148e8d8bef9SDimitry Andric  HelpText<"Use colors in diagnostics (default: auto)">,
1490b57cec5SDimitry Andric  MetaVarName<"[auto,always,never]">;
150972a253aSDimitry Andricdef : Flag<["--"], "color-diagnostics">, Alias<color_diagnostics>, AliasArgs<["always"]>,
151972a253aSDimitry Andric  HelpText<"Alias for --color-diagnostics=always">;
152972a253aSDimitry Andricdef : Flag<["--"], "no-color-diagnostics">, Alias<color_diagnostics>, AliasArgs<["never"]>,
153972a253aSDimitry Andric  HelpText<"Alias for --color-diagnostics=never">;
1540b57cec5SDimitry Andric
1554824e7fdSDimitry Andricdef cref: FF<"cref">,
1564824e7fdSDimitry Andric  HelpText<"Output cross reference table. If -Map is specified, print to the map file">;
1570b57cec5SDimitry Andric
158*0fca6ea1SDimitry Andricdefm debug_names: BB<"debug-names",
159*0fca6ea1SDimitry Andric    "Generate a merged .debug_names section",
160*0fca6ea1SDimitry Andric    "Do not generate a merged .debug_names section (default)">;
161*0fca6ea1SDimitry Andric
162*0fca6ea1SDimitry Andricdefm default_script: EEq<"default-script", "In the absence of --script, read this default linker script">;
163*0fca6ea1SDimitry Andric
1640b57cec5SDimitry Andricdefm demangle: B<"demangle",
1650b57cec5SDimitry Andric    "Demangle symbol names (default)",
1660b57cec5SDimitry Andric    "Do not demangle symbol names">;
1670b57cec5SDimitry Andric
168e8d8bef9SDimitry Andricdefm dependency_file: EEq<"dependency-file", "Write a dependency file">,
169e8d8bef9SDimitry Andric  MetaVarName<"<file>">;
170e8d8bef9SDimitry Andric
1710b57cec5SDimitry Andricdef disable_new_dtags: F<"disable-new-dtags">,
1720b57cec5SDimitry Andric  HelpText<"Disable new dynamic tags">;
1730b57cec5SDimitry Andric
1740b57cec5SDimitry Andricdef discard_all: F<"discard-all">, HelpText<"Delete all local symbols">;
1750b57cec5SDimitry Andric
1760b57cec5SDimitry Andricdef discard_locals: F<"discard-locals">,
1770b57cec5SDimitry Andric  HelpText<"Delete temporary local symbols">;
1780b57cec5SDimitry Andric
1790b57cec5SDimitry Andricdef discard_none: F<"discard-none">,
1800b57cec5SDimitry Andric  HelpText<"Keep all symbols in the symbol table">;
1810b57cec5SDimitry Andric
1820b57cec5SDimitry Andricdefm dynamic_linker: Eq<"dynamic-linker", "Which dynamic linker to use">;
1830b57cec5SDimitry Andric
1845ffd83dbSDimitry Andricdefm dynamic_list : Eq<"dynamic-list",
185349cc55cSDimitry Andric   "Similar to --export-dynamic-symbol-list. When creating a shared object, "
186349cc55cSDimitry Andric   "this additionally implies -Bsymbolic but does not set DF_SYMBOLIC">,
1875ffd83dbSDimitry Andric   MetaVarName<"<file>">;
1880b57cec5SDimitry Andric
189fe6060f1SDimitry Andricdef eb: F<"EB">, HelpText<"Select the big-endian format in OUTPUT_FORMAT">;
190fe6060f1SDimitry Andricdef el: F<"EL">, HelpText<"Select the little-endian format in OUTPUT_FORMAT">;
191fe6060f1SDimitry Andric
1920b57cec5SDimitry Andricdefm eh_frame_hdr: B<"eh-frame-hdr",
1930b57cec5SDimitry Andric    "Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header",
1940b57cec5SDimitry Andric    "Do not create .eh_frame_hdr section">;
1950b57cec5SDimitry Andric
1960b57cec5SDimitry Andricdef emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">;
1970b57cec5SDimitry Andric
1980b57cec5SDimitry Andricdef enable_new_dtags: F<"enable-new-dtags">,
1990b57cec5SDimitry Andric  HelpText<"Enable new dynamic tags (default)">;
2000b57cec5SDimitry Andric
201*0fca6ea1SDimitry Andricdef enable_non_contiguous_regions : FF<"enable-non-contiguous-regions">,
202*0fca6ea1SDimitry Andric  HelpText<"Spill input sections to later matching output sections to avoid memory region overflow">;
203*0fca6ea1SDimitry Andric
2040b57cec5SDimitry Andricdef end_group: F<"end-group">,
2050b57cec5SDimitry Andric  HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">;
2060b57cec5SDimitry Andric
2070b57cec5SDimitry Andricdef end_lib: F<"end-lib">,
2080b57cec5SDimitry Andric  HelpText<"End a grouping of objects that should be treated as if they were together in an archive">;
2090b57cec5SDimitry Andric
2100b57cec5SDimitry Andricdefm entry: Eq<"entry", "Name of entry point symbol">,
2110b57cec5SDimitry Andric  MetaVarName<"<entry>">;
2120b57cec5SDimitry Andric
2130b57cec5SDimitry Andricdefm error_limit:
21481ad6265SDimitry Andric  EEq<"error-limit", "Maximum number of errors to emit before stopping (0 = no limit)">;
2150b57cec5SDimitry Andric
2160b57cec5SDimitry Andricdef error_unresolved_symbols: F<"error-unresolved-symbols">,
2170b57cec5SDimitry Andric  HelpText<"Report unresolved symbols as errors">;
2180b57cec5SDimitry Andric
219e8d8bef9SDimitry Andricdefm error_handling_script: EEq<"error-handling-script",
220e8d8bef9SDimitry Andric    "Specify an error handling script">;
221e8d8bef9SDimitry Andric
2220b57cec5SDimitry Andricdefm exclude_libs: Eq<"exclude-libs", "Exclude static libraries from automatic export">;
2230b57cec5SDimitry Andric
2245ffd83dbSDimitry Andricdefm execute_only: BB<"execute-only",
2250b57cec5SDimitry Andric    "Mark executable sections unreadable",
2260b57cec5SDimitry Andric    "Mark executable sections readable (default)">;
2270b57cec5SDimitry Andric
2280b57cec5SDimitry Andricdefm export_dynamic: B<"export-dynamic",
2290b57cec5SDimitry Andric    "Put symbols in the dynamic symbol table",
2300b57cec5SDimitry Andric    "Do not put symbols in the dynamic symbol table (default)">;
2310b57cec5SDimitry Andric
2325ffd83dbSDimitry Andricdefm export_dynamic_symbol : EEq<"export-dynamic-symbol",
2335ffd83dbSDimitry Andric    "(executable) Put matched symbols in the dynamic symbol table. "
2345ffd83dbSDimitry Andric    "(shared object) References to matched non-local STV_DEFAULT symbols "
2355ffd83dbSDimitry Andric    "shouldn't be bound to definitions within the shared object. "
2365ffd83dbSDimitry Andric    "Does not imply -Bsymbolic.">,
2375ffd83dbSDimitry Andric    MetaVarName<"glob">;
2380b57cec5SDimitry Andric
239349cc55cSDimitry Andricdefm export_dynamic_symbol_list : EEq<"export-dynamic-symbol-list",
240349cc55cSDimitry Andric   "Read a list of dynamic symbol patterns. Apply --export-dynamic-symbol on each pattern">,
241349cc55cSDimitry Andric    MetaVarName<"file">;
242349cc55cSDimitry Andric
2430b57cec5SDimitry Andricdefm fatal_warnings: B<"fatal-warnings",
2440b57cec5SDimitry Andric    "Treat warnings as errors",
2450b57cec5SDimitry Andric    "Do not treat warnings as errors (default)">;
2460b57cec5SDimitry Andric
2470b57cec5SDimitry Andricdefm filter: Eq<"filter", "Set DT_FILTER field to the specified name">;
2480b57cec5SDimitry Andric
2490b57cec5SDimitry Andricdefm fini: Eq<"fini", "Specify a finalizer function">, MetaVarName<"<symbol>">;
2500b57cec5SDimitry Andric
2510b57cec5SDimitry Andricdef fix_cortex_a53_843419: F<"fix-cortex-a53-843419">,
2520b57cec5SDimitry Andric  HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">;
2530b57cec5SDimitry Andric
25485868e8aSDimitry Andricdef fix_cortex_a8: F<"fix-cortex-a8">,
25585868e8aSDimitry Andric  HelpText<"Apply fixes for ARM Cortex-A8 erratum 657417">;
25685868e8aSDimitry Andric
257*0fca6ea1SDimitry Andricdef force_group_allocation: FF<"force-group-allocation">,
258*0fca6ea1SDimitry Andric  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">;
259*0fca6ea1SDimitry Andric
2600b57cec5SDimitry Andricdefm format: Eq<"format", "Change the input format of the inputs following this option">,
2610b57cec5SDimitry Andric  MetaVarName<"[default,elf,binary]">;
2620b57cec5SDimitry Andric
2630b57cec5SDimitry Andricdefm gc_sections: B<"gc-sections",
2640b57cec5SDimitry Andric    "Enable garbage collection of unused sections",
2650b57cec5SDimitry Andric    "Disable garbage collection of unused sections (default)">;
2660b57cec5SDimitry Andric
2675ffd83dbSDimitry Andricdefm gdb_index: BB<"gdb-index",
2680b57cec5SDimitry Andric    "Generate .gdb_index section",
2690b57cec5SDimitry Andric    "Do not generate .gdb_index section (default)">;
2700b57cec5SDimitry Andric
2715ffd83dbSDimitry Andricdefm gnu_unique: BB<"gnu-unique",
2720b57cec5SDimitry Andric  "Enable STB_GNU_UNIQUE symbol binding (default)",
2730b57cec5SDimitry Andric  "Disable STB_GNU_UNIQUE symbol binding">;
2740b57cec5SDimitry Andric
2750b57cec5SDimitry Andricdefm hash_style: Eq<"hash-style", "Specify hash style (sysv, gnu or both)">;
2760b57cec5SDimitry Andric
2770b57cec5SDimitry Andricdef help: F<"help">, HelpText<"Print option help">;
2780b57cec5SDimitry Andric
2790b57cec5SDimitry Andricdef icf_all: F<"icf=all">, HelpText<"Enable identical code folding">;
2800b57cec5SDimitry Andric
2810b57cec5SDimitry Andricdef icf_safe: F<"icf=safe">, HelpText<"Enable safe identical code folding">;
2820b57cec5SDimitry Andric
2830b57cec5SDimitry Andricdef icf_none: F<"icf=none">, HelpText<"Disable identical code folding (default)">;
2840b57cec5SDimitry Andric
285349cc55cSDimitry Andricdef ignore_function_address_equality: FF<"ignore-function-address-equality">,
2860b57cec5SDimitry Andric  HelpText<"lld can break the address equality of functions">;
2870b57cec5SDimitry Andric
288349cc55cSDimitry Andricdef ignore_data_address_equality: FF<"ignore-data-address-equality">,
2890b57cec5SDimitry Andric  HelpText<"lld can break the address equality of data">;
2900b57cec5SDimitry Andric
291349cc55cSDimitry Andricdefm image_base: EEq<"image-base", "Set the base address">;
2920b57cec5SDimitry Andric
2930b57cec5SDimitry Andricdefm init: Eq<"init", "Specify an initializer function">,
2940b57cec5SDimitry Andric  MetaVarName<"<symbol>">;
2950b57cec5SDimitry Andric
2960b57cec5SDimitry Andricdefm just_symbols: Eq<"just-symbols", "Just link symbols">;
2970b57cec5SDimitry Andric
2980b57cec5SDimitry Andricdefm keep_unique: Eq<"keep-unique", "Do not fold this symbol during ICF">;
2990b57cec5SDimitry Andric
3000eae32dcSDimitry Andricdef library: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libname>">,
3010eae32dcSDimitry Andric  HelpText<"Search for library <libname>">;
3020eae32dcSDimitry Andricdef library_path: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
3030eae32dcSDimitry Andric  HelpText<"Add <dir> to the library search path">;
3040b57cec5SDimitry Andric
3050b57cec5SDimitry Andricdef m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
3060b57cec5SDimitry Andric
3070b57cec5SDimitry Andricdefm Map: Eq<"Map", "Print a link map to the specified file">;
3080b57cec5SDimitry Andric
3090b57cec5SDimitry Andricdefm merge_exidx_entries: B<"merge-exidx-entries",
3100b57cec5SDimitry Andric    "Enable merging .ARM.exidx entries (default)",
3110b57cec5SDimitry Andric    "Disable merging .ARM.exidx entries">;
3120b57cec5SDimitry Andric
3135ffd83dbSDimitry Andricdefm mmap_output_file: BB<"mmap-output-file",
314480093f4SDimitry Andric    "Mmap the output file for writing (default)",
315480093f4SDimitry Andric    "Do not mmap the output file for writing">;
316480093f4SDimitry Andric
3170b57cec5SDimitry Andricdef nmagic: F<"nmagic">, MetaVarName<"<magic>">,
3180b57cec5SDimitry Andric  HelpText<"Do not page align sections, link against static libraries.">;
3190b57cec5SDimitry Andric
3200b57cec5SDimitry Andricdef nostdlib: F<"nostdlib">,
3210b57cec5SDimitry Andric  HelpText<"Only search directories specified on the command line">;
3220b57cec5SDimitry Andric
3230b57cec5SDimitry Andricdef no_dynamic_linker: F<"no-dynamic-linker">,
3240b57cec5SDimitry Andric  HelpText<"Inhibit output of .interp section">;
3250b57cec5SDimitry Andric
3260b57cec5SDimitry Andricdef noinhibit_exec: F<"noinhibit-exec">,
3270b57cec5SDimitry Andric  HelpText<"Retain the executable output file whenever it is still usable">;
3280b57cec5SDimitry Andric
329*0fca6ea1SDimitry Andricdef no_warn_mismatch: F<"no-warn-mismatch">,
330*0fca6ea1SDimitry Andric  HelpText<"Suppress errors for certain unknown seciton types">;
331*0fca6ea1SDimitry Andric
3320b57cec5SDimitry Andricdef no_nmagic: F<"no-nmagic">, MetaVarName<"<magic>">,
3330b57cec5SDimitry Andric  HelpText<"Page align sections (default)">;
3340b57cec5SDimitry Andric
3350b57cec5SDimitry Andricdef no_omagic: F<"no-omagic">, MetaVarName<"<magic>">,
3360b57cec5SDimitry Andric  HelpText<"Do not set the text data sections to be writable, page align sections (default)">;
3370b57cec5SDimitry Andric
3380b57cec5SDimitry Andricdef no_undefined: F<"no-undefined">,
3390b57cec5SDimitry Andric  HelpText<"Report unresolved symbols even if the linker is creating a shared library">;
3400b57cec5SDimitry Andric
341bdd1243dSDimitry Andricdef no_warnings: FF<"no-warnings">, HelpText<"Suppress warnings and cancel --fatal-warnings">;
342bdd1243dSDimitry Andricdef : Flag<["-"], "w">, Alias<no_warnings>, HelpText<"Alias for --no-warnings">;
343bdd1243dSDimitry Andric
3440b57cec5SDimitry Andricdef o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
3450b57cec5SDimitry Andric  HelpText<"Path to file to write output">;
3460b57cec5SDimitry Andric
3474824e7fdSDimitry Andricdefm oformat: EEq<"oformat", "Specify the binary format for the output object file">,
3484824e7fdSDimitry Andric  MetaVarName<"[elf,binary]">;
3490b57cec5SDimitry Andric
3505ffd83dbSDimitry Andricdef omagic: FF<"omagic">, MetaVarName<"<magic>">,
3510b57cec5SDimitry Andric  HelpText<"Set the text and data sections to be readable and writable, do not page align sections, link against static libraries">;
3520b57cec5SDimitry Andric
3530b57cec5SDimitry Andricdefm orphan_handling:
3540b57cec5SDimitry Andric  Eq<"orphan-handling", "Control how orphan sections are handled when linker script used">;
3550b57cec5SDimitry Andric
3560b57cec5SDimitry Andricdefm pack_dyn_relocs:
357349cc55cSDimitry Andric  EEq<"pack-dyn-relocs", "Pack dynamic relocations in the given format">,
3580b57cec5SDimitry Andric  MetaVarName<"[none,android,relr,android+relr]">;
3590b57cec5SDimitry Andric
3605ffd83dbSDimitry Andricdefm use_android_relr_tags: BB<"use-android-relr-tags",
3610b57cec5SDimitry Andric    "Use SHT_ANDROID_RELR / DT_ANDROID_RELR* tags instead of SHT_RELR / DT_RELR*",
3620b57cec5SDimitry Andric    "Use SHT_RELR / DT_RELR* tags (default)">;
3630b57cec5SDimitry Andric
3640b57cec5SDimitry Andricdef pic_veneer: F<"pic-veneer">,
3650b57cec5SDimitry Andric  HelpText<"Always generate position independent thunks (veneers)">;
3660b57cec5SDimitry Andric
3670b57cec5SDimitry Andricdefm pie: B<"pie",
3680b57cec5SDimitry Andric    "Create a position independent executable",
3690b57cec5SDimitry Andric    "Do not create a position independent executable (default)">;
3700b57cec5SDimitry Andric
3710b57cec5SDimitry Andricdefm print_gc_sections: B<"print-gc-sections",
3720b57cec5SDimitry Andric    "List removed unused sections",
3730b57cec5SDimitry Andric    "Do not list removed unused sections (default)">;
3740b57cec5SDimitry Andric
3750b57cec5SDimitry Andricdefm print_icf_sections: B<"print-icf-sections",
3760b57cec5SDimitry Andric    "List identical folded sections",
3770b57cec5SDimitry Andric    "Do not list identical folded sections (default)">;
3780b57cec5SDimitry Andric
3795ffd83dbSDimitry Andricdef print_archive_stats: J<"print-archive-stats=">,
3805ffd83dbSDimitry Andric  HelpText<"Write archive usage statistics to the specified file. "
3814824e7fdSDimitry Andric           "Print the numbers of members and extracted members for each archive">;
3825ffd83dbSDimitry Andric
3830b57cec5SDimitry Andricdefm print_symbol_order: Eq<"print-symbol-order",
384480093f4SDimitry Andric  "Print a symbol order specified by --call-graph-ordering-file into the specified file">;
3850b57cec5SDimitry Andric
3860b57cec5SDimitry Andricdef pop_state: F<"pop-state">,
38704eeddc0SDimitry Andric  HelpText<"Restore the states saved by --push-state">;
3880b57cec5SDimitry Andric
3890b57cec5SDimitry Andricdef push_state: F<"push-state">,
39004eeddc0SDimitry Andric  HelpText<"Save the current state of --as-needed, -static and --whole-archive">;
3910b57cec5SDimitry Andric
3920b57cec5SDimitry Andricdef print_map: F<"print-map">,
3930b57cec5SDimitry Andric  HelpText<"Print a link map to the standard output">;
3940b57cec5SDimitry Andric
39506c3fb27SDimitry Andricdef print_memory_usage: F<"print-memory-usage">,
39606c3fb27SDimitry Andric  HelpText<"Report target memory usage">;
39706c3fb27SDimitry Andric
398349cc55cSDimitry Andricdefm relax: BB<"relax",
399349cc55cSDimitry Andric  "Enable target-specific relaxations if supported (default)",
400349cc55cSDimitry Andric  "Disable target-specific relaxations">;
401349cc55cSDimitry Andric
40206c3fb27SDimitry Andricdefm relax_gp: BB<"relax-gp",
40306c3fb27SDimitry Andric  "Enable global pointer relaxation",
40406c3fb27SDimitry Andric  "Disable global pointer relaxation (default)">;
40506c3fb27SDimitry Andric
40606c3fb27SDimitry Andricdefm remap_inputs: EEq<"remap-inputs",
40706c3fb27SDimitry Andric  "Remap input files matching <from-glob> to <to-file>">,
40806c3fb27SDimitry Andric  MetaVarName<"<from-glob>=<to-file>">;
40906c3fb27SDimitry Andric
41006c3fb27SDimitry Andricdef remap_inputs_file: JJ<"remap-inputs-file=">,
41106c3fb27SDimitry Andric  HelpText<"Each line contains 'from-glob=to-file'. An input file matching <from-glob> is remapped to <to-file>">,
41206c3fb27SDimitry Andric  MetaVarName<"<file>">;
41306c3fb27SDimitry Andric
414e8d8bef9SDimitry Andricdefm reproduce:
415349cc55cSDimitry Andric  EEq<"reproduce",
416e8d8bef9SDimitry Andric     "Write tar file containing inputs and command to reproduce link">;
4170b57cec5SDimitry Andric
4185ffd83dbSDimitry Andricdefm rosegment: BB<"rosegment",
4195ffd83dbSDimitry Andric  "Put read-only non-executable sections in their own segment (default)",
4205ffd83dbSDimitry Andric  "Do not put read-only non-executable sections in their own segment">;
4215ffd83dbSDimitry Andric
4220b57cec5SDimitry Andricdefm rpath: Eq<"rpath", "Add a DT_RUNPATH to the output">;
4230b57cec5SDimitry Andric
4240b57cec5SDimitry Andricdef relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
4250b57cec5SDimitry Andric
4260b57cec5SDimitry Andricdefm retain_symbols_file:
4270b57cec5SDimitry Andric  Eq<"retain-symbols-file", "Retain only the symbols listed in the file">,
4280b57cec5SDimitry Andric  MetaVarName<"<file>">;
4290b57cec5SDimitry Andric
4300b57cec5SDimitry Andricdefm script: Eq<"script", "Read linker script">;
4310b57cec5SDimitry Andric
4320b57cec5SDimitry Andricdefm section_start: Eq<"section-start", "Set address of section">,
4330b57cec5SDimitry Andric  MetaVarName<"<address>">;
4340b57cec5SDimitry Andric
4350b57cec5SDimitry Andricdef shared: F<"shared">, HelpText<"Build a shared object">;
4360b57cec5SDimitry Andric
4370b57cec5SDimitry Andricdefm soname: Eq<"soname", "Set DT_SONAME">;
4380b57cec5SDimitry Andric
4390b57cec5SDimitry Andricdefm sort_section:
4400b57cec5SDimitry Andric  Eq<"sort-section", "Specifies sections sorting rule when linkerscript is used">;
4410b57cec5SDimitry Andric
4420b57cec5SDimitry Andricdef start_group: F<"start-group">,
4430b57cec5SDimitry Andric  HelpText<"Ignored for compatibility with GNU unless you pass --warn-backrefs">;
4440b57cec5SDimitry Andric
4450b57cec5SDimitry Andricdef start_lib: F<"start-lib">,
4460b57cec5SDimitry Andric  HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">;
4470b57cec5SDimitry Andric
448fe6060f1SDimitry Andricdef strip_all: F<"strip-all">, HelpText<"Strip all symbols. Implies --strip-debug">;
4490b57cec5SDimitry Andric
4500b57cec5SDimitry Andricdef strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">;
4510b57cec5SDimitry Andric
4520b57cec5SDimitry Andricdefm symbol_ordering_file:
45304eeddc0SDimitry Andric  EEq<"symbol-ordering-file", "Layout sections to place symbols in the order specified by symbol ordering file">;
4540b57cec5SDimitry Andric
4550b57cec5SDimitry Andricdefm sysroot: Eq<"sysroot", "Set the system root">;
4560b57cec5SDimitry Andric
4570b57cec5SDimitry Andricdef target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">;
4580b57cec5SDimitry Andric
4590b57cec5SDimitry Andricdef target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32 (default)">;
4600b57cec5SDimitry Andric
4610b57cec5SDimitry Andricdefm target2:
4620b57cec5SDimitry Andric  Eq<"target2", "Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">,
4630b57cec5SDimitry Andric  MetaVarName<"<type>">;
4640b57cec5SDimitry Andric
4655ffd83dbSDimitry Andricdefm threads
466349cc55cSDimitry Andric    : EEq<"threads",
4675ffd83dbSDimitry Andric         "Number of threads. '1' disables multi-threading. By default all "
4685ffd83dbSDimitry Andric         "available hardware threads are used">;
4695ffd83dbSDimitry Andric
47081ad6265SDimitry Andricdef time_trace_eq: JJ<"time-trace=">, MetaVarName<"<file>">,
47181ad6265SDimitry Andric  HelpText<"Record time trace to <file>">;
47281ad6265SDimitry Andricdef : FF<"time-trace">, Alias<time_trace_eq>,
47381ad6265SDimitry Andric  HelpText<"Record time trace to file next to output">;
4745ffd83dbSDimitry Andric
475e8d8bef9SDimitry Andricdefm time_trace_granularity: EEq<"time-trace-granularity",
4765ffd83dbSDimitry Andric  "Minimum time granularity (in microseconds) traced by time profiler">;
4770b57cec5SDimitry Andric
478e8d8bef9SDimitry Andricdefm toc_optimize : BB<"toc-optimize",
4790b57cec5SDimitry Andric    "(PowerPC64) Enable TOC related optimizations (default)",
4800b57cec5SDimitry Andric    "(PowerPC64) Disable TOC related optimizations">;
4810b57cec5SDimitry Andric
482e8d8bef9SDimitry Andricdefm pcrel_optimize : BB<"pcrel-optimize",
483e8d8bef9SDimitry Andric    "(PowerPC64) Enable PC-relative optimizations (default)",
484e8d8bef9SDimitry Andric    "(PowerPC64) Disable PC-relative optimizations">;
485e8d8bef9SDimitry Andric
4860b57cec5SDimitry Andricdef trace: F<"trace">, HelpText<"Print the names of the input files">;
4870b57cec5SDimitry Andric
4880b57cec5SDimitry Andricdefm trace_symbol: Eq<"trace-symbol", "Trace references to symbols">;
4890b57cec5SDimitry Andric
4900b57cec5SDimitry Andricdefm undefined: Eq<"undefined", "Force undefined symbol during linking">,
4910b57cec5SDimitry Andric  MetaVarName<"<symbol>">;
4920b57cec5SDimitry Andric
493e8d8bef9SDimitry Andricdefm undefined_glob: EEq<"undefined-glob", "Force undefined symbol during linking">,
4940b57cec5SDimitry Andric  MetaVarName<"<pattern>">;
4950b57cec5SDimitry Andric
4965ffd83dbSDimitry Andricdef unique: F<"unique">, HelpText<"Creates a separate output section for every orphan input section">;
4975ffd83dbSDimitry Andric
4980b57cec5SDimitry Andricdefm unresolved_symbols:
4990b57cec5SDimitry Andric  Eq<"unresolved-symbols", "Determine how to handle unresolved symbols">;
5000b57cec5SDimitry Andric
5010b57cec5SDimitry Andricdefm undefined_version: B<"undefined-version",
502bdd1243dSDimitry Andric  "Allow unused version in version script (disabled by default)",
5030b57cec5SDimitry Andric  "Report version scripts that refer undefined symbols">;
5040b57cec5SDimitry Andric
50504eeddc0SDimitry Andricdefm rsp_quoting: EEq<"rsp-quoting", "Quoting style for response files">,
5060b57cec5SDimitry Andric  MetaVarName<"[posix,windows]">;
5070b57cec5SDimitry Andric
5080b57cec5SDimitry Andricdef v: Flag<["-"], "v">, HelpText<"Display the version number">;
5090b57cec5SDimitry Andric
5100b57cec5SDimitry Andricdef verbose: F<"verbose">, HelpText<"Verbose mode">;
5110b57cec5SDimitry Andric
5120b57cec5SDimitry Andricdef version: F<"version">, HelpText<"Display the version number and exit">;
5130b57cec5SDimitry Andric
5144824e7fdSDimitry Andricdef power10_stubs_eq: JJ<"power10-stubs=">, MetaVarName<"<mode>">,
5154824e7fdSDimitry Andric  HelpText<"Whether to use Power10 instructions in call stubs for R_PPC64_REL24_NOTOC and TOC/NOTOC "
5164824e7fdSDimitry Andric  "interworking (yes (default): use; no: don't use). \"auto\" is currently the same as \"yes\"">;
5174824e7fdSDimitry Andricdef power10_stubs: FF<"power10-stubs">, Alias<power10_stubs_eq>, AliasArgs<["yes"]>,
5184824e7fdSDimitry Andric  HelpText<"Alias for --power10-stubs=auto">;
5194824e7fdSDimitry Andricdef no_power10_stubs: FF<"no-power10-stubs">, Alias<power10_stubs_eq>, AliasArgs<["no"]>,
5204824e7fdSDimitry Andric  HelpText<"Alias for --power10-stubs=no">;
521fe6060f1SDimitry Andric
5220b57cec5SDimitry Andricdefm version_script: Eq<"version-script", "Read a version script">;
5230b57cec5SDimitry Andric
5245ffd83dbSDimitry Andricdefm warn_backrefs: BB<"warn-backrefs",
5254824e7fdSDimitry Andric    "Warn about backward symbol references to extract archive members",
5264824e7fdSDimitry Andric    "Do not warn about backward symbol references to extract archive members (default)">;
5270b57cec5SDimitry Andric
5285ffd83dbSDimitry Andricdefm warn_backrefs_exclude
5295ffd83dbSDimitry Andric    : EEq<"warn-backrefs-exclude",
5305ffd83dbSDimitry Andric         "Glob describing an archive (or an object file within --start-lib) "
5315ffd83dbSDimitry Andric         "which should be ignored for --warn-backrefs.">,
5325ffd83dbSDimitry Andric      MetaVarName<"<glob>">;
5335ffd83dbSDimitry Andric
5340b57cec5SDimitry Andricdefm warn_common: B<"warn-common",
5350b57cec5SDimitry Andric    "Warn about duplicate common symbols",
5360b57cec5SDimitry Andric    "Do not warn about duplicate common symbols (default)">;
5370b57cec5SDimitry Andric
5385ffd83dbSDimitry Andricdefm warn_ifunc_textrel: BB<"warn-ifunc-textrel",
5390b57cec5SDimitry Andric    "Warn about using ifunc symbols with text relocations",
5400b57cec5SDimitry Andric    "Do not warn about using ifunc symbols with text relocations (default)">;
5410b57cec5SDimitry Andric
5425ffd83dbSDimitry Andricdefm warn_symbol_ordering: BB<"warn-symbol-ordering",
5430b57cec5SDimitry Andric    "Warn about problems with the symbol ordering file (default)",
5440b57cec5SDimitry Andric    "Do not warn about problems with the symbol ordering file">;
5450b57cec5SDimitry Andric
5460b57cec5SDimitry Andricdef warn_unresolved_symbols: F<"warn-unresolved-symbols">,
5470b57cec5SDimitry Andric  HelpText<"Report unresolved symbols as warnings">;
5480b57cec5SDimitry Andric
5490b57cec5SDimitry Andricdefm whole_archive: B<"whole-archive",
5500b57cec5SDimitry Andric    "Force load of all members in a static library",
5510b57cec5SDimitry Andric    "Do not force load of all members in a static library (default)">;
5520b57cec5SDimitry Andric
553349cc55cSDimitry Andricdef why_extract: JJ<"why-extract=">, HelpText<"Print to a file about why archive members are extracted">;
554349cc55cSDimitry Andric
555e8d8bef9SDimitry Andricdefm wrap : Eq<"wrap", "Redirect symbol references to __wrap_symbol and "
556e8d8bef9SDimitry Andric                       "__real_symbol references to symbol">,
557e8d8bef9SDimitry Andric            MetaVarName<"<symbol>">;
5580b57cec5SDimitry Andric
5590b57cec5SDimitry Andricdef z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">,
5600b57cec5SDimitry Andric  HelpText<"Linker option extensions">;
5610b57cec5SDimitry Andric
562349cc55cSDimitry Andricdef visual_studio_diagnostics_format : FF<"vs-diagnostics">,
563480093f4SDimitry AndricHelpText<"Format diagnostics for Visual Studio compatibility">;
5640b57cec5SDimitry Andric
56561cfbce3SDimitry Andricdef package_metadata: JJ<"package-metadata=">, HelpText<"Emit package metadata note">;
56661cfbce3SDimitry Andric
5670b57cec5SDimitry Andric// Aliases
568*0fca6ea1SDimitry Andricdef: Separate<["-"], "dT">, Alias<default_script>, HelpText<"Alias for --default-script">;
5690b57cec5SDimitry Andricdef: Separate<["-"], "f">, Alias<auxiliary>, HelpText<"Alias for --auxiliary">;
5700b57cec5SDimitry Andricdef: F<"call_shared">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
5710b57cec5SDimitry Andricdef: F<"dy">, Alias<Bdynamic>, HelpText<"Alias for --Bdynamic">;
5720b57cec5SDimitry Andricdef: F<"dn">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
5730b57cec5SDimitry Andricdef: F<"non_shared">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
5740b57cec5SDimitry Andricdef: F<"static">, Alias<Bstatic>, HelpText<"Alias for --Bstatic">;
5750b57cec5SDimitry Andricdef: Flag<["-"], "x">, Alias<discard_all>, HelpText<"Alias for --discard-all">;
5760b57cec5SDimitry Andricdef: Flag<["-"], "X">, Alias<discard_locals>, HelpText<"Alias for --discard-locals">;
5770b57cec5SDimitry Andricdef: Flag<["-"], "q">, Alias<emit_relocs>, HelpText<"Alias for --emit-relocs">;
5780b57cec5SDimitry Andricdef: Flag<["-"], ")">, Alias<end_group>, HelpText<"Alias for --end-group">;
5790b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "e">, Alias<entry>, HelpText<"Alias for --entry">;
5800b57cec5SDimitry Andricdef: Flag<["-"], "E">, Alias<export_dynamic>, HelpText<"Alias for --export-dynamic">;
5810b57cec5SDimitry Andricdef: Separate<["-"], "F">, Alias<filter>, HelpText<"Alias for --filter">;
5820b57cec5SDimitry Andricdef: Separate<["-"], "b">, Alias<format>, HelpText<"Alias for --format">;
5830eae32dcSDimitry Andricdef: Separate<["--", "-"], "library">, Alias<library>;
5840eae32dcSDimitry Andricdef: Joined<["--", "-"], "library=">, Alias<library>;
5850eae32dcSDimitry Andricdef: Separate<["--", "-"], "library-path">, Alias<library_path>;
5860eae32dcSDimitry Andricdef: Joined<["--", "-"], "library-path=">, Alias<library_path>;
5870b57cec5SDimitry Andricdef: Flag<["-"], "n">, Alias<nmagic>, HelpText<"Alias for --nmagic">;
5880b57cec5SDimitry Andricdef: Flag<["-"], "N">, Alias<omagic>, HelpText<"Alias for --omagic">;
5890b57cec5SDimitry Andricdef: Joined<["--"], "output=">, Alias<o>, HelpText<"Alias for -o">;
5900b57cec5SDimitry Andricdef: Separate<["--"], "output">, Alias<o>, HelpText<"Alias for -o">;
5910b57cec5SDimitry Andricdef: F<"pic-executable">, Alias<pie>, HelpText<"Alias for --pie">;
5920b57cec5SDimitry Andricdef: Flag<["-"], "M">, Alias<print_map>, HelpText<"Alias for --print-map">;
5930b57cec5SDimitry Andricdef: Flag<["-"], "r">, Alias<relocatable>, HelpText<"Alias for --relocatable">;
5940b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "R">, Alias<rpath>, HelpText<"Alias for --rpath">;
5950b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "T">, Alias<script>, HelpText<"Alias for --script">;
5960b57cec5SDimitry Andricdef: F<"Bshareable">, Alias<shared>, HelpText<"Alias for --shared">;
5970b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "h">, Alias<soname>, HelpText<"Alias for --soname">;
5980b57cec5SDimitry Andricdef: Flag<["-"], "(">, Alias<start_group>, HelpText<"Alias for --start-group">;
5990b57cec5SDimitry Andricdef: Flag<["-"], "s">, Alias<strip_all>, HelpText<"Alias for --strip-all">;
6000b57cec5SDimitry Andricdef: Flag<["-"], "S">, Alias<strip_debug>, HelpText<"Alias for --strip-debug">;
6010b57cec5SDimitry Andricdef: Flag<["-"], "t">, Alias<trace>, HelpText<"Alias for --trace">;
602480093f4SDimitry Andricdef: Joined<["-", "--"], "Ttext-segment=">, Alias<Ttext_segment>;
6030b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>, HelpText<"Alias for --trace-symbol">;
6040b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "u">, Alias<undefined>, HelpText<"Alias for --undefined">;
605bdd1243dSDimitry Andricdef: Flag<["-"], "V">, Alias<v>, HelpText<"Alias for -v">;
6060b57cec5SDimitry Andric
6070b57cec5SDimitry Andric// LTO-related options.
60806c3fb27SDimitry Andric
60906c3fb27SDimitry Andricdef lto: JJ<"lto=">, HelpText<"Set LTO backend">,
61006c3fb27SDimitry Andric                 MetaVarName<"[full,thin]">;
6115ffd83dbSDimitry Andricdef lto_aa_pipeline: JJ<"lto-aa-pipeline=">,
6120b57cec5SDimitry Andric  HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">;
6135ffd83dbSDimitry Andricdef lto_debug_pass_manager: FF<"lto-debug-pass-manager">,
6140b57cec5SDimitry Andric  HelpText<"Debug new pass manager">;
6155ffd83dbSDimitry Andricdef lto_emit_asm: FF<"lto-emit-asm">,
6165ffd83dbSDimitry Andric  HelpText<"Emit assembly code">;
617*0fca6ea1SDimitry Andricdef lto_emit_llvm: FF<"lto-emit-llvm">,
618*0fca6ea1SDimitry Andric  HelpText<"Emit LLVM-IR bitcode">;
6195ffd83dbSDimitry Andricdef lto_newpm_passes: JJ<"lto-newpm-passes=">,
6200b57cec5SDimitry Andric  HelpText<"Passes to run during LTO">;
6215ffd83dbSDimitry Andricdef lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
6220b57cec5SDimitry Andric  HelpText<"Optimization level for LTO">;
62306c3fb27SDimitry Andricdef lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">,
62406c3fb27SDimitry Andric  HelpText<"Codegen optimization level for LTO">;
6255ffd83dbSDimitry Andricdef lto_partitions: JJ<"lto-partitions=">,
6260b57cec5SDimitry Andric  HelpText<"Number of LTO codegen partitions">;
6275ffd83dbSDimitry Andricdef lto_cs_profile_generate: FF<"lto-cs-profile-generate">,
628480093f4SDimitry Andric  HelpText<"Perform context sensitive PGO instrumentation">;
6295ffd83dbSDimitry Andricdef lto_cs_profile_file: JJ<"lto-cs-profile-file=">,
6300b57cec5SDimitry Andric  HelpText<"Context sensitive profile file path">;
631349cc55cSDimitry Andricdefm lto_pgo_warn_mismatch: BB<"lto-pgo-warn-mismatch",
63206c3fb27SDimitry Andric  "turn on warnings about profile cfg mismatch (default)",
633349cc55cSDimitry Andric  "turn off warnings about profile cfg mismatch">;
6345f757f3fSDimitry Andricdefm lto_known_safe_vtables : EEq<"lto-known-safe-vtables",
6355f757f3fSDimitry Andric  "When --lto-validate-all-vtables-have-type-infos is enabled, skip validation on these vtables (_ZTV symbols)">;
6365ffd83dbSDimitry Andricdef lto_obj_path_eq: JJ<"lto-obj-path=">;
6375ffd83dbSDimitry Andricdef lto_sample_profile: JJ<"lto-sample-profile=">,
6380b57cec5SDimitry Andric  HelpText<"Sample profile file path">;
6395f757f3fSDimitry Andricdefm lto_validate_all_vtables_have_type_infos: BB<"lto-validate-all-vtables-have-type-infos",
6405f757f3fSDimitry Andric  "Validate that all vtables have type infos for LTO link",
6415f757f3fSDimitry Andric  "Do not validate that all vtables have type infos for LTO link">;
642e8d8bef9SDimitry Andricdefm lto_whole_program_visibility: BB<"lto-whole-program-visibility",
643e8d8bef9SDimitry Andric  "Asserts that the LTO link has whole program visibility",
644e8d8bef9SDimitry Andric  "Asserts that the LTO link does not have whole program visibility">;
6450b57cec5SDimitry Andricdef disable_verify: F<"disable-verify">;
6460b57cec5SDimitry Andricdefm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;
6470b57cec5SDimitry Andricdef opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
6480b57cec5SDimitry Andric  HelpText<"YAML output file for optimization remarks">;
649e8d8bef9SDimitry Andricdefm opt_remarks_hotness_threshold: EEq<"opt-remarks-hotness-threshold",
650e8d8bef9SDimitry Andric  "Minimum profile count required for an optimization remark to be output."
651e8d8bef9SDimitry Andric  " Use 'auto' to apply the threshold from profile summary.">,
652e8d8bef9SDimitry Andric  MetaVarName<"<value>">;
6530b57cec5SDimitry Andricdef opt_remarks_passes: Separate<["--"], "opt-remarks-passes">,
6540b57cec5SDimitry Andric  HelpText<"Regex for the passes that need to be serialized to the output file">;
6555ffd83dbSDimitry Andricdef opt_remarks_with_hotness: FF<"opt-remarks-with-hotness">,
6560b57cec5SDimitry Andric  HelpText<"Include hotness information in the optimization remarks file">;
6570b57cec5SDimitry Andricdef opt_remarks_format: Separate<["--"], "opt-remarks-format">,
6580b57cec5SDimitry Andric  HelpText<"The format used for serializing remarks (default: YAML)">;
659e8d8bef9SDimitry Andricdef save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">;
660753f127fSDimitry Andricdef save_temps_eq: JJ<"save-temps=">, HelpText<"Save select intermediate LTO compilation results">,
661753f127fSDimitry Andric  Values<"resolution,preopt,promote,internalize,import,opt,precodegen,prelink,combinedindex">;
662e8d8bef9SDimitry Andricdef lto_basic_block_sections: JJ<"lto-basic-block-sections=">,
6635ffd83dbSDimitry Andric  HelpText<"Enable basic block sections for LTO">;
664*0fca6ea1SDimitry Andricdefm lto_basic_block_address_map: BB<"lto-basic-block-address-map",
665*0fca6ea1SDimitry Andric  "Emit basic block address map for LTO",
666*0fca6ea1SDimitry Andric  "Do not emit basic block address map for LTO (default)">;
667e8d8bef9SDimitry Andricdefm lto_unique_basic_block_section_names: BB<"lto-unique-basic-block-section-names",
6685ffd83dbSDimitry Andric    "Give unique names to every basic block section for LTO",
6695ffd83dbSDimitry Andric    "Do not give unique names to every basic block section for LTO (default)">;
670fe6060f1SDimitry Andricdefm shuffle_sections: EEq<"shuffle-sections",
671fe6060f1SDimitry Andric  "Shuffle matched sections using the given seed before mapping them to the output sections. "
672fe6060f1SDimitry Andric  "If -1, reverse the section order. If 0, use a random seed">,
673fe6060f1SDimitry Andric  MetaVarName<"<section-glob>=<seed>">;
6745ffd83dbSDimitry Andricdef thinlto_cache_dir: JJ<"thinlto-cache-dir=">,
6750b57cec5SDimitry Andric  HelpText<"Path to ThinLTO cached object file directory">;
6765ffd83dbSDimitry Andricdefm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
6775ffd83dbSDimitry Andricdef thinlto_emit_imports_files: FF<"thinlto-emit-imports-files">;
67881ad6265SDimitry Andricdef thinlto_emit_index_files: FF<"thinlto-emit-index-files">;
6795ffd83dbSDimitry Andricdef thinlto_index_only: FF<"thinlto-index-only">;
6805ffd83dbSDimitry Andricdef thinlto_index_only_eq: JJ<"thinlto-index-only=">;
681bdd1243dSDimitry Andricdef thinlto_jobs_eq: JJ<"thinlto-jobs=">,
6825ffd83dbSDimitry Andric  HelpText<"Number of ThinLTO jobs. Default to --threads=">;
6835ffd83dbSDimitry Andricdef thinlto_object_suffix_replace_eq: JJ<"thinlto-object-suffix-replace=">;
6845ffd83dbSDimitry Andricdef thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">;
6855ffd83dbSDimitry Andricdef thinlto_single_module_eq: JJ<"thinlto-single-module=">,
686bdd1243dSDimitry Andric  HelpText<"Specify a single module to compile in ThinLTO mode, for debugging only">;
6870b57cec5SDimitry Andric
6885f757f3fSDimitry Andricdefm fat_lto_objects: BB<"fat-lto-objects",
6895f757f3fSDimitry Andric    "Use the .llvm.lto section, which contains LLVM bitcode, in fat LTO object files to perform LTO.",
6905f757f3fSDimitry Andric    "Ignore the .llvm.lto section in relocatable object files (default).">;
6915f757f3fSDimitry Andric
6925ffd83dbSDimitry Andricdef: J<"plugin-opt=O">, Alias<lto_O>, HelpText<"Alias for --lto-O">;
6930b57cec5SDimitry Andricdef: F<"plugin-opt=debug-pass-manager">,
6945ffd83dbSDimitry Andric  Alias<lto_debug_pass_manager>, HelpText<"Alias for --lto-debug-pass-manager">;
6955ffd83dbSDimitry Andricdef: F<"plugin-opt=disable-verify">, Alias<disable_verify>, HelpText<"Alias for --disable-verify">;
6960b57cec5SDimitry Andricdef plugin_opt_dwo_dir_eq: J<"plugin-opt=dwo_dir=">,
6970b57cec5SDimitry Andric  HelpText<"Directory to store .dwo files when LTO and debug fission are used">;
6985ffd83dbSDimitry Andricdef plugin_opt_emit_asm: F<"plugin-opt=emit-asm">,
6995ffd83dbSDimitry Andric  Alias<lto_emit_asm>, HelpText<"Alias for --lto-emit-asm">;
700*0fca6ea1SDimitry Andricdef plugin_opt_emit_llvm: F<"plugin-opt=emit-llvm">,
701*0fca6ea1SDimitry Andric  Alias<lto_emit_llvm>, HelpText<"Alias for --lto-emit-llvm">;
702bdd1243dSDimitry Andricdef: J<"plugin-opt=jobs=">, Alias<thinlto_jobs_eq>, HelpText<"Alias for --thinlto-jobs=">;
7035ffd83dbSDimitry Andricdef: J<"plugin-opt=lto-partitions=">, Alias<lto_partitions>, HelpText<"Alias for --lto-partitions">;
7040b57cec5SDimitry Andricdef plugin_opt_mcpu_eq: J<"plugin-opt=mcpu=">;
7050b57cec5SDimitry Andricdef: F<"plugin-opt=cs-profile-generate">,
7065ffd83dbSDimitry Andric  Alias<lto_cs_profile_generate>, HelpText<"Alias for --lto-cs-profile-generate">;
7070b57cec5SDimitry Andricdef: J<"plugin-opt=cs-profile-path=">,
7085ffd83dbSDimitry Andric  Alias<lto_cs_profile_file>, HelpText<"Alias for --lto-cs-profile-file">;
70985868e8aSDimitry Andricdef: J<"plugin-opt=obj-path=">,
71085868e8aSDimitry Andric  Alias<lto_obj_path_eq>,
7115ffd83dbSDimitry Andric  HelpText<"Alias for --lto-obj-path=">;
712e8d8bef9SDimitry Andricdef: J<"plugin-opt=opt-remarks-filename=">,
713e8d8bef9SDimitry Andric  Alias<opt_remarks_filename>,
714e8d8bef9SDimitry Andric  HelpText<"Alias for --opt-remarks-filename">;
715e8d8bef9SDimitry Andricdef: J<"plugin-opt=opt-remarks-passes=">,
716e8d8bef9SDimitry Andric  Alias<opt_remarks_passes>,
717e8d8bef9SDimitry Andric  HelpText<"Alias for --opt-remarks-passes">;
718e8d8bef9SDimitry Andricdef: J<"plugin-opt=opt-remarks-format=">,
719e8d8bef9SDimitry Andric  Alias<opt_remarks_format>,
720e8d8bef9SDimitry Andric  HelpText<"Alias for --opt-remarks-format">;
721e8d8bef9SDimitry Andricdef: F<"plugin-opt=opt-remarks-with-hotness">,
722e8d8bef9SDimitry Andric  Alias<opt_remarks_with_hotness>,
723e8d8bef9SDimitry Andric  HelpText<"Alias for --opt-remarks-with_hotness">;
724e8d8bef9SDimitry Andricdef: J<"plugin-opt=opt-remarks-hotness-threshold=">,
725e8d8bef9SDimitry Andric  Alias<opt_remarks_hotness_threshold>,
726e8d8bef9SDimitry Andric  HelpText<"Alias for --opt-remarks-hotness-threshold">;
7270b57cec5SDimitry Andricdef: J<"plugin-opt=sample-profile=">,
7285ffd83dbSDimitry Andric  Alias<lto_sample_profile>, HelpText<"Alias for --lto-sample-profile">;
7295ffd83dbSDimitry Andricdef: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for --save-temps">;
73081ad6265SDimitry Andricdef plugin_opt_stats_file: J<"plugin-opt=stats-file=">,
73181ad6265SDimitry Andric  HelpText<"Filename to write LTO statistics to">;
73285868e8aSDimitry Andricdef: F<"plugin-opt=thinlto-emit-imports-files">,
73385868e8aSDimitry Andric  Alias<thinlto_emit_imports_files>,
7345ffd83dbSDimitry Andric  HelpText<"Alias for --thinlto-emit-imports-files">;
73585868e8aSDimitry Andricdef: F<"plugin-opt=thinlto-index-only">,
73685868e8aSDimitry Andric  Alias<thinlto_index_only>,
7375ffd83dbSDimitry Andric  HelpText<"Alias for --thinlto-index-only">;
73885868e8aSDimitry Andricdef: J<"plugin-opt=thinlto-index-only=">,
73985868e8aSDimitry Andric  Alias<thinlto_index_only_eq>,
7405ffd83dbSDimitry Andric  HelpText<"Alias for --thinlto-index-only=">;
74185868e8aSDimitry Andricdef: J<"plugin-opt=thinlto-object-suffix-replace=">,
74285868e8aSDimitry Andric Alias<thinlto_object_suffix_replace_eq>,
7435ffd83dbSDimitry Andric HelpText<"Alias for --thinlto-object-suffix-replace=">;
74485868e8aSDimitry Andricdef: J<"plugin-opt=thinlto-prefix-replace=">,
74585868e8aSDimitry Andric  Alias<thinlto_prefix_replace_eq>,
7465ffd83dbSDimitry Andric  HelpText<"Alias for --thinlto-prefix-replace=">;
7470b57cec5SDimitry Andric
7480b57cec5SDimitry Andric// Ignore LTO plugin-related options.
7490b57cec5SDimitry Andric// clang -flto passes -plugin and -plugin-opt to the linker. This is required
7500b57cec5SDimitry Andric// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't
7510b57cec5SDimitry Andric// rely on a plugin. Instead of detecting which linker is used on clang side we
7520b57cec5SDimitry Andric// just ignore the option on lld side as it's easier. In fact, the linker could
7530b57cec5SDimitry Andric// be called 'ld' and understanding which linker is used would require parsing of
7540b57cec5SDimitry Andric// --version output.
7550b57cec5SDimitry Andricdefm plugin: Eq<"plugin", "Ignored for compatibility with GNU linkers">;
7560b57cec5SDimitry Andric
7575ffd83dbSDimitry Andricdef plugin_opt_eq_minus: J<"plugin-opt=-">,
7585ffd83dbSDimitry Andric  HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">;
7595ffd83dbSDimitry Andricdef: J<"plugin-opt=thinlto">;
7605ffd83dbSDimitry Andric
7615ffd83dbSDimitry Andric// Ignore GCC collect2 LTO plugin related options. Note that we don't support
7625ffd83dbSDimitry Andric// GCC LTO, but GCC collect2 passes these options even in non-LTO mode.
7635ffd83dbSDimitry Andricdef: J<"plugin-opt=-fresolution=">;
7645ffd83dbSDimitry Andricdef: J<"plugin-opt=-pass-through=">;
7655ffd83dbSDimitry Andric// This may be either an unhandled LLVMgold.so feature or GCC passed
7665ffd83dbSDimitry Andric// -plugin-opt=path/to/{liblto_plugin.so,lto-wrapper}
7675ffd83dbSDimitry Andricdef plugin_opt_eq : J<"plugin-opt=">;
7680b57cec5SDimitry Andric
7690b57cec5SDimitry Andric// Options listed below are silently ignored for now for compatibility.
77081ad6265SDimitry Andricdef: Flag<["-"], "d">;
7710b57cec5SDimitry Andricdef: Flag<["-"], "g">;
7720b57cec5SDimitry Andricdef: F<"long-plt">;
7732a66634dSDimitry Andricdef: FF<"no-add-needed">;
7740b57cec5SDimitry Andricdef: F<"no-copy-dt-needed-entries">;
7750b57cec5SDimitry Andricdef: F<"no-ctors-in-init-array">;
7760b57cec5SDimitry Andricdef: F<"no-keep-memory">;
7770b57cec5SDimitry Andricdef: Separate<["--", "-"], "rpath-link">;
7780b57cec5SDimitry Andricdef: J<"rpath-link=">;
7790b57cec5SDimitry Andricdef: F<"secure-plt">;
7800b57cec5SDimitry Andricdef: F<"sort-common">;
7810b57cec5SDimitry Andricdef: F<"stats">;
7820b57cec5SDimitry Andricdef: F<"warn-execstack">;
7830b57cec5SDimitry Andricdef: F<"warn-once">;
7840b57cec5SDimitry Andricdef: F<"warn-shared-textrel">;
7850b57cec5SDimitry Andricdef: JoinedOrSeparate<["-"], "G">;
7860b57cec5SDimitry Andric
7870b57cec5SDimitry Andric// Hidden option used for testing MIPS multi-GOT implementation.
7880b57cec5SDimitry Andricdefm mips_got_size:
7890b57cec5SDimitry Andric  Eq<"mips-got-size", "Max size of a single MIPS GOT. 0x10000 by default.">,
7900b57cec5SDimitry Andric  Flags<[HelpHidden]>;
791fe6060f1SDimitry Andric
792fe6060f1SDimitry Andric// Hidden option used to opt-in to additional output checks.
793fe6060f1SDimitry Andricdefm check_dynamic_relocations: BB<"check-dynamic-relocations",
794fe6060f1SDimitry Andric    "Perform additional validation of the written dynamic relocations",
795fe6060f1SDimitry Andric    "Do not perform additional validation of the written dynamic relocations">,
796fe6060f1SDimitry Andric  Flags<[HelpHidden]>;
79781ad6265SDimitry Andric
79881ad6265SDimitry Andricdefm load_pass_plugins: EEq<"load-pass-plugin", "Load passes from plugin library">;
79981ad6265SDimitry Andric
80081ad6265SDimitry Andric// Hidden options, used by clang's -fsanitize=memtag-* options to emit an ELF
80181ad6265SDimitry Andric// note to designate what kinds of memory (stack/heap) should be protected using
80281ad6265SDimitry Andric// ARM's MTE on armv8.5+. A binary's desire for stack MTE can't be obtained
80381ad6265SDimitry Andric// implicitly, so we have a specific bit in the note to signal to the loader to
80481ad6265SDimitry Andric// remap the stack as PROT_MTE.
80581ad6265SDimitry Andricdefm android_memtag_stack: BB<"android-memtag-stack",
80681ad6265SDimitry Andric    "Instruct the dynamic loader to prepare for MTE stack instrumentation", "">;
80781ad6265SDimitry Andricdefm android_memtag_heap: BB<"android-memtag-heap",
80881ad6265SDimitry Andric    "Instruct the dynamic loader to enable MTE protection for the heap", "">;
80981ad6265SDimitry Andricdefm android_memtag_mode: EEq<"android-memtag-mode",
81081ad6265SDimitry Andric    "Instruct the dynamic loader to start under MTE mode {async, sync, none}">;
811