Options.td revision 327952
1include "llvm/Option/OptParser.td" 2 3// For options whose names are multiple letters, either one dash or 4// two can precede the option name except those that start with 'o'. 5class F<string name>: Flag<["--", "-"], name>; 6class J<string name>: Joined<["--", "-"], name>; 7class S<string name>: Separate<["--", "-"], name>; 8 9multiclass Eq<string name> { 10 def "": Separate<["--", "-"], name>; 11 def _eq: Joined<["--", "-"], name # "=">, Alias<!cast<Separate>(NAME)>; 12} 13 14def auxiliary: S<"auxiliary">, HelpText<"Set DT_AUXILIARY field to the specified name">; 15 16def Bsymbolic: F<"Bsymbolic">, HelpText<"Bind defined symbols locally">; 17 18def Bsymbolic_functions: F<"Bsymbolic-functions">, 19 HelpText<"Bind defined function symbols locally">; 20 21def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">; 22 23def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">; 24 25def build_id: F<"build-id">, HelpText<"Generate build ID note">; 26 27def build_id_eq: J<"build-id=">, HelpText<"Generate build ID note">; 28 29defm compress_debug_sections : Eq<"compress-debug-sections">, 30 HelpText<"Compress DWARF debug sections">; 31 32defm defsym: Eq<"defsym">, HelpText<"Define a symbol alias">; 33 34defm library_path: Eq<"library-path">, 35 HelpText<"Add a directory to the library search path">, MetaVarName<"<dir>">; 36 37def O: JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">; 38 39defm Tbss: Eq<"Tbss">, 40 HelpText<"Same as --section-start with .bss as the sectionname">; 41 42defm Tdata: Eq<"Tdata">, 43 HelpText<"Same as --section-start with .data as the sectionname">; 44 45defm Ttext: Eq<"Ttext">, 46 HelpText<"Same as --section-start with .text as the sectionname">; 47 48def allow_multiple_definition: F<"allow-multiple-definition">, 49 HelpText<"Allow multiple definitions">; 50 51def as_needed: F<"as-needed">, 52 HelpText<"Only set DT_NEEDED for shared libraries if used">; 53 54// -chroot doesn't have a help text because it is an internal option. 55def chroot: S<"chroot">; 56 57def color_diagnostics: F<"color-diagnostics">, 58 HelpText<"Use colors in diagnostics">; 59 60def color_diagnostics_eq: J<"color-diagnostics=">, 61 HelpText<"Use colors in diagnostics">; 62 63def define_common: F<"define-common">, 64 HelpText<"Assign space to common symbols">; 65 66def demangle: F<"demangle">, HelpText<"Demangle symbol names">; 67 68def disable_new_dtags: F<"disable-new-dtags">, 69 HelpText<"Disable new dynamic tags">; 70 71def discard_all: F<"discard-all">, HelpText<"Delete all local symbols">; 72 73def discard_locals: F<"discard-locals">, 74 HelpText<"Delete temporary local symbols">; 75 76def discard_none: F<"discard-none">, 77 HelpText<"Keep all symbols in the symbol table">; 78 79def dynamic_linker: S<"dynamic-linker">, 80 HelpText<"Which dynamic linker to use">; 81 82defm dynamic_list: Eq<"dynamic-list">, 83 HelpText<"Read a list of dynamic symbols">; 84 85def eh_frame_hdr: F<"eh-frame-hdr">, 86 HelpText<"Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header">; 87 88def emit_relocs: F<"emit-relocs">, HelpText<"Generate relocations in output">; 89 90def enable_new_dtags: F<"enable-new-dtags">, 91 HelpText<"Enable new dynamic tags">; 92 93def end_lib: F<"end-lib">, 94 HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; 95 96defm entry: Eq<"entry">, HelpText<"Name of entry point symbol">, 97 MetaVarName<"<entry>">; 98 99defm error_limit: Eq<"error-limit">, 100 HelpText<"Maximum number of errors to emit before stopping (0 = no limit)">; 101 102def error_unresolved_symbols: F<"error-unresolved-symbols">, 103 HelpText<"Report unresolved symbols as errors">; 104 105defm exclude_libs: Eq<"exclude-libs">, 106 HelpText<"Exclude static libraries from automatic export">; 107 108def export_dynamic: F<"export-dynamic">, 109 HelpText<"Put symbols in the dynamic symbol table">; 110 111defm export_dynamic_symbol: Eq<"export-dynamic-symbol">, 112 HelpText<"Put a symbol in the dynamic symbol table">; 113 114def fatal_warnings: F<"fatal-warnings">, 115 HelpText<"Treat warnings as errors">; 116 117defm filter: Eq<"filter">, 118 HelpText<"Set DT_FILTER field to the specified name">; 119 120defm fini: Eq<"fini">, 121 HelpText<"Specify a finalizer function">, MetaVarName<"<symbol>">; 122 123def fix_cortex_a53_843419: F<"fix-cortex-a53-843419">, 124 HelpText<"Apply fixes for AArch64 Cortex-A53 erratum 843419">; 125 126def full_shutdown : F<"full-shutdown">, 127 HelpText<"Perform a full shutdown instead of calling _exit">; 128 129defm format: Eq<"format">, 130 HelpText<"Change the input format of the inputs following this option">, 131 MetaVarName<"<input-format>">; 132 133def gc_sections: F<"gc-sections">, 134 HelpText<"Enable garbage collection of unused sections">; 135 136def gdb_index: F<"gdb-index">, 137 HelpText<"Generate .gdb_index section">; 138 139defm hash_style: Eq<"hash-style">, 140 HelpText<"Specify hash style (sysv, gnu or both)">; 141 142def help: F<"help">, HelpText<"Print option help">; 143 144def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">; 145 146def icf_data: F<"icf-data">, 147 HelpText<"Enable ICF to also fold identical read only data">; 148 149def icf_none: F<"icf=none">, HelpText<"Disable identical code folding">; 150 151defm image_base : Eq<"image-base">, HelpText<"Set the base address">; 152 153defm init: Eq<"init">, HelpText<"Specify an initializer function">, 154 MetaVarName<"<symbol>">; 155 156defm library: Eq<"library">, HelpText<"Root name of library to use">, 157 MetaVarName<"<libName>">; 158 159def lto_O: J<"lto-O">, MetaVarName<"<opt-level>">, 160 HelpText<"Optimization level for LTO">; 161 162def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; 163 164defm Map: Eq<"Map">, HelpText<"Print a link map to the specified file">; 165 166def merge_exidx_entries: F<"merge-exidx-entries">, 167 HelpText<"Enable merging .ARM.exidx entries">; 168 169def nostdlib: F<"nostdlib">, 170 HelpText<"Only search directories specified on the command line">; 171 172def no_as_needed: F<"no-as-needed">, 173 HelpText<"Always DT_NEEDED for shared libraries">; 174 175def no_color_diagnostics: F<"no-color-diagnostics">, 176 HelpText<"Do not use colors in diagnostics">; 177 178def no_define_common: F<"no-define-common">, 179 HelpText<"Do not assign space to common symbols">; 180 181def no_demangle: F<"no-demangle">, 182 HelpText<"Do not demangle symbol names">; 183 184def no_dynamic_linker: F<"no-dynamic-linker">, 185 HelpText<"Inhibit output of .interp section">; 186 187def no_eh_frame_hdr: F<"no-eh-frame-hdr">, 188 HelpText<"Do not create .eh_frame_hdr section">; 189 190def no_export_dynamic: F<"no-export-dynamic">; 191def no_fatal_warnings: F<"no-fatal-warnings">; 192 193def no_gc_sections: F<"no-gc-sections">, 194 HelpText<"Disable garbage collection of unused sections">; 195 196def no_gdb_index: F<"no-gdb-index">, 197 HelpText<"Do not generate .gdb_index section">; 198 199def no_gnu_unique: F<"no-gnu-unique">, 200 HelpText<"Disable STB_GNU_UNIQUE symbol binding">; 201 202def no_merge_exidx_entries: F<"no-merge-exidx-entries">, 203 HelpText<"Disable merging .ARM.exidx entries">; 204 205def no_threads: F<"no-threads">, 206 HelpText<"Do not run the linker multi-threaded">; 207 208def no_whole_archive: F<"no-whole-archive">, 209 HelpText<"Restores the default behavior of loading archive members">; 210 211def noinhibit_exec: F<"noinhibit-exec">, 212 HelpText<"Retain the executable output file whenever it is still usable">; 213 214def nopie: F<"nopie">, HelpText<"Do not create a position independent executable">; 215 216def no_omagic: Flag<["--"], "no-omagic">, MetaVarName<"<magic>">, 217 HelpText<"Do not set the text data sections to be writable">; 218 219def no_print_gc_sections: F<"no-print-gc-sections">, 220 HelpText<"Do not list removed unused sections">; 221 222def no_rosegment: F<"no-rosegment">, 223 HelpText<"Do not put read-only non-executable sections in their own segment">; 224 225def no_undefined: F<"no-undefined">, 226 HelpText<"Report unresolved symbols even if the linker is creating a shared library">; 227 228def no_undefined_version: F<"no-undefined-version">, 229 HelpText<"Report version scripts that refer undefined symbols">; 230 231def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">, 232 HelpText<"Path to file to write output">; 233 234def oformat: Separate<["--"], "oformat">, MetaVarName<"<format>">, 235 HelpText<"Specify the binary format for the output object file">; 236 237def omagic: Flag<["--"], "omagic">, MetaVarName<"<magic>">, 238 HelpText<"Set the text and data sections to be readable and writable">; 239 240defm orphan_handling: Eq<"orphan-handling">, 241 HelpText<"Control how orphan sections are handled when linker script used">; 242 243def pack_dyn_relocs_eq: J<"pack-dyn-relocs=">, MetaVarName<"<format>">, 244 HelpText<"Pack dynamic relocations in the given format (none or android)">; 245 246def pie: F<"pie">, HelpText<"Create a position independent executable">; 247 248def print_gc_sections: F<"print-gc-sections">, 249 HelpText<"List removed unused sections">; 250 251def print_map: F<"print-map">, 252 HelpText<"Print a link map to the standard output">; 253 254defm reproduce: Eq<"reproduce">, 255 HelpText<"Dump linker invocation and input files for debugging">; 256 257defm rpath: Eq<"rpath">, HelpText<"Add a DT_RUNPATH to the output">; 258 259def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">; 260 261defm retain_symbols_file: Eq<"retain-symbols-file">, 262 HelpText<"Retain only the symbols listed in the file">, 263 MetaVarName<"<file>">; 264 265defm script: Eq<"script">, HelpText<"Read linker script">; 266 267def section_start: S<"section-start">, MetaVarName<"<address>">, 268 HelpText<"Set address of section">; 269 270def shared: F<"shared">, HelpText<"Build a shared object">; 271 272defm soname: Eq<"soname">, HelpText<"Set DT_SONAME">; 273 274defm sort_section: Eq<"sort-section">, 275 HelpText<"Specifies sections sorting rule when linkerscript is used">; 276 277def start_lib: F<"start-lib">, 278 HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; 279 280def strip_all: F<"strip-all">, HelpText<"Strip all symbols">; 281 282def strip_debug: F<"strip-debug">, HelpText<"Strip debugging information">; 283 284def symbol_ordering_file: S<"symbol-ordering-file">, 285 HelpText<"Layout sections in the order specified by symbol file">; 286 287defm sysroot: Eq<"sysroot">, HelpText<"Set the system root">; 288 289def target1_rel: F<"target1-rel">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_REL32">; 290 291def target1_abs: F<"target1-abs">, HelpText<"Interpret R_ARM_TARGET1 as R_ARM_ABS32">; 292 293defm target2: Eq<"target2">, 294 HelpText<"Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel">, 295 MetaVarName<"<type>">; 296 297def threads: F<"threads">, HelpText<"Run the linker multi-threaded">; 298 299def trace: F<"trace">, HelpText<"Print the names of the input files">; 300 301defm trace_symbol : Eq<"trace-symbol">, HelpText<"Trace references to symbols">; 302 303defm undefined: Eq<"undefined">, 304 HelpText<"Force undefined symbol during linking">; 305 306defm unresolved_symbols: Eq<"unresolved-symbols">, 307 HelpText<"Determine how to handle unresolved symbols">; 308 309defm rsp_quoting: Eq<"rsp-quoting">, 310 HelpText<"Quoting style for response files. Values supported: windows|posix">; 311 312def v: Flag<["-"], "v">, HelpText<"Display the version number">; 313 314def verbose: F<"verbose">, HelpText<"Verbose mode">; 315 316def version: F<"version">, HelpText<"Display the version number and exit">; 317 318defm version_script: Eq<"version-script">, HelpText<"Read a version script">; 319 320def warn_common: F<"warn-common">, 321 HelpText<"Warn about duplicate common symbols">; 322 323def warn_unresolved_symbols: F<"warn-unresolved-symbols">, 324 HelpText<"Report unresolved symbols as warnings">; 325 326def whole_archive: F<"whole-archive">, 327 HelpText<"Force load of all members in a static library">; 328 329defm wrap: Eq<"wrap">, HelpText<"Use wrapper functions for symbol">, 330 MetaVarName<"<symbol>">; 331 332def z: JoinedOrSeparate<["-"], "z">, MetaVarName<"<option>">, 333 HelpText<"Linker option extensions">; 334 335// Aliases 336def alias_auxiliary: Separate<["-"], "f">, Alias<auxiliary>; 337def alias_Bdynamic_call_shared: F<"call_shared">, Alias<Bdynamic>; 338def alias_Bdynamic_dy: F<"dy">, Alias<Bdynamic>; 339def alias_Bstatic_dn: F<"dn">, Alias<Bstatic>; 340def alias_Bstatic_non_shared: F<"non_shared">, Alias<Bstatic>; 341def alias_Bstatic_static: F<"static">, Alias<Bstatic>; 342def alias_define_common_d: Flag<["-"], "d">, Alias<define_common>; 343def alias_define_common_dc: F<"dc">, Alias<define_common>; 344def alias_define_common_dp: F<"dp">, Alias<define_common>; 345def alias_discard_all_x: Flag<["-"], "x">, Alias<discard_all>; 346def alias_discard_locals_X: Flag<["-"], "X">, Alias<discard_locals>; 347def alias_emit_relocs: Flag<["-"], "q">, Alias<emit_relocs>; 348def alias_entry_e: JoinedOrSeparate<["-"], "e">, Alias<entry>; 349def alias_export_dynamic_E: Flag<["-"], "E">, Alias<export_dynamic>; 350def alias_filter: Separate<["-"], "F">, Alias<filter>; 351def alias_format_b: S<"b">, Alias<format>; 352def alias_library: JoinedOrSeparate<["-"], "l">, Alias<library>; 353def alias_library_path: JoinedOrSeparate<["-"], "L">, Alias<library_path>; 354def alias_omagic: Flag<["-"], "N">, Alias<omagic>; 355def alias_o_output: Joined<["--"], "output=">, Alias<o>; 356def alias_o_output2 : Separate<["--"], "output">, Alias<o>; 357def alias_pie_pic_executable: F<"pic-executable">, Alias<pie>; 358def alias_print_map_M: Flag<["-"], "M">, Alias<print_map>; 359def alias_relocatable_r: Flag<["-"], "r">, Alias<relocatable>; 360def alias_rpath_R: JoinedOrSeparate<["-"], "R">, Alias<rpath>; 361def alias_script_T: JoinedOrSeparate<["-"], "T">, Alias<script>; 362def alias_shared_Bshareable: F<"Bshareable">, Alias<shared>; 363def alias_soname_h: JoinedOrSeparate<["-"], "h">, Alias<soname>; 364def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>; 365def alias_strip_debug_S: Flag<["-"], "S">, Alias<strip_debug>; 366def alias_trace: Flag<["-"], "t">, Alias<trace>; 367def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>; 368def alias_Ttext_segment: S<"Ttext-segment">, Alias<Ttext>; 369def alias_Ttext_segment_eq: J<"Ttext-segment=">, Alias<Ttext>; 370def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; 371def alias_version_V: Flag<["-"], "V">, Alias<version>; 372 373// Our symbol resolution algorithm handles symbols in archive files differently 374// than traditional linkers, so we don't need --start-group and --end-group. 375// These options are recongized for compatibility but ignored. 376def end_group: F<"end-group">; 377def end_group_paren: Flag<["-"], ")">; 378def start_group: F<"start-group">; 379def start_group_paren: Flag<["-"], "(">; 380 381// LTO-related options. 382def lto_aa_pipeline: J<"lto-aa-pipeline=">, 383 HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">; 384def lto_newpm_passes: J<"lto-newpm-passes=">, 385 HelpText<"Passes to run during LTO">; 386def lto_partitions: J<"lto-partitions=">, 387 HelpText<"Number of LTO codegen partitions">; 388def disable_verify: F<"disable-verify">; 389def mllvm: S<"mllvm">; 390def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">, 391 HelpText<"YAML output file for optimization remarks">; 392def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">, 393 HelpText<"Include hotness informations in the optimization remarks file">; 394defm plugin_opt: Eq<"plugin-opt">, 395 HelpText<"specifies LTO options for compatibility with GNU linkers">; 396def save_temps: F<"save-temps">; 397def thinlto_cache_dir: J<"thinlto-cache-dir=">, 398 HelpText<"Path to ThinLTO cached object file directory">; 399def thinlto_cache_policy: S<"thinlto-cache-policy">, 400 HelpText<"Pruning policy for the ThinLTO cache">; 401def thinlto_jobs: J<"thinlto-jobs=">, HelpText<"Number of ThinLTO jobs">; 402 403// Ignore LTO plugin-related options. 404// clang -flto passes -plugin and -plugin-opt to the linker. This is required 405// for ld.gold and ld.bfd to get LTO working. But it's not for lld which doesn't 406// rely on a plugin. Instead of detecting which linker is used on clang side we 407// just ignore the option on lld side as it's easier. In fact, the linker could 408// be called 'ld' and understanding which linker is used would require parsing of 409// --version output. 410def plugin: S<"plugin">; 411def plugin_eq: J<"plugin=">; 412 413// Options listed below are silently ignored for now for compatibility. 414def allow_shlib_undefined: F<"allow-shlib-undefined">; 415def cref: F<"cref">; 416def detect_odr_violations: F<"detect-odr-violations">; 417def g: Flag<["-"], "g">; 418def long_plt: F<"long-plt">; 419def no_add_needed: F<"no-add-needed">; 420def no_allow_shlib_undefined: F<"no-allow-shlib-undefined">; 421def no_copy_dt_needed_entries: F<"no-copy-dt-needed-entries">; 422def no_ctors_in_init_array: F<"no-ctors-in-init-array">; 423def no_keep_memory: F<"no-keep-memory">; 424def no_mmap_output_file: F<"no-mmap-output-file">; 425def no_warn_common: F<"no-warn-common">; 426def no_warn_mismatch: F<"no-warn-mismatch">; 427def rpath_link: S<"rpath-link">; 428def rpath_link_eq: J<"rpath-link=">; 429def sort_common: F<"sort-common">; 430def stats: F<"stats">; 431def warn_execstack: F<"warn-execstack">; 432def warn_once: F<"warn-once">; 433def warn_shared_textrel: F<"warn-shared-textrel">; 434def EB : F<"EB">; 435def EL : F<"EL">; 436def G: JoinedOrSeparate<["-"], "G">; 437def Qy : F<"Qy">; 438